sh: Initialize OPTIND=1 even if it came from the environment.
This commit is contained in:
parent
0c695afb96
commit
7e81d0c8c3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259846
@ -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
|
||||
|
3
bin/sh/tests/parameters/optind2.0
Normal file
3
bin/sh/tests/parameters/optind2.0
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
[ "$(OPTIND=42 ${SH} -c 'printf %s "$OPTIND"')" = 1 ]
|
@ -188,6 +188,7 @@ initvar(void)
|
||||
setvareq(*envp, VEXPORT|VTEXTFIXED);
|
||||
}
|
||||
}
|
||||
setvareq("OPTIND=1", VTEXTFIXED);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user