From: Matthias Clasen Date: Fri, 27 Aug 2004 04:49:02 +0000 (+0000) Subject: Set the program name from argv[0], noticed by Masatake YAMATO. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=c8dfe75d2229b6c58f3fef9667e7d3e5a0ea4398;p=dana%2Fcg-glib.git Set the program name from argv[0], noticed by Masatake YAMATO. Fri Aug 27 00:45:41 2004 Matthias Clasen * glib/goption.c (g_option_context_parse): Set the program name from argv[0], noticed by Masatake YAMATO. --- diff --git a/ChangeLog b/ChangeLog index 1b6cfd54..70558801 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 27 00:45:41 2004 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Set the program name + from argv[0], noticed by Masatake YAMATO. + 2004-08-26 Tor Lillqvist * tests/testglib.c (main): Test the new XDG basedir functions. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1b6cfd54..70558801 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Fri Aug 27 00:45:41 2004 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Set the program name + from argv[0], noticed by Masatake YAMATO. + 2004-08-26 Tor Lillqvist * tests/testglib.c (main): Test the new XDG basedir functions. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 1b6cfd54..70558801 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Fri Aug 27 00:45:41 2004 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Set the program name + from argv[0], noticed by Masatake YAMATO. + 2004-08-26 Tor Lillqvist * tests/testglib.c (main): Test the new XDG basedir functions. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1b6cfd54..70558801 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Fri Aug 27 00:45:41 2004 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Set the program name + from argv[0], noticed by Masatake YAMATO. + 2004-08-26 Tor Lillqvist * tests/testglib.c (main): Test the new XDG basedir functions. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1b6cfd54..70558801 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Fri Aug 27 00:45:41 2004 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Set the program name + from argv[0], noticed by Masatake YAMATO. + 2004-08-26 Tor Lillqvist * tests/testglib.c (main): Test the new XDG basedir functions. diff --git a/glib/goption.c b/glib/goption.c index 1332ddf0..d0cfe864 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -256,9 +256,9 @@ print_help (GOptionContext *context, GList *list; gint max_length, len; gint i; - + g_print ("%s\n %s %s %s\n\n", - _("Usage:"), g_get_prgname (), _("[OPTION...]"), + _("Usage:"), g_get_prgname(), _("[OPTION...]"), context->parameter_string ? context->parameter_string : ""); list = context->groups; @@ -845,6 +845,16 @@ g_option_context_parse (GOptionContext *context, if (argc && argv) { + gchar *prgname; + + prgname = strrchr ((*argv)[0], G_DIR_SEPARATOR); + if (prgname) + prgname++; + else + prgname = (*argv)[0]; + + g_set_prgname (prgname); + for (i = 1; i < *argc; i++) { gchar *arg;