Bring back -d option without need for argument
authorGustavo F. Padovan <gustavo@padovan.org>
Tue, 25 May 2010 08:12:39 +0000 (05:12 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 25 May 2010 09:05:12 +0000 (11:05 +0200)
src/main.c

index 5971af8..5818099 100644 (file)
@@ -67,8 +67,19 @@ static gboolean option_compat = FALSE;
 static gboolean option_selftest = FALSE;
 static gboolean option_version = FALSE;
 
+static gboolean parse_debug(const char *key, const char *value, gpointer user_data, GError **error)
+{
+       if (value)
+               option_debug = g_strdup(value);
+       else
+               option_debug = g_strdup("*");
+
+       return TRUE;
+}
+
 static GOptionEntry options[] = {
-       { "debug", 'd', 0, G_OPTION_ARG_STRING, &option_debug,
+       { "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
+                               G_OPTION_ARG_CALLBACK, parse_debug,
                                "Specify debug options to enable", "DEBUG" },
        { "device", 'i', 0, G_OPTION_ARG_STRING, &option_device,
                        "Specify networking device or interface", "DEV" },