summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2000-09-04 03:49:22 +0000
committerimp <imp@FreeBSD.org>2000-09-04 03:49:22 +0000
commit78c14ae89a92aa9260ed9b0a20930a490b386746 (patch)
treea17d15fe4595e918f16781ccde4884d273c09c24 /lib/libc
parent6eee268d676545dbd278a3f78afaca1060845fd3 (diff)
downloadFreeBSD-src-78c14ae89a92aa9260ed9b0a20930a490b386746.zip
FreeBSD-src-78c14ae89a92aa9260ed9b0a20930a490b386746.tar.gz
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.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/getopt.c2
1 files changed, 1 insertions, 1 deletions
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);
OpenPOWER on IntegriCloud