summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog1
-rw-r--r--src/var.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9500c87..4276676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2013-08-23  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Propagate EXP_QPAT in subevalvar.
+	* Initialise OPTIND after importing environment.
 
 2013-03-12  Peter Rosin <peda@lysator.liu.se>
 
diff --git a/src/var.c b/src/var.c
index c35e925..fa24854 100644
--- a/src/var.c
+++ b/src/var.c
@@ -142,6 +142,8 @@ INIT {
 		}
 	}
 
+	setvarint("OPTIND", 1, 0);
+
 	fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid());
 	setvareq(ppid, VTEXTFIXED);