mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 20:35:49 +01:00
Set prgname to <unknown> if argc and argv are NULL.
2004-08-30 Anders Carlsson <andersca@gnome.org> * glib/goption.c: (g_option_context_parse): Set prgname to <unknown> if argc and argv are NULL. * tests/option-test.c: (empty_test1), (main): Add test case for that.
This commit is contained in:
parent
fd92ac8f52
commit
11957cabec
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-30 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* glib/goption.c: (g_option_context_parse):
|
||||||
|
Set prgname to <unknown> if argc and argv are NULL.
|
||||||
|
|
||||||
|
* tests/option-test.c: (empty_test1), (main):
|
||||||
|
Add test case for that.
|
||||||
|
|
||||||
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/ghash.c (g_hash_table_lookup): Point to
|
* glib/ghash.c (g_hash_table_lookup): Point to
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-30 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* glib/goption.c: (g_option_context_parse):
|
||||||
|
Set prgname to <unknown> if argc and argv are NULL.
|
||||||
|
|
||||||
|
* tests/option-test.c: (empty_test1), (main):
|
||||||
|
Add test case for that.
|
||||||
|
|
||||||
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/ghash.c (g_hash_table_lookup): Point to
|
* glib/ghash.c (g_hash_table_lookup): Point to
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-30 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* glib/goption.c: (g_option_context_parse):
|
||||||
|
Set prgname to <unknown> if argc and argv are NULL.
|
||||||
|
|
||||||
|
* tests/option-test.c: (empty_test1), (main):
|
||||||
|
Add test case for that.
|
||||||
|
|
||||||
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/ghash.c (g_hash_table_lookup): Point to
|
* glib/ghash.c (g_hash_table_lookup): Point to
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-30 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* glib/goption.c: (g_option_context_parse):
|
||||||
|
Set prgname to <unknown> if argc and argv are NULL.
|
||||||
|
|
||||||
|
* tests/option-test.c: (empty_test1), (main):
|
||||||
|
Add test case for that.
|
||||||
|
|
||||||
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/ghash.c (g_hash_table_lookup): Point to
|
* glib/ghash.c (g_hash_table_lookup): Point to
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-30 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* glib/goption.c: (g_option_context_parse):
|
||||||
|
Set prgname to <unknown> if argc and argv are NULL.
|
||||||
|
|
||||||
|
* tests/option-test.c: (empty_test1), (main):
|
||||||
|
Add test case for that.
|
||||||
|
|
||||||
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
Sun Aug 29 23:58:38 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* glib/ghash.c (g_hash_table_lookup): Point to
|
* glib/ghash.c (g_hash_table_lookup): Point to
|
||||||
|
@ -1057,7 +1057,10 @@ g_option_context_parse (GOptionContext *context,
|
|||||||
*argc -= k;
|
*argc -= k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_set_prgname ("<unknown>");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -410,6 +410,24 @@ add_test1 (void)
|
|||||||
g_option_context_free (context);
|
g_option_context_free (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
empty_test1 (void)
|
||||||
|
{
|
||||||
|
GOptionContext *context;
|
||||||
|
GOptionEntry entries [] =
|
||||||
|
{ { NULL } };
|
||||||
|
|
||||||
|
context = g_option_context_new (NULL);
|
||||||
|
|
||||||
|
g_option_context_add_main_entries (context, entries, NULL);
|
||||||
|
|
||||||
|
g_option_context_parse (context, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
g_assert (strcmp (g_get_prgname (), "<unknown>") == 0);
|
||||||
|
|
||||||
|
g_option_context_free (context);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -434,5 +452,8 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
add_test1 ();
|
add_test1 ();
|
||||||
|
|
||||||
|
/* Test parsing empty args */
|
||||||
|
empty_test1 ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user