summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-10-08 03:20:30 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-08 03:20:30 +0200
commit8fe89832159647cd165cf7de282eb713bf01bc0f (patch)
tree4c799d521bd4ab6774237891a60dc08db408ed05
parentadd manpage for sydra-launch (diff)
complain about unkown command line arguments
-rw-r--r--src/options-launch.c16
-rw-r--r--src/options-rtp.c7
2 files changed, 23 insertions, 0 deletions
diff --git a/src/options-launch.c b/src/options-launch.c
index fad40fe..16e855d 100644
--- a/src/options-launch.c
+++ b/src/options-launch.c
@@ -61,6 +61,21 @@ static void options_defaults(options_t* opt)
opt->pipeline_ = NULL;
}
+static GQuark options_error_quark()
+{
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string("sydra_options_error");
+
+ return quark;
+}
+
+static gboolean options_parse_remaining(const gchar *option_name, const gchar *value, gpointer data, GError **error)
+{
+ g_set_error(error, options_error_quark(), G_OPTION_ERROR_FAILED, "unkown option '%s'", value);
+ return FALSE;
+}
+
static int options_parse_post(options_t* opt);
int options_parse(options_t* opt, int argc, char* argv[])
@@ -97,6 +112,7 @@ int options_parse(options_t* opt, int argc, char* argv[])
"set the application name (will be used by xvimagesink for window title)", "NAME" },
{ "pipeline", 'p', 0, G_OPTION_ARG_STRING, &opt->pipeline_,
"the gst-launch style pipeline description", "PIPELINE DESCRIPTION" },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_CALLBACK, options_parse_remaining, NULL, NULL},
{ NULL }
};
GOptionContext *ctx = g_option_context_new("- spreadspace streaming hydra ");
diff --git a/src/options-rtp.c b/src/options-rtp.c
index 70cc5fc..3a1aab8 100644
--- a/src/options-rtp.c
+++ b/src/options-rtp.c
@@ -224,6 +224,12 @@ static gboolean options_parse_mode(const gchar *option_name, const gchar *value,
return TRUE;
}
+static gboolean options_parse_remaining(const gchar *option_name, const gchar *value, gpointer data, GError **error)
+{
+ g_set_error(error, options_error_quark(), G_OPTION_ERROR_FAILED, "unkown option '%s'", value);
+ return FALSE;
+}
+
static int options_parse_post(options_t* opt);
int options_parse(options_t* opt, int argc, char* argv[])
@@ -260,6 +266,7 @@ int options_parse(options_t* opt, int argc, char* argv[])
"set the application name (will be used by xvimagesink for window title)", "NAME" },
{ "mode", 'm', 0, G_OPTION_ARG_CALLBACK, options_parse_mode,
"the main operation mode", "(sender|receiver)" },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_CALLBACK, options_parse_remaining, NULL, NULL},
{ NULL }
};
GOptionContext *ctx = g_option_context_new("- spreadspace streaming hydra ");