From: Anders Carlsson Date: Wed, 1 Sep 2004 17:35:59 +0000 (+0000) Subject: Set program name before calling the pre-parse hooks. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=d1871edbdc6a4e0e813e89cf56d06055c9c4840a;p=dana%2Fcg-glib.git Set program name before calling the pre-parse hooks. 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_parse): Set program name before calling the pre-parse hooks. --- diff --git a/ChangeLog b/ChangeLog index 82f1b839..51c46b1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-09-01 Anders Carlsson + + * glib/goption.c: (g_option_context_parse): + Set program name before calling the pre-parse hooks. + 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_free), (print_help), diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 82f1b839..51c46b1c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2004-09-01 Anders Carlsson + + * glib/goption.c: (g_option_context_parse): + Set program name before calling the pre-parse hooks. + 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_free), (print_help), diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 82f1b839..51c46b1c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2004-09-01 Anders Carlsson + + * glib/goption.c: (g_option_context_parse): + Set program name before calling the pre-parse hooks. + 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_free), (print_help), diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 82f1b839..51c46b1c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2004-09-01 Anders Carlsson + + * glib/goption.c: (g_option_context_parse): + Set program name before calling the pre-parse hooks. + 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_free), (print_help), diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 82f1b839..51c46b1c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2004-09-01 Anders Carlsson + + * glib/goption.c: (g_option_context_parse): + Set program name before calling the pre-parse hooks. + 2004-09-01 Anders Carlsson * glib/goption.c: (g_option_context_free), (print_help), diff --git a/glib/goption.c b/glib/goption.c index b619546e..507a84a2 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -822,6 +822,24 @@ g_option_context_parse (GOptionContext *context, gint i, j, k; GList *list; + /* Set program name */ + if (argc && argv) + { + gchar *prgname; + + prgname = strrchr ((*argv)[0], G_DIR_SEPARATOR); + if (prgname) + prgname++; + else + prgname = (*argv)[0]; + + g_set_prgname (prgname); + } + else + { + g_set_prgname (""); + } + /* Call pre-parse hooks */ list = context->groups; while (list) @@ -847,16 +865,6 @@ 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; @@ -1062,10 +1070,6 @@ g_option_context_parse (GOptionContext *context, } } } - else - { - g_set_prgname (""); - } return TRUE;