Don't print an error message if the bad option is '?'. This has been
in my tree for a long time. bde reviewed this once upon a time and said it was OK, iirc. This also obviates the need to put ? in the optstring argument to preclude the extra warning message which some people think confuses users. When I made my getopt cleanups of a long time ago, this was the compromise reached. I just neglected to commit it until now.
This commit is contained in:
parent
12b92015dd
commit
e9d918edb6
@ -89,7 +89,7 @@ getopt(nargc, nargv, ostr)
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
if (opterr && *ostr != ':' && optopt != BADCH)
|
||||
(void)fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname, optopt);
|
||||
return (BADCH);
|
||||
|
Loading…
Reference in New Issue
Block a user