summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1999-12-17 01:54:28 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1999-12-17 01:54:28 +0000
commit16fa413cce427b18ab8a3ca1a1cb47e36133dc9f (patch)
tree3fcd33dcdc236e1bcb8f7166abc5e94820ad3d4f /lib
parente14abeefac54458702e6981f2cc9fc356c3325e7 (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/getopt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c
index 5dddf86072a5..1b297a7982cf 100644
--- a/lib/libc/stdlib/getopt.c
+++ b/lib/libc/stdlib/getopt.c
@@ -32,7 +32,10 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
+#endif
+static const char rcsid[] = "$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -62,6 +65,7 @@ getopt(nargc, nargv, ostr)
extern char *__progname;
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
+ int ret;
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
@@ -101,12 +105,14 @@ getopt(nargc, nargv, ostr)
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
- return (BADARG);
+ ret = BADARG;
+ else
+ ret = BADCH;
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__progname, optopt);
- return (BADCH);
+ return (ret);
}
else /* white space */
optarg = nargv[optind];