From 3077ace0759e192c449180ade7462f8f722e9047 Mon Sep 17 00:00:00 2001 From: Shao Changbin Date: Mon, 21 Jan 2013 02:15:42 -0500 Subject: [PATCH] fix issue of duplicate args of wrt-launcher [Title] fix issue of duplicate args of wrt-launcher [Issue#] N/A [Problem] wrt-launcher doesn't handle duplicate arguments, for instance, "wrt-launcher -l -l", it will print widget list twice. [Cause] doesn't check argument before using [Solution] check whether the argument has already parsed Change-Id: Ic54605d1d55f79baf69526ce6dffcd784ecec46e --- src/wrt-launcher/wrt-launcher.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wrt-launcher/wrt-launcher.cpp b/src/wrt-launcher/wrt-launcher.cpp index 57fae6c..a1c2fa7 100644 --- a/src/wrt-launcher/wrt-launcher.cpp +++ b/src/wrt-launcher/wrt-launcher.cpp @@ -203,6 +203,8 @@ int main(int argc, char* argv[]) char op = '\0'; bool isDebugMode = false; struct sigaction sigact; + bool dispHelp = false; + bool dispList = false; service_h serviceHandle = NULL; int ret = SERVICE_ERROR_NONE; @@ -250,14 +252,20 @@ int main(int argc, char* argv[]) switch (next_opt) { case 'h': - print_help(stdout, 0); + if(!dispHelp){ + print_help(stdout, 0); + dispHelp = true; + } break; case 'l': + if(dispList) + break; if (!display_widget_info()) { printf("Fail to display the list of installed widgets"); return -1; } + dispList = true; break; case 's': -- 2.7.4