ustream-example-client: fix usage information
authorFelix Fietkau <nbd@openwrt.org>
Tue, 25 Mar 2014 08:45:28 +0000 (09:45 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 25 Mar 2014 08:45:28 +0000 (09:45 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ustream-example-client.c

index c3d00182d78dc7f3fac9f4510be9182142b9b5be..fc49146a1f72fd414ddf07ec4843ddf5c3380cef 100644 (file)
@@ -110,12 +110,17 @@ static void connect_client(void)
 
 static int usage(const char *progname)
 {
-       fprintf(stderr, "Usage: %s [options] <hostname> <port>\n", progname);
+       fprintf(stderr,
+               "Usage: %s [options] <hostname> <port>\n"
+               "Options:\n"
+               "       -c <cert>:         Load CA certificates from file <cert>\n"
+               "\n", progname);
        return 1;
 }
 
 int main(int argc, char **argv)
 {
+       const char *progname = argv[0];
        int ch;
 
        ctx = ustream_ssl_context_new(false);
@@ -125,6 +130,8 @@ int main(int argc, char **argv)
                case 'c':
                        ustream_ssl_context_add_ca_crt_file(ctx, optarg);
                        break;
+               default:
+                       return usage(progname);
                }
        }
 
@@ -132,7 +139,7 @@ int main(int argc, char **argv)
        argc -= optind;
 
        if (argc != 2)
-               return usage(argv[0]);
+               return usage(progname);
 
        uloop_init();
        host = argv[0];