From 8be043116387c9dbe1154e7819feb922404b91dc Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Tue, 1 Nov 2016 09:58:25 +0900 Subject: [PATCH] emulator: "--conf" should be first argument "--conf" should be first argument. Do not proceed if it is not. Print more kind usage if arguments are not valid. Change-Id: Ifb62075f3b130974b4a54d5900289c66c772dabd Signed-off-by: SeokYeon Hwang --- tizen/src/emulator.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 94b0fcc..e4a1707 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -285,7 +285,10 @@ static int emulator_main(int argc, char *argv[], char **envp) set_variable(argv[optind - 1], argv[optind], true); break; case 'c': - launch_conf_file = g_strdup(optarg); + if (optind == 3) { + // "--conf" should be a first argument + launch_conf_file = g_strdup(optarg); + } break; case 'q': c = -1; @@ -297,8 +300,12 @@ static int emulator_main(int argc, char *argv[], char **envp) } if (!launch_conf_file && qemu_arg_index == 0) { - fprintf(stderr, "Usage: %s {-c|--conf} conf_file ...\n", - basename(argv[0])); + char *executable = basename(argv[0]); + fprintf(stderr, "Usage: %s {-c|--conf} conf_file [-- ]...\n" + " %*s [{-q|--qemu} ...]\n", + executable, (int)strlen(executable), ""); + fprintf(stderr, " %s {-q|--qemu} ...\n", + executable); return -1; } -- 2.7.4