diff -rN -u old-ucspi-unix-1.0/unixclient.c new-ucspi-unix-1.0/unixclient.c --- old-ucspi-unix-1.0/unixclient.c 2020-10-10 19:45:48.788346103 +0200 +++ new-ucspi-unix-1.0/unixclient.c 2020-10-10 19:45:48.788346103 +0200 @@ -13,6 +13,8 @@ static const char* argv0; static const char* opt_socket; static char** command_argv; +static unsigned opt_quiet = 0; +static unsigned opt_verbose = 0; void die(const char* msg) { @@ -44,20 +46,27 @@ { if(message) fprintf(stderr, "%s: %s\n", argv0, message); - fprintf(stderr, "usage: %s [options] socket program\n" - " -q Quiet. Do not print any messages.\n" - " -Q (default) Print error messages.\n" - " -v Verbose. Print error and status messages.\n" - " -c N Do not handle more than N simultaneous connections.\n" - " (default 10)\n", argv0); + fprintf(stderr, + "usage: %s [options] socket program\n" + " -q Quiet. Do not print any messages.\n" + " -Q (default) Print error messages.\n" + " -v Verbose. Print error and status messages.\n", argv0); exit(1); } void parse_options(int argc, char* argv[]) { + int opt; argv0 = argv[0]; - ++argv; - --argc; + while((opt = getopt(argc, argv, "qQv")) != EOF) { + switch(opt) { + case 'q': opt_quiet = 1; opt_verbose = 0; break; + case 'Q': opt_quiet = 0; break; + case 'v': opt_quiet = 0; opt_verbose = 1; break; + } + } + argc -= optind; + argv += optind; if(argc < 2) usage(0); opt_socket = argv[0]; patch 3bd1b20f6b87d52a442b1254845bc62a72e428f8 Author: Ben Franksen Date: Sat Oct 10 19:04:53 CEST 2020 * unixclient: actually handle the standard -q, -Q, and -v options