From 8fe89832159647cd165cf7de282eb713bf01bc0f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 8 Oct 2014 03:20:30 +0200 Subject: complain about unkown command line arguments --- src/options-launch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/options-launch.c') 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 "); -- cgit v1.2.3