summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-05-30 13:00:46 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:56 +0200
commitd3c55d2a7dc02b5dd1ad65029ce40c28ba185eef (patch)
treea3b977c677dabc479c8df1182c529409ff008f2a
parent0aa65b2b8eb974ed098cf4f341f99f8ca84bf4c8 (diff)
cli: exit with error if failed parsing input arguments
-rw-r--r--cli/qmicli.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cli/qmicli.c b/cli/qmicli.c
index f91907d..5029d1b 100644
--- a/cli/qmicli.c
+++ b/cli/qmicli.c
@@ -328,6 +328,7 @@ device_new_ready (GObject *unused,
int main (int argc, char **argv)
{
+ GError *error = NULL;
GFile *file;
GOptionContext *context;
@@ -342,7 +343,11 @@ int main (int argc, char **argv)
g_option_context_add_group (context,
qmicli_wds_get_option_group ());
g_option_context_add_main_entries (context, main_entries, NULL);
- g_option_context_parse (context, &argc, &argv, NULL);
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_printerr ("error: %s\n",
+ error->message);
+ exit (EXIT_FAILURE);
+ }
g_option_context_free (context);
if (version_flag)