Module Name: src Committed By: martin Date: Sat Nov 6 13:42:18 UTC 2021
Modified Files: src/bin/sh [netbsd-9]: cd.c sh.1 Log Message: Pull up following revision(s) (requested by kre in ticket #1372): bin/sh/sh.1: revision 1.236 (patch) bin/sh/cd.c: revision 1.51 PR bin/45390 - fix for folly four In the pwd builtin, verify that curdir names '.' before simply printing it. Never alter PWD or OLDPWD in the pwd command. Also while here, implement the (new: coming in POSIX, but has existed for a while in several other shells) -e option to cd (with -e, cd -P will exit(1) if the chdir() succeeds, but PWD cannot be discovered). cd now prints the directory name used (if different from that given, or cdprint is on) if interactive or (the new bit)in posix mode. Some additional/changed comments added, and a DEBUG mode trace call that was accidentally put inside an #if 0 block moved to where it can do some good. XXX pullup -9 PR bin/45390 Be explicit about what happens to PWD after a successful cd command. Also be very clear that "cd" and "cd -P" are the same thing, and the only cd variant implemented. Also, when it is appropriate to print the new directory after a cd command, note that it happens if interactive (as it always has here) and also if the posix option is set (for POSIX compat, where "interactive" is irrelevant). Mention that "cd -" is a case where the new directory is printed (along with paths relative to a non-empty CDPATH entry, and where the "cd old new" (string replacement in curdir) is used. While here document the new -e option to cd. XXX pullup -9 To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.50.8.1 src/bin/sh/cd.c cvs rdiff -u -r1.223.2.1 -r1.223.2.2 src/bin/sh/sh.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.