Pass the option name also in the NO_ARG case. (#308602, Masatake YAMATO)

2005-06-22  Matthias Clasen  <mclasen@redhat.com>

	* glib/goption.c (parse_short_option, parse_long_option):
	Pass the option name also in the NO_ARG case.  (#308602,
	Masatake YAMATO)
This commit is contained in:
Matthias Clasen 2005-06-22 16:24:22 +00:00 committed by Matthias Clasen
parent 1833a93ddd
commit 0c2739405c
5 changed files with 35 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2005-06-22 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (parse_short_option, parse_long_option):
Pass the option name also in the NO_ARG case. (#308602,
Masatake YAMATO)
2005-06-22 Tor Lillqvist <tml@novell.com> 2005-06-22 Tor Lillqvist <tml@novell.com>
* glib/gfileutils.c (g_makepath): New function. Creates a * glib/gfileutils.c (g_makepath): New function. Creates a

View File

@ -1,3 +1,9 @@
2005-06-22 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (parse_short_option, parse_long_option):
Pass the option name also in the NO_ARG case. (#308602,
Masatake YAMATO)
2005-06-22 Tor Lillqvist <tml@novell.com> 2005-06-22 Tor Lillqvist <tml@novell.com>
* glib/gfileutils.c (g_makepath): New function. Creates a * glib/gfileutils.c (g_makepath): New function. Creates a

View File

@ -1,3 +1,9 @@
2005-06-22 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (parse_short_option, parse_long_option):
Pass the option name also in the NO_ARG case. (#308602,
Masatake YAMATO)
2005-06-22 Tor Lillqvist <tml@novell.com> 2005-06-22 Tor Lillqvist <tml@novell.com>
* glib/gfileutils.c (g_makepath): New function. Creates a * glib/gfileutils.c (g_makepath): New function. Creates a

View File

@ -1,3 +1,9 @@
2005-06-22 Matthias Clasen <mclasen@redhat.com>
* glib/goption.c (parse_short_option, parse_long_option):
Pass the option name also in the NO_ARG case. (#308602,
Masatake YAMATO)
2005-06-22 Tor Lillqvist <tml@novell.com> 2005-06-22 Tor Lillqvist <tml@novell.com>
* glib/gfileutils.c (g_makepath): New function. Creates a * glib/gfileutils.c (g_makepath): New function. Creates a

View File

@ -904,8 +904,13 @@ parse_short_option (GOptionContext *context,
{ {
if (NO_ARG (&group->entries[j])) if (NO_ARG (&group->entries[j]))
{ {
gchar *option_name;
option_name = g_strdup_printf ("-%c", group->entries[j].short_name);
parse_arg (context, group, &group->entries[j], parse_arg (context, group, &group->entries[j],
NULL, NULL, error); NULL, option_name, error);
g_free (option_name);
*parsed = TRUE; *parsed = TRUE;
} }
else else
@ -972,8 +977,12 @@ parse_long_option (GOptionContext *context,
if (NO_ARG (&group->entries[j]) && if (NO_ARG (&group->entries[j]) &&
strcmp (arg, group->entries[j].long_name) == 0) strcmp (arg, group->entries[j].long_name) == 0)
{ {
gchar *option_name;
option_name = g_strconcat ("--", group->entries[j].long_name, NULL);
parse_arg (context, group, &group->entries[j], parse_arg (context, group, &group->entries[j],
NULL, NULL, error); NULL, option_name, error);
g_free(option_name);
add_pending_null (context, &((*argv)[*index]), NULL); add_pending_null (context, &((*argv)[*index]), NULL);
*parsed = TRUE; *parsed = TRUE;