All of lore.kernel.org
 help / color / mirror / Atom feed
From: Meador Inge <meadori@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: riku.voipio@iki.fi
Subject: [Qemu-devel] [PATCH 1/4] linux-user: Exit 0 when -h is used
Date: Tue, 27 Mar 2012 17:44:28 -0500	[thread overview]
Message-ID: <1332888271-7083-2-git-send-email-meadori@codesourcery.com> (raw)
In-Reply-To: <1332888271-7083-1-git-send-email-meadori@codesourcery.com>

Signed-off-by: Meador Inge <meadori@codesourcery.com>
---
 linux-user/main.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 962677e..aabce83 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -51,7 +51,7 @@ int have_guest_base;
 unsigned long reserved_va;
 #endif
 
-static void usage(void);
+static void usage(int exitcode);
 
 static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX;
 const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
@@ -2926,7 +2926,7 @@ void init_task_state(TaskState *ts)
 
 static void handle_arg_help(const char *arg)
 {
-    usage();
+    usage(0);
 }
 
 static void handle_arg_log(const char *arg)
@@ -2956,7 +2956,7 @@ static void handle_arg_set_env(const char *arg)
     r = p = strdup(arg);
     while ((token = strsep(&p, ",")) != NULL) {
         if (envlist_setenv(envlist, token) != 0) {
-            usage();
+            usage(1);
         }
     }
     free(r);
@@ -2968,7 +2968,7 @@ static void handle_arg_unset_env(const char *arg)
     r = p = strdup(arg);
     while ((token = strsep(&p, ",")) != NULL) {
         if (envlist_unsetenv(envlist, token) != 0) {
-            usage();
+            usage(1);
         }
     }
     free(r);
@@ -2984,7 +2984,7 @@ static void handle_arg_stack_size(const char *arg)
     char *p;
     guest_stack_size = strtoul(arg, &p, 0);
     if (guest_stack_size == 0) {
-        usage();
+        usage(1);
     }
 
     if (*p == 'M') {
@@ -3143,7 +3143,7 @@ struct qemu_argument arg_table[] = {
     {NULL, NULL, false, NULL, NULL, NULL}
 };
 
-static void usage(void)
+static void usage(int exitcode)
 {
     struct qemu_argument *arginfo;
     int maxarglen;
@@ -3204,7 +3204,7 @@ static void usage(void)
            "Note that if you provide several changes to a single variable\n"
            "the last change will stay in effect.\n");
 
-    exit(1);
+    exit(exitcode);
 }
 
 static int parse_args(int argc, char **argv)
@@ -3243,7 +3243,7 @@ static int parse_args(int argc, char **argv)
             if (!strcmp(r, arginfo->argv)) {
                 if (arginfo->has_arg) {
                     if (optind >= argc) {
-                        usage();
+                        usage(1);
                     }
                     arginfo->handle_opt(argv[optind]);
                     optind++;
@@ -3256,12 +3256,12 @@ static int parse_args(int argc, char **argv)
 
         /* no option matched the current argv */
         if (arginfo->handle_opt == NULL) {
-            usage();
+            usage(1);
         }
     }
 
     if (optind >= argc) {
-        usage();
+        usage(1);
     }
 
     filename = argv[optind];
-- 
1.7.7.6

  reply	other threads:[~2012-03-27 22:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 22:44 [Qemu-devel] [PATCH 0/4] linux-user: Option parser cleanup Meador Inge
2012-03-27 22:44 ` Meador Inge [this message]
2012-05-07 14:50   ` [Qemu-devel] [PATCH 1/4] linux-user: Exit 0 when -h is used Andreas Färber
2012-03-27 22:44 ` [Qemu-devel] [PATCH 2/4] linux-user: Add -help Meador Inge
2012-03-27 22:44 ` [Qemu-devel] [PATCH 3/4] linux-user: Add proper error messages for bad options Meador Inge
2012-03-27 22:44 ` [Qemu-devel] [PATCH 4/4] linux-user: Treat --foo options the same as -foo Meador Inge
2012-04-05  2:30 ` [Qemu-devel] [PATCH 0/4] linux-user: Option parser cleanup Meador Inge
2012-05-07 14:44   ` Meador Inge
2012-06-08 13:40     ` Meador Inge
2015-07-06 18:03 [Qemu-devel] [PATCH 0/4] linux-user: CLI cleanup meadori
2015-07-06 18:03 ` [Qemu-devel] [PATCH 1/4] linux-user: Exit 0 when -h is used meadori
2015-07-06 19:43   ` Laurent Vivier
2015-07-08 20:02     ` Meador Inge
2015-07-13 20:08     ` Meador Inge
2015-09-28 13:22       ` Riku Voipio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332888271-7083-2-git-send-email-meadori@codesourcery.com \
    --to=meadori@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.