summaryrefslogtreecommitdiffstats
path: root/bin/sh/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r--bin/sh/options.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index caaa884..8594c57 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -480,7 +480,7 @@ atend:
INTON;
}
c = '?';
- goto bad;
+ goto out;
}
if (*++q == ':')
q++;
@@ -501,7 +501,7 @@ atend:
INTON;
c = '?';
}
- goto bad;
+ goto out;
}
if (p == **optnext)
@@ -511,14 +511,10 @@ atend:
}
else
setvarsafe("OPTARG", "", 0);
- ind = *optnext - optfirst + 1;
- goto out;
-bad:
- ind = 1;
- *optnext = NULL;
- p = NULL;
out:
+ if (*optnext != NULL)
+ ind = *optnext - optfirst + 1;
*optptr = p;
fmtstr(s, sizeof(s), "%d", ind);
err |= setvarsafe("OPTIND", s, VNOFUNC);
OpenPOWER on IntegriCloud