Print error when unknown arguments are specified to ctrlproxy.
authorEmanuele Giaquinta <e.giaquinta@glauco.it>
Mon, 10 Sep 2007 14:32:55 +0000 (16:32 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 10 Sep 2007 14:32:55 +0000 (16:32 +0200)
NEWS
src/main.c

diff --git a/NEWS b/NEWS
index 93b606cced24ab2e6977c2c6e5f2e08f118d9865..0a86d422d67e1a096bdb0f62953bbb9f27cd6fca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,9 @@ Ctrlproxy 3.0.4 UNRELEASED
 
        * Compress /NAMES lines (#123).
 
+       * Bail out when invalid arguments are specified on the command-line
+         (Emanuele Giaquinta <e.giaquinta@glauco.it>)
+
   INTERNALS
 
     * Moved some common logging code to the core.
index 8ce796b260bad13e6fdc7bd3a0273e4905ab30ad..986c865c6b0d0d702fe47dda1b1a1c94b33cd921 100644 (file)
@@ -192,6 +192,7 @@ int main(int argc, char **argv)
                {"version", 'v', 0, G_OPTION_ARG_NONE, &version, ("Show version information")},
                { NULL }
        };
+       GError *error;
 
        signal(SIGINT, signal_quit);
        signal(SIGTERM, signal_quit);
@@ -213,8 +214,10 @@ int main(int argc, char **argv)
        pc = g_option_context_new("");
        g_option_context_add_main_entries(pc, options, NULL);
 
-       if (!g_option_context_parse(pc, &argc, &argv, NULL))
+       if (!g_option_context_parse(pc, &argc, &argv, &error)) {
+               fprintf(stderr, "%s\n", error->message);
                return 1;
+       }
 
        if (version) {
                printf("ctrlproxy %s\n", VERSION);