sh: Use OLDPWD shell variable for 'cd -'.
authorjilles <jilles@FreeBSD.org>
Sat, 23 Jan 2016 23:00:38 +0000 (23:00 +0000)
committerjilles <jilles@FreeBSD.org>
Sat, 23 Jan 2016 23:00:38 +0000 (23:00 +0000)
commitc917a39008740eaf29dc9d7f60f03e1b3984fee9
treed4f63f37586bc1731736e89e674aaf47d5d79fe4
parentf519aed619251f16640a39b7d3a9f04fba3641d3
sh: Use OLDPWD shell variable for 'cd -'.

Per POSIX, 'cd -' should use the OLDPWD shell variable, not internal state.
This variable is normally exported.

Also, if OLDPWD is not set, fail 'cd -' instead of changing to the current
directory.
bin/sh/cd.c