Browse Source

Let getopt() print error messages about options.

This removes tsdecrypt's error message in favour of getopt
native errors. Our message was always 'Unknown parameter'
which was not correct (most of the time) and very misleading.
Georgi Chorbadzhiyski 9 years ago
parent
commit
8c14716e5c
1 changed files with 1 additions and 4 deletions
  1. 1
    4
      tsdecrypt.c

+ 1
- 4
tsdecrypt.c View File

@@ -306,12 +306,9 @@ extern int optind, opterr, optopt;
306 306
 
307 307
 static void parse_options(struct ts *ts, int argc, char **argv) {
308 308
 	int j, i, ca_err = 0, server_err = 1, input_addr_err = 0, output_addr_err = 0, ident_err = 0, port_set = 0;
309
-	opterr = 0; // Prevent printing of error messages for unknown options in getopt()
310 309
 	while ((j = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
311
-		if (j == '?') {
312
-			fprintf(stderr, "ERROR: Unknown parameter '%s'.\n", argv[optind - 1]);
310
+		if (j == '?')
313 311
 			exit(EXIT_FAILURE);
314
-		}
315 312
 		switch (j) {
316 313
 			case 'i': // -- ident
317 314
 				ts->ident = optarg;

Loading…
Cancel
Save