From 78c14ae89a92aa9260ed9b0a20930a490b386746 Mon Sep 17 00:00:00 2001 From: imp Date: Mon, 4 Sep 2000 03:49:22 +0000 Subject: 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. --- lib/libc/stdlib/getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c index 1b297a7..17059a8 100644 --- a/lib/libc/stdlib/getopt.c +++ b/lib/libc/stdlib/getopt.c @@ -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); -- cgit v1.1