sh: Initialize OPTIND=1 even if it came from the environment.

This commit is contained in:
Jilles Tjoelker 2013-12-24 22:38:24 +00:00
parent 0c695afb96
commit 7e81d0c8c3
3 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ FILES+= exitstatus1.0
FILES+= mail1.0
FILES+= mail2.0
FILES+= optind1.0
FILES+= optind2.0
FILES+= positional1.0
FILES+= positional2.0
FILES+= pwd1.0

View File

@ -0,0 +1,3 @@
# $FreeBSD$
[ "$(OPTIND=42 ${SH} -c 'printf %s "$OPTIND"')" = 1 ]

View File

@ -188,6 +188,7 @@ initvar(void)
setvareq(*envp, VEXPORT|VTEXTFIXED);
}
}
setvareq("OPTIND=1", VTEXTFIXED);
}
/*