diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2012-08-10 14:59:51 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2012-08-10 15:50:46 +0200 |
commit | 3d43a9f455102977511cc9fc576001471386353f (patch) | |
tree | 843de4a4b3c07d6e99020195da82d5b33dc3828e /src/remote-viewer-main.c | |
parent | e88f5a52cf1b4e5665829f1be6bc19a7d946e473 (diff) | |
download | virt-viewer-3d43a9f455102977511cc9fc576001471386353f.tar.gz virt-viewer-3d43a9f455102977511cc9fc576001471386353f.tar.xz virt-viewer-3d43a9f455102977511cc9fc576001471386353f.zip |
Use real binary name in help message
Now that we have 2 distinct binaries, remote-viewer and virt-viewer,
'PACKAGE' can no longer be used in error messages as the name of the
binary. This causes a small inconsistency when running
'remote-viewer --foobar' as the error message would be:
'Unknown option --foobar
Run 'virt-viewer --help' to see a full list of available command line options'
This commit makes sure we use argv[0] for this message.
Fixes rhbz#814150
Diffstat (limited to 'src/remote-viewer-main.c')
-rw-r--r-- | src/remote-viewer-main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c index 156bd0b..a671c18 100644 --- a/src/remote-viewer-main.c +++ b/src/remote-viewer-main.c @@ -204,7 +204,6 @@ main(int argc, char **argv) gboolean controller = FALSE; #endif VirtViewerApp *app; - const char *help_msg = N_("Run '" PACKAGE " --help' to see a full list of available command line options"); const GOptionEntry options [] = { { "version", 'V', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, remote_viewer_version, N_("Display version information"), NULL }, @@ -261,9 +260,11 @@ main(int argc, char **argv) #endif g_option_context_parse (context, &argc, &argv, &error); if (error) { - g_printerr("%s\n%s\n", - error->message, - gettext(help_msg)); + char *basename; + basename = g_path_get_basename(argv[0]); + g_printerr(_("%s\nRun '%s --help' to see a full list of available command line options\n"), + error->message, basename); + g_free(basename); g_error_free(error); goto cleanup; } |