After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734619 - test/gkbd-keyboard-drawing-test.c: bail out when option parsing fails
test/gkbd-keyboard-drawing-test.c: bail out when option parsing fails
Status: RESOLVED FIXED
Product: libgnomekbd
Classification: Core
Component: Drawing
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: libgnomekbd maintainers
Sergey V. Udaltsov
Depends on:
Blocks:
 
 
Reported: 2014-08-11 14:27 UTC by Antonio Ospite
Modified: 2016-01-22 16:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test/gkbd-keyboard-drawing-test.c: bail out when option parsing fails (1.41 KB, patch)
2014-08-11 14:27 UTC, Antonio Ospite
none Details | Review
test/gkbd-keyboard-drawing-test.c: bail out when option parsing fails V2 (1.46 KB, patch)
2016-01-22 12:48 UTC, Antonio Ospite
committed Details | Review

Description Antonio Ospite 2014-08-11 14:27:52 UTC
Created attachment 283106 [details] [review]
test/gkbd-keyboard-drawing-test.c: bail out when option  parsing fails

gkbd-keyboard-drawing-test is quite useful, but it doesn't tell when some parsing command line options fails, let's fix this.
Comment 1 Antonio Ospite 2016-01-11 14:26:03 UTC
ping
Comment 2 Michael Catanzaro 2016-01-21 20:29:55 UTC
Review of attachment 283106 [details] [review]:

Thanks for your patch and sorry for the delay.

::: test/gkbd-keyboard-drawing-test.c
@@ +176,3 @@
 	context = g_option_context_new ("kbdraw");
 	g_option_context_add_main_entries (context, options, NULL);
+	if (!g_option_context_parse(context, &argc, &argv, &error)) {

Please add a space before opening parenthesis in a function call.

@@ +177,3 @@
 	g_option_context_add_main_entries (context, options, NULL);
+	if (!g_option_context_parse(context, &argc, &argv, &error)) {
+		g_message("option parsing failed: %s", error->message);

Ditto.

@@ +179,3 @@
+		g_message("option parsing failed: %s", error->message);
+		g_option_context_free (context);
+		exit(EXIT_FAILURE);

Ditto.
Comment 3 Antonio Ospite 2016-01-22 12:48:24 UTC
Created attachment 319551 [details] [review]
test/gkbd-keyboard-drawing-test.c: bail out when option parsing fails V2

Thanks for the review Michael.

Please find attached a v2 of the patch which addresses your comments.