Module Name: src
Committed By: kre
Date: Wed Feb 5 14:56:26 UTC 2020
Modified Files:
src/bin/sh: options.c
Log Message:
Oops, the previous didn't do what was promised. Rather that ignoring
just "--" for exec & "." it ignored any first arg starting '-'.
Do it properly.
To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/sh/options.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.54 src/bin/sh/options.c:1.55
--- src/bin/sh/options.c:1.54 Tue Feb 4 16:06:59 2020
+++ src/bin/sh/options.c Wed Feb 5 14:56:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $ */
+/* $NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.55 2020/02/05 14:56:25 kre Exp $");
#endif
#endif /* not lint */
@@ -616,6 +616,8 @@ nextopt(const char *optstring)
argptr++;
if (p[0] == '-' && p[1] == '\0') /* check for "--" */
return '\0';
+ if (optstring == NULL) /* not processing the "option" */
+ argptr--; /* so make it be an arg again */
}
if (optstring == NULL)
return '\0';