qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname
@ 2011-12-13  1:22 michael@ellerman.id.au
  2011-12-13  1:22 ` [Qemu-devel] [PATCH 2/2] vl.c: Print the actual program name in help output michael@ellerman.id.au
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: michael@ellerman.id.au @ 2011-12-13  1:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber

We'd like to get the progname for help output, so add an accessor.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 qemu-error.c |    5 +++++
 qemu-error.h |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/qemu-error.c b/qemu-error.c
index 4b20d28..7cd5ffe 100644
--- a/qemu-error.c
+++ b/qemu-error.c
@@ -157,6 +157,11 @@ void error_set_progname(const char *argv0)
     progname = p ? p + 1 : argv0;
 }
 
+const char *error_get_progname(void)
+{
+    return progname;
+}
+
 /*
  * Print current location to current monitor if we have one, else to stderr.
  */
diff --git a/qemu-error.h b/qemu-error.h
index 4d5c537..93d74b4 100644
--- a/qemu-error.h
+++ b/qemu-error.h
@@ -36,5 +36,6 @@ void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 void error_print_loc(void);
 void error_set_progname(const char *argv0);
 void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
+const char *error_get_progname(void);
 
 #endif
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] vl.c: Print the actual program name in help output
  2011-12-13  1:22 [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname michael@ellerman.id.au
@ 2011-12-13  1:22 ` michael@ellerman.id.au
  2011-12-13  8:03 ` [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname Stefan Hajnoczi
  2011-12-15 18:10 ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: michael@ellerman.id.au @ 2011-12-13  1:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber

In help() we do what boils down to:

  printf("%s", "qemu");

This seems to be an artifact of be995c27640a82c7056b6f53d02ec823570114e5
("removed unused code"), which removed some ifdef'ery that used to print
a different name depending on CONFIG_SOFTMMU.

Instead print the actual program name, originally from argv[0].

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 vl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/vl.c b/vl.c
index a50842b..6e5742a 100644
--- a/vl.c
+++ b/vl.c
@@ -1513,7 +1513,7 @@ static void help(int exitcode)
            "ctrl-alt        toggle mouse and keyboard grab\n"
            "\n"
            "When using -nographic, press 'ctrl-a h' to get some help.\n",
-           "qemu",
+           error_get_progname(),
            options_help);
     exit(exitcode);
 }
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname
  2011-12-13  1:22 [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname michael@ellerman.id.au
  2011-12-13  1:22 ` [Qemu-devel] [PATCH 2/2] vl.c: Print the actual program name in help output michael@ellerman.id.au
@ 2011-12-13  8:03 ` Stefan Hajnoczi
  2011-12-13  9:54   ` Andreas Färber
  2011-12-15 18:10 ` Anthony Liguori
  2 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2011-12-13  8:03 UTC (permalink / raw)
  To: michael@ellerman.id.au; +Cc: qemu-devel, afaerber

On Tue, Dec 13, 2011 at 12:22:57PM +1100, michael@ellerman.id.au wrote:
> We'd like to get the progname for help output, so add an accessor.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---
>  qemu-error.c |    5 +++++
>  qemu-error.h |    1 +
>  2 files changed, 6 insertions(+), 0 deletions(-)

Both patches:

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname
  2011-12-13  8:03 ` [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname Stefan Hajnoczi
@ 2011-12-13  9:54   ` Andreas Färber
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Färber @ 2011-12-13  9:54 UTC (permalink / raw)
  To: michael@ellerman.id.au; +Cc: Stefan Hajnoczi, qemu-devel

Am 13.12.2011 09:03, schrieb Stefan Hajnoczi:
> On Tue, Dec 13, 2011 at 12:22:57PM +1100, michael@ellerman.id.au wrote:
>> We'd like to get the progname for help output, so add an accessor.
>>
>> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>> ---
>>  qemu-error.c |    5 +++++
>>  qemu-error.h |    1 +
>>  2 files changed, 6 insertions(+), 0 deletions(-)
> 
> Both patches:
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname
  2011-12-13  1:22 [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname michael@ellerman.id.au
  2011-12-13  1:22 ` [Qemu-devel] [PATCH 2/2] vl.c: Print the actual program name in help output michael@ellerman.id.au
  2011-12-13  8:03 ` [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname Stefan Hajnoczi
@ 2011-12-15 18:10 ` Anthony Liguori
  2 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2011-12-15 18:10 UTC (permalink / raw)
  To: michael@ellerman.id.au; +Cc: qemu-devel, afaerber

On 12/12/2011 07:22 PM, michael@ellerman.id.au wrote:
> We'd like to get the progname for help output, so add an accessor.
>
> Signed-off-by: Michael Ellerman<michael@ellerman.id.au>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   qemu-error.c |    5 +++++
>   qemu-error.h |    1 +
>   2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-error.c b/qemu-error.c
> index 4b20d28..7cd5ffe 100644
> --- a/qemu-error.c
> +++ b/qemu-error.c
> @@ -157,6 +157,11 @@ void error_set_progname(const char *argv0)
>       progname = p ? p + 1 : argv0;
>   }
>
> +const char *error_get_progname(void)
> +{
> +    return progname;
> +}
> +
>   /*
>    * Print current location to current monitor if we have one, else to stderr.
>    */
> diff --git a/qemu-error.h b/qemu-error.h
> index 4d5c537..93d74b4 100644
> --- a/qemu-error.h
> +++ b/qemu-error.h
> @@ -36,5 +36,6 @@ void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
>   void error_print_loc(void);
>   void error_set_progname(const char *argv0);
>   void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
> +const char *error_get_progname(void);
>
>   #endif

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-15 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13  1:22 [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname michael@ellerman.id.au
2011-12-13  1:22 ` [Qemu-devel] [PATCH 2/2] vl.c: Print the actual program name in help output michael@ellerman.id.au
2011-12-13  8:03 ` [Qemu-devel] [PATCH 1/2] error: Add an accessor for progname Stefan Hajnoczi
2011-12-13  9:54   ` Andreas Färber
2011-12-15 18:10 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).