]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/commitdiff
Don't display usage on errors.
authorSimon Ruderich <simon@ruderich.org>
Mon, 29 Jul 2013 03:12:16 +0000 (05:12 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 29 Jul 2013 03:12:16 +0000 (05:12 +0200)
Display only the error message. The usage is distracting and requires
more time to read.

src/tlsproxy.c

index 7c4f1da2d122e2d693812ade6f4796082ce79e3a..ba8386b2125c9ddf56efae46848eb772ff484701 100644 (file)
@@ -97,8 +97,7 @@ int main(int argc, char **argv) {
 
     port = atoi(argv[argc - 1]);
     if (port <= 0 || port > 0xffff ) {
-        print_usage(argv[0]);
-        fprintf(stderr, "\ninvalid port: '%s'\n", argv[argc - 1]);
+        fprintf(stderr, "invalid port: '%s'\n", argv[argc - 1]);
         return EXIT_FAILURE;
     }
 
@@ -262,8 +261,7 @@ static void parse_arguments(int argc, char **argv) {
             case 'd': {
                 global_log_level = atoi(optarg);
                 if (global_log_level < 0) {
-                    print_usage(argv[0]);
-                    fprintf(stderr, "\n-d positive number required: '%s'\n",
+                    fprintf(stderr, "-d positive number required: '%s'\n",
                                     optarg);
                     exit(EXIT_FAILURE);
                 }
@@ -278,9 +276,8 @@ static void parse_arguments(int argc, char **argv) {
                         || strlen(position + 1) == 0
                         || atoi(position + 1) <= 0
                         || atoi(position + 1) > 0xffff) {
-                    print_usage(argv[0]);
-                    fprintf(stderr, "\ninvalid -p: '%s', format host:port\n",
-                            optarg);
+                    fprintf(stderr, "invalid -p: '%s', format host:port\n",
+                                    optarg);
                     exit(EXIT_FAILURE);
                 }
 
@@ -303,8 +300,7 @@ static void parse_arguments(int argc, char **argv) {
             }
             case 't': {
                 if (atoi(optarg) <= 0) {
-                    print_usage(argv[0]);
-                    fprintf(stderr, "\n-t positive number required: '%s'\n",
+                    fprintf(stderr, "-t positive number required: '%s'\n",
                                     optarg);
                     exit(EXIT_FAILURE);
                 }
@@ -323,8 +319,7 @@ static void parse_arguments(int argc, char **argv) {
     }
 
     if (optind >= argc) {
-        print_usage(argv[0]);
-        fprintf(stderr, "\nport missing\n");
+        fprintf(stderr, "port missing\n");
         exit(EXIT_FAILURE);
     }
 }