From: Simon Ruderich Date: Mon, 29 Jul 2013 03:12:16 +0000 (+0200) Subject: Don't display usage on errors. X-Git-Url: https://ruderich.org/simon/gitweb/?p=tlsproxy%2Ftlsproxy.git;a=commitdiff_plain;h=f4eb585e927d86ece30067bdf8e96abe8058f5d2 Don't display usage on errors. Display only the error message. The usage is distracting and requires more time to read. --- diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 7c4f1da..ba8386b 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -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); } }