NetBSD/bin/sh
kre 1676135e1a Make cd (really) do cd -P, and not just claim that is what it is doing
while doing a half-hearted, broken, partial, version of cd -L instead.
The latter (as the manual says) is not supported, what's more, it is an
abomination, and should never be supported (anywhere.)

Fix the doc so that the pretense that we notice when a path given crosses
a symlink (and turns on printing of the destination directory) is claimed
no more (that used to be true until late Dec 2016, but was changed).  Now
the print happens if -o cdprint is set, or if an entry from CDPATH that is
not "" or "." is used (or if the "cd dest repl" cd cmd variant is used.)

Fix CDPATH processing: avoid the magic '%' processing that is used for
PATH and MAILPATH from corrupting CDPATH.  The % magic (both variants)
remains undocumented.

Also, don't double the '/' if an entry in PATH or CDPATH ends in '/'
(as in CDPATH=":/usr/src/").  A "cd usr.bin" used to do
chdir("/usr/src//usr.bin").  No more.  This is almost invisible,
and relatively harmless, either way....

Also fix a bug where if a plausible destination directory in CDPATH
was located, but the chdir() failed (eg: permission denied) and then
a later "." or "" CDPATH entry succeeded, "print" mode was turned on.
That is:
	cd /tmp; mkdir bin
	mkdir -p P/bin; chmod 0 P/bin
	CDPATH=/tmp/P:
	cd bin
would cd to /tmp/bin (correctly) but print it (incorrectly).

Also when in "cd dest replace" mode, if the result of the replacement
generates '-' as the path named, as in:
	cd $PWD -
then simply change to '-' (or attempt to, with CDPATH search), rather
than having this being equivalent to "cd -")

Because of these changes, the pwd command (and $PWD) essentially
always acts as pwd -P, even when called as pwd -L (which is still
the default.)   That is, even more than it did before.

Also fixed a (kind of minor) mem management error (CDPATH related)
"whosoever shall padvance must stunalloc before repeating" (and the
same for MAILPATH).
2017-06-04 20:27:14 +00:00
..
bltin Avoid warning by using gcc'ism 2016-03-16 22:36:21 +00:00
funcs delete clauses 3,4 2016-02-29 23:50:59 +00:00
USD.doc Reorg docs, part 2: 2014-07-05 19:23:00 +00:00
alias.c Adjust to the new alias text libedit API. 2014-06-18 18:17:30 +00:00
alias.h Adjust to the new alias text libedit API. 2014-06-18 18:17:30 +00:00
arith_token.c Add DEBUG tracing to arithmetic $(( )) parsing & evaluation. 2017-05-29 22:54:07 +00:00
arith_tokens.h Finish support for all required $(( )) (shell arithmetic) operators, 2017-03-20 11:26:07 +00:00
arithmetic.c Add DEBUG tracing to arithmetic $(( )) parsing & evaluation. 2017-05-29 22:54:07 +00:00
arithmetic.h Finish support for all required $(( )) (shell arithmetic) operators, 2017-03-20 11:26:07 +00:00
builtins.def DEBUG mode shell update (changes nothing for shells which are not 2017-05-15 20:00:36 +00:00
cd.c Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
cd.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
error.c PR bin/47065 PR bin/39466 2016-06-01 02:50:02 +00:00
error.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
eval.c Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
eval.h PR bin/48875 - avoid holding (replaced) file descriptors open when running a 2016-05-09 21:03:10 +00:00
exec.c Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
exec.h Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
expand.c DEBUG mode only change. Convert old trace style to new, and add some more. 2017-06-03 21:52:05 +00:00
expand.h Fixes to shell expand (that is, $ stuff) from FreeBSD (implemented 2017-06-03 10:31:16 +00:00
histedit.c Sprinkle volatile for gcc 5! 2016-03-16 22:36:40 +00:00
init.h
input.c Another fix from FreeBSD. I'm not sure how to trigger the problem 2017-05-03 06:20:12 +00:00
input.h Deal with \newline line continuations more correctly. 2017-05-03 04:51:04 +00:00
jobs.c DEBUG mode only change - correctly track internal shell sub-shell nesting 2017-05-18 13:34:17 +00:00
jobs.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
machdep.h
mail.c Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
mail.h
main.c More DEBUG mode changes. As usual, read the source if you care. 2017-05-29 14:03:23 +00:00
main.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
Makefile More DEBUG mode changes. As usual, read the source if you care. 2017-05-29 14:03:23 +00:00
memalloc.c
memalloc.h Fixes to shell expand (that is, $ stuff) from FreeBSD (implemented 2017-06-03 10:31:16 +00:00
miscbltin.c Fix inconsistent whitespace 2017-05-13 15:03:34 +00:00
miscbltin.h
mkbuiltins
mkinit.sh General KNF and source code cleanups, avoid scattering the 2016-03-27 14:34:46 +00:00
mknodenames.sh General KNF and source code cleanups, avoid scattering the 2016-03-27 14:34:46 +00:00
mknodes.sh
mkoptions.sh Redo mkoptions.sh .. much better this way, now fully automated 2017-05-28 14:14:22 +00:00
mktokens Implement the ';&' (used instead of ';;') case statement list terminator 2017-05-04 04:37:51 +00:00
myhistedit.h PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
mystring.c Add const. 2013-04-28 17:01:28 +00:00
mystring.h
nodes.c.pat Use C89 function definitions 2012-03-20 18:42:28 +00:00
nodetypes If we are going to permit 2017-05-09 05:14:03 +00:00
option.list Redo mkoptions.sh .. much better this way, now fully automated 2017-05-28 14:14:22 +00:00
options.c More DEBUG mode changes. As usual, read the source if you care. 2017-05-29 14:03:23 +00:00
options.h Arrange for set -o and $- output to be sorted, rather than more 2017-05-28 00:38:01 +00:00
output.c Added comma and plus to the "don't need quoting" set. This affects 2017-05-18 13:31:10 +00:00
output.h Add __printflike attribution to use vprintf and friends with an argument 2012-03-15 02:02:20 +00:00
parser.c When we record an arithmetic expression ($(( ))) as being quoted, 2017-06-03 18:31:35 +00:00
parser.h After discussions with Jilles Tjoelker (FreeBSD shell) and 2016-03-31 23:11:05 +00:00
redir.c Now that the shell is protecting its internal fds properly, moving 2017-05-29 22:21:00 +00:00
redir.h Keep track of which file descriptors the shell is using for its 2017-04-29 15:14:28 +00:00
sh.1 Make cd (really) do cd -P, and not just claim that is what it is doing 2017-06-04 20:27:14 +00:00
shell.h More DEBUG mode changes. As usual, read the source if you care. 2017-05-29 14:03:23 +00:00
show.c More DEBUG mode changes. As usual, read the source if you care. 2017-05-29 14:03:23 +00:00
show.h The beginnings of the great shell DEBUG (tracing) upgrade of 2017... 2017-05-13 03:26:03 +00:00
syntax.c include <limits.h> for CHAR_MIN/CHAR_MAX 2012-03-28 20:11:25 +00:00
syntax.h DEBUG mode shell update (changes nothing for shells which are not 2017-05-15 20:00:36 +00:00
TOUR Fix grammar in couple of sentences. 2016-10-25 13:01:59 +00:00
trap.c Enhance the trap command to make it possible to do what POSIX wants 2017-05-07 15:01:18 +00:00
trap.h report the signal that wait was interrupted by, which is not always SIGINT 2015-08-22 12:12:47 +00:00
var.c More standard (and saner) implementation of the ! reserved word. 2017-05-27 11:19:57 +00:00
var.h Implement the NETBSD_SHELL readonly unexportable unimportable 2016-03-31 16:16:35 +00:00
version.h replace with standard copyright :-) 2016-03-31 16:28:23 +00:00