Browse Source

Let getopt() print error messages about options.

This removes tsdumper2'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
1183c37365
1 changed files with 1 additions and 2 deletions
  1. 1
    2
      tsdumper2.c

+ 1
- 2
tsdumper2.c View File

@@ -86,10 +86,9 @@ extern int optind, opterr, optopt;
86 86
 
87 87
 static void parse_options(struct ts *ts, int argc, char **argv) {
88 88
 	int j, input_addr_err = 1;
89
-	opterr = 0; // Prevent printing of error messages for unknown options in getopt()
90 89
 	while ((j = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) {
91 90
 		if (j == '?')
92
-			die("Unknown parameter '%s'.\n", argv[optind - 1]);
91
+			exit(EXIT_FAILURE);
93 92
 		switch (j) {
94 93
 			case 'n': // --prefix
95 94
 				ts->prefix = optarg;

Loading…
Cancel
Save