All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before commands processing
Date: Wed, 29 Jun 2016 11:22:27 +0300	[thread overview]
Message-ID: <57738543.3030006@openvz.org> (raw)
In-Reply-To: <1467149250-31165-7-git-send-email-stefanha@redhat.com>

On 06/29/2016 12:27 AM, Stefan Hajnoczi wrote:
> From: "Denis V. Lunev" <den@openvz.org>
>
> This is necessary to enable creation of common qemu-img options which will
> be specified before command.
>
> The patch also enables '-V' alias to '--version' (exactly like in other
> block utilities) and documents this change.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Message-id: 1466174654-30130-7-git-send-email-den@openvz.org
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>   qemu-img.c    | 41 +++++++++++++++++++++++++++--------------
>   qemu-img.texi | 10 +++++++++-
>   2 files changed, 36 insertions(+), 15 deletions(-)
>
> diff --git a/qemu-img.c b/qemu-img.c
> index 14e2661..2194c2d 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -91,9 +91,12 @@ static void QEMU_NORETURN help(void)
>   {
>       const char *help_msg =
>              QEMU_IMG_VERSION
> -           "usage: qemu-img command [command options]\n"
> +           "usage: qemu-img [standard options] command [command options]\n"
>              "QEMU disk image utility\n"
>              "\n"
> +           "    '-h', '--help'       display this help and exit\n"
> +           "    '-V', '--version'    output version information and exit\n"
> +           "\n"
>              "Command syntax:\n"
>   #define DEF(option, callback, arg_string)        \
>              "  " arg_string "\n"
> @@ -3806,7 +3809,7 @@ int main(int argc, char **argv)
>       int c;
>       static const struct option long_options[] = {
>           {"help", no_argument, 0, 'h'},
> -        {"version", no_argument, 0, 'v'},
> +        {"version", no_argument, 0, 'V'},
>           {0, 0, 0, 0}
>       };
>   
> @@ -3829,28 +3832,38 @@ int main(int argc, char **argv)
>       if (argc < 2) {
>           error_exit("Not enough arguments");
>       }
> -    cmdname = argv[1];
>   
>       qemu_add_opts(&qemu_object_opts);
>       qemu_add_opts(&qemu_source_opts);
>   
> +    while ((c = getopt_long(argc, argv, "+hV", long_options, NULL)) != -1) {
> +        switch (c) {
> +        case 'h':
> +            help();
> +            return 0;
> +        case 'V':
> +            printf(QEMU_IMG_VERSION);
> +            return 0;
> +        }
> +    }
> +
> +    cmdname = argv[optind];
> +
> +    /* reset getopt_long scanning */
> +    argc -= optind;
> +    if (argc < 1) {
> +        return 0;
> +    }
> +    argv += optind;
> +    optind = 1;
this patch breaks check-block.sh
we should have here
   'optind = 0'

Den

  reply	other threads:[~2016-06-29  8:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 21:27 [Qemu-devel] [PULL 0/8] Tracing patches Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 1/8] doc: sync help description for --trace with man for qemu.1 Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 2/8] doc: move text describing --trace to specific .texi file Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 3/8] trace: move qemu_trace_opts to trace/control.c Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 4/8] trace: enable tracing in qemu-io Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 5/8] trace: enable tracing in qemu-nbd Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 6/8] qemu-img: move common options parsing before commands processing Stefan Hajnoczi
2016-06-29  8:22   ` Denis V. Lunev [this message]
2016-07-01 16:39     ` Eric Blake
2016-06-28 21:27 ` [Qemu-devel] [PULL 7/8] trace: enable tracing in qemu-img Stefan Hajnoczi
2016-06-28 21:27 ` [Qemu-devel] [PULL 8/8] trace: [*-user] Add events to trace guest syscalls in syscall emulation mode Stefan Hajnoczi
2016-06-29 15:08 ` [Qemu-devel] [PULL 0/8] Tracing patches Peter Maydell

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=57738543.3030006@openvz.org \
    --to=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.