aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1996-12-21 13:21:57 +0000
committerSteve Price <steve@FreeBSD.org>1996-12-21 13:21:57 +0000
commit93d0e5ef1437d778f18bd7fd4b73614c29e15f57 (patch)
tree0caea5f9942a8df5593baeac330c72caa8fb53e3 /bin
parentdeb4f83f3c5c8bb6dc57cd8909f778fb69ab183a (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/options.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index 26c62b585d02f..0b2c6c1b0032f 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: options.c,v 1.8 1996/10/29 03:12:48 steve Exp $
+ * $Id: options.c,v 1.9 1996/12/14 06:19:24 steve Exp $
*/
#ifndef lint
@@ -110,9 +110,11 @@ procargs(argc, argv)
setinputfile(commandname, 0);
}
/* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */
- if (*argptr && minusc)
+ if (argptr && minusc)
arg0 = *argptr++;
+
shellparam.p = argptr;
+ shellparam.reset = 1;
/* assert(shellparam.malloc == 0 && shellparam.nparam == 0); */
while (*argptr) {
shellparam.nparam++;
@@ -284,6 +286,7 @@ setparam(argv)
shellparam.nparam = nparam;
shellparam.p = newparam;
shellparam.optnext = NULL;
+ shellparam.reset = 1;
}
@@ -423,8 +426,9 @@ getopts(optstr, optvar, optfirst, optnext, optptr)
p = **optnext;
if (p == NULL || *p != '-' || *++p == '\0') {
atend:
- *optnext = NULL;
ind = *optnext - optfirst + 1;
+ *optnext = NULL;
+ p = NULL;
done = 1;
goto out;
}