+2005-05-06 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/option-test.c: Add a testcase.
+
+ * glib/goption.c (g_option_context_parse): Treat '-'
+ on its own as a non-option argument. (#168008, Tim Musson,
+ Thomas Leonard and others)
+
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/gdataset.[ch] glib/gdatasetprivate.h: Add
+2005-05-06 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/option-test.c: Add a testcase.
+
+ * glib/goption.c (g_option_context_parse): Treat '-'
+ on its own as a non-option argument. (#168008, Tim Musson,
+ Thomas Leonard and others)
+
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/gdataset.[ch] glib/gdatasetprivate.h: Add
+2005-05-06 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/option-test.c: Add a testcase.
+
+ * glib/goption.c (g_option_context_parse): Treat '-'
+ on its own as a non-option argument. (#168008, Tim Musson,
+ Thomas Leonard and others)
+
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/gdataset.[ch] glib/gdatasetprivate.h: Add
+2005-05-06 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/option-test.c: Add a testcase.
+
+ * glib/goption.c (g_option_context_parse): Treat '-'
+ on its own as a non-option argument. (#168008, Tim Musson,
+ Thomas Leonard and others)
+
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/gdataset.[ch] glib/gdatasetprivate.h: Add
gchar *arg, *dash;
gboolean parsed = FALSE;
- if ((*argv)[i][0] == '-' && !stop_parsing)
+ if ((*argv)[i][0] == '-' && (*argv)[i][1] != '\0' && !stop_parsing)
{
if ((*argv)[i][1] == '-')
{
g_option_context_free (context);
}
+/* test that lone dashes are treated as non-options */
+void lonely_dash_test (void)
+{
+ GOptionContext *context;
+ gboolean retval;
+ GError *error = NULL;
+ gchar **argv;
+ int argc;
+
+ context = g_option_context_new (NULL);
+
+ /* Now try parsing */
+ argv = split_string ("program -", &argc);
+
+ retval = g_option_context_parse (context, &argc, &argv, &error);
+
+ g_assert (retval);
+
+ g_assert (argv[1] && strcmp (argv[1], "-") == 0);
+
+ g_strfreev (argv);
+ g_option_context_free (context);
+}
+
int
main (int argc, char **argv)
{
/* test for bug 166609 */
unknown_short_test ();
+ /* test for bug 168008 */
+ lonely_dash_test ();
+
return 0;
}