[Midnightbsd-cvs] src [11147] vendor/tcsh/dist: tcsh 6.20

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jun 26 20:42:18 EDT 2018


Revision: 11147
          http://svnweb.midnightbsd.org/src/?rev=11147
Author:   laffer1
Date:     2018-06-26 20:42:17 -0400 (Tue, 26 Jun 2018)
Log Message:
-----------
tcsh 6.20

Modified Paths:
--------------
    vendor/tcsh/dist/Fixes
    vendor/tcsh/dist/Imakefile
    vendor/tcsh/dist/Makefile.in
    vendor/tcsh/dist/Makefile.std
    vendor/tcsh/dist/Makefile.vms
    vendor/tcsh/dist/README
    vendor/tcsh/dist/complete.tcsh
    vendor/tcsh/dist/config/bsd4.4
    vendor/tcsh/dist/config.guess
    vendor/tcsh/dist/config.h.in
    vendor/tcsh/dist/config.sub
    vendor/tcsh/dist/config_f.h
    vendor/tcsh/dist/configure
    vendor/tcsh/dist/ed.chared.c
    vendor/tcsh/dist/ed.decls.h
    vendor/tcsh/dist/ed.defns.c
    vendor/tcsh/dist/ed.h
    vendor/tcsh/dist/ed.init.c
    vendor/tcsh/dist/ed.inputl.c
    vendor/tcsh/dist/ed.refresh.c
    vendor/tcsh/dist/ed.screen.c
    vendor/tcsh/dist/ed.term.c
    vendor/tcsh/dist/ed.term.h
    vendor/tcsh/dist/ed.xmap.c
    vendor/tcsh/dist/gethost.c
    vendor/tcsh/dist/glob.c
    vendor/tcsh/dist/host.defs
    vendor/tcsh/dist/mi.termios.c
    vendor/tcsh/dist/mi.varargs.h
    vendor/tcsh/dist/nls/C/set1
    vendor/tcsh/dist/nls/C/set20
    vendor/tcsh/dist/nls/C/set9
    vendor/tcsh/dist/nls/Makefile.in
    vendor/tcsh/dist/nls/catgen
    vendor/tcsh/dist/nls/et/set1
    vendor/tcsh/dist/nls/et/set20
    vendor/tcsh/dist/nls/et/set9
    vendor/tcsh/dist/nls/finnish/set1
    vendor/tcsh/dist/nls/finnish/set20
    vendor/tcsh/dist/nls/finnish/set3
    vendor/tcsh/dist/nls/finnish/set9
    vendor/tcsh/dist/nls/french/set1
    vendor/tcsh/dist/nls/french/set20
    vendor/tcsh/dist/nls/french/set9
    vendor/tcsh/dist/nls/german/set1
    vendor/tcsh/dist/nls/german/set20
    vendor/tcsh/dist/nls/german/set9
    vendor/tcsh/dist/nls/greek/set1
    vendor/tcsh/dist/nls/greek/set20
    vendor/tcsh/dist/nls/greek/set9
    vendor/tcsh/dist/nls/italian/set1
    vendor/tcsh/dist/nls/italian/set20
    vendor/tcsh/dist/nls/italian/set9
    vendor/tcsh/dist/nls/ja/set1
    vendor/tcsh/dist/nls/russian/set1
    vendor/tcsh/dist/nls/russian/set20
    vendor/tcsh/dist/nls/russian/set9
    vendor/tcsh/dist/nls/spanish/set1
    vendor/tcsh/dist/nls/spanish/set20
    vendor/tcsh/dist/nls/spanish/set9
    vendor/tcsh/dist/nls/ukrainian/set1
    vendor/tcsh/dist/nls/ukrainian/set20
    vendor/tcsh/dist/nls/ukrainian/set9
    vendor/tcsh/dist/patchlevel.h
    vendor/tcsh/dist/pathnames.h
    vendor/tcsh/dist/sh.c
    vendor/tcsh/dist/sh.char.c
    vendor/tcsh/dist/sh.char.h
    vendor/tcsh/dist/sh.decls.h
    vendor/tcsh/dist/sh.dir.c
    vendor/tcsh/dist/sh.dir.h
    vendor/tcsh/dist/sh.dol.c
    vendor/tcsh/dist/sh.err.c
    vendor/tcsh/dist/sh.exec.c
    vendor/tcsh/dist/sh.exp.c
    vendor/tcsh/dist/sh.file.c
    vendor/tcsh/dist/sh.func.c
    vendor/tcsh/dist/sh.glob.c
    vendor/tcsh/dist/sh.h
    vendor/tcsh/dist/sh.hist.c
    vendor/tcsh/dist/sh.init.c
    vendor/tcsh/dist/sh.lex.c
    vendor/tcsh/dist/sh.misc.c
    vendor/tcsh/dist/sh.parse.c
    vendor/tcsh/dist/sh.print.c
    vendor/tcsh/dist/sh.proc.c
    vendor/tcsh/dist/sh.proc.h
    vendor/tcsh/dist/sh.sem.c
    vendor/tcsh/dist/sh.set.c
    vendor/tcsh/dist/sh.time.c
    vendor/tcsh/dist/sh.types.h
    vendor/tcsh/dist/snames.h
    vendor/tcsh/dist/tc.alloc.c
    vendor/tcsh/dist/tc.bind.c
    vendor/tcsh/dist/tc.const.c
    vendor/tcsh/dist/tc.decls.h
    vendor/tcsh/dist/tc.disc.c
    vendor/tcsh/dist/tc.func.c
    vendor/tcsh/dist/tc.h
    vendor/tcsh/dist/tc.nls.c
    vendor/tcsh/dist/tc.nls.h
    vendor/tcsh/dist/tc.os.c
    vendor/tcsh/dist/tc.os.h
    vendor/tcsh/dist/tc.printf.c
    vendor/tcsh/dist/tc.prompt.c
    vendor/tcsh/dist/tc.sched.c
    vendor/tcsh/dist/tc.sig.c
    vendor/tcsh/dist/tc.sig.h
    vendor/tcsh/dist/tc.str.c
    vendor/tcsh/dist/tc.vers.c
    vendor/tcsh/dist/tc.wait.h
    vendor/tcsh/dist/tc.who.c
    vendor/tcsh/dist/tcsh.man
    vendor/tcsh/dist/tw.color.c
    vendor/tcsh/dist/tw.comp.c
    vendor/tcsh/dist/tw.decls.h
    vendor/tcsh/dist/tw.h
    vendor/tcsh/dist/tw.help.c
    vendor/tcsh/dist/tw.init.c
    vendor/tcsh/dist/tw.parse.c
    vendor/tcsh/dist/tw.spell.c
    vendor/tcsh/dist/vms.termcap.c

Added Paths:
-----------
    vendor/tcsh/dist/dotlock.c
    vendor/tcsh/dist/dotlock.h
    vendor/tcsh/dist/nls/C/charset
    vendor/tcsh/dist/nls/et/charset
    vendor/tcsh/dist/nls/finnish/charset
    vendor/tcsh/dist/nls/french/charset
    vendor/tcsh/dist/nls/german/charset
    vendor/tcsh/dist/nls/greek/charset
    vendor/tcsh/dist/nls/italian/charset
    vendor/tcsh/dist/nls/ja/charset
    vendor/tcsh/dist/nls/russian/charset
    vendor/tcsh/dist/nls/spanish/charset
    vendor/tcsh/dist/nls/ukrainian/charset
    vendor/tcsh/dist/tcsh.man.new

Property Changed:
----------------
    vendor/tcsh/dist/MAKEDIFFS
    vendor/tcsh/dist/MAKESHAR
    vendor/tcsh/dist/config.guess
    vendor/tcsh/dist/config.sub
    vendor/tcsh/dist/configure
    vendor/tcsh/dist/cygwin/postinstall.sh
    vendor/tcsh/dist/cygwin/preremove.sh
    vendor/tcsh/dist/install-sh
    vendor/tcsh/dist/nls/catgen
    vendor/tcsh/dist/nls/greek/set1
    vendor/tcsh/dist/nls/greek/set20
    vendor/tcsh/dist/nls/greek/set9
    vendor/tcsh/dist/nls/ja/set1
    vendor/tcsh/dist/nls/russian/set1
    vendor/tcsh/dist/nls/russian/set20
    vendor/tcsh/dist/nls/ukrainian/set1

Modified: vendor/tcsh/dist/Fixes
===================================================================
--- vendor/tcsh/dist/Fixes	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/Fixes	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,3 +1,96 @@
+ 22. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
+ 20. V6.20.00 - 20161124
+ 19. Don't resize the screen if it did not change size.
+ 18. V6.19.01 - 20161025
+ 17. restore file description when cleaning up after eval:
+	repeat 99 time
+ 16. PR/572: Fix $SHLVL issue when exec'ing subshells.
+ 15. PR/403: Fix backquote expansion for multi-byte character sets.
+ 14. Fix drawing issu with multi-line prompt (Kensuke Iwahashi/David Kaspar)
+ 13. always send prusage to stdout.
+ 12. PR/526: Fix double \\ printing from previous fix in history expansion.
+ 11. Android updates from Corinna Vinschen
+ 10. PR/526: Quote backslashes properly so they can be preserved in ``
+     expansions
+  9. Fix memory leak for paraml
+  8. Add notempty and ask values for the noclobber setting (Martin Tournoij)
+  7. more correct $wordchars for vimode (Luke Mewburn)
+  6. expose VImode in $vimode (Luke Mewburn)
+  5. display what the compiled in editor is in bindkey -d (Luke Mewburn)
+  4. run-fg-editor improvements and documentation (Luke Mewburn)
+  3. Fix parsing of 'if (cond)then' (Fridolin Pokorny)
+  2. PR/437: Fix handling of invalid unicode characters.
+  1. PR/451: Fix error messages containing %c to be always '%c'
+
+ 41. V6.19.00 - 20150521
+ 40. V6.18.05 - 20150510
+ 39. fix reseting when interrupted inside an eval "eval sleep 10^C"
+     (paulo.cesar.pereira.de.andrade)
+ 38. rename handle_intr -> handle_interrupt as originally intended.
+ 37. fix input tests that need stdin on a tty
+ 36. V6.18.04 - 20150504
+ 35. revert fix echo "\1", it is incorrect.
+ 34. revert fix to PR/437, breaks short strings.
+ 33. V6.18.03 - 20150503
+ 32. PR/437: Nakajima Akira: Fix segmentation fault reading input files
+ 31. PR/291: Print job status messages to stderr.
+ 30. Fridolin Pokorny NUL in `` does not mean EOF.
+ 29. Pavel Raiskup fix hang with:
+	while (1)
+	   ( date & ; wait )
+        end
+ 28. Add cdtohome special variable (Martin Tournoij)
+ 27. Fix root prompt char for windows (Corinna Vinschen)
+ 26. For "next" completion matches only consider exact matches of the previous
+     word (Jamie Landeg-Jones)
+ 25. Fix echo "\1" for echo_style=both where the first character was
+     not processed properly (Gary Duzan)
+ 24. V6.18.02 - 20140618
+ 23. fix ls-F /non printing exit value twice.
+ 22. rename configure.in to configure.ac, add aclocal.m4 to CVS
+ 21. set foo="aabaabaa"; echo $foo:as/a// should produce bb
+ 20. Add locked merge history support (Marcin Konarski)
+ 19. Support more resource limits from various BSD's
+ 18. Cache history count to speed up thing
+ 17. PR/240: minix support 
+ 16. revert fix for 15. Causes extra quoting, for example (foo is a program
+     that prints its arguments):
+	$ ./foo 'abc' *
+	'\a\b\c'
+ 15. fix globbing for ``, stripping backslashes. Example:
+	cat << _EOF > huh
+	echo 'hello\;world'
+        _EOF
+	echo `./huh 0`
+	echo `./huh $?`
+ 14. fix for `` that causes hang. Example:
+	cat << _EOF > huh
+	#!/bin/sh
+	echo "[$@]"
+	echo "I am running"
+	echo "I am running ($$)" >> huh.out
+	_EOF
+	cat << _EOF > huh.tcsh
+	#!/bin/tcsh -f
+
+	./huh \
+	    `#comment blah blah blah` \
+	    parameter a \
+	    `#comment blah blah blah` \
+	    parameter b \
+	    `#comment blah blah blah` \
+	    parameter c
+	echo ok
+	_EOF
+ 13. remove AsciiOnly fix now that the real issue has been fixed (Roman Kollar)
+ 12. define utmp file for aix (Laurence Darby)
+ 11. fix if history in loops
+ 10. make ls-F print to stderr and set the exit code
+  9. make rmstar interruptible on linux
+  8. Get rid of pret_t and make the printf functions return the number of
+     characters printed as the system ones do.
+  7. Parse a FreeBSD compat $LSCOLORS. What to do when both LSCOLORS and
+     LS_COLORS are set. I am not documenting this until we decide.
   6. V6.18.01 - 20120214
   5. fix interruptible wait again
   4. ignore bogus compiler overflow message

Modified: vendor/tcsh/dist/Imakefile
===================================================================
--- vendor/tcsh/dist/Imakefile	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/Imakefile	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,5 +1,5 @@
 XCOMM
-XCOMM $tcsh: Imakefile,v 1.87 2010/01/28 19:01:05 christos Exp $
+XCOMM $tcsh: Imakefile,v 1.88 2014/07/07 20:34:58 christos Exp $
 XCOMM
 XCOMM Imakefile for tcsh 6.12
 XCOMM Marc Horowitz, MIT SIPB
@@ -526,8 +526,8 @@
 	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
 	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
 	README.imake complete.tcsh vmsreadme.txt Makefile.vms termcap.vms \
-	snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.in \
-	Makefile.win32
+	snames.h host.defs gethost.c tcsh.man2html Makefile.in configure.ac \
+	Makefile.win32 aclocal.m4
 CONFSRCS=config/[a-z]*
 
 

Index: vendor/tcsh/dist/MAKEDIFFS
===================================================================
--- vendor/tcsh/dist/MAKEDIFFS	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/MAKEDIFFS	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/MAKEDIFFS
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: vendor/tcsh/dist/MAKESHAR
===================================================================
--- vendor/tcsh/dist/MAKESHAR	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/MAKESHAR	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/MAKESHAR
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Modified: vendor/tcsh/dist/Makefile.in
===================================================================
--- vendor/tcsh/dist/Makefile.in	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/Makefile.in	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-# $tcsh: Makefile.in,v 3.49 2011/02/05 17:35:31 christos Exp $
+# $tcsh: Makefile.in,v 3.59 2015/08/24 20:09:04 kim Exp $
 #	Makefile.in	4.3	6/11/83
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -315,8 +315,8 @@
 # on the suns does not know how to make dynamically linked binaries.
 # This is set by autoconf.
 CC = @CC@
-#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra
-# -ansi -pedantic
+#CC= gcc -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Werror -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wsign-compare -Wcast-qual -Wreturn-type -Wswitch -Wshadow -Wwrite-strings -Wextra -Wcast-qual -Wwrite-strings -Wold-style-definition -Wuninitialized -Wpointer-sign
+# -Wconversion -Wformat=2 -ansi -pedantic
 #CC=	gcc -Wall -pipe -B/bin/
 # Generate code for Intel 486 (linux)
 #CC=	gcc -m486 -pipe -Wall
@@ -377,7 +377,7 @@
 	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
 	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h \
 	tw.color.c
-PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
+PSSRCS= sh.decls.h glob.c glob.h dotlock.c dotlock.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
 	vms.termcap.c
 SHSRCS= ${ASSRCS} ${PSSRCS}
 SHOBJS=	sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
@@ -384,7 +384,7 @@
 	sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
 	sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
 	sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
-	sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} \
+	sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} dotlock.${SUF} \
 	mi.termios.${SUF} ma.setp.${SUF} vms.termcap.${SUF}
 
 TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
@@ -411,12 +411,12 @@
 	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
 	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
 	README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
-	host.defs gethost.c tcsh.man2html configure.in configure config.h.in \
-	tests/testsuite.at
+	host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
+	tests/testsuite.at aclocal.m4
 TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \
 	tests/expr.at tests/lexical.at tests/mb-eucjp.at \
-	tests/mb-utf8.at tests/noexec.at tests/syntax.at tests/subst.at \
-	tests/variables.at tests/sh.dol.at
+	tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \
+	tests/subst.at tests/variables.at tests/sh.dol.at
 
 VHSRCS=${PVSRCS} ${AVSRCS}
 
@@ -533,11 +533,11 @@
 	${CPP} $(CPPFLAGS) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
 	    $(srcdir)/tc.const.c | \
 	    sed -n -e 's/^\(Char STR[a-zA-Z0-9_]*\) *\[ *\].*/extern \1[];/p' | \
-	    sort >> $@.tmp
+	    LC_COLLATE=C sort >> $@.tmp
 	@echo '#endif /* _h_tc_const */' >> $@.tmp
 	@if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi
 
-$(srcdir)/tests/package.m4: $(srcdir)/configure.in
+$(srcdir)/tests/package.m4: $(srcdir)/configure.ac
 	{								   \
 	  echo '# Signature of the current package.';			   \
 	  echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])';	   \
@@ -594,12 +594,12 @@
 	@vgrind -t -x -h Index index >/crp/bill/csh/index.t
 
 install-strip: install
+	-strip ${DESTBIN}/tcsh$(EXEEXT)
 
 install: tcsh$(EXEEXT) install.catalogs install.man
 	-mkdir -p ${DESTBIN}
 	-mv -f ${DESTBIN}/tcsh$(EXEEXT)  ${DESTBIN}/tcsh.old
 	cp tcsh$(EXEEXT) ${DESTBIN}/tcsh$(EXEEXT)
-	-strip ${DESTBIN}/tcsh$(EXEEXT)
 	chmod 755 ${DESTBIN}/tcsh$(EXEEXT)
 
 install.catalogs:
@@ -623,25 +623,6 @@
 #	nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z
 #	chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z
 
-install.cygwin: install
-	-gzip ${DESTMAN}/tcsh.${MANSECT}
-	-mkdir -p ${DESTDIR}${prefix}/share/doc/tcsh
-	cp ${srcdir}/FAQ ${srcdir}/Fixes ${DESTDIR}${prefix}/share/doc/tcsh
-	cp ${srcdir}/NewThings ${srcdir}/README ${DESTDIR}${prefix}/share/doc/tcsh
-	cp ${srcdir}/WishList ${srcdir}/Y2K ${DESTDIR}${prefix}/share/doc/tcsh
-	perl ${srcdir}/tcsh.man2html ${srcdir}/tcsh.man
-	cp -rp tcsh.html ${DESTDIR}${prefix}/share/doc/tcsh
-	-mkdir -p ${DESTDIR}/etc/defaults/etc/profile.d
-	-mkdir -p ${DESTDIR}/etc/profile.d
-	-mkdir -p ${DESTDIR}/etc/postinstall
-	-mkdir -p ${DESTDIR}/etc/preremove
-	cp -p ${srcdir}/cygwin/csh.cshrc ${DESTDIR}/etc/defaults/etc
-	cp -p ${srcdir}/cygwin/csh.login ${DESTDIR}/etc/defaults/etc
-	cp -p ${srcdir}/cygwin/bindkey.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
-	cp -p ${srcdir}/complete.tcsh ${DESTDIR}/etc/defaults/etc/profile.d
-	cp -p ${srcdir}/cygwin/postinstall.sh ${DESTDIR}/etc/postinstall/tcsh.sh
-	cp -p ${srcdir}/cygwin/preremove.sh ${DESTDIR}/etc/preremove/tcsh.sh
-
 clean: clean.catalogs
 	${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG gethost
 	${RM} -f *.${SUF} *.i *.s
@@ -748,11 +729,11 @@
 
 autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
 
-$(srcdir)/configure: $(srcdir)/configure.in
+$(srcdir)/configure: $(srcdir)/configure.ac
 	cd $(srcdir) && autoconf
 
 $(srcdir)/config.h.in: $(srcdir)/stamp-h.in
-$(srcdir)/stamp-h.in: $(srcdir)/configure.in
+$(srcdir)/stamp-h.in: $(srcdir)/configure.ac
 	cd $(srcdir) && autoheader
 	@echo timestamp > $(srcdir)/stamp-h.in
 
@@ -787,6 +768,9 @@
 # glob.h
 glob.${SUF} sh.glob.${SUF}: glob.h
 
+# dotlock.h
+dotlock.${SUF}: dotlock.h
+
 # ed.defns.h
 EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
 ${EDOBJS} ${EDDINC}: ed.defns.h

Modified: vendor/tcsh/dist/Makefile.std
===================================================================
--- vendor/tcsh/dist/Makefile.std	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/Makefile.std	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-# $tcsh: Makefile.std,v 1.97 2006/03/02 18:46:44 christos Exp $
+# $tcsh: Makefile.std,v 1.100 2015/08/24 20:09:04 kim Exp $
 #	Makefile.std	4.3	6/11/83
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -287,7 +287,7 @@
 	sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \
 	sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \
 	sh.set.c sh.time.c sh.char.h sh.dir.h sh.proc.h sh.h 
-PSSRCS= sh.decls.h glob.c glob.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
+PSSRCS= sh.decls.h glob.c glob.h dotlock.c dotlock.h mi.termios.c mi.wait.h mi.varargs.h ma.setp.c \
 	vms.termcap.c
 SHSRCS= ${ASSRCS} ${PSSRCS}
 SHOBJS=	sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \
@@ -294,7 +294,7 @@
 	sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \
 	sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \
 	sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \
-	sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} \
+	sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} dotlock.${SUF} \
 	mi.termios.${SUF} ma.setp.${SUF} vms.termcap.${SUF}
 
 TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \
@@ -321,7 +321,8 @@
 	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
 	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
 	README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
-	host.defs gethost.c tcsh.man2html configure.in configure config.h.in
+	host.defs gethost.c tcsh.man2html configure.ac configure config.h.in \
+	aclocal.m4
 
 VHSRCS=${PVSRCS} ${AVSRCS}
 
@@ -424,7 +425,7 @@
 	${CPP} $(INCLUDES) ${DFLAGS} ${EXTRAFLAGS} -D_h_tc_const\
 	    $(srcdir)/tc.const.c | grep 'Char STR' | \
 	    sed -e 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' | \
-	    sort >> $@
+	    LC_COLLATE=C sort >> $@
 	@echo '#endif /* _h_tc_const */' >> $@
 
 csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF}
@@ -584,11 +585,11 @@
 
 autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in
 
-$(srcdir)/configure: $(srcdir)/configure.in
+$(srcdir)/configure: $(srcdir)/configure.ac
 	cd $(srcdir) && autoconf
 
 $(srcdir)/config.h.in: $(srcdir)/stamp-h.in
-$(srcdir)/stamp-h.in: $(srcdir)/configure.in
+$(srcdir)/stamp-h.in: $(srcdir)/configure.ac
 	cd $(srcdir) && autoheader
 	@echo timestamp > $(srcdir)/stamp-h.in
 
@@ -620,6 +621,9 @@
 # glob.h
 glob.${SUF} sh.glob.${SUF}: glob.h
 
+# dotlock.h
+dotlock.${SUF}: dotlock.h
+
 # ed.defns.h
 EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF}
 ${EDOBJS} ${EDDINC}: ed.defns.h

Modified: vendor/tcsh/dist/Makefile.vms
===================================================================
--- vendor/tcsh/dist/Makefile.vms	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/Makefile.vms	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-# $tcsh: Makefile.vms,v 1.39 2006/03/02 18:46:44 christos Exp $
+# $tcsh: Makefile.vms,v 1.40 2014/07/07 20:34:58 christos Exp $
 #	Makefile.vms	4.3	6/11/83
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -299,7 +299,7 @@
 	WishList config_f.h eight-bit.me glob.3 patchlevel.h \
 	pathnames.h tcsh.man Ported src.desc Imakefile imake.config \
 	README.imake complete.tcsh vmsreadme.txt termcap.vms snames.h \
-	host.defs gethost.c tcsh.man2html configure.in
+	host.defs gethost.c tcsh.man2html configure.ac aclocal.m4
 
 VHSRCS=${PVSRCS} ${AVSRCS}
 

Modified: vendor/tcsh/dist/README
===================================================================
--- vendor/tcsh/dist/README	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/README	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-This is tcsh version 6.18.01.  Tcsh is a version of the Berkeley
+This is tcsh version 6.20.00.  Tcsh is a version of the Berkeley
 C-Shell, with the addition of: a command line editor, command and file
 name completion, listing, etc. and a bunch of small additions to the
 shell itself.

Modified: vendor/tcsh/dist/complete.tcsh
===================================================================
--- vendor/tcsh/dist/complete.tcsh	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/complete.tcsh	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,5 +1,5 @@
 #
-# $tcsh: complete.tcsh,v 1.52 2010/05/07 17:54:13 christos Exp $
+# $tcsh: complete.tcsh,v 1.56 2015/07/03 16:52:47 christos Exp $
 # example file using the new completion code
 #
 # Debian GNU/Linux
@@ -20,1209 +20,1262 @@
 # Cleanup by Martin A. Godisch <martin at godisch.de>.
 
 onintr -
-if (! $?prompt) goto end
+if ( ! $?prompt ) goto end
 
-if ($?tcsh) then
-    if ($tcsh != 1) then
-   	set rev=$tcsh:r
-	set rel=$rev:e
-	set pat=$tcsh:e
-	set rev=$rev:r
+if ( $?tcsh ) then
+  if ( $tcsh != 1 ) then
+    set rev=$tcsh:r:r
+    set rel=$tcsh:r:e
+    if ( $rev > 6 || ( $rev > 5 && $rel > 1 ) ) then
+      set _has_complete=1
     endif
-    if ($rev > 5 && $rel > 1) then
-	set _complete=1
-    endif
-    unset rev rel pat
+  endif
+  unset rev rel
 endif
 
-if ($?_complete) then
-    set noglob
-    if ( ! $?hosts ) set hosts
-    foreach f ("$HOME/.hosts" /usr/local/etc/csh.hosts "$HOME/.rhosts" /etc/hosts.equiv)
-        if ( -r "$f" ) then
-	    set hosts = ($hosts `grep -v "+" "$f" | grep -E -v "^#" | tr -s " " "	" | cut -f 1`)
-	endif
-    end
-    if ( -r "$HOME/.netrc" ) then
-	set f=`awk '/machine/ { print $2 }' < "$HOME/.netrc"` >& /dev/null
-	set hosts=($hosts $f)
-    endif
-    if ( -r "$HOME/.ssh/known_hosts" ) then
-	set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ ` >& /dev/null
-	set f=`cat "$HOME/.ssh/known_hosts" | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null
-	set hosts=($hosts $f)
-    endif
-    unset f
-    if ( ! $?hosts ) then
-	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
-		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
-		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
-		   labrea.stanford.edu sumex-aim.stanford.edu \
-		   tut.cis.ohio-state.edu)
-    endif
+if ( ! $?_has_complete ) goto end
 
-    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
-    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
-    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
-    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
-    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
-    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
+if ( ! $?noglob ) set noglob _unset_noglob
 
-    complete cd  	p/1/d/		# Directories only
-    complete chdir 	p/1/d/
-    complete pushd 	p/1/d/
-    complete popd 	p/1/d/
-    complete pu 	p/1/d/
-    complete po 	p/1/d/
-    complete complete 	p/1/X/		# Completions only
-    complete uncomplete	n/*/X/
-    complete exec 	p/1/c/		# Commands only
-    complete trace 	p/1/c/
-    complete strace 	p/1/c/
-    complete which	n/*/c/
-    complete where	n/*/c/
-    complete skill 	p/1/c/
-    complete dde	p/1/c/ 
-    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
-    complete sdb	p/1/c/
-    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
-    complete xdb	p/1/c/
-    complete gdb	n/-d/d/ n/*/c/
-    complete ups	p/1/c/
-    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
-    complete unset	n/*/s/
-    complete alias 	p/1/a/		# only aliases are valid
-    complete unalias	n/*/a/
-    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
-    complete dvips 	n/*/f:*.dvi/
-    if ($?traditional_complete) then
-        complete tex 	n/*/f:*.tex/	# Only files that match *.tex
-    else
-        complete tex 	n/*/f:*.{tex,texi}/	# Files that match *.tex and *.texi
-    endif
-    complete latex 	n/*/f:*.{tex,ltx}/
-    complete su		c/--/"(login fast preserve-environment command shell \
-			help version)"/	c/-/"(f l m p c s -)"/ \
-			n/{-c,--command}/c/ \
-			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
-    complete cc 	c/-[IL]/d/ \
-              c at -l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
-			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
-    complete acc 	c/-[IL]/d/ \
-       c at -l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
-			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
-    complete gcc 	c/-[IL]/d/ \
-		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
-		               elide-constructors expensive-optimizations \
-			       float-store force-addr force-mem inline \
-			       inline-functions keep-inline-functions \
-			       memoize-lookups no-default-inline \
-			       no-defer-pop no-function-cse omit-frame-pointer \
-			       rerun-cse-after-loop schedule-insns \
-			       schedule-insns2 strength-reduce \
-			       thread-jumps unroll-all-loops \
-			       unroll-loops syntax-only all-virtual \
-			       cond-mismatch dollars-in-identifiers \
-			       enum-int-equiv no-asm no-builtin \
-			       no-strict-prototype signed-bitfields \
-			       signed-char this-is-variable unsigned-bitfields \
-			       unsigned-char writable-strings call-saved-reg \
-			       call-used-reg fixed-reg no-common \
-			       no-gnu-binutils nonnull-objects \
-			       pcc-struct-return pic PIC shared-data \
-			       short-enums short-double volatile)"/ \
-		 	c/-W/"(all aggregate-return cast-align cast-qual \
-		      	       comment conversion enum-clash error format \
-		      	       id-clash-len implicit missing-prototypes \
-		      	       no-parentheses pointer-arith return-type shadow \
-		      	       strict-prototypes switch uninitialized unused \
-		      	       write-strings)"/ \
-		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
-			       short c68000 c68020 soft-float g gnu unix fpu \
-			       no-epilogue)"/ \
-		 	c/-d/"(D M N)"/ \
-		 	c/-/"(f W vspec v vpath ansi traditional \
-			      traditional-cpp trigraphs pedantic x o l c g L \
-			      I D U O O2 C E H B b V M MD MM i dynamic \
-			      nodtdlib static nostdinc undef)"/ \
-		 	c/-l/f:*.a/ \
-		 	n/*/f:*.{c,C,cc,o,a,s,i}/
-    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
-    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
-    complete rm 	c/--/"(directory force interactive verbose \
-			recursive help version)"/ c/-/"(d f i v r R -)"/ \
-			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
-    complete vi 	n/*/f:^*.[oa]/
-    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
-			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
-			n/-k/"(left right up down)"/ p/2-/b/ \
-			p/1/'x:<key-sequence or option>'/
+# Old TCSH versions don't define OSTYPE.
+# Use a close approximation instead.
 
-    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
-		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
-			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
-		  	c/-/"(fstype name perm prune type user nouser \
-		  	     group nogroup size inum atime mtime ctime exec \
-			     ok print ls cpio ncpio newer xdev depth \
-			     daystart follow maxdepth mindepth noleaf version \
-			     anewer cnewer amin cmin mmin true false uid gid \
-			     ilname iname ipath iregex links lname empty path \
-			     regex used xtype fprint fprint0 fprintf \
-			     print0 printf not a and o or)"/ \
-			     n/*/d/
+if ( ! $?OSTYPE ) then
+  setenv OSTYPE `echo "$HOSTTYPE" | sed -e 's/^(i[3456]86|(amd|x86_)64)-//'`
+endif
 
-    complete -%*	c/%/j/			# fill in the jobs builtin
-    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
+if ( ! $?hosts ) set hosts
 
-    complete limit	c/-/"(h)"/ n/*/l/
-    complete unlimit	c/-/"(h)"/ n/*/l/
+foreach f ( "$HOME/."{,r,ssh/known_}hosts* \
+  /usr/local/etc/csh.hosts /etc/hosts.equiv )
+  if ( -r "$f" ) then
+    set hosts=($hosts `sed \
+      -e 's/#.*//' \
+      -e '/^[+-]@/d' \
+      -e 's/^[-+]//' \
+      -e 's/[[:space:]].*//' \
+      -e 's/,/\n/g' "$f" \
+      | sed -e '/^[.:[:xdigit:][:space:]]*$/d'`)
+  endif
+end
+unset f
 
-    complete -co*	p/0/"(compress)"/	# make compress completion
-						# not ambiguous
-    if ($?traditional_complete) then
-        complete zcat	n/*/f:*.Z/
-    else
-        # "zcat" may be linked to "compress" or "gzip"
-        if (-X zcat) then
-            zcat --version >& /dev/null
-            if ($status != 0) then
-                complete zcat	n/*/f:*.Z/
-            else
-                complete zcat	c/--/"(force help license quiet version)"/ \
-				c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
-	    endif
-        endif
-    endif
+if ( -r "$HOME/.netrc" ) then
+  set hosts=($hosts `awk '$1 == "machine" { print $2 }' "$HOME/.netrc"`)
+endif
 
-    complete finger	c/*@/\$hosts/ n/*/u/@ 
-    complete ping	p/1/\$hosts/
-    complete traceroute	p/1/\$hosts/
+set hosts=(`echo $hosts | tr ' ' '\012' | sort -u`)
 
-    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
-		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
+if ( ! $#hosts ) then
+  # This is just a hint for the user.
+  set hosts=(ftp.funet.fi ftp.gnu.org ftp.uu.net)
+endif
 
-    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
+complete ywho		n/*/\$hosts/	# argument from list in $hosts
+complete rsh		p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+complete ssh		p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+complete xrsh		p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
+complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
+complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
 
-    # this one is simple...
-    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
-    # From Michael Schroeder <mlschroe at immd4.informatik.uni-erlangen.de> 
-    # This one will rsh to the file to fetch the list of files!
-    complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@'  'n/*/$hosts/:'
+complete cd  		p/1/d/		# Directories only
+complete chdir 		p/1/d/
+complete pushd 		p/1/d/
+complete popd 		p/1/d/
+complete pu 		p/1/d/
+complete po 		p/1/d/
+complete complete 	p/1/X/		# Completions only
+complete uncomplete	n/*/X/
+complete exec 		p/1/c/		# Commands only
+complete trace 		p/1/c/
+complete strace 	p/1/c/
+complete which		n/*/c/
+complete where		n/*/c/
+complete skill 		p/1/c/
+complete dde		p/1/c/ 
+complete adb		c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
+complete sdb		p/1/c/
+complete dbx		c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
+complete xdb		p/1/c/
+complete gdb		n/-d/d/ n/*/c/
+complete ups		p/1/c/
+complete set		'c/*=/f/' 'p/1/s/=' 'n/=/f/'
+complete unset		n/*/s/
+complete alias 		p/1/a/		# only aliases are valid
+complete unalias	n/*/a/
+complete xdvi 		n/*/f:*.dvi/
+complete dvips 		n/*/f:*.dvi/
+complete tex	 	n/*/f:*.{tex,texi}/
+complete latex	 	n/*/f:*.{tex,ltx}/
 
-    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
-		c/conv=*,/"(ascii ebcdic ibm block unblock \
-			    lcase notrunc ucase swab noerror sync)"/,\
-		c/conv=/"(ascii ebcdic ibm block unblock \
-			  lcase notrunc ucase swab noerror sync)"/,\
-	        c/*=/x:'<number>'/ \
-		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
+complete su \
+  c/--/"(login fast preserve-environment command shell help version)"/ \
+  c/-/"(f l m p c s -)"/ \
+  n/{-c,--command}/c/ \
+  n@{-s,--shell}@'`cat /etc/shells`'@ \
+  n/*/u/
+complete cc \
+  c/-[IL]/d/ \
+  c at -l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
+  c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
+complete acc \
+  c/-[IL]/d/ \
+  c at -l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
+  c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
+complete gcc \
+  c/-[IL]/d/ \
+  c/-f/"(caller-saves cse-follow-jumps delayed-branch elide-constructors \
+	expensive-optimizations float-store force-addr force-mem inline \
+	inline-functions keep-inline-functions memoize-lookups \
+	no-default-inline no-defer-pop no-function-cse omit-frame-pointer \
+	rerun-cse-after-loop schedule-insns schedule-insns2 strength-reduce \
+	thread-jumps unroll-all-loops unroll-loops syntax-only all-virtual \
+	cond-mismatch dollars-in-identifiers enum-int-equiv no-asm no-builtin \
+	no-strict-prototype signed-bitfields signed-char this-is-variable \
+	unsigned-bitfields unsigned-char writable-strings call-saved-reg \
+	call-used-reg fixed-reg no-common no-gnu-binutils nonnull-objects \
+	pcc-struct-return pic PIC shared-data short-enums short-double \
+	volatile)"/ \
+  c/-W/"(all aggregate-return cast-align cast-qual comment conversion \
+	enum-clash error format id-clash-len implicit missing-prototypes \
+	no-parentheses pointer-arith return-type shadow strict-prototypes \
+	switch uninitialized unused write-strings)"/ \
+  c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd short c68000 c68020 \
+	soft-float g gnu unix fpu no-epilogue)"/ \
+  c/-d/"(D M N)"/ \
+  c/-/"(f W vspec v vpath ansi traditional traditional-cpp trigraphs pedantic \
+	x o l c g L I D U O O2 C E H B b V M MD MM i dynamic nodtdlib static \
+	nostdinc undef)"/ \
+  c/-l/f:*.a/ \
+  n/*/f:*.{c,C,cc,o,a,s,i}/
+complete g++ 	n/*/f:*.{C,cc,o,s,i}/
+complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
+complete rm \
+  c/--/"(directory force interactive verbose recursive help version)"/ \
+  c/-/"(d f i v r R -)"/ \
+  n/*/f:^*.{c,cc,C,h,in}/
+  # Protect precious files
+complete vi 	n/*/f:^*.[oa]/
+complete bindkey \
+  N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
+  n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/ \
+  n/-k/"(left right up down)"/ p/2-/b/ \
+  p/1/'x:<key-sequence or option>'/
 
-    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
+complete find \
+  n/-fstype/"(nfs 4.2)"/ \
+  n/-name/f/ \
+  n/-type/"(c b d f p l s)"/ \
+  n/-user/u/ \
+  n/-group/g/ \
+  n/-exec/c/ \
+  n/-ok/c/ \
+  n/-cpio/f/ \
+  n/-ncpio/f/ \
+  n/-newer/f/ \
+  c/-/"(fstype name perm prune type user nouser group nogroup size inum \
+	atime mtime ctime exec ok print ls cpio ncpio newer xdev depth \
+	daystart follow maxdepth mindepth noleaf version anewer cnewer \
+	amin cmin mmin true false uid gid ilname iname ipath iregex links \
+	lname empty path regex used xtype fprint fprint0 fprintf print0 \
+	printf not a and o or)"/ \
+  n/*/d/
 
-    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
-		p/2/f:*.a/ p/*/f:*.o/
+complete -%*		c/%/j/			# fill in the jobs builtin
+complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
 
-    # these should be merged with the MH completion hacks below - jgotts
-    complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
-		"c at +@F:$HOME/Mail/@"
+complete limit		c/-/"(h)"/ n/*/l/
+complete unlimit	c/-/"(h)"/ n/*/l/
 
-    # these and interrupt handling from Jaap Vermeulen <jaap at sequent.com>
-    complete {rexec,rxexec,rxterm,rmterm} \
-			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
-			'n/-E/e/' 'n/*/c/'
-    complete kill	'c/-/S/' 'c/%/j/' \
-			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
+#complete -co*	p/0/"(compress)"/	# make compress completion
+#					    # not ambiguous
 
-    # these from Marc Horowitz <marc at cam.ov.com>
-    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
-		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
-		    'c/-/(verbose quiet force printpath lookup debug map \
-			  nomap remap zephyr nozephyr readonly write \
-			  mountpoint noexplicit explicit type mountoptions \
-			  nosetuid setuid override skipfsck lock user host)/' \
-		    'n/-e/f/' 'n/*/()/'
-    complete hesinfo	'p/1/u/' \
-			'p/2/(passwd group uid grplist pcap pobox cluster \
-			      filsys sloc service)/'
+# "zcat" may be linked to "compress" or "gzip"
+if (-X zcat) then
+  zcat --version >& /dev/null
+  if ($status != 0) then
+    complete zcat	n/*/f:*.Z/
+  else
+    complete zcat	c/--/"(force help license quiet version)"/ \
+			c/-/"(f h L q V -)"/ \
+			n/*/f:*.{gz,Z,z,zip}/
+  endif
+endif
 
-    # these from E. Jay Berkenbilt <ejb at ERA.COM>
-    # = isn't always followed by a filename or a path anymore - jgotts
-    if ($?traditional_complete) then
-        complete ./configure \
-			 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
-    				bindir,sbindir,libexecdir,datadir,\
-				sysconfdir,sharedstatedir,localstatedir,\
-				libdir,includedir,oldincludedir,infodir,\
-				mandir,srcdir}/(=)//' \
-			 'c/--/(cache-file verbose prefix exec-prefix bindir \
-			 	sbindir libexecdir datadir sysconfdir \
-				sharedstatedir localstatedir libdir \
-				includedir oldincludedir infodir mandir \
-				srcdir)//'
-    else
-	complete ./configure \
-			'c at --{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:<directory e.g. /usr/local>'@ \
- 			'c/--cachefile=*/x:<filename>/' \
-  			'c/--{enable,disable,with}-*/x:<feature>//' \
- 			'c/--*=/x:<directory>//' \
-  			'c/--/(prefix= exec-prefix= bindir= \
-			sbindir= libexecdir= datadir= sysconfdir= \
-   			sharedstatedir= localstatedir= infodir= \
-			mandir= srcdir= x-includes= x-libraries= cachefile= \
- 			enable- disable- with- \
- 			help no-create quiet silent version verbose )//'
-    endif
-    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
-			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
-			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
-		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
-		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
-    complete perl	'n/-S/c/'
-    complete printenv	'n/*/e/'
-    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
-			delta diffs edit enter fix get help info \
-			print prs prt rmdel sccsdiff tell unedit \
-			unget val what)"/
-    complete setenv	'p/1/e/' 'c/*:/f/'
+complete finger	c/*@/\$hosts/ n/*/u/@ 
+complete ping	p/1/\$hosts/
+complete traceroute	p/1/\$hosts/
 
-    # these and method of setting hosts from Kimmo Suominen <kim at tac.nyc.ny.us>
-    if ( -f "$HOME/.mh_profile" && -x "`which folders`" ) then 
+complete {talk,ntalk,phone} \
+  p/1/'`users | tr " " "\012" | uniq`'/ \
+  n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
 
-    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
-    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
+complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
 
-    set folders = ( $FOLDERS )
-    set mha = ( $MHA )
+# this one is simple...
+#complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
+# From Michael Schroeder <mlschroe at immd4.informatik.uni-erlangen.de> 
+# This one will rsh to the file to fetch the list of files!
+complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@'  'n/*/$hosts/:'
 
-    complete ali \
-        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
-        'n,-alias,f,'
+complete dd \
+  c/--/"(help version)"/ c/[io]f=/f/ \
+  c/conv=*,/"(ascii ebcdic ibm block unblock \
+	      lcase notrunc ucase swab noerror sync)"/,\
+  c/conv=/"(ascii ebcdic ibm block unblock \
+	    lcase notrunc ucase swab noerror sync)"/,\
+  c/*=/x:'<number>'/ \
+  n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
 
-    complete anno \
-        'c/-/(component noinplace inplace nodate date text help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
 
-    complete burst \
-        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+complete ar \
+  c/[dmpqrtx]/"(c l o u v a b i)"/ \
+  p/1/"(d m p q r t x)"// \
+  p/2/f:*.a/ \
+  p/*/f:*.o/
 
-    complete comp \
-        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
-        'c,+,$folders,'  \
-        'n,-whatnowproc,c,'  \
-        'n,-file,f,'\
-        'n,-form,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+# these should be merged with the MH completion hacks below - jgotts
+complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
+	    "c at +@F:$HOME/Mail/@"
 
-    complete dist \
-        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
-        'c,+,$folders,'  \
-        'n,-whatnowproc,c,'  \
-        'n,-form,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+# these and interrupt handling from Jaap Vermeulen <jaap at sequent.com>
+complete {rexec,rxexec,rxterm,rmterm} \
+  'p/1/$hosts/' \
+  'c/-/(l L E)/' \
+  'n/-l/u/' \
+  'n/-L/f/' \
+  'n/-E/e/' \
+  'n/*/c/'
+complete kill \
+  'c/-/S/' \
+  'c/%/j/' \
+  'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
 
-    complete folder \
-        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+# these from Marc Horowitz <marc at cam.ov.com>
+complete attach \
+  'n/-mountpoint/d/' \
+  'n/-m/d/' \
+  'n/-type/(afs nfs rvd ufs)/' \
+  'n/-t/(afs nfs rvd ufs)/' \
+  'n/-user/u/' \
+  'n/-U/u/' \
+  'c/-/(verbose quiet force printpath lookup debug map nomap remap zephyr \
+	nozephyr readonly write mountpoint noexplicit explicit type \
+	mountoptions nosetuid setuid override skipfsck lock user host)/' \
+  'n/-e/f/' \
+  'n/*/()/'
+complete hesinfo \
+  'p/1/u/' \
+  'p/2/(passwd group uid grplist pcap pobox cluster filsys sloc service)/'
 
-    complete folders \
-        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+complete ./configure \
+  'c at --{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:<directory e.g. /usr/local>'@ \
+  'c/--cachefile=*/x:<filename>/' \
+  'c/--{enable,disable,with}-*/x:<feature>//' \
+  'c/--*=/x:<directory>//' \
+  'c/--/(prefix= exec-prefix= bindir= sbindir= libexecdir= datadir= \
+	sysconfdir= sharedstatedir= localstatedir= infodir= mandir= \
+	srcdir= x-includes= x-libraries= cachefile= enable- disable- \
+	with- help no-create quiet silent version verbose )//'
 
-    complete forw \
-        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
-        'c,+,$folders,'  \
-        'n,-whatnowproc,c,'  \
-        'n,-filter,f,'\
-        'n,-form,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+complete gs \
+  'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc dfaxhigh dfaxlow \
+		laserjet ljet4 sparc pbm pbmraw pgm pgmraw ppm ppmraw bit)/' \
+  'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
+  'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
+complete perl		'n/-S/c/'
+complete sccs \
+  p/1/"(admin cdc check clean comb deledit delget delta diffs edit enter \
+	fix get help info print prs prt rmdel sccsdiff tell unedit unget \
+	val what)"/
 
-    complete inc \
-        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
-        'c,+,$folders,'  \
-        'n,-audit,f,'\
-        'n,-form,f,'
+complete printenv	'n/*/e/'
+complete setenv		'p/1/e/' 'c/*:/f/'
 
-    complete mark \
-        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+# these and method of setting hosts from Kimmo Suominen <kim at tac.nyc.ny.us>
+if ( -f "$HOME/.mh_profile" && -X folders ) then 
+  if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
+  if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
 
-    complete mhmail \
-        'c/-/(body cc from subject help)/' \
-        'n,-cc,$mha,'  \
-        'n,-from,$mha,'  \
-        'n/*/$mha/'
+  set folders = ( $FOLDERS )
+  set mha = ( $MHA )
 
-    complete mhpath \
-        'c/-/(help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete ali \
+    'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
+    'n,-alias,f,'
 
-    complete msgchk \
-        'c/-/(nodate date nonotify notify help)/' 
+  complete anno \
+    'c/-/(component noinplace inplace nodate date text help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete msh \
-        'c/-/(prompt noscan scan notopcur topcur help)/' 
+  complete burst \
+    'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete next \
-        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
-        'c,+,$folders,'  \
-        'n,-moreproc,c,'  \
-        'n,-showproc,c,'  \
-        'n,-form,f,'
+  complete comp \
+    'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
+    'c,+,$folders,'  \
+    'n,-whatnowproc,c,'  \
+    'n,-file,f,'\
+    'n,-form,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete packf \
-        'c/-/(file help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete dist \
+    'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
+    'c,+,$folders,'  \
+    'n,-whatnowproc,c,'  \
+    'n,-form,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete pick \
-        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete folder \
+    'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete prev \
-        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
-        'c,+,$folders,'  \
-        'n,-moreproc,c,'  \
-        'n,-showproc,c,'  \
-        'n,-form,f,'
+  complete folders \
+    'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete prompter \
-        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
+  complete forw \
+    'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
+    'c,+,$folders,'  \
+    'n,-whatnowproc,c,'  \
+    'n,-filter,f,'\
+    'n,-form,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete refile \
-        'c/-/(draft nolink link nopreserve preserve src file help)/' \
-        'c,+,$folders,'  \
-        'n,-file,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete inc \
+    'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
+    'c,+,$folders,'  \
+    'n,-audit,f,'\
+    'n,-form,f,'
 
-    complete rmf \
-        'c/-/(nointeractive interactive help)/' \
-        'c,+,$folders,'  
+  complete mark \
+    'c/-/(add delete list sequence nopublic public nozero zero help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete rmm \
-        'c/-/(help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete mhmail \
+    'c/-/(body cc from subject help)/' \
+    'n,-cc,$mha,'  \
+    'n,-from,$mha,'  \
+    'n/*/$mha/'
 
-    complete scan \
-        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
-        'c,+,$folders,'  \
-        'n,-form,f,'\
-        'n,-file,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete mhpath \
+    'c/-/(help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete send \
-        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
-        'n,-alias,f,'\
-        'n,-filter,f,'
+  complete msgchk \
+    'c/-/(nodate date nonotify notify help)/' 
 
-    complete show \
-        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
-        'c,+,$folders,'  \
-        'n,-moreproc,c,'  \
-        'n,-showproc,c,'  \
-        'n,-form,f,'\
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete msh \
+    'c/-/(prompt noscan scan notopcur topcur help)/' 
 
-    complete sortm \
-        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete next \
+    'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+    'c,+,$folders,'  \
+    'n,-moreproc,c,'  \
+    'n,-showproc,c,'  \
+    'n,-form,f,'
 
-    complete vmh \
-        'c/-/(prompt vmhproc novmhproc help)/' \
-        'n,-vmhproc,c,'  
+  complete packf \
+    'c/-/(file help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete whatnow \
-        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
+  complete pick \
+    'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    complete whom \
-        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
-        'n,-alias,f,'
+  complete prev \
+    'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+    'c,+,$folders,'  \
+    'n,-moreproc,c,'  \
+    'n,-showproc,c,'  \
+    'n,-form,f,'
 
-    complete plum \
-        'c/-/()/' \
-        'c,+,$folders,'  \
-        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
+  complete prompter \
+    'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
 
-    complete mail \
-        'c/-/()/' \
-        'n/*/$mha/'
+  complete refile \
+    'c/-/(draft nolink link nopreserve preserve src file help)/' \
+    'c,+,$folders,'  \
+    'n,-file,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    endif
+  complete rmf \
+    'c/-/(nointeractive interactive help)/' \
+    'c,+,$folders,'  
 
-    #from Dan Nicolaescu <dann at ics.uci.edu>
-    if ( $?MODULESHOME ) then
-	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
-	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
-	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
-	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
-	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
-	'C%[^-]*%`eval Compl_module`%'
-    endif
+  complete rmm \
+    'c/-/(help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
 
-    # from George Cox
-    complete acroread	'p/*/f:*.{pdf,PDF}/'
-    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
-			configtest help)/'
-    complete appletviewer	'p/*/f:*.class/'
-    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
-			help name-prefix= no-lines no-parser output= \
-			token-table verbose version yacc)/' \
-			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
-			'n/-p/f/'
-    complete bzcat	c/--/"(help test quiet verbose license version)"/ \
+  complete scan \
+    'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
+    'c,+,$folders,'  \
+    'n,-form,f,'\
+    'n,-file,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
+
+  complete send \
+    'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
+    'n,-alias,f,'\
+    'n,-filter,f,'
+
+  complete show \
+    'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
+    'c,+,$folders,'  \
+    'n,-moreproc,c,'  \
+    'n,-showproc,c,'  \
+    'n,-form,f,'\
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
+
+  complete sortm \
+    'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
+
+  complete vmh \
+    'c/-/(prompt vmhproc novmhproc help)/' \
+    'n,-vmhproc,c,'  
+
+  complete whatnow \
+    'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
+
+  complete whom \
+    'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
+    'n,-alias,f,'
+
+  complete plum \
+    'c/-/()/' \
+    'c,+,$folders,'  \
+    'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,'
+
+  complete mail \
+    'c/-/()/' \
+    'n/*/$mha/'
+
+endif
+
+#from Dan Nicolaescu <dann at ics.uci.edu>
+if ( $?MODULESHOME ) then
+  alias Compl_module \
+    'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune \
+    -o -print | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
+  complete module \
+    'p%1%(add load unload switch display avail use unuse update purge list \
+	  clear help initadd initrm initswitch initlist initclear)%' \
+    'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
+    'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
+    'N%{sw*,initsw*}%`eval Compl_module`%' \
+    'C%-%(-append)%' \
+    'n%{use,unu*,av*}%d%' \
+    'n%-append%d%' \
+    'C%[^-]*%`eval Compl_module`%'
+endif
+
+# from George Cox
+complete acroread	'p/*/f:*.{pdf,PDF}/'
+complete apachectl	'c/*/(start stop restart fullstatus status graceful \
+			      configtest help)/'
+complete appletviewer	'p/*/f:*.class/'
+complete bison		'c/--/(debug defines file-prefix= fixed-output-files \
+				help name-prefix= no-lines no-parser output= \
+				token-table verbose version yacc)/' \
+			'c/-/(b d h k l n o p t v y V)/' \
+			'n/-b/f/' 'n/-o/f/' 'n/-p/f/'
+complete bzcat		c/--/"(help test quiet verbose license version)"/ \
 			c/-/"(h t L V -)"/ n/*/f:*.{bz2,tbz}/
-    complete bunzip2	c/--/"(help keep force test stdout quiet verbose \
-                        license version)"/ c/-/"(h k f t c q v L V -)"/ \
+complete bunzip2	c/--/"(help keep force test stdout quiet verbose \
+				license version)"/ \
+			c/-/"(h k f t c q v L V -)"/ \
 			n/*/f:*.{bz2,tbz}/
-    complete bzip2	c/--/"(help decompress compress keep force test \
-			stdout quiet verbose license version small)"/ \
+complete bzip2		c/--/"(help decompress compress keep force test \
+				stdout quiet verbose license version small)"/ \
 			c/-/"(h d z k f t c q v L V s 1 2 3 4 5 6 7 8 9 -)"/ \
 			n/{-d,--decompress}/f:*.{bz2,tbz}/ \
 			N/{-d,--decompress}/f:*.{bz2,tbz}/ n/*/f:^*.{bz2,tbz}/
-    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
-    complete co		'p at 1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
-    complete crontab	'n/-u/u/'
-    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
-			modepage negotiate periphlist rescan reset start \
-			stop tags tur)/'
-    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
-			checkfile drop feedinfo flush flushlogs go hangup \
-			logmode mode name newgroup param pause readers refile \
-			reject reload renumber reserve rmgroup send shutdown \
-			kill throttle trace xabort xexec)/'
-    complete cvs	'c/--/(help help-commands help-synonyms)/' \
-			'p/1/(add admin annotate checkout commit diff \
-			edit editors export history import init log login \
-			logout rdiff release remove rtag status tag unedit \
-			update watch watchers)/' 'n/-a/(edit unedit commit \
-			all none)/' 'n/watch/(on off add remove)/'
-    complete svn 	'C at file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \
+complete c++		'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
+complete co		'p at 1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
+complete crontab	'n/-u/u/'
+complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
+			      modepage negotiate periphlist rescan reset \
+			      start stop tags tur)/'
+complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
+			      checkfile drop feedinfo flush flushlogs go \
+			      hangup logmode mode name newgroup param pause \
+			      readers refile reject reload renumber reserve \
+			      rmgroup send shutdown kill throttle trace \
+			      xabort xexec)/'
+complete cvs		'c/--/(help help-commands help-synonyms)/' \
+			'p/1/(add admin annotate checkout commit diff edit \
+			      editors export history import init log login \
+			      logout rdiff release remove rtag status tag \
+			      unedit update watch watchers)/' \
+			'n/-a/(edit unedit commit all none)/' \
+			'n/watch/(on off add remove)/'
+complete svn	 	'C at file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \
 			'n at ls@(file:/// svn+ssh:// svn://)@@' \
-			'n at help@(add blame cat checkout \
-			cleanup commit copy delete export help \
-			import info list ls lock log merge mkdir \
-			move propdel propedit propget proplist \
-			propset resolved revert status switch unlock \
-			update)@' 'p at 1@(add blame cat checkout \
-			cleanup commit copy delete export help \
-			import info list ls lock log merge mkdir \
-			move propdel propedit propget proplist \
-			propset resolved revert status switch unlock \
-			update)@'
-    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
-    complete detex	'p/*/f:*.tex/'
-    complete edquota    'n/*/u/'
-    complete exec	'p/1/c/'
-    complete ghostview	'p/*/f:*.ps/'
-    complete gv		'p/*/f:*.ps/'
-    complete ifconfig	'p at 1@`ifconfig -l`@' 'n/*/(range phase link netmask \
-			mtu vlandev vlan metric mediaopt down delete \
-			broadcast arp debug)/'
-    complete imake	'c/-I/d/'
-    complete ipfw 	'p/1/(flush add delete list show zero)/' \
+			'n at help@(add blame cat checkout cleanup commit copy \
+				  delete export help import info list ls \
+				  lock log merge mkdir move propdel propedit \
+				  propget proplist propset resolved revert \
+				  status switch unlock update)@' \
+			'p at 1@(add blame cat checkout cleanup commit copy \
+			      delete export help import info list ls lock \
+			      log merge mkdir move propdel propedit propget \
+			      proplist propset resolved revert status switch \
+			      unlock update)@'
+
+complete cxx		'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
+complete detex		'p/*/f:*.tex/'
+complete edquota	'n/*/u/'
+complete exec		'p/1/c/'
+complete ghostview	'p/*/f:*.ps/'
+complete gv		'p/*/f:*.ps/'
+complete ifconfig	'p at 1@`ifconfig -l`@' \
+			'n/*/(range phase link netmask mtu vlandev vlan \
+			    metric mediaopt down delete broadcast arp debug)/'
+complete imake		'c/-I/d/'
+complete ipfw		'p/1/(flush add delete list show zero)/' \
 			'n/add/(allow permit accept pass deny drop reject \
-			reset count skipto num divert port tee port)/'
-    complete javac	'p/*/f:*.java/'
-    complete ldif2ldbm	'n/-i/f:*.ldif/'
-    complete libtool	'c/--mode=/(compile execute finish install link \
-			uninstall)/' 'c/--/(config debug dry-run features \
-			finish help quiet silent version mode=)/'
-    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
-			ltdl-tar version)/'
-    complete links	'c/-/(assume-codepage async-dns download-dir \
-			format-cache-size ftp-proxy help http-proxy \
-			max-connections max-connections-to-host \
-			memory-cache-size receive-timeout retries \
-			unrestartable-receive-timeout version)/'
-    complete natd	c/-/'(alias_address config deny_incoming dynamic \
-			inport interface log log_denied log_facility \
-			outport outport port pptpalias proxy_only \
-			proxy_rule redirect_address redirect_port \
-			reverse same_ports unregistered_only use_sockets \
-			verbose)'/ 'n at -interface@`ifconfig -l`@'
-    complete netstat	'n at -I@`ifconfig -l`@'
-    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
-			archive-headers debugging demangle disassemble \
-			disassemble-all disassemble-zeroes dynamic-reloc \
-			dynamic-syms endian= file-headers full-contents \
-			headers help info line-numbers no-show-raw-insn \
-			prefix-addresses private-headers reloc section-headers \
-			section=source stabs start-address= stop-address= \
-			syms target= version wide)/' \
+				reset count skipto num divert port tee port)/'
+complete javac		'p/*/f:*.java/'
+complete ldif2ldbm	'n/-i/f:*.ldif/'
+complete libtool	'c/--mode=/(compile execute finish install link \
+				    uninstall)/' \
+			'c/--/(config debug dry-run features finish help \
+				quiet silent version mode=)/'
+complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
+				ltdl-tar version)/'
+complete links		'c/-/(assume-codepage async-dns download-dir \
+			      format-cache-size ftp-proxy help http-proxy \
+			      max-connections max-connections-to-host \
+			      memory-cache-size receive-timeout retries \
+			      unrestartable-receive-timeout version)/'
+complete natd		c/-/'(alias_address config deny_incoming dynamic \
+			      inport interface log log_denied log_facility \
+			      outport outport port pptpalias proxy_only \
+			      proxy_rule redirect_address redirect_port \
+			      reverse same_ports unregistered_only use_sockets \
+			      verbose)'/ \
+			'n at -interface@`ifconfig -l`@'
+complete netstat	'n at -I@`ifconfig -l`@'
+complete objdump	'c/--/(adjust-vma= all-headers architecture= \
+			      archive-headers debugging demangle disassemble \
+			      disassemble-all disassemble-zeroes dynamic-reloc \
+			      dynamic-syms endian= file-headers full-contents \
+			      headers help info line-numbers no-show-raw-insn \
+			      prefix-addresses private-headers reloc \
+			      section-headers section=source stabs \
+			      start-address= stop-address= syms target= \
+			      version wide)/' \
 			'c/-/(a h i f C d D p r R t T x s S l w)/'
-    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
-			pke pp)/'
-    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
-			assume_local_charset= assume_unrec_charset= auth= base \
-			book buried_news cache= case cfg= child cookie_file= \
-			cookies core crawl debug_partial display= dump editor= \
-			emacskeys enable_scrollback error_file= force_html \
-			force_secure forms_options from ftp get_data head help \
-			hiddenlinks= historical homepage= image_links index= \
-			ismap link= localhost mime_header minimal \
-			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
-			nofilereferer nolist nolog nopause noprint noredir \
-			noreferer nostatus number_links partial partial_thres \
-			pauth= popup post_data preparsed print pseudo_inlines \
-			raw realm reload restrictions= resubmit_posts rlogin \
-			selective show_cursor soft_dquotes source stack_dump \
-			startfile_ok tagsoup telnet term= tlog trace traversal \
-			underscore useragent= validate verbose version vikeys \
-			width=)/' 'c/(http|ftp)/$URLS/'
-    complete gmake	'c/{--directory=,--include-dir=}/d/' \
+complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
+			      pke pp)/'
+complete lynx		'c/-/(accept_all_cookies anonymous assume_charset= \
+			      assume_local_charset= assume_unrec_charset= \
+			      auth= base book buried_news cache= case cfg= \
+			      child cookie_file= cookies core crawl \
+			      debug_partial display= dump editor= emacskeys \
+			      enable_scrollback error_file= force_html \
+			      force_secure forms_options from ftp get_data \
+			      head help hiddenlinks= historical homepage= \
+			      image_links index= ismap link= localhost \
+			      mime_header minimal newschunksize= \
+			      newsmaxchunk= nobrowse nocc nocolor \
+			      nofilereferer nolist nolog nopause noprint \
+			      noredir noreferer nostatus number_links \
+			      partial partial_thres pauth= popup post_data \
+			      preparsed print pseudo_inlines raw realm \
+			      reload restrictions= resubmit_posts rlogin \
+			      selective show_cursor soft_dquotes source \
+			      stack_dump startfile_ok tagsoup telnet term= \
+			      tlog trace traversal underscore useragent= \
+			      validate verbose version vikeys width=)/' \
+			'c/(http|ftp)/$URLS/'
+complete gmake		'c/{--directory=,--include-dir=}/d/' \
 			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
 			'c/--/(assume-new= assume-old= debug directory= \
-			dry-run environment-overrides file= help \
-			ignore-errors include-dir= jobs[=N] just-print \
-			keep-going load-average[=N] makefile= max-load[=N] \
-			new-file= no-builtin-rules no-keep-going \
-			no-print-directory old-file= print-data-base \
-			print-directory question quiet recon silent stop \
-			touch version warn-undefined-variables what-if=)/' \
+			      dry-run environment-overrides file= help \
+			      ignore-errors include-dir= jobs[=N] just-print \
+			      keep-going load-average[=N] makefile= \
+			      max-load[=N] new-file= no-builtin-rules \
+			      no-keep-going no-print-directory old-file= \
+			      print-data-base print-directory question quiet \
+			      recon silent stop touch version \
+			      warn-undefined-variables what-if=)/' \
 			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
-			'n/=/f/' 'n/-f/f/'
-    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
-			pcm2 rec igain ogain line1 line2 line3)'/ \
+			'n/=/f/' \
+			'n/-f/f/'
+complete mixer		p/1/'(vol bass treble synth pcm speaker mic cd mix \
+			      pcm2 rec igain ogain line1 line2 line3)'/ \
 			p at 2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
 
-    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
-    			auth buffer cdr check doublespeed equalizer frames \
-			gain halfspeed headphones left lineout list mix mono \
-			proxy quiet random rate reopen resync right scale \
-			shuffle single0 single1 skip speaker stdout stereo \
-			test verbose wav)/'
-    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
-			flush-logs flush-status flush-tables flush-privileges \
-			kill password ping processlist reload refresh \
-			shutdown status variables version)/'
-    complete mutt	"c at -f=@F:${HOME}/Mail/@" \
-			n/-a/f/ \
-			n/-F/f/ n/-H/f/ \
-			n/-s/x:'<subject line>'/ \
-			n/-e/x:'<command>'/ \
-			n at -b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
-			n at -c@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
-			n@*@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@
-    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
-			querylog start stop restart )/'
-    if ($?traditional_complete) then
-        complete nm \
-		'c/--/(debug-syms defined-only demangle dynamic \
-			extern-only format= help line-numbers no-demangle \
-			no-sort numeric-sort portability print-armap \
-			print-file-name reverse-sort size-sort undefined-only \
-			version)/' 'p/*/f:^*.{h,C,c,cc}/'
-    else
-	complete nm \
-		'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
-		'c/--target=/x:<bfdname>/' \
-		'c/--format=/(bsd sysv posix)/n/' \
-		'c/--/(debugsyms extern-only demangle dynamic print-armap \
-			print-file-name numeric-sort no-sort reverse-sort \
-			size-sort undefined-only portability target= radix= \
-			format= defined-only\ line-numbers no-demangle version \
-			help)//' \
-		'n/*/f:^*.{h,c,cc,s,S}/'
-    endif
-    complete nmap	'n at -e@`ifconfig -l`@' 'p/*/$hostnames/'
-    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
-    complete postfix    'n/*/(start stop reload abort flush check)/'
-    complete postmap	'n/1/(hash: regexp:)/' 'c/hash:/f/' 'c/regexp:/f/'
-    complete rcsdiff	'p at 1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
-    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
-			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
-			bgamma bpp broadcast bs c cc class co core deferglyphs \
-			disableModInDev disableVidMode displayID dpi dpms f fc \
-			flipPixels fn fp gamma ggamma help indirect kb keeptty \
-			ld lf logo ls nolisten string noloadxkb nolock nopn \
-			once p pn port probeonly query quiet r rgamma s \
-			showconfig sp su t terminate to tst v verbose version \
-			weight wm x xkbdb xkbmap)/'
-    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
-    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
-			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
-			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
-			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
-			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
-    complete vim	'n/*/f:^*.[oa]/'
-    complete where	'n/*/c/'
-    complete which	'n/*/c/'
-    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
-			'c/--/(back-color center colors dither help match \
-			maxscale parse scale smooth tile update-domain \
-			update-wmaker version workspace)/'
-    complete xdb	'p/1/c/'
-    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
-			hushchecksums hushspecials install interpreter keep \
-			margins nogrey noinstall nomakepk noscan paper safer \
-			shrinkbuttonn thorough topmargin underlink version)/' \
-			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
-    complete xlock	'c/-/(allowaccess allowroot debug description \
-			echokeys enablesaver grabmouse grabserver hide inroot \
-			install inwindow mono mousemotion nolock remote \
-			resetsaver sound timeelapsed use3d usefirst verbose \
-			wireframe background batchcount bg bitmap both3d \
-			count cycles delay delta3d display dpmsoff \
-			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
-			erasetime fg font foreground geometry help \
-			icongeometry info invalid left3d lockdelay logoutCmd \
-			mailCmd mailIcon message messagefile messagefont \
-			messagesfile mode name ncolors nice nomailIcon none3d \
-			parent password planfont program resources right3d \
-			saturation size startCmd timeout username validate \
-			version visual)/' 'n/-mode/(ant atlantis ball bat \
-			blot bouboule bounce braid bubble bubble3d bug cage \
-			cartoon clock coral crystal daisy dclock decay deco \
-			demon dilemma discrete drift eyes fadeplot flag flame \
-			flow forest galaxy gears goop grav helix hop hyper \
-			ico ifs image invert julia kaleid kumppa lament laser \
-			life life1d life3d lightning lisa lissie loop lyapunov \
-			mandelbrot marquee matrix maze moebius morph3d \
-			mountain munch nose pacman penrose petal pipes puzzle \
-			pyro qix roll rotor rubik shape sierpinski slip sphere \
-			spiral spline sproingies stairs star starfish strange \
-			superquadrics swarm swirl tetris thornbird triangle \
-			tube turtle vines voters wator wire world worm xjack \
-			blank bomb random)/' 
-    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
-    complete wget 	c/--/"(accept= append-output= background cache= \
-			continue convert-links cut-dirs= debug \
-			delete-after directory-prefix= domains= \
-			dont-remove-listing dot-style= exclude-directories= \
-			exclude-domains= execute= follow-ftp \
-			force-directories force-html glob= header= help \
-			http-passwd= http-user= ignore-length \
-			include-directories= input-file= level= mirror \
-			no-clobber no-directories no-host-directories \
-			no-host-lookup no-parent non-verbose \
-			output-document= output-file= passive-ftp \
-			proxy-passwd= proxy-user= proxy= quiet quota= \
-			recursive reject= relative retr-symlinks save-headers \
-			server-response span-hosts spider timeout= \
-			timestamping tries= user-agent= verbose version wait=)"/
+complete mpg123		'c/--/(2to1 4to1 8bit aggressive au audiodevice auth \
+			      buffer cdr check doublespeed equalizer frames \
+			      gain halfspeed headphones left lineout list \
+			      mix mono proxy quiet random rate reopen resync \
+			      right scale shuffle single0 single1 skip \
+			      speaker stdout stereo test verbose wav)/'
+complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
+			      flush-logs flush-status flush-tables \
+			      flush-privileges kill password ping \
+			      processlist reload refresh shutdown status \
+			      variables version)/'
 
-    # these from Tom Warzeka <tom at waz.cc>
+complete mutt \
+  "c at -f=@F:${HOME}/Mail/@" \
+  n/-a/f/ \
+  n/-F/f/ \
+  n/-H/f/ \
+  n/-s/x:'<subject line>'/ \
+  n/-e/x:'<command>'/ \
+  n at -b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
+  n at -c@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \
+  n@*@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@
 
-    # this one works but is slow and doesn't descend into subdirectories
-    # complete	cd	C@[./\$~]*@d@ \
-    #			p at 1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
+complete ndc	'n/*/(status dumpdb reload stats trace notrace \
+		    querylog start stop restart )/'
 
-    if ( -r /etc/shells ) then
-        complete setenv	p at 1@e@ n at DISPLAY@\$hosts@: n at SHELL@'`cat /etc/shells`'@
-    else
-	complete setenv	p at 1@e@ n at DISPLAY@\$hosts@:
-    endif
-    complete unsetenv	n/*/e/
+complete nm \
+  'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
+  'c/--target=/x:<bfdname>/' \
+  'c/--format=/(bsd sysv posix)/n/' \
+  'c/--/(debugsyms extern-only demangle dynamic print-armap \
+	  print-file-name numeric-sort no-sort reverse-sort \
+	  size-sort undefined-only portability target= radix= \
+	  format= defined-only\ line-numbers no-demangle version \
+	  help)//' \
+  'n/*/f:^*.{h,c,cc,s,S}/'
 
-    set _maildir = /var/mail
-    if (-r "$HOME/.mailrc") then
-        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
-			"c at +@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
-			n at -u@T:$_maildir@ n/-f/f/ \
-			n@*@'`sed -n s/alias//p "$HOME/.mailrc" | \
-			tr -s " " "	" | cut -f 2`'@
+complete nmap	'n at -e@`ifconfig -l`@' 'p/*/$hostnames/'
+complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
+complete postfix    'n/*/(start stop reload abort flush check)/'
+complete postmap	'n/1/(hash: regexp:)/' 'c/hash:/f/' 'c/regexp:/f/'
+complete rcsdiff	'p at 1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
+complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
+		    allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
+		    bgamma bpp broadcast bs c cc class co core deferglyphs \
+		    disableModInDev disableVidMode displayID dpi dpms f fc \
+		    flipPixels fn fp gamma ggamma help indirect kb keeptty \
+		    ld lf logo ls nolisten string noloadxkb nolock nopn \
+		    once p pn port probeonly query quiet r rgamma s \
+		    showconfig sp su t terminate to tst v verbose version \
+		    weight wm x xkbdb xkbmap)/'
+complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
+complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
+		    80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
+		    VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
+		    VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
+		    VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
+complete vim	'n/*/f:^*.[oa]/'
+complete where	'n/*/c/'
+complete which	'n/*/c/'
+complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
+		    'c/--/(back-color center colors dither help match \
+		    maxscale parse scale smooth tile update-domain \
+		    update-wmaker version workspace)/'
+complete xdb	'p/1/c/'
+complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
+		    hushchecksums hushspecials install interpreter keep \
+		    margins nogrey noinstall nomakepk noscan paper safer \
+		    shrinkbuttonn thorough topmargin underlink version)/' \
+		    'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
+complete xlock	'c/-/(allowaccess allowroot debug description \
+		    echokeys enablesaver grabmouse grabserver hide inroot \
+		    install inwindow mono mousemotion nolock remote \
+		    resetsaver sound timeelapsed use3d usefirst verbose \
+		    wireframe background batchcount bg bitmap both3d \
+		    count cycles delay delta3d display dpmsoff \
+		    dpmsstandby dpmssuspend endCmd erasedelay erasemode \
+		    erasetime fg font foreground geometry help \
+		    icongeometry info invalid left3d lockdelay logoutCmd \
+		    mailCmd mailIcon message messagefile messagefont \
+		    messagesfile mode name ncolors nice nomailIcon none3d \
+		    parent password planfont program resources right3d \
+		    saturation size startCmd timeout username validate \
+		    version visual)/' 'n/-mode/(ant atlantis ball bat \
+		    blot bouboule bounce braid bubble bubble3d bug cage \
+		    cartoon clock coral crystal daisy dclock decay deco \
+		    demon dilemma discrete drift eyes fadeplot flag flame \
+		    flow forest galaxy gears goop grav helix hop hyper \
+		    ico ifs image invert julia kaleid kumppa lament laser \
+		    life life1d life3d lightning lisa lissie loop lyapunov \
+		    mandelbrot marquee matrix maze moebius morph3d \
+		    mountain munch nose pacman penrose petal pipes puzzle \
+		    pyro qix roll rotor rubik shape sierpinski slip sphere \
+		    spiral spline sproingies stairs star starfish strange \
+		    superquadrics swarm swirl tetris thornbird triangle \
+		    tube turtle vines voters wator wire world worm xjack \
+		    blank bomb random)/' 
+complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
+complete wget 	c/--/"(accept= append-output= background cache= \
+		    continue convert-links cut-dirs= debug \
+		    delete-after directory-prefix= domains= \
+		    dont-remove-listing dot-style= exclude-directories= \
+		    exclude-domains= execute= follow-ftp \
+		    force-directories force-html glob= header= help \
+		    http-passwd= http-user= ignore-length \
+		    include-directories= input-file= level= mirror \
+		    no-clobber no-directories no-host-directories \
+		    no-host-lookup no-parent non-verbose \
+		    output-document= output-file= passive-ftp \
+		    proxy-passwd= proxy-user= proxy= quiet quota= \
+		    recursive reject= relative retr-symlinks save-headers \
+		    server-response span-hosts spider timeout= \
+		    timestamping tries= user-agent= verbose version wait=)"/
+
+# these from Tom Warzeka <tom at waz.cc>
+
+# this one works but is slow and doesn't descend into subdirectories
+# complete	cd	C@[./\$~]*@d@ \
+#			p at 1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
+
+if ( -r /etc/shells ) then
+    complete setenv	p at 1@e@ n at DISPLAY@\$hosts@: n at SHELL@'`cat /etc/shells`'@
+else
+    complete setenv	p at 1@e@ n at DISPLAY@\$hosts@:
+endif
+complete unsetenv	n/*/e/
+
+set _maildir = /var/mail
+if (-r "$HOME/.mailrc") then
+    complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
+		    "c at +@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+		    n at -u@T:$_maildir@ n/-f/f/ \
+		    n@*@'`sed -n s/alias//p "$HOME/.mailrc" | \
+		    tr -s " " "	" | cut -f 2`'@
+else
+    complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
+		    "c at +@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
+		    n at -u@T:$_maildir@ n/-f/f/ n/*/u/
+endif
+unset _maildir
+
+if (! $?MANPATH) then
+    if (-r /usr/share/man) then
+	setenv MANPATH /usr/share/man:
     else
-        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
-			"c at +@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:'<subject>'/ \
-			n at -u@T:$_maildir@ n/-f/f/ n/*/u/
+	setenv MANPATH /usr/man:
     endif
-    unset _maildir
+endif
 
-    if (! $?MANPATH) then
-	if (-r /usr/share/man) then
-	    setenv MANPATH /usr/share/man:
-	else
-	    setenv MANPATH /usr/man:
-	endif
-    endif
-
-    if ($?traditional_complete) then
-        # use of $MANPATH from Dan Nicolaescu <dann at ics.uci.edu>
-        # use of 'find' adapted from Lubomir Host <host8 at kepler.fmph.uniba.sk>
-        complete man \
-	    'n at 1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
-	    'n at 2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
-	    'n at 3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
-	    'n at 4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
-	    'n at 5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
-	    'n at 6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
-	    'n at 7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
-	    'n at 8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
-	    'n at 9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
-	    'n at 0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
-	    'n at n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
-	    'n at o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
-	    'n at l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
-	    'n at p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
-	    c at -@"(- f k M P s S t)"@ n at -f@c@ n at -k@x:'<keyword>'@ n at -[MP]@d@   \
-	    'N at -[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
-	    'n at -[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
-	    'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
-	    #n@*@c@ # old way -- commands only
-    else
-        complete man	    n at 1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
-			    n at 2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
-			    n at 3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
-			    n at 4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
-			    n at 5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
-			    n at 6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
-			    n at 7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
-			    n at 8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
-    n at 9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
-    n at 0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
-  n at new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
-  n at old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
+if ($?traditional_complete) then
+    # use of $MANPATH from Dan Nicolaescu <dann at ics.uci.edu>
+    # use of 'find' adapted from Lubomir Host <host8 at kepler.fmph.uniba.sk>
+    complete man \
+	'n at 1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
+	'n at 2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
+	'n at 3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
+	'n at 4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
+	'n at 5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
+	'n at 6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
+	'n at 7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
+	'n at 8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
+	'n at 9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
+	'n at 0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
+	'n at n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
+	'n at o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
+	'n at l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
+	'n at p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
+	c at -@"(- f k M P s S t)"@ n at -f@c@ n at -k@x:'<keyword>'@ n at -[MP]@d@   \
+	'N at -[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
+	'n at -[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
+	'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
+	#n@*@c@ # old way -- commands only
+else
+    complete man	    n at 1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
+			n at 2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
+			n at 3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
+			n at 4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
+			n at 5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
+			n at 6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
+			n at 7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
+			n at 8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
+n at 9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
+n at 0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
+n at new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
+n at old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
 n at local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
 n at public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
-		c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
-		N at -P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
-    endif
+	    c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
+	    N at -P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
+endif
 
-    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
-			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
-    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
-    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
+complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
+		    n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
+complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
+complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
 
-    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
-    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
+complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
+complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
 
-    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
-    complete xpdf	c/-/"(z g remote raise quit cmap rgb papercolor       \
-			      eucjp t1lib freetype ps paperw paperh level1    \
-			      upw fullscreen cmd q v h help)"/                \
-			n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
-			n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
-			n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
-			n/-{t1lib,freetype}/x:'<font_type>'/                  \
-			n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
-			n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
-			n/-/f:*.{pdf,PDF}/                                    \
-			N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
-			N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
+complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
+complete xpdf	c/-/"(z g remote raise quit cmap rgb papercolor       \
+			  eucjp t1lib freetype ps paperw paperh level1    \
+			  upw fullscreen cmd q v h help)"/                \
+		    n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
+		    n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
+		    n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
+		    n/-{t1lib,freetype}/x:'<font_type>'/                  \
+		    n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
+		    n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
+		    n/-/f:*.{pdf,PDF}/                                    \
+		    N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
+		    N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
 
-    complete tcsh	c/-D*=/'x:<value>'/ c/-D/'x:<name>'/ \
-			c/-/"(b c d D e f F i l m n q s t v V x X -version)"/ \
-			n/-c/c/ n/{-l,--version}/n/ n/*/'f:*.{,t}csh'/
+complete tcsh	c/-D*=/'x:<value>'/ c/-D/'x:<name>'/ \
+		    c/-/"(b c d D e f F i l m n q s t v V x X -version)"/ \
+		    n/-c/c/ n/{-l,--version}/n/ n/*/'f:*.{,t}csh'/
 
-    complete rpm	c/--/"(query verify nodeps nofiles nomd5 noscripts    \
-	                nogpg nopgp install upgrade freshen erase allmatches  \
-		        notriggers repackage test rebuild recompile initdb    \
-		        rebuilddb addsign resign querytags showrc setperms    \
-		        setugids all file group package querybynumber qf      \
-		        triggeredby whatprovides whatrequires changelog       \
-		        configfiles docfiles dump filesbypkg info last list   \
-		        provides queryformat requires scripts state triggers  \
-		        triggerscripts allfiles badreloc excludepath checksig \
-	                excludedocs force hash ignoresize ignorearch ignoreos \
-		        includedocs justdb noorder oldpackage percent prefix  \
-		        relocate replace-files replacepkgs buildroot clean    \
-		        nobuild rmsource rmspec short-circuit sign target     \
-		        help version quiet rcfile pipe dbpath root specfile)"/\
-		        c/-/"(q V K i U F e ba bb bp bc bi bl bs ta tb tp tc  \
-			ti tl ts a f g p c d l R s h ? v vv -)"/              \
-		n/{-f,--file}/f/ n/{-g,--group}/g/ n/--pipe/c/ n/--dbpath/d/  \
-		n/--querybynumber/x:'<number>'/ n/--triggeredby/x:'<package>'/\
-		n/--what{provides,requires}/x:'<capability>'/ n/--root/d/     \
-		n/--{qf,queryformat}/x:'<format>'/ n/--buildroot/d/           \
-		n/--excludepath/x:'<oldpath>'/  n/--prefix/x:'<newpath>'/     \
-		n/--relocate/x:'<oldpath=newpath>'/ n/--target/x:'<platform>'/\
-		n/--rcfile/x:'<filelist>'/ n/--specfile/x:'<specfile>'/       \
-	        n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/
+complete rpm	c/--/"(query verify nodeps nofiles nomd5 noscripts    \
+		    nogpg nopgp install upgrade freshen erase allmatches  \
+		    notriggers repackage test rebuild recompile initdb    \
+		    rebuilddb addsign resign querytags showrc setperms    \
+		    setugids all file group package querybynumber qf      \
+		    triggeredby whatprovides whatrequires changelog       \
+		    configfiles docfiles dump filesbypkg info last list   \
+		    provides queryformat requires scripts state triggers  \
+		    triggerscripts allfiles badreloc excludepath checksig \
+		    excludedocs force hash ignoresize ignorearch ignoreos \
+		    includedocs justdb noorder oldpackage percent prefix  \
+		    relocate replace-files replacepkgs buildroot clean    \
+		    nobuild rmsource rmspec short-circuit sign target     \
+		    help version quiet rcfile pipe dbpath root specfile)"/\
+		    c/-/"(q V K i U F e ba bb bp bc bi bl bs ta tb tp tc  \
+		    ti tl ts a f g p c d l R s h ? v vv -)"/              \
+	    n/{-f,--file}/f/ n/{-g,--group}/g/ n/--pipe/c/ n/--dbpath/d/  \
+	    n/--querybynumber/x:'<number>'/ n/--triggeredby/x:'<package>'/\
+	    n/--what{provides,requires}/x:'<capability>'/ n/--root/d/     \
+	    n/--{qf,queryformat}/x:'<format>'/ n/--buildroot/d/           \
+	    n/--excludepath/x:'<oldpath>'/  n/--prefix/x:'<newpath>'/     \
+	    n/--relocate/x:'<oldpath=newpath>'/ n/--target/x:'<platform>'/\
+	    n/--rcfile/x:'<filelist>'/ n/--specfile/x:'<specfile>'/       \
+	    n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/
 
-    # these conform to the latest GNU versions available at press time ...
-    # updates by John Gotts <jgotts at engin.umich.edu>
-    if (-X emacs) then
-      # TW note:  if your version of GNU Emacs supports the "--version" option,
-      #           uncomment this line and comment the next to automatically
-      #           detect the version, else set "_emacs_ver" to your version.
-      #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
-      set _emacs_ver=21.3
-      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
-      complete emacs	c/--/"(batch terminal display no-windows no-init-file \
-                               user debug-init unibyte multibyte version help \
-                               no-site-file funcall load eval insert kill)"/ \
-                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
-			n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
-	                n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
-			n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
-			n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
-      unset _emacs_ver _emacs_dir
-    endif
+# these conform to the latest GNU versions available at press time ...
+# updates by John Gotts <jgotts at engin.umich.edu>
+if (-X emacs) then
+  # TW note:  if your version of GNU Emacs supports the "--version" option,
+  #           uncomment this line and comment the next to automatically
+  #           detect the version, else set "_emacs_ver" to your version.
+  #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
+  set _emacs_ver=21.3
+  set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
+  complete emacs	c/--/"(batch terminal display no-windows no-init-file \
+			   user debug-init unibyte multibyte version help \
+			   no-site-file funcall load eval insert kill)"/ \
+		    c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
+		    n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
+		    n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
+		    n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
+		    n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
+  unset _emacs_ver _emacs_dir
+endif
 
-    complete gzcat	c/--/"(force help license quiet version)"/ \
-			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
-    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
-			force help list license no-name quiet recurse \
-			suffix test verbose version fast best)"/ \
-			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
-			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
-			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
-			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
-			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
-    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
-			no-name quiet recurse suffix test verbose version)"/ \
-			c/-/"(c f h l L n q r S t v V -)"/ \
-			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
-			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
-    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/-/"(A b B c C e f h i l n s v V w x)"/ \
-			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
-			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
-    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/-/"(A b B c C e f h i l n s v V w x)"/ \
-			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
-			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
-    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/-/"(A b B c C e f h i l n s v V w x)"/ \
-			p/1/x:'<fixed_string>'/ N/-*e/f/ \
-			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
-    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
-    complete zmore	n/*/f:*.{gz,Z,z,zip}/
-    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
-    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
-    complete zforce	n/*/f:^*.{gz,tgz}/
+complete gzcat	c/--/"(force help license quiet version)"/ \
+		    c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
+complete gzip	c/--/"(stdout to-stdout decompress uncompress \
+		    force help list license no-name quiet recurse \
+		    suffix test verbose version fast best)"/ \
+		    c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
+		    n/{-S,--suffix}/x:'<file_name_suffix>'/ \
+		    n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
+		    N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
+		    n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
+complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
+		    no-name quiet recurse suffix test verbose version)"/ \
+		    c/-/"(c f h l L n q r S t v V -)"/ \
+		    n/{-S,--suffix}/x:'<file_name_suffix>'/ \
+		    n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/-/"(A b B c C e f h i l n s v V w x)"/ \
+		    p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
+		    n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
+complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/-/"(A b B c C e f h i l n s v V w x)"/ \
+		    p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
+		    n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
+complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/-/"(A b B c C e f h i l n s v V w x)"/ \
+		    p/1/x:'<fixed_string>'/ N/-*e/f/ \
+		    n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
+complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
+complete zmore	n/*/f:*.{gz,Z,z,zip}/
+complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
+complete zforce	n/*/f:^*.{gz,tgz}/
 
-    complete dcop 'p/1/`$:0`/ /' \
-	'p/2/`$:0 $:1 | awk \{print\ \$1\}`/ /' \
-	'p/3/`$:0 $:1 $:2 | sed "s%.* \(.*\)(.*%\1%"`/ /'
+complete dcop 'p/1/`$:0`/ /' \
+    'p/2/`$:0 $:1 | awk \{print\ \$1\}`/ /' \
+    'p/3/`$:0 $:1 $:2 | sed "s%.* \(.*\)(.*%\1%"`/ /'
 
 
-    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/--/"(extended-regexp fixed-regexp basic-regexp \
-			regexp file ignore-case word-regexp line-regexp \
-			no-messages revert-match version help byte-offset \
-			line-number with-filename no-filename quiet silent \
-			text directories recursive files-without-match \
-			files-with-matches count before-context after-context \
-			context binary unix-byte-offsets)"/ \
-			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
-				v w x)"/ \
-			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
-			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
-    complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/--/"(extended-regexp fixed-regexp basic-regexp \
-			regexp file ignore-case word-regexp line-regexp \
-			no-messages revert-match version help byte-offset \
-			line-number with-filename no-filename quiet silent \
-			text directories recursive files-without-match \
-			files-with-matches count before-context after-context \
-			context binary unix-byte-offsets)"/ \
-			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
-				v w x)"/ \
-			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
-			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
-    complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
-			c/--/"(extended-regexp fixed-regexp basic-regexp \
-			regexp file ignore-case word-regexp line-regexp \
-			no-messages revert-match version help byte-offset \
-			line-number with-filename no-filename quiet silent \
-			text directories recursive files-without-match \
-			files-with-matches count before-context after-context \
-			context binary unix-byte-offsets)"/ \
-			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
-				v w x)"/ \
-			p/1/x:'<fixed_string>'/ N/-*e/f/ \
-			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
+complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/--/"(extended-regexp fixed-regexp basic-regexp \
+		    regexp file ignore-case word-regexp line-regexp \
+		    no-messages revert-match version help byte-offset \
+		    line-number with-filename no-filename quiet silent \
+		    text directories recursive files-without-match \
+		    files-with-matches count before-context after-context \
+		    context binary unix-byte-offsets)"/ \
+		    c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+			    v w x)"/ \
+		    p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
+		    n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
+complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/--/"(extended-regexp fixed-regexp basic-regexp \
+		    regexp file ignore-case word-regexp line-regexp \
+		    no-messages revert-match version help byte-offset \
+		    line-number with-filename no-filename quiet silent \
+		    text directories recursive files-without-match \
+		    files-with-matches count before-context after-context \
+		    context binary unix-byte-offsets)"/ \
+		    c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+			    v w x)"/ \
+		    p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
+		    n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
+complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
+		    c/--/"(extended-regexp fixed-regexp basic-regexp \
+		    regexp file ignore-case word-regexp line-regexp \
+		    no-messages revert-match version help byte-offset \
+		    line-number with-filename no-filename quiet silent \
+		    text directories recursive files-without-match \
+		    files-with-matches count before-context after-context \
+		    context binary unix-byte-offsets)"/ \
+		    c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
+			    v w x)"/ \
+		    p/1/x:'<fixed_string>'/ N/-*e/f/ \
+		    n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
 
-    complete sed	c/--/"(quiet silent version help expression file)"/   \
-			c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
-			n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
-			n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
+complete sed	c/--/"(quiet silent version help expression file)"/   \
+		    c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
+		    n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
+		    n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
 
-    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
-    complete who	c/--/"(heading idle count mesg message writable help \
-    			version)"/ c/-/"(H i m q s T w u -)"/ \
-			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
+complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
+complete who	c/--/"(heading idle count mesg message writable help \
+		    version)"/ c/-/"(H i m q s T w u -)"/ \
+		    p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
 
-    complete chown	c/--/"(changes dereference no-dereference silent \
-    			quiet reference recursive verbose help version)"/ \
-			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
-			n/-/u/: p/1/u/: n/*/f/
-    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
-    			recursive verbose help version)"/ \
-			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
-    complete chmod	c/--/"(changes silent quiet verbose reference \
-    			recursive help version)"/ c/-/"(c f R v)"/
-    complete df		c/--/"(all block-size human-readable si inodes \
-			kilobytes local megabytes no-sync portability sync \
-			type print-type exclude-type help version)"/ \
-			c/-/"(a H h i k l m P T t v x)"/
-    complete du		c/--/"(all block-size bytes total dereference-args \
-    			human-readable si kilobytes count-links dereference \
-			megabytes separate-dirs summarize one-file-system \
-			exclude-from exclude max-depth help version"/ \
-			c/-/"(a b c D H h k L l m S s X x)"/
+complete chown	c/--/"(changes dereference no-dereference silent \
+		    quiet reference recursive verbose help version)"/ \
+		    c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
+		    n/-/u/: p/1/u/: n/*/f/
+complete chgrp	c/--/"(changes no-dereference silent quiet reference \
+		    recursive verbose help version)"/ \
+		    c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
+complete chmod	c/--/"(changes silent quiet verbose reference \
+		    recursive help version)"/ c/-/"(c f R v)"/
+complete df		c/--/"(all block-size human-readable si inodes \
+		    kilobytes local megabytes no-sync portability sync \
+		    type print-type exclude-type help version)"/ \
+		    c/-/"(a H h i k l m P T t v x)"/
+complete du		c/--/"(all block-size bytes total dereference-args \
+		    human-readable si kilobytes count-links dereference \
+		    megabytes separate-dirs summarize one-file-system \
+		    exclude-from exclude max-depth help version"/ \
+		    c/-/"(a b c D H h k L l m S s X x)"/
 
-    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
-			show-nonprinting show-ends show-tabs help version)"/ \
-			c/-/"(A b E e n s T t u v -)"/ n/*/f/
-    complete mv		c/--/"(backup force interactive update verbose suffix \
-			version-control help version)"/ \
-			c/-/"(b f i S u V v -)"/ \
-			n/{-S,--suffix}/x:'<suffix>'/ \
-			n/{-V,--version-control}/"(t numbered nil existing \
-			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
-    complete cp		c/--/"(archive backup no-dereference force \
-    			interactive link preserve parents sparse recursive \
-			symbolic-link suffix update verbose version-control \
-			one-file-system help version)"/ \
-			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
-			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
-			n/{-V,--version-control}/"(t numbered nil existing \
-			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
-    complete ln		c/--/"(backup directory force no-dereference \
-    			interactive symbolic suffix verbose version-control \
-			help version)"/ \
-			c/-/"(b d F f i n S s V v -)"/ \
-			n/{-S,--suffix}/x:'<suffix>'/ \
-			n/{-V,--version-control}/"(t numbered nil existing \
-			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
-			p/1/f/ p/2/x:'<link_name>'/
-    complete touch	c/--/"(date reference time help version)"/ \
-			c/-/"(a c d f m r t -)"/ \
-			n/{-d,--date}/x:'<date_string>'/ \
-			c/--time/"(access atime mtime modify use)"/ \
-			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
-    complete mkdir	c/--/"(mode parents verbose help version)"/ \
-    			c/-/"(p m -)"/ \
-			n/{-m,--mode}/x:'<mode>'/ n/*/d/
-    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
-    			version)"/ c/-/"(p -)"/ n/*/d/
-    complete env 	'c/*=/f/' 'p/1/e/=/' 'p/2/c/'
+complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
+		    show-nonprinting show-ends show-tabs help version)"/ \
+		    c/-/"(A b E e n s T t u v -)"/ n/*/f/
+complete mv		c/--/"(backup force interactive update verbose suffix \
+		    version-control help version)"/ \
+		    c/-/"(b f i S u V v -)"/ \
+		    n/{-S,--suffix}/x:'<suffix>'/ \
+		    n/{-V,--version-control}/"(t numbered nil existing \
+		    never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
+complete cp		c/--/"(archive backup no-dereference force \
+		    interactive link preserve parents sparse recursive \
+		    symbolic-link suffix update verbose version-control \
+		    one-file-system help version)"/ \
+		    c/-/"(a b d f i l P p R r S s u V v x -)"/ \
+		    n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
+		    n/{-V,--version-control}/"(t numbered nil existing \
+		    never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
+complete ln		c/--/"(backup directory force no-dereference \
+		    interactive symbolic suffix verbose version-control \
+		    help version)"/ \
+		    c/-/"(b d F f i n S s V v -)"/ \
+		    n/{-S,--suffix}/x:'<suffix>'/ \
+		    n/{-V,--version-control}/"(t numbered nil existing \
+		    never simple)"/ n/-*/f/ N/-*/x:'<link_name>'/ \
+		    p/1/f/ p/2/x:'<link_name>'/
+complete touch	c/--/"(date reference time help version)"/ \
+		    c/-/"(a c d f m r t -)"/ \
+		    n/{-d,--date}/x:'<date_string>'/ \
+		    c/--time/"(access atime mtime modify use)"/ \
+		    n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
+complete mkdir	c/--/"(mode parents verbose help version)"/ \
+		    c/-/"(p m -)"/ \
+		    n/{-m,--mode}/x:'<mode>'/ n/*/d/
+complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
+		    version)"/ c/-/"(p -)"/ n/*/d/
+complete env 	'c/*=/f/' 'p/1/e/=/' 'p/2/c/'
 
-    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
-			R S T v V w W X z Z)"/ \
-			c/-[dtx]*/"( B C f F g G i k K m M O p P \
-			R s S T v w x X z Z)"/ \
-			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
-			--catenate --concatenate --create --diff --compare \
-			--delete --append --list --update --extract --get \
-			--help --version)"/ \
-			c/--/"(catenate concatenate create diff compare \
-			delete append list update extract get atime-preserve \
-			block-size read-full-blocks directory checkpoint file \
-			force-local info-script new-volume-script incremental \
-			listed-incremental dereference ignore-zeros \
-			ignore-failed-read keep-old-files starting-file \
-			one-file-system tape-length modification-time \
-			multi-volume after-date newer old-archive portability \
-			to-stdout same-permissions preserve-permissions \
-			absolute-paths preserve record-number remove-files \
-			same-order preserve-order same-owner sparse \
-			files-from null totals verbose label version \
-			interactive confirmation verify exclude exclude-from \
-			compress uncompress gzip ungzip use-compress-program \
-			block-compress help version)"/ \
-			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
-			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
-			C@/dev at f@ \
-			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
-			n/{-[Adrtux]j*f,--file}/f:*.{tar.bz2,tbz}/ \
-			n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
-			n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
-			n/{-[Adrtux]*f,--file}/f:*.tar/ \
-			N/{-xj*f,--file}/'`tar -tjf $:-1`'/ \
-			N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
-			N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
-			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
-			n/--use-compress-program/c/ \
-			n/{-b,--block-size}/x:'<block_size>'/ \
-			n/{-V,--label}/x:'<volume_label>'/ \
-			n/{-N,--{after-date,newer}}/x:'<date>'/ \
-			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
-			n/{-C,--directory}/d/ \
-			N/{-C,--directory}/'`\ls $:-1`'/ \
-			n/-[0-7]/"(l m h)"/
+complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
+		    R S T v V w W X z Z)"/ \
+		    c/-[dtx]*/"( B C f F g G i k K m M O p P \
+		    R s S T v w x X z Z)"/ \
+		    p/1/"(A c d r t u x -A -c -d -r -t -u -x \
+		    --catenate --concatenate --create --diff --compare \
+		    --delete --append --list --update --extract --get \
+		    --help --version)"/ \
+		    c/--/"(catenate concatenate create diff compare \
+		    delete append list update extract get atime-preserve \
+		    block-size read-full-blocks directory checkpoint file \
+		    force-local info-script new-volume-script incremental \
+		    listed-incremental dereference ignore-zeros \
+		    ignore-failed-read keep-old-files starting-file \
+		    one-file-system tape-length modification-time \
+		    multi-volume after-date newer old-archive portability \
+		    to-stdout same-permissions preserve-permissions \
+		    absolute-paths preserve record-number remove-files \
+		    same-order preserve-order same-owner sparse \
+		    files-from null totals verbose label version \
+		    interactive confirmation verify exclude exclude-from \
+		    compress uncompress gzip ungzip use-compress-program \
+		    block-compress help version)"/ \
+		    c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
+		    T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
+		    C@/dev at f@ \
+		    n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
+		    n/{-[Adrtux]j*f,--file}/f:*.{tar.bz2,tbz}/ \
+		    n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
+		    n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
+		    n/{-[Adrtux]*f,--file}/f:*.tar/ \
+		    N/{-xj*f,--file}/'`tar -tjf $:-1`'/ \
+		    N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
+		    N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
+		    N/{-x*f,--file}/'`tar -tf $:-1`'/ \
+		    n/--use-compress-program/c/ \
+		    n/{-b,--block-size}/x:'<block_size>'/ \
+		    n/{-V,--label}/x:'<volume_label>'/ \
+		    n/{-N,--{after-date,newer}}/x:'<date>'/ \
+		    n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
+		    n/{-C,--directory}/d/ \
+		    N/{-C,--directory}/'`\ls $:-1`'/ \
+		    n/-[0-7]/"(l m h)"/
 
-    switch ( "$OSTYPE" )
-    case "linux":
-      # Linux filesystems
-      complete  mount	c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
-			n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
-			n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
-			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	 " | cut -f 2`'@
-      complete umount	c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
-			  n/*/'`mount | cut -d " " -f 3`'/
-      breaksw
-    case "sunos*":
-    case "solaris":
-      # Solaris filesystems
-      complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
-      			n/-o/x:'<FSType_options>'/ \
-      			n at -F@'`\ls -1 /usr/lib/fs`'@ \
-      			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
-      complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
-      			n/*/'`mount | cut -d " " -f 1`'/
-      complete  mountall	c/-/"(F l r)"/ n at -F@'`\ls -1 /usr/lib/fs`'@
-      complete umountall	c/-/"(F h k l r s)"/ n at -F@'`\ls -1 /usr/lib/fs`'@ \
-      			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
-      breaksw
-    case "cygwin":
-      # Cygwin mounts
-      complete  mount	c/-/"(b c f h m o p s t u v x E X)"/ n/-[hmpv]/n/ \
-      			n/-c/x:'/'/ \
-			n/-o/"(user system binary text exec notexec cygexec nosuid managed)"/ \
-      			n@*@'`mount -p | tail -1 | cut -d " " -f 1 | xargs ls -1 | awk '"'"'{print $1":/"; } END{print "//";}'"'"'`'@
-      complete umount	c/-/"(A c h s S u U v)"/ n/-[AhSUv]/n/ \
-      			n@*@'`mount | grep -v noumount | cut -d " " -f 3`'@
-      breaksw
-    default:
-      breaksw
-    endsw
+switch ( "$OSTYPE" )
+case linux:
+  # Linux filesystems
+  complete  mount	c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
+		    n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
+		    n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
+		    n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	 " | cut -f 2`'@
+  complete umount	c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
+		      n/*/'`mount | cut -d " " -f 3`'/
+  breaksw
+case sunos*:
+case solaris:
+  # Solaris filesystems
+  complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
+		    n/-o/x:'<FSType_options>'/ \
+		    n at -F@'`\ls -1 /usr/lib/fs`'@ \
+		    n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
+  complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
+		    n/*/'`mount | cut -d " " -f 1`'/
+  complete  mountall	c/-/"(F l r)"/ n at -F@'`\ls -1 /usr/lib/fs`'@
+  complete umountall	c/-/"(F h k l r s)"/ n at -F@'`\ls -1 /usr/lib/fs`'@ \
+		    n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
+  breaksw
+case cygwin:
+  # Cygwin mounts
+  complete  mount	c/-/"(b c f h m o p s t u v x E X)"/ n/-[hmpv]/n/ \
+		    n/-c/x:'/'/ \
+		    n/-o/"(user system binary text exec notexec cygexec nosuid managed)"/ \
+		    n@*@'`mount -p | tail -1 | cut -d " " -f 1 | xargs ls -1 | awk '"'"'{print $1":/"; } END{print "//";}'"'"'`'@
+  complete umount	c/-/"(A c h s S u U v)"/ n/-[AhSUv]/n/ \
+		    n@*@'`mount | grep -v noumount | cut -d " " -f 3`'@
+  breaksw
+endsw
 
-    # these deal with NIS (formerly YP); if it's not running you don't need 'em
-    if (-X domainname) then
-      set _domain = "`domainname`"
-      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
-      if ("$_domain" != "" && "$_domain" != "noname") then
-        complete domainname p at 1@D:$_ypdir@" " n@*@n@
-        complete ypcat	    c at -@"(d k t x)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
-	                    N at -d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
-	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
-        complete ypmatch    c at -@"(d k t x)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
-	                    N at -d@x:'<key ...>'@ n at -@x:'<key ...>'@ p at 1@x:'<key ...>'@ \
-	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
-        complete ypwhich    c at -@"(d m t x V1 V2)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
-	                    n at -m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
-			    N at -m@n@ n@*@\$hosts@
-      endif
-      unset _domain _ypdir
-    endif
+# these deal with NIS (formerly YP); if it's not running you don't need 'em
+if (-X domainname) then
+  set _domain = "`domainname`"
+  set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
+  if ("$_domain" != "" && "$_domain" != "noname") then
+    complete domainname p at 1@D:$_ypdir@" " n@*@n@
+    complete ypcat	    c at -@"(d k t x)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
+			N at -d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
+			n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
+    complete ypmatch    c at -@"(d k t x)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
+			N at -d@x:'<key ...>'@ n at -@x:'<key ...>'@ p at 1@x:'<key ...>'@ \
+			n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
+    complete ypwhich    c at -@"(d m t x V1 V2)"@ n at -x@n@ n at -d@D:$_ypdir@" " \
+			n at -m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
+			N at -m@n@ n@*@\$hosts@
+  endif
+  unset _domain _ypdir
+endif
 
-    complete make \
-	'n/-f/f/' \
-      	'c/*=/f/' \
-	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
+complete make \
+    'n/-f/f/' \
+    'c/*=/f/' \
+    'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
 
-    if ( -f /etc/printcap ) then
-	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
+if ( -f /etc/printcap ) then
+    set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
 
-	complete lpr    'c/-P/$printers/'
-	complete lpq    'c/-P/$printers/'
-	complete lprm   'c/-P/$printers/'
-	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
-	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
-	complete dvilj	'p/*/f:*.dvi/'
-    endif
+    complete lpr    'c/-P/$printers/'
+    complete lpq    'c/-P/$printers/'
+    complete lprm   'c/-P/$printers/'
+    complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
+    complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
+    complete dvilj	'p/*/f:*.dvi/'
+endif
 
-    # From Alphonse Bendt
-    complete ant \
-	 'n/-f/f:*.xml/' \
-	      'n@*@`cat build.xml | sed -n -e "s/[ \t]*<target[\t\n]*name=.\([a-zA-Z0-9_:]*\).*/\1/p"`@'
+# From Alphonse Bendt
+complete ant \
+     'n/-f/f:*.xml/' \
+	  'n@*@`cat build.xml | sed -n -e "s/[ \t]*<target[\t\n]*name=.\([a-zA-Z0-9_:]*\).*/\1/p"`@'
 
-    if ($?P4CLIENT && -X perl) then
-	# This is from Greg Allen.
-	set p4cmds=(add branch branches commands change changes client clients \
-	    counter counters delete depot depots describe diff diff2 \
-	    edit filelog files fix fixes fstat group groups have help \
-	    info integrate integrated job jobs jobspec label labels \
-	    labelsync lock obliterate opened passwd print protect rename \
-	    reopen resolve resolved revert review reviews set submit \
-	    sync triggers unlock user users verify where)
-	complete p4 'p/1/$p4cmds/' 'n/help/$p4cmds/' \
-	    'n%{-l,label}%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
-	    'n%-t%`p4 $:1s | sed "s/[^ ]* \([^ ]*\) .*/\1/"`%' \
-	    'c%*@%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
-	    'c@//*/*@`p4 files $:-0... |& perl -nle "m%\Q$:-0\E([^#][^/# ] \
-	    *)%;print "\$"1 if \\\!/no such/&&\!"\$"h{"\$"1}++"`@@' \
-	    'c@//@`p4 depots | sed "s/Depot \([^ ]*\) .*/\1/"`@/@'
-    endif
+if ($?P4CLIENT && -X perl) then
+    # This is from Greg Allen.
+    set p4cmds=(add branch branches commands change changes client clients \
+	counter counters delete depot depots describe diff diff2 \
+	edit filelog files fix fixes fstat group groups have help \
+	info integrate integrated job jobs jobspec label labels \
+	labelsync lock obliterate opened passwd print protect rename \
+	reopen resolve resolved revert review reviews set submit \
+	sync triggers unlock user users verify where)
+    complete p4 'p/1/$p4cmds/' 'n/help/$p4cmds/' \
+	'n%{-l,label}%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
+	'n%-t%`p4 $:1s | sed "s/[^ ]* \([^ ]*\) .*/\1/"`%' \
+	'c%*@%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
+	'c@//*/*@`p4 files $:-0... |& perl -nle "m%\Q$:-0\E([^#][^/# ] \
+	*)%;print "\$"1 if \\\!/no such/&&\!"\$"h{"\$"1}++"`@@' \
+	'c@//@`p4 depots | sed "s/Depot \([^ ]*\) .*/\1/"`@/@'
+endif
 
 
-    if (! $?traditional_complete) then
-        uncomplete vi
-        uncomplete vim
-        complete {vi,vim,gvim,nvi,elvis} 	n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
-        complete {ispell,spell,spellword}	'n at -d@`ls /usr/lib/ispell/*.aff | sed -e "s/\.aff//" `@' 'n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/'
-        complete elm	'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
-        complete ncftp	'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
-        complete bibtex	'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
-        complete dvi2tty	n/*/f:*.dvi/	# Only files that match *.dvi
-	uncomplete gv
-	uncomplete ghostview
-        complete {gv,ghostview}	'n/*/f:*.{ps,eps,epsi}/'
-        complete enscript \
-		'c/--/(columns= pages= header= no-header truncate-lines \
-			line-numbers setpagedevice= escapes font= \
-			header-font= fancy-header no-job-header \
-			highlight-bars indent= filter= borders page-prefeed \
-			no-page-prefeed lineprinter lines-per-page= mail \
-			media= copies= newline= output= missing-characters \
-			printer= quiet silent landscape portrait \
-			baselineskip= statusdict= title= tabsize= underlay= \
-			verbose version encoding pass-through download-font= \
-			filter-stdin= help highlight-bar-gray= list-media \
-			list-options non-printable-format= page-label-format= \
-			printer-options= ul-angle= ul-font= ul-gray= \
-			ul-position= ul-style= \
-		     )/'
-    endif
+if (! $?traditional_complete) then
+    uncomplete vi
+    uncomplete vim
+    complete {vi,vim,gvim,nvi,elvis} 	n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
+    complete {ispell,spell,spellword}	'n at -d@`ls /usr/lib/ispell/*.aff | sed -e "s/\.aff//" `@' 'n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/'
+    complete elm	'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
+    complete ncftp	'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
+    complete bibtex	'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
+    complete dvi2tty	n/*/f:*.dvi/	# Only files that match *.dvi
+    uncomplete gv
+    uncomplete ghostview
+    complete {gv,ghostview}	'n/*/f:*.{ps,eps,epsi}/'
+    complete enscript \
+	    'c/--/(columns= pages= header= no-header truncate-lines \
+		    line-numbers setpagedevice= escapes font= \
+		    header-font= fancy-header no-job-header \
+		    highlight-bars indent= filter= borders page-prefeed \
+		    no-page-prefeed lineprinter lines-per-page= mail \
+		    media= copies= newline= output= missing-characters \
+		    printer= quiet silent landscape portrait \
+		    baselineskip= statusdict= title= tabsize= underlay= \
+		    verbose version encoding pass-through download-font= \
+		    filter-stdin= help highlight-bar-gray= list-media \
+		    list-options non-printable-format= page-label-format= \
+		    printer-options= ul-angle= ul-font= ul-gray= \
+		    ul-position= ul-style= \
+		 )/'
+endif
 
-    complete dpkg \
-		'c/--{admindir,instdir,root}=/d/' \
-		'c/--debug=/n/' \
-		'c/--{admindir,debug,instdir,root}/(=)//' \
-		'c/--/(admindir= debug= instdir= root= \
-			assert-support-predepends assert-working-epoch \
-			audit auto-deconfigure clear-avail \
-			compare-versions configure contents control \
-			extract force-bad-path field \
-			force-configure-any force-conflicts \
-			force-depends force-depends-version force-help \
-			force-hold force-non-root \
-			force-overwrite-diverted \
-			force-remove-essential force-remove-reinstreq \
-			forget-old-unavail fsys-tarfile get-selections \
-			help ignore-depends info install largemem \
-			license list listfiles merge-avail no-act \
-			pending predep-package print-architecture \
-			print-gnu-build-architecture \
-			print-installation-architecture print-avail \
-			purge record-avail recursive refuse-downgrade \
-			remove search set-selections selected-only \
-			skip-same-version smallmem status unpack \
-			update-avail version vextract \
-		      )//' \
-		'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
-		'n/*/f:*.deb'/
-    complete dpkg-deb 	   'c/--{build}=/d/' \
-			   'c/--/(build contents info field control extract \
-				 vextract fsys-tarfile help version \
-				 license)//' \
-			   'n/*/f:*.deb/'
-    complete apt-get \
-	        'c/--/(build config-file diff-only download-only \
-		   fix-broken fix-missing force-yes help ignore-hold no-download \
-		   no-upgrade option print-uris purge reinstall quiet simulate \
-		   show-upgraded target-release tar-only version yes )/' \
-	    	'c/-/(b c= d f h m o= q qq s t x y )/' \
- 		'n/{source,build-dep}/x:<pkgname>/' \
- 		'n/{remove}/`dpkg -l|grep ^ii|awk \{print\ \$2\}`/' \
- 		'n/{install}/`apt-cache pkgnames | sort`/' \
- 		'C/*/(update upgrade dselect-upgrade source \
-		   build-dep check clean autoclean install remove)/'
-    complete apt-cache \
- 		'c/--/(all-versions config-file generate full help important \
- 		names-only option pkg-cache quiet recurse src-cache version )/' \
- 	    	'c/-/(c= h i o= p= q s= v)/' \
-  		'n/{search}/x:<regex>/' \
- 		'n/{pkgnames,policy,show,showpkg,depends,dotty}/`apt-cache pkgnames | sort`/' \
- 		'C/*/(add gencaches showpkg stats dump dumpavail unmet show \
- 		search depends pkgnames dotty policy )/'
+complete dpkg \
+	    'c/--{admindir,instdir,root}=/d/' \
+	    'c/--debug=/n/' \
+	    'c/--{admindir,debug,instdir,root}/(=)//' \
+	    'c/--/(admindir= debug= instdir= root= \
+		    assert-support-predepends assert-working-epoch \
+		    audit auto-deconfigure clear-avail \
+		    compare-versions configure contents control \
+		    extract force-bad-path field \
+		    force-configure-any force-conflicts \
+		    force-depends force-depends-version force-help \
+		    force-hold force-non-root \
+		    force-overwrite-diverted \
+		    force-remove-essential force-remove-reinstreq \
+		    forget-old-unavail fsys-tarfile get-selections \
+		    help ignore-depends info install largemem \
+		    license list listfiles merge-avail no-act \
+		    pending predep-package print-architecture \
+		    print-gnu-build-architecture \
+		    print-installation-architecture print-avail \
+		    purge record-avail recursive refuse-downgrade \
+		    remove search set-selections selected-only \
+		    skip-same-version smallmem status unpack \
+		    update-avail version vextract \
+		  )//' \
+	    'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
+	    'n/*/f:*.deb'/
+complete dpkg-deb 	   'c/--{build}=/d/' \
+		       'c/--/(build contents info field control extract \
+			     vextract fsys-tarfile help version \
+			     license)//' \
+		       'n/*/f:*.deb/'
+complete apt-get \
+	    'c/--/(build config-file diff-only download-only \
+	       fix-broken fix-missing force-yes help ignore-hold no-download \
+	       no-upgrade option print-uris purge reinstall quiet simulate \
+	       show-upgraded target-release tar-only version yes )/' \
+	    'c/-/(b c= d f h m o= q qq s t x y )/' \
+	    'n/{source,build-dep}/x:<pkgname>/' \
+	    'n/{remove}/`dpkg -l|grep ^ii|awk \{print\ \$2\}`/' \
+	    'n/{install}/`apt-cache pkgnames | sort`/' \
+	    'C/*/(update upgrade dselect-upgrade source \
+	       build-dep check clean autoclean install remove)/'
+complete apt-cache \
+	    'c/--/(all-versions config-file generate full help important \
+	    names-only option pkg-cache quiet recurse src-cache version )/' \
+	    'c/-/(c= h i o= p= q s= v)/' \
+	    'n/{search}/x:<regex>/' \
+	    'n/{pkgnames,policy,show,showpkg,depends,dotty}/`apt-cache pkgnames | sort`/' \
+	    'C/*/(add gencaches showpkg stats dump dumpavail unmet show \
+	    search depends pkgnames dotty policy )/'
 
-    unset noglob
-    unset _complete
-    unset traditional_complete
-endif
+switch ( "${OSTYPE}" )
+case FreeBSD:
+  set commands=()
+  foreach p (fast force one quiet "")
+    foreach c (enabled poll rcvar reload restart start status stop)
+      set commands=($commands $p$c)
+    end
+  end
+  complete service \
+    n/-R/n/ \
+    n/-e/n/ \
+    n/-l/n/ \
+    n/-r/n/ \
+    c/-/"(R e l r v)"/ \
+    p/2/"($commands)"/ \
+    p at 1@'`service -l`'@
+  unset commands c p
+  breaksw
+case linux:
+  if ( -d /etc/init.d ) then
+    set rcdir=/etc/init.d/
+  else
+    set rcdir=/etc/rc.d/
+  endif
+  complete service \
+    p/2/"(--full-restart force-reload reload restart start stop status)"/ \
+    c/--/"(help status-all version)"/ \
+    c/-/"(- h)"/ \
+    p at 1@F:$rcdir@
+  unset rcdir
+  breaksw
+endsw
 
+if ( $?_unset_noglob ) unset noglob _unset_noglob
+
 end:
-	onintr
+unset _has_complete
+onintr

Modified: vendor/tcsh/dist/config/bsd4.4
===================================================================
--- vendor/tcsh/dist/config/bsd4.4	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/config/bsd4.4	2018-06-27 00:42:17 UTC (rev 11147)
@@ -98,6 +98,7 @@
 
 #elif defined(__APPLE__)
 # define SYSMALLOC
+# define BSD_STYLE_COLORLS
 #endif
 
 #endif /* _h_config */

Modified: vendor/tcsh/dist/config.guess
===================================================================
--- vendor/tcsh/dist/config.guess	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/config.guess	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,14 +1,12 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2009-12-30'
+timestamp='2015-03-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
@@ -17,27 +15,23 @@
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches at gnu.org> and include a ChangeLog
-# entry.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 #
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches to <config-patches at gnu.org>.
 
+
 me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
@@ -56,9 +50,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -140,12 +132,33 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	LIBC=gnu
+
+	eval $set_cc_for_build
+	cat <<-EOF > $dummy.c
+	#include <features.h>
+	#if defined(__UCLIBC__)
+	LIBC=uclibc
+	#elif defined(__dietlibc__)
+	LIBC=dietlibc
+	#else
+	LIBC=gnu
+	#endif
+	EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	;;
+esac
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -155,8 +168,10 @@
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
@@ -163,12 +178,17 @@
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently, or will in the future.
 	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+	    arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
@@ -181,9 +201,16 @@
 		fi
 		;;
 	    *)
-	        os=netbsd
+		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -200,8 +227,12 @@
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
+    *:Bitrig:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+	exit ;;
     *:OpenBSD:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
 	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -224,7 +255,7 @@
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -270,7 +301,10 @@
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
     Alpha\ *:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# Should we change UNAME_MACHINE based on the output of uname instead
@@ -296,12 +330,12 @@
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
+	echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
 	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
 	echo arm-unknown-riscos
 	exit ;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -395,23 +429,23 @@
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
+	exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
+	echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -481,8 +515,8 @@
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
 	then
 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -495,7 +529,7 @@
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
- 	exit ;;
+	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -552,7 +586,7 @@
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[456])
+    *:AIX:*:[4567])
 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
@@ -559,8 +593,9 @@
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -595,52 +630,52 @@
 	    9000/[678][0-9][0-9])
 		if [ -x /usr/bin/getconf ]; then
 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+			esac ;;
+		    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
+		    sed 's/^		//' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
 EOF
 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -731,22 +766,22 @@
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-        exit ;;
+	exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-        exit ;;
+	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-        exit ;;
+	exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-        exit ;;
+	exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-        exit ;;
+	exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -770,14 +805,14 @@
 	exit ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
     5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
 	exit ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -789,30 +824,35 @@
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case ${UNAME_PROCESSOR} in
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
 	exit ;;
+    *:MINGW64*:*)
+	echo ${UNAME_MACHINE}-pc-mingw64
+	exit ;;
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
+    *:MSYS*:*)
+	echo ${UNAME_MACHINE}-pc-msys
+	exit ;;
     i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
 	exit ;;
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
     *:Interix*:*)
-    	case ${UNAME_MACHINE} in
+	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
@@ -849,15 +889,22 @@
 	exit ;;
     *:GNU:*:*)
 	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit ;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 	exit ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    aarch64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
+    aarch64_be:Linux:*:*)
+	UNAME_MACHINE=aarch64_be
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
@@ -867,52 +914,59 @@
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
+	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    arc:Linux:*:* | arceb:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	else
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+		| grep -q __ARM_PCS_VFP
+	    then
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+	    else
+		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+	    fi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     cris:Linux:*:*)
-	echo cris-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
     crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
+	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    hexagon:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     i*86:Linux:*:*)
-	LIBC=gnu
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -931,51 +985,63 @@
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
+    openrisc*:Linux:*:*)
+	echo or1k-unknown-linux-${LIBC}
 	exit ;;
+    or32:Linux:*:* | or1k*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-gnu
+	echo sparc-unknown-linux-${LIBC}
 	exit ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit ;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
 	exit ;;
+    ppc64le:Linux:*:*)
+	echo powerpc64le-unknown-linux-${LIBC}
+	exit ;;
+    ppcle:Linux:*:*)
+	echo powerpcle-unknown-linux-${LIBC}
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
+	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 	exit ;;
     sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
+	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -984,11 +1050,11 @@
 	echo i386-sequent-sysv4
 	exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+	# Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1020,7 +1086,7 @@
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1048,13 +1114,13 @@
 	exit ;;
     pc:*:*:*)
 	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configury will decide that
 	# this is a cross-build.
 	echo i586-pc-msdosdjgpp
-        exit ;;
+	exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1089,8 +1155,8 @@
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
 	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
@@ -1133,10 +1199,10 @@
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel at ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel at ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1162,11 +1228,11 @@
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
+		echo mips-nec-sysv${UNAME_RELEASE}
 	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
+		echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-        exit ;;
+	exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1179,6 +1245,9 @@
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
 	echo i586-pc-haiku
 	exit ;;
+    x86_64:Haiku:*:*)
+	echo x86_64-unknown-haiku
+	exit ;;
     SX-4:SUPER-UX:*:*)
 	echo sx4-nec-superux${UNAME_RELEASE}
 	exit ;;
@@ -1205,19 +1274,31 @@
 	exit ;;
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    i386)
-		eval $set_cc_for_build
-		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-		      grep IS_64BIT_ARCH >/dev/null
-		  then
-		      UNAME_PROCESSOR="x86_64"
-		  fi
-		fi ;;
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
+	eval $set_cc_for_build
+	if test "$UNAME_PROCESSOR" = unknown ; then
+	    UNAME_PROCESSOR=powerpc
+	fi
+	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		    grep IS_64BIT_ARCH >/dev/null
+		then
+		    case $UNAME_PROCESSOR in
+			i386) UNAME_PROCESSOR=x86_64 ;;
+			powerpc) UNAME_PROCESSOR=powerpc64 ;;
+		    esac
+		fi
+	    fi
+	elif test "$UNAME_PROCESSOR" = i386 ; then
+	    # Avoid executing cc on OS X 10.9, as it ships with a stub
+	    # that puts up a graphical alert prompting to install
+	    # developer tools.  Any system running Mac OS X 10.7 or
+	    # later (Darwin 11 and later) is required to have a 64-bit
+	    # processor. This is not true of the ARM version of Darwin
+	    # that Apple uses in portable devices.
+	    UNAME_PROCESSOR=x86_64
+	fi
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
 	exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1231,7 +1312,10 @@
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-*:NONSTOP_KERNEL:*:*)
 	echo nse-tandem-nsk${UNAME_RELEASE}
 	exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
@@ -1276,13 +1360,13 @@
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
+	echo mips-sei-seiux${UNAME_RELEASE}
 	exit ;;
     *:DragonFly:*:*)
 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
 	exit ;;
     *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1300,159 +1384,11 @@
     i*86:AROS:*:*)
 	echo ${UNAME_MACHINE}-pc-aros
 	exit ;;
+    x86_64:VMkernel:*:*)
+	echo ${UNAME_MACHINE}-unknown-esx
+	exit ;;
 esac
 
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
 cat >&2 <<EOF
 $0: unable to guess system type
 


Property changes on: vendor/tcsh/dist/config.guess
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Modified: vendor/tcsh/dist/config.h.in
===================================================================
--- vendor/tcsh/dist/config.h.in	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/config.h.in	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* Define to the type of elements in the array set by `getgroups'. Usually
    this is either `int' or `gid_t'. */
@@ -69,6 +69,9 @@
 /* Define to 1 if you have the `mallinfo' function. */
 #undef HAVE_MALLINFO
 
+/* Define to 1 if you have the `mblen' function. */
+#undef HAVE_MBLEN
+
 /* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 #undef HAVE_MBRTOWC
 

Modified: vendor/tcsh/dist/config.sub
===================================================================
--- vendor/tcsh/dist/config.sub	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/config.sub	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,38 +1,31 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-#   Free Software Foundation, Inc.
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
-timestamp='2009-12-31'
+timestamp='2013-04-24'
 
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
+# the same distribution terms that you use for the rest of that
+# program.  This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches at gnu.org.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -75,9 +68,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,13 +115,18 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
+  android-linux)
+    os=-linux-android
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+    ;;
   *)
     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
     if [ $basic_machine != $1 ]
@@ -153,12 +149,12 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray | -microblaze)
+	-apple | -axis | -knuth | -cray | -microblaze*)
 		os=
 		basic_machine=$1
 		;;
-        -bluegene*)
-	        os=-cnk
+	-bluegene*)
+		os=-cnk
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
@@ -174,10 +170,10 @@
 		os=-chorusos
 		basic_machine=$1
 		;;
- 	-chorusrdb)
- 		os=-chorusrdb
+	-chorusrdb)
+		os=-chorusrdb
 		basic_machine=$1
- 		;;
+		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -222,6 +218,12 @@
 	-isc*)
 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
 		;;
+	-lynx*178)
+		os=-lynxos178
+		;;
+	-lynx*5)
+		os=-lynxos5
+		;;
 	-lynx*)
 		os=-lynxos
 		;;
@@ -246,20 +248,27 @@
 	# Some are omitted here because they have special meanings below.
 	1750a | 580 \
 	| a29k \
+	| aarch64 | aarch64_be \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| arc | arceb \
+	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+	| avr | avr32 \
+	| be32 | be64 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
+	| epiphany \
 	| fido | fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| hexagon \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
+	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep | metag \
+	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -277,34 +286,45 @@
 	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipsr5900 | mipsr5900el \
 	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| moxie \
 	| mt \
 	| msp430 \
-	| nios | nios2 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 | nios2eb | nios2el \
 	| ns16k | ns32k \
-	| or32 \
+	| open8 \
+	| or1k | or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
 	| pyramid \
-	| rx \
+	| rl78 | rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e \
+	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
 	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-		# Motorola 68HC11/12.
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -314,6 +334,21 @@
 		basic_machine=mt-unknown
 		;;
 
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+	xgate)
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -328,13 +363,15 @@
 	# Recognize the basic CPU types with company name.
 	580-* \
 	| a29k-* \
+	| aarch64-* | aarch64_be-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
@@ -341,12 +378,15 @@
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| hexagon-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
+	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| microblaze-* | microblazeel-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -364,29 +404,34 @@
 	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipsr5900-* | mipsr5900el-* \
 	| mipstx39-* | mipstx39el-* \
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
-	| nios-* | nios2-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* | nios2eb-* | nios2el-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
-	| romp-* | rs6000-* | rx-* \
+	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile*-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | vax-* \
+	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+	| vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -411,7 +456,7 @@
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-    	abacus)
+	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -481,11 +526,20 @@
 		basic_machine=powerpc-ibm
 		os=-cnk
 		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
 		;;
-        cegcc)
+	cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -517,7 +571,7 @@
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16)
+	cr16 | cr16-*)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -675,7 +729,6 @@
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -733,9 +786,13 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-        microblaze)
+	microblaze*)
 		basic_machine=microblaze-xilinx
 		;;
+	mingw64)
+		basic_machine=x86_64-pc
+		os=-mingw64
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -772,10 +829,18 @@
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
+	msys)
+		basic_machine=i386-pc
+		os=-msys
+		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
+	nacl)
+		basic_machine=le32-unknown
+		os=-nacl
+		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -840,6 +905,12 @@
 	np1)
 		basic_machine=np1-gould
 		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -922,9 +993,10 @@
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc)	basic_machine=powerpc-unknown
+	ppc | ppcbe)	basic_machine=powerpc-unknown
 		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -949,7 +1021,11 @@
 		basic_machine=i586-unknown
 		os=-pw32
 		;;
-	rdos)
+	rdos | rdos64)
+		basic_machine=x86_64-pc
+		os=-rdos
+		;;
+	rdos32)
 		basic_machine=i386-pc
 		os=-rdos
 		;;
@@ -1018,6 +1094,9 @@
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1074,20 +1153,8 @@
 		basic_machine=t90-cray
 		os=-unicos
 		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
 	tile*)
-		basic_machine=tile-unknown
+		basic_machine=$basic_machine-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1157,6 +1224,9 @@
 	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
 	ymp)
 		basic_machine=ymp-cray
 		os=-unicos
@@ -1254,11 +1324,11 @@
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+	# First match some system type aliases
+	# that might get confused with valid system types.
 	# -solaris* is a basic system type, with this one exception.
-        -auroraux)
-	        os=-auroraux
+	-auroraux)
+		os=-auroraux
 		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1282,20 +1352,21 @@
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-	      | -sym* | -kopensolaris* \
+	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
 	      | -aos* | -aros* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
+	      | -bitrig* | -openbsd* | -solidbsd* \
 	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
 	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1342,7 +1413,7 @@
 	-opened*)
 		os=-openedition
 		;;
-        -os400*)
+	-os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1391,7 +1462,7 @@
 	-sinix*)
 		os=-sysv4
 		;;
-        -tpf*)
+	-tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1427,9 +1498,6 @@
 	-aros*)
 		os=-aros
 		;;
-	-kaos*)
-		os=-kaos
-		;;
 	-zvmoe)
 		os=-zvmoe
 		;;
@@ -1436,8 +1504,8 @@
 	-dicos*)
 		os=-dicos
 		;;
-        -nacl*)
-	        ;;
+	-nacl*)
+		;;
 	-none)
 		;;
 	*)
@@ -1460,10 +1528,10 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
-        score-*)
+	score-*)
 		os=-elf
 		;;
-        spu-*)
+	spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1475,9 +1543,21 @@
 	arm*-semi)
 		os=-aout
 		;;
-        c4x-* | tic4x-*)
-        	os=-coff
+	c4x-* | tic4x-*)
+		os=-coff
 		;;
+	hexagon-*)
+		os=-elf
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
@@ -1496,14 +1576,11 @@
 		;;
 	m68000-sun)
 		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-        mep-*)
+	mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1512,6 +1589,9 @@
 	mips*-*)
 		os=-elf
 		;;
+	or1k-*)
+		os=-elf
+		;;
 	or32-*)
 		os=-coff
 		;;
@@ -1530,7 +1610,7 @@
 	*-ibm)
 		os=-aix
 		;;
-    	*-knuth)
+	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)


Property changes on: vendor/tcsh/dist/config.sub
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Modified: vendor/tcsh/dist/config_f.h
===================================================================
--- vendor/tcsh/dist/config_f.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/config_f.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/config_f.h,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/config_f.h,v 3.52 2016/04/16 15:44:18 christos Exp $ */
 /*
  * config_f.h -- configure various defines for tcsh
  *
@@ -38,6 +38,10 @@
 #ifndef _h_config_f
 #define _h_config_f
 
+#ifdef HAVE_FEATURES_H
+#include <features.h>		/* for __GLIBC__ */
+#endif
+
 /*
  * SHORT_STRINGS Use at least 16 bit characters instead of 8 bit chars
  * 	         This fixes up quoting problems and eases implementation
@@ -50,7 +54,7 @@
  * WIDE_STRINGS	Represent strings using wide characters
  *		Allows proper function in multibyte encodings like UTF-8
  */
-#if defined (SHORT_STRINGS) && defined (NLS) && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX)
+#if defined (SHORT_STRINGS) && defined (NLS) && !defined (WINNT_NATIVE) && !defined(_OSD_POSIX) && SIZEOF_WCHAR_T > 1
 # define WIDE_STRINGS
 # if SIZEOF_WCHAR_T < 4
 #  define UTF16_STRINGS
@@ -135,7 +139,7 @@
  *		This can be much slower and no memory statistics will be
  *		provided.
  */
-#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__)
+#if defined(__MACHTEN__) || defined(PURIFY) || defined(MALLOC_TRACE) || defined(_OSD_POSIX) || defined(__MVS__) || defined (__CYGWIN__) || defined(__GLIBC__) || defined(__OpenBSD__) || defined(__APPLE__) || defined (__ANDROID__)
 # define SYSMALLOC
 #else
 # undef SYSMALLOC

Modified: vendor/tcsh/dist/configure
===================================================================
--- vendor/tcsh/dist/configure	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/configure	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,13 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for tcsh 6.18.01.
+# Generated by GNU Autoconf 2.69 for tcsh 6.20.00.
 #
 # Report bugs to <http://bugs.gw.com/>.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -136,6 +134,31 @@
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -169,7 +192,8 @@
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -214,21 +238,25 @@
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -331,6 +359,14 @@
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -452,6 +488,10 @@
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -486,16 +526,16 @@
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -507,28 +547,8 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -560,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='tcsh'
 PACKAGE_TARNAME='tcsh'
-PACKAGE_VERSION='6.18.01'
-PACKAGE_STRING='tcsh 6.18.01'
+PACKAGE_VERSION='6.20.00'
+PACKAGE_STRING='tcsh 6.20.00'
 PACKAGE_BUGREPORT='http://bugs.gw.com/'
 PACKAGE_URL=''
 
@@ -1145,8 +1165,6 @@
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1232,7 +1250,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures tcsh 6.18.01 to adapt to many kinds of systems.
+\`configure' configures tcsh 6.20.00 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1297,7 +1315,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of tcsh 6.18.01:";;
+     short | recursive ) echo "Configuration of tcsh 6.20.00:";;
    esac
   cat <<\_ACEOF
 
@@ -1312,7 +1330,7 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-gnu-ld           assume the C compiler uses GNU ld default=no
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
   --with-hesiod=PREFIX    Use Hesiod lookup for ~ expansion
@@ -1393,10 +1411,10 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-tcsh configure 6.18.01
-generated by GNU Autoconf 2.68
+tcsh configure 6.20.00
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1509,7 +1527,7 @@
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1709,7 +1727,8 @@
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1725,7 +1744,8 @@
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1751,7 +1771,8 @@
 main ()
 {
 static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1767,7 +1788,8 @@
 main ()
 {
 static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1801,7 +1823,8 @@
 main ()
 {
 static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -1948,7 +1971,8 @@
 main ()
 {
 static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
-test_array [0] = 0
+test_array [0] = 0;
+return test_array [0];
 
   ;
   return 0;
@@ -2150,8 +2174,8 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tcsh $as_me 6.18.01, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by tcsh $as_me 6.20.00, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2571,7 +2595,7 @@
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2781,6 +2805,11 @@
     tcsh_config_file=sysV88
   ;;
 
+  ## Minix systems
+  *-*-minix*)
+    tcsh_config_file=minix
+  ;;
+
   ## NetBSD systems
   *-*-netbsd*)
     tcsh_config_file=bsd4.4
@@ -2801,6 +2830,11 @@
     tcsh_config_file=bsd4.4
   ;;
 
+  ## MirBSD systems
+  *-*-mirbsd*)
+    tcsh_config_file=bsd4.4
+  ;;
+
   ## OpenBSD systems
   *-*-openbsd*)
     tcsh_config_file=bsd4.4
@@ -2975,7 +3009,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3015,7 +3049,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3068,7 +3102,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3109,7 +3143,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -3167,7 +3201,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3211,7 +3245,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3657,8 +3691,7 @@
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3898,7 +3931,7 @@
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -3964,7 +3997,7 @@
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4073,7 +4106,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_path_GENCAT="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4108,6 +4141,13 @@
   CFLAGS="$CFLAGS $NON_GNU_CFLAGS"
 fi
 
+case "${host}" in
+  *-*-android*)
+    CFLAGS="${CFLAGS} -fPIE"
+    LDFLAGS="${LDFLAGS} -pie"
+    ;;
+esac
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5
 $as_echo_n "checking for library containing crypt... " >&6; }
 if ${ac_cv_search_crypt+:} false; then :
@@ -4274,6 +4314,10 @@
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+else
+
+   as_fn_error $? "unable to find the tgetent() function" "$LINENO" 5
+
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5
@@ -4461,6 +4505,7 @@
   prefix="$acl_save_prefix"
 
 
+
 # Check whether --with-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then :
   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
@@ -4471,21 +4516,21 @@
 # Prepare PATH_SEPARATOR.
 # The user is always right.
 if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
 fi
+
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
-$as_echo_n "checking for ld used by GCC... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -4495,11 +4540,11 @@
   esac
   case $ac_prog in
     # Accept absolute paths.
-    [\\/]* | [A-Za-z]:[\\/]*)
+    [\\/]* | ?:[\\/]*)
       re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the path of ld
-      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+      # Canonicalize the pathname of ld
+      ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'`
+      while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do
         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
@@ -4524,23 +4569,26 @@
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
+    IFS="$acl_save_ifs"
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
       acl_cv_path_LD="$ac_dir/$ac_prog"
       # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some GNU ld's only accept -v.
+      # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-        test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break
+        ;;
       *)
-        test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break
+        ;;
       esac
     fi
   done
-  IFS="$ac_save_ifs"
+  IFS="$acl_save_ifs"
 else
   acl_cv_path_LD="$LD" # Let the user override the test with a path.
 fi
@@ -4560,12 +4608,14 @@
 if ${acl_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
 *GNU* | *'with BFD'*)
-  acl_cv_prog_gnu_ld=yes ;;
+  acl_cv_prog_gnu_ld=yes
+  ;;
 *)
-  acl_cv_prog_gnu_ld=no ;;
+  acl_cv_prog_gnu_ld=no
+  ;;
 esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld" >&5
@@ -4748,7 +4798,7 @@
       done
       if test -z "$already_handled"; then
         names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
         eval value=\"\$HAVE_LIB$uppername\"
         if test -n "$value"; then
           if test "$value" = yes; then
@@ -5176,14 +5226,16 @@
     am_cv_lib_iconv=no
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
 #include <stdlib.h>
 #include <iconv.h>
+
 int
 main ()
 {
 iconv_t cd = iconv_open("","");
-       iconv(cd,NULL,NULL,NULL,NULL);
-       iconv_close(cd);
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);
   ;
   return 0;
 }
@@ -5198,14 +5250,16 @@
       LIBS="$LIBS $LIBICONV"
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
 #include <stdlib.h>
 #include <iconv.h>
+
 int
 main ()
 {
 iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);
   ;
   return 0;
 }
@@ -5229,15 +5283,17 @@
   $as_echo_n "(cached) " >&6
 else
 
-            am_save_LIBS="$LIBS"
+                  am_save_LIBS="$LIBS"
       if test $am_cv_lib_iconv = yes; then
         LIBS="$LIBS $LIBICONV"
       fi
-      if test "$cross_compiling" = yes; then :
+      am_cv_func_iconv_works=no
+      for ac_iconv_const in '' 'const'; do
+        if test "$cross_compiling" = yes; then :
   case "$host_os" in
-           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
-           *)            am_cv_func_iconv_works="guessing yes" ;;
-         esac
+             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+             *)            am_cv_func_iconv_works="guessing yes" ;;
+           esac
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -5244,8 +5300,15 @@
 
 #include <iconv.h>
 #include <string.h>
-int main ()
+
+#ifndef ICONV_CONST
+# define ICONV_CONST $ac_iconv_const
+#endif
+
+int
+main ()
 {
+int result = 0;
   /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
      returns.  */
   {
@@ -5252,17 +5315,18 @@
     iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
     if (cd_utf8_to_88591 != (iconv_t)(-1))
       {
-        static const char input[] = "\342\202\254"; /* EURO SIGN */
+        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
         char buf[10];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_utf8_to_88591,
-                            (char **) &inptr, &inbytesleft,
+                            &inptr, &inbytesleft,
                             &outptr, &outbytesleft);
         if (res == 0)
-          return 1;
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
       }
   }
   /* Test against Solaris 10 bug: Failures are not distinguishable from
@@ -5271,19 +5335,39 @@
     iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
     if (cd_ascii_to_88591 != (iconv_t)(-1))
       {
-        static const char input[] = "\263";
+        static ICONV_CONST char input[] = "\263";
         char buf[10];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_ascii_to_88591,
-                            (char **) &inptr, &inbytesleft,
+                            &inptr, &inbytesleft,
                             &outptr, &outbytesleft);
         if (res == 0)
-          return 1;
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
       }
   }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
 #if 0 /* This bug could be worked around by the caller.  */
   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
   {
@@ -5290,17 +5374,18 @@
     iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
     if (cd_88591_to_utf8 != (iconv_t)(-1))
       {
-        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
         char buf[50];
-        const char *inptr = input;
+        ICONV_CONST char *inptr = input;
         size_t inbytesleft = strlen (input);
         char *outptr = buf;
         size_t outbytesleft = sizeof (buf);
         size_t res = iconv (cd_88591_to_utf8,
-                            (char **) &inptr, &inbytesleft,
+                            &inptr, &inbytesleft,
                             &outptr, &outbytesleft);
         if ((int)res > 0)
-          return 1;
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
       }
   }
 #endif
@@ -5314,19 +5399,22 @@
       && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
       /* Try HP-UX names.  */
       && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
-    return 1;
+    result |= 16;
+  return result;
+
+  ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_run "$LINENO"; then :
   am_cv_func_iconv_works=yes
-else
-  am_cv_func_iconv_works=no
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+        test "$am_cv_func_iconv_works" = no || break
+      done
       LIBS="$am_save_LIBS"
 
 fi
@@ -5373,7 +5461,7 @@
 #ifdef __cplusplus
 "C"
 #endif
-#if defined(__STDC__) || defined(__cplusplus)
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
 #else
 size_t iconv();
@@ -5406,6 +5494,7 @@
 #define ICONV_CONST $am_cv_proto_iconv_arg1
 _ACEOF
 
+
   fi
 
 
@@ -6303,11 +6392,11 @@
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -6324,8 +6413,9 @@
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -6341,10 +6431,10 @@
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -6486,7 +6576,7 @@
   have_catgets=no
 fi
 
-for ac_func in dup2 getauthid getcwd gethostname getpwent 	getutent getutxent mallinfo memmove memset mkstemp nice 	nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
+for ac_func in dup2 getauthid getcwd gethostname getpwent 	getutent getutxent mallinfo mblen memmove memset mkstemp nice 	nl_langinfo sbrk setpgid setpriority strerror strstr sysconf wcwidth
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -7161,16 +7251,16 @@
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -7230,29 +7320,17 @@
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
 
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
@@ -7272,8 +7350,8 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by tcsh $as_me 6.18.01, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by tcsh $as_me 6.20.00, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -7338,11 +7416,11 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-tcsh config.status 6.18.01
-configured by $0, generated by GNU Autoconf 2.68,
+tcsh config.status 6.20.00
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -7431,7 +7509,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -8027,7 +8105,7 @@
     "./atconfig":C) cat >./atconfig <<ATEOF
 # Configurable variable values for building test suites.
 # Generated by $0.
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2012 Free Software Foundation, Inc.
 
 # The test suite will define top_srcdir=$at_top_srcdir/../.. etc.
 at_testdir='.'


Property changes on: vendor/tcsh/dist/configure
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: vendor/tcsh/dist/cygwin/postinstall.sh
===================================================================
--- vendor/tcsh/dist/cygwin/postinstall.sh	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/cygwin/postinstall.sh	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/cygwin/postinstall.sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: vendor/tcsh/dist/cygwin/preremove.sh
===================================================================
--- vendor/tcsh/dist/cygwin/preremove.sh	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/cygwin/preremove.sh	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/cygwin/preremove.sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Added: vendor/tcsh/dist/dotlock.c
===================================================================
--- vendor/tcsh/dist/dotlock.c	                        (rev 0)
+++ vendor/tcsh/dist/dotlock.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,180 @@
+/*	$NetBSD: dotlock.c,v 1.11 2009/10/21 01:07:46 snj Exp $	*/
+
+/*
+ * Copyright (c) 1996 Christos Zoulas.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "sh.h"
+RCSID("$tcsh: dotlock.c,v 3.4 2015/11/03 21:04:13 christos Exp $")
+
+#include <stdio.h>
+#ifndef O_SYNC
+#define O_SYNC	0
+#endif
+
+#include "dotlock.h"
+
+static int create_exclusive(const char *);
+/*
+ * Create a unique file. O_EXCL does not really work over NFS so we follow
+ * the following trick: [Inspired by  S.R. van den Berg]
+ *
+ * - make a mostly unique filename and try to create it.
+ * - link the unique filename to our target
+ * - get the link count of the target
+ * - unlink the mostly unique filename
+ * - if the link count was 2, then we are ok; else we've failed.
+ */
+static int
+create_exclusive(const char *fname)
+{
+	char path[MAXPATHLEN], hostname[MAXHOSTNAMELEN + 1];
+	const char *ptr;
+	struct timeval tv;
+	pid_t pid;
+	size_t ntries, cookie;
+	int fd, serrno;
+	struct stat st;
+
+	(void)gettimeofday(&tv, NULL);
+	(void)gethostname(hostname, sizeof(hostname));
+	hostname[sizeof(hostname) - 1] = '\0';
+	pid = getpid();
+
+	cookie = pid ^ tv.tv_usec;
+
+	/*
+	 * We generate a semi-unique filename, from hostname.(pid ^ usec)
+	 */
+	if ((ptr = strrchr(fname, '/')) == NULL)
+		ptr = fname;
+	else
+		ptr++;
+
+	(void)snprintf(path, sizeof(path), "%.*s.%s.%lx",
+	    (int)(ptr - fname), fname, hostname, (u_long)cookie);
+
+	/*
+	 * We try to create the unique filename.
+	 */
+	for (ntries = 0; ntries < 5; ntries++) {
+		fd = open(path, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL|O_SYNC, 0);
+		if (fd != -1) {
+			(void)close(fd);
+			break;
+		}
+		else if (errno == EEXIST)
+			continue;
+		else
+			return -1;
+	}
+
+	/*
+	 * We link the path to the name
+	 */
+	if (link(path, fname) == -1)
+		goto bad;
+
+	/*
+	 * Note that we stat our own exclusively created name, not the
+	 * destination, since the destination can be affected by others.
+	 */
+	if (stat(path, &st) == -1)
+		goto bad;
+
+	(void)unlink(path);
+
+	/*
+	 * If the number of links was two (one for the unique file and one
+	 * for the lock), we've won the race
+	 */
+	if (st.st_nlink != 2) {
+		errno = EEXIST;
+		return -1;
+	}
+	return 0;
+
+bad:
+	serrno = errno;
+	(void)unlink(path);
+	errno = serrno;
+	return -1;
+}
+
+/*
+ * fname -- Pathname to lock
+ * pollinterval -- Interval (miliseconds) to check for lock, -1 return
+ */
+int
+dot_lock(const char *fname, int pollinterval)
+{
+	char path[MAXPATHLEN];
+	sigset_t nset, oset;
+	int retval;
+
+	(void)sigemptyset(&nset);
+	(void)sigaddset(&nset, SIGHUP);
+	(void)sigaddset(&nset, SIGINT);
+	(void)sigaddset(&nset, SIGQUIT);
+	(void)sigaddset(&nset, SIGTERM);
+	(void)sigaddset(&nset, SIGTTIN);
+	(void)sigaddset(&nset, SIGTTOU);
+	(void)sigaddset(&nset, SIGTSTP);
+	(void)sigaddset(&nset, SIGCHLD);
+
+	(void)snprintf(path, sizeof(path), "%s.lock", fname);
+
+	retval = -1;
+	for (;;) {
+		handle_pending_signals();
+		(void)sigprocmask(SIG_BLOCK, &nset, &oset);
+		if (create_exclusive(path) != -1) {
+			(void)sigprocmask(SIG_SETMASK, &oset, NULL);
+			retval = 0;
+			break;
+		}
+		else
+			(void)sigprocmask(SIG_SETMASK, &oset, NULL);
+
+		if (errno != EEXIST)
+			break;
+
+		if (pollinterval) {
+			if (pollinterval == -1) {
+				errno = EEXIST;
+				break;
+			}
+			(void)usleep((unsigned int)pollinterval * 1000);
+		}
+	}
+	handle_pending_signals();
+	return retval;
+}
+
+void
+dot_unlock(const char *fname)
+{
+	char path[MAXPATHLEN];
+
+	(void)snprintf(path, sizeof(path), "%s.lock", fname);
+	(void)unlink(path);
+}

Added: vendor/tcsh/dist/dotlock.h
===================================================================
--- vendor/tcsh/dist/dotlock.h	                        (rev 0)
+++ vendor/tcsh/dist/dotlock.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 1996 Christos Zoulas.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DOTLOCK_H_
+#define _DOTLOCK_H_ 1
+
+/*
+ * fname -- Pathname to lock
+ * pollinterval -- Interval (miliseconds) to check for lock, -1 return
+ */
+int dot_lock(const char *fname, int pollinterval);
+void dot_unlock(const char *fname);
+
+#endif /* #ifndef _DOTLOCK_H_ */

Modified: vendor/tcsh/dist/ed.chared.c
===================================================================
--- vendor/tcsh/dist/ed.chared.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.chared.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.chared.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $ */
 /*
  * ed.chared.c: Character editing functions.
  */
@@ -72,7 +72,7 @@
 
 #include "sh.h"
 
-RCSID("$tcsh: ed.chared.c,v 3.98 2010/05/08 00:37:39 christos Exp $")
+RCSID("$tcsh: ed.chared.c,v 3.103 2015/08/19 14:29:55 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -93,7 +93,7 @@
  * from: Gert-Jan Vons <vons at cesar.crbca1.sinet.slb.com>
  */
 #define C_CLASS_WHITE	1
-#define C_CLASS_ALNUM	2
+#define C_CLASS_WORD	2
 #define C_CLASS_OTHER	3
 
 static Char *InsertPos = InputBuf; /* Where insertion starts */
@@ -290,7 +290,7 @@
 /*
  * c_to_class() returns the class of the given character.
  *
- * This is used to make the c_prev_word() and c_next_word() functions
+ * This is used to make the c_prev_word(), c_next_word() and c_eword() functions
  * work like vi's, which classify characters. A word is a sequence of
  * characters belonging to the same class, classes being defined as
  * follows:
@@ -305,8 +305,8 @@
     if (Isspace(ch))
         return C_CLASS_WHITE;
 
-    if (Isdigit(ch) || Isalpha(ch) || ch == '_')
-        return C_CLASS_ALNUM;
+    if (isword(ch))
+        return C_CLASS_WORD;
 
     return C_CLASS_OTHER;
 }
@@ -750,7 +750,7 @@
     /*
      * If we found a history character, go expand it.
      */
-    if (HIST != '\0' && *p == HIST)
+    if (p >= InputBuf && HIST != '\0' && *p == HIST)
 	nr_exp = c_excl(p);
     else
         nr_exp = 0;
@@ -828,15 +828,24 @@
     p++;
 
     while (n--) {
-	while ((p < high) && Isspace(*p)) 
-	    p++;
+        int  c_class;
 
-	if (isword(*p))
-	    while ((p < high) && isword(*p)) 
-		p++;
-	else
-	    while ((p < high) && !(Isspace(*p) || isword(*p)))
-		p++;
+        if (p >= high)
+            break;
+
+        /* scan until end of current word (may be all whitespace!) */
+        c_class = c_to_class(*p);
+        while ((p < high) && c_class == c_to_class(*p))
+            p++;
+
+        /* if this was a non_whitespace word, we're ready */
+        if (c_class != C_CLASS_WHITE)
+            continue;
+
+        /* otherwise, move to the end of the word just found */
+        c_class = c_to_class(*p);
+        while ((p < high) && c_class == c_to_class(*p))
+            p++;
     }
 
     p--;
@@ -941,7 +950,7 @@
 
 /* Save InputBuf etc in SavedBuf etc for restore after cmd exec */
 static void
-c_save_inputbuf()
+c_save_inputbuf(void)
 {
     SavedBuf.len = 0;
     Strbuf_append(&SavedBuf, InputBuf);
@@ -953,7 +962,7 @@
 }
 
 CCRETVAL
-GetHistLine()
+GetHistLine(void)
 {
     struct Hist *hp;
     int     h;
@@ -3025,7 +3034,7 @@
 
 /*ARGSUSED*/
 CCRETVAL
-e_capitolcase(Char c)
+e_capitalcase(Char c)
 {
     Char   *cp, *end;
 
@@ -3387,7 +3396,7 @@
          (void) Cookedmode();
 
      (void) xwrite(SHIN, "\n", 1);
-     len = one_wctomb(buf, c & CHAR);
+     len = one_wctomb(buf, c);
      for (i = 0; i < len; i++)
 	 (void) ioctl(SHIN, TIOCSTI, (ioctl_t) &buf[i]);
 

Modified: vendor/tcsh/dist/ed.decls.h
===================================================================
--- vendor/tcsh/dist/ed.decls.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.decls.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.decls.h,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.decls.h,v 3.46 2015/08/19 14:29:55 christos Exp $ */
 /*
  * ed.decls.h: Editor external definitions
  */
@@ -142,7 +142,7 @@
 extern	CCRETVAL	v_wordbegnext		(Char);
 extern	CCRETVAL	e_uppercase		(Char);
 extern	CCRETVAL	e_lowercase		(Char);
-extern	CCRETVAL	e_capitolcase		(Char);
+extern	CCRETVAL	e_capitalcase		(Char);
 extern	CCRETVAL	e_cleardisp		(Char);
 extern	CCRETVAL	e_complete		(Char);
 extern	CCRETVAL	e_correct		(Char);

Modified: vendor/tcsh/dist/ed.defns.c
===================================================================
--- vendor/tcsh/dist/ed.defns.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.defns.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.defns.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $ */
 /*
  * ed.defns.c: Editor function definitions and initialization
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.defns.c,v 3.46 2006/03/02 18:46:44 christos Exp $")
+RCSID("$tcsh: ed.defns.c,v 3.51 2016/02/14 15:44:18 christos Exp $")
 
 #include "ed.h"
 
@@ -151,7 +151,7 @@
 #define         F_CASEUPPER     54
     e_lowercase,
 #define         F_CASELOWER     55
-    e_capitolcase,
+    e_capitalcase,
 #define         F_CASECAPITAL   56
     v_zero,
 #define		V_ZERO		57
@@ -1801,27 +1801,27 @@
 void
 CheckMaps(void)
 {		/* check the size of the key maps */
-    int     c1 = (NT_NUM_KEYS * sizeof(KEYCMD));
+    size_t     c1 = NT_NUM_KEYS * sizeof(KEYCMD);
 
-    if ((sizeof(CcKeyMap)) != c1)
-	xprintf("CcKeyMap should be %d entries, but is %d.\r\n",
-		NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD)));
+    if (sizeof(CcKeyMap) != c1)
+	xprintf("CcKeyMap should be %u entries, but is %zu.\r\n",
+		NT_NUM_KEYS, sizeof(CcKeyMap) / sizeof(KEYCMD));
 
-    if ((sizeof(CcAltMap)) != c1)
-	xprintf("CcAltMap should be %d entries, but is %d.\r\n",
-		NT_NUM_KEYS, (sizeof(CcAltMap) / sizeof(KEYCMD)));
+    if (sizeof(CcAltMap) != c1)
+	xprintf("CcAltMap should be %u entries, but is %zu.\r\n",
+		NT_NUM_KEYS, sizeof(CcAltMap) / sizeof(KEYCMD));
 
-    if ((sizeof(CcEmacsMap)) != c1)
-	xprintf("CcEmacsMap should be %d entries, but is %d.\r\n",
-		NT_NUM_KEYS, (sizeof(CcEmacsMap) / sizeof(KEYCMD)));
+    if (sizeof(CcEmacsMap) != c1)
+	xprintf("CcEmacsMap should be %u entries, but is %zu.\r\n",
+		NT_NUM_KEYS, sizeof(CcEmacsMap) / sizeof(KEYCMD));
 
-    if ((sizeof(CcViMap)) != c1)
-	xprintf("CcViMap should be %d entries, but is %d.\r\n",
-		NT_NUM_KEYS, (sizeof(CcViMap) / sizeof(KEYCMD)));
+    if (sizeof(CcViMap) != c1)
+	xprintf("CcViMap should be %u entries, but is %zu.\r\n",
+		NT_NUM_KEYS, sizeof(CcViMap) / sizeof(KEYCMD));
 
-    if ((sizeof(CcViCmdMap)) != c1)
-	xprintf("CcViCmdMap should be %d entries, but is %d.\r\n",
-		NT_NUM_KEYS, (sizeof(CcViCmdMap) / sizeof(KEYCMD)));
+    if (sizeof(CcViCmdMap) != c1)
+	xprintf("CcViCmdMap should be %u entries, but is %zu.\r\n",
+		NT_NUM_KEYS, sizeof(CcViCmdMap) / sizeof(KEYCMD));
 }
 
 #endif
@@ -1889,6 +1889,9 @@
     int i;
 
     VImode = 1;
+    setNS(STRvimode);
+    update_wordchars();
+
     ResetXmap();
     for (i = 0; i < NT_NUM_KEYS; i++) {
 	CcKeyMap[i] = CcViMap[i];
@@ -1910,6 +1913,10 @@
     cstr.len = 2;
 
     VImode = 0;
+    if (adrof(STRvimode))
+	unsetv(STRvimode);
+    update_wordchars();
+
     ResetXmap();
     for (i = 0; i < NT_NUM_KEYS; i++) {
 	CcKeyMap[i] = CcEmacsMap[i];

Modified: vendor/tcsh/dist/ed.h
===================================================================
--- vendor/tcsh/dist/ed.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.h,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.h,v 3.50 2007/07/05 14:13:06 christos Exp $ */
 /*
  * ed.h: Editor declarations and globals
  */

Modified: vendor/tcsh/dist/ed.init.c
===================================================================
--- vendor/tcsh/dist/ed.init.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.init.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.init.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.init.c,v 3.60 2006/08/24 20:56:31 christos Exp $ */
 /*
  * ed.init.c: Editor initializations
  */

Modified: vendor/tcsh/dist/ed.inputl.c
===================================================================
--- vendor/tcsh/dist/ed.inputl.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.inputl.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.inputl.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.inputl.c,v 3.73 2012/10/19 15:23:32 christos Exp $ */
 /*
  * ed.inputl.c: Input line handling.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.inputl.c,v 3.71 2010/12/22 17:26:04 christos Exp $")
+RCSID("$tcsh: ed.inputl.c,v 3.73 2012/10/19 15:23:32 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"		/* for the function names */
@@ -683,7 +683,7 @@
 #ifdef DSPMBYTE
 	     _enable_mbdisp &&
 #else
-	     MB_CUR_MAX == 1 &&
+	     MB_LEN_MAX == 1 &&
 #endif
 	     !adrof(STRnokanji) && (*ch & META)) {
 	    MetaNext = 0;
@@ -800,17 +800,13 @@
 		return -1;
 	    }
 	}
-	if (AsciiOnly) {
-	    *cp = (unsigned char)*cbuf;
-	} else {
-	    cbp++;
-	    if (normal_mbtowc(cp, cbuf, cbp) == -1) {
-		reset_mbtowc();
-		if (cbp < MB_CUR_MAX)
-		    continue; /* Maybe a partial character */
-		/* And drop the following bytes, if any */
-		*cp = (unsigned char)*cbuf | INVALID_BYTE;
-	    }
+	cbp++;
+	if (normal_mbtowc(cp, cbuf, cbp) == -1) {
+	    reset_mbtowc();
+	    if (cbp < MB_CUR_MAX)
+		continue; /* Maybe a partial character */
+	    /* And drop the following bytes, if any */
+	    *cp = (unsigned char)*cbuf | INVALID_BYTE;
 	}
 	break;
     }

Modified: vendor/tcsh/dist/ed.refresh.c
===================================================================
--- vendor/tcsh/dist/ed.refresh.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.refresh.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.refresh.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $ */
 /*
  * ed.refresh.c: Lower level screen refreshing functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.refresh.c,v 3.47 2011/02/27 00:14:51 christos Exp $")
+RCSID("$tcsh: ed.refresh.c,v 3.51 2015/06/06 21:19:07 christos Exp $")
 
 #include "ed.h"
 /* #define DEBUG_UPDATE */
@@ -46,7 +46,7 @@
 static int rprompt_h, rprompt_v;
 
 static	int	MakeLiteral		(Char *, int, Char);
-static	int	Draw 			(Char *, int);
+static	int	Draw 			(Char *, int, int);
 static	void	Vdraw 			(Char, int);
 static	void	RefreshPromptpart	(Char *);
 static	void	update_line 		(Char *, Char *, int);
@@ -159,15 +159,44 @@
     return i | LITERAL;
 }
 
+/* draw char at cp, expand tabs, ctl chars */
 static int
-Draw(Char *cp, int nocomb)	/* draw char at cp, expand tabs, ctl chars */
+Draw(Char *cp, int nocomb, int drawPrompt)
 {
     int w, i, lv, lh;
     Char c, attr;
 
+#ifdef WIDE_STRINGS
+    if (!drawPrompt) {			/* draw command-line */
+	attr = 0;
+	c = *cp;
+    } else {				/* draw prompt */
+	/* prompt with attributes(UNDER,BOLD,STANDOUT) */
+	if (*cp & (UNDER | BOLD | STANDOUT)) {		/* *cp >= STANDOUT */
+
+	    /* example)
+	     * We can't distinguish whether (*cp=)0x02ffffff is
+	     * U+02FFFFFF or U+00FFFFFF|STANDOUT.
+	     * We handle as U+00FFFFFF|STANDOUT, only when drawing prompt. */
+	    attr = (*cp & ATTRIBUTES);
+	    /* ~(UNDER | BOLD | STANDOUT) = 0xf1ffffff */
+	    c = *cp & ~(UNDER | BOLD | STANDOUT);
+
+	    /* if c is ctrl code, we handle *cp as havnig no attributes */
+	    if ((c < 0x20 && c >= 0) || c == 0x7f) {
+		attr = 0;
+		c = *cp;
+	    }
+	} else {			/* prompt without attributes */
+	    attr = 0;
+	    c = *cp;
+	}
+    }
+#else
     attr = *cp & ~CHAR;
     c = *cp & CHAR;
-    w = NLSClassify(c, nocomb);
+#endif
+    w = NLSClassify(c, nocomb, drawPrompt);
     switch (w) {
 	case NLSCLASS_NL:
 	    Vdraw('\0', 0);		/* assure end of line	 */
@@ -201,10 +230,11 @@
 	case NLSCLASS_ILLEGAL2:
 	case NLSCLASS_ILLEGAL3:
 	case NLSCLASS_ILLEGAL4:
-	    Vdraw('\\' | attr, 1);
-	    Vdraw('U' | attr, 1);
-	    Vdraw('+' | attr, 1);
-	    for (i = 8 * NLSCLASS_ILLEGAL_SIZE(w) - 4; i >= 0; i -= 4)
+	case NLSCLASS_ILLEGAL5:
+	    Vdraw('\\', 1);
+	    Vdraw('U', 1);
+	    Vdraw('+', 1);
+	    for (i = 16 + 4 * (-w-5); i >= 0; i -= 4)
 		Vdraw("0123456789ABCDEF"[(c >> i) & 15] | attr, 1);
 	    break;
 	case 0:
@@ -302,7 +332,7 @@
 	    }
 	}
 	else
-	    cp += Draw(cp, cp == buf);
+	    cp += Draw(cp, cp == buf, 1);
     }
 }
 
@@ -354,7 +384,7 @@
 	    cur_v = vcursor_v;
 	    Cursor = cp;
 	}
-	cp += Draw(cp, cp == InputBuf);
+	cp += Draw(cp, cp == InputBuf, 0);
     }
 
     if (cur_h == -1) {		/* if I haven't been set yet, I'm at the end */
@@ -1126,7 +1156,7 @@
 	    cp++;
 	    continue;
 	}
-	w = NLSClassify(*cp & CHAR, cp == Prompt);
+	w = NLSClassify(*cp & CHAR, cp == Prompt, 0);
 	cp++;
 	switch(w) {
 	    case NLSCLASS_NL:
@@ -1158,7 +1188,7 @@
     }
 
     for (cp = InputBuf; cp < Cursor;) {	/* do input buffer to Cursor */
-	w = NLSClassify(*cp & CHAR, cp == InputBuf);
+	w = NLSClassify(*cp & CHAR, cp == InputBuf, 0);
 	cp++;
 	switch(w) {
 	    case NLSCLASS_NL:
@@ -1251,7 +1281,7 @@
     }
     cp = Cursor - l;
     c = *cp & CHAR;
-    w = NLSClassify(c, cp == InputBuf);
+    w = NLSClassify(c, cp == InputBuf, 0);
     switch(w) {
 	case NLSCLASS_CTRL:
 	    PutPlusOne('^', 1);
@@ -1299,7 +1329,7 @@
     CursorV = 0;		/* clear the display buffer */
     CursorH = 0;
     for (i = 0; i < TermV; i++)
-	(void) memset(Display[i], 0, TermH * sizeof(Display[0][0]));
+	(void) memset(Display[i], 0, (TermH + 1) * sizeof(Display[0][0]));
     OldvcV = 0;
     litlen = 0;
 }

Modified: vendor/tcsh/dist/ed.screen.c
===================================================================
--- vendor/tcsh/dist/ed.screen.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.screen.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.screen.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $ */
 /*
  * ed.screen.c: Editor/termcap-curses interface
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.screen.c,v 3.78 2011/02/27 00:14:38 christos Exp $")
+RCSID("$tcsh: ed.screen.c,v 3.82 2016/11/24 15:04:14 christos Exp $")
 
 #include "ed.h"
 #include "tc.h"
@@ -994,7 +994,7 @@
 int highlighting = 0;
 
 void
-StartHighlight()
+StartHighlight(void)
 {
     (void) tputs(Str(T_mr), 1, PUTPURE);
     highlighting = 1;
@@ -1001,7 +1001,7 @@
 }
 
 void
-StopHighlight()
+StopHighlight(void)
 {
     (void) tputs(Str(T_me), 1, PUTPURE);
     highlighting = 0;
@@ -1437,7 +1437,8 @@
     if (i <= 0) {
 	if (i == -1) {
 #if (SYSVREL == 0) || defined(IRIS3D)
-	    xprintf(CGETS(7, 20, "%s: Cannot open /etc/termcap.\n"), progname);
+	    xprintf(CGETS(7, 20,
+		"%s: The terminal database could not be opened.\n"), progname);
 	}
 	else if (i == 0) {
 #endif /* SYSVREL */
@@ -1563,13 +1564,13 @@
 #endif /* SIG_WINDOW */
 
 #ifdef KNOWsize
-static void
+static int
 UpdateVal(const Char *tag, int value, Char *termcap, Char *backup)
 {
     Char *ptr, *p;
     if ((ptr = Strstr(termcap, tag)) == NULL) {
 	(void)Strcpy(backup, termcap);
-	return;
+	return 0;
     } else {
 	size_t len = (ptr - termcap) + Strlen(tag);
 	(void)Strncpy(backup, termcap, len);
@@ -1580,6 +1581,7 @@
 	ptr = Strchr(ptr, ':');
 	if (ptr)
 	    (void) Strcat(backup, ptr);
+	return 1;
     }
 }
 #endif
@@ -1625,21 +1627,23 @@
 	if ((tptr = getenv("TERMCAP")) != NULL) {
 	    /* Leave 64 characters slop in case we enlarge the termcap string */
 	    Char    termcap[TC_BUFSIZE+64], backup[TC_BUFSIZE+64], *ptr;
-	    Char buf[4];
+	    int changed;
 
 	    ptr = str2short(tptr);
 	    (void) Strncpy(termcap, ptr, TC_BUFSIZE);
 	    termcap[TC_BUFSIZE-1] = '\0';
 
-	    UpdateVal(STRco, Val(T_co), termcap, backup);
-	    UpdateVal(STRli, Val(T_li), termcap, backup);
+	    changed = UpdateVal(STRco, Val(T_co), termcap, backup);
+	    changed |= UpdateVal(STRli, Val(T_li), termcap, backup);
 
-	    /*
-	     * Chop the termcap string at TC_BUFSIZE-1 characters to avoid
-	     * core-dumps in the termcap routines
-	     */
-	    termcap[TC_BUFSIZE - 1] = '\0';
-	    tsetenv(STRTERMCAP, termcap);
+	    if (changed) {
+		/*
+		 * Chop the termcap string at TC_BUFSIZE-1 characters to avoid
+		 * core-dumps in the termcap routines
+		 */
+		termcap[TC_BUFSIZE - 1] = '\0';
+		tsetenv(STRTERMCAP, termcap);
+	    }
 	}
     }
 #endif /* KNOWsize */

Modified: vendor/tcsh/dist/ed.term.c
===================================================================
--- vendor/tcsh/dist/ed.term.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.term.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.term.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.c,v 1.38 2011/02/25 23:58:34 christos Exp $ */
 /*
  * ed.term.c: Low level terminal interface
  */

Modified: vendor/tcsh/dist/ed.term.h
===================================================================
--- vendor/tcsh/dist/ed.term.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.term.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.term.h,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.term.h,v 1.19 2015/03/25 19:53:16 christos Exp $ */
 /*
  * ed.term.h: Local terminal header
  */
@@ -300,10 +300,18 @@
 # endif /* masscomp */
 #endif /* CBRK */
 #ifndef CMIN
-# define CMIN		CEOF
+# if VMIN == VEOF
+#  define CMIN		CEOF
+# else
+#  define CMIN		1
+# endif
 #endif /* CMIN */
 #ifndef CTIME
-# define CTIME		CEOL
+# if VTIME == VEOL
+#  define CTIME		CEOL
+# else
+#  define CTIME		0
+# endif
 #endif /* CTIME */
 
 /*

Modified: vendor/tcsh/dist/ed.xmap.c
===================================================================
--- vendor/tcsh/dist/ed.xmap.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/ed.xmap.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/ed.xmap.c,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/ed.xmap.c,v 3.38 2015/06/06 21:19:07 christos Exp $ */
 /*
  * ed.xmap.c: This module contains the procedures for maintaining
  *	      the extended-key map.
@@ -88,7 +88,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: ed.xmap.c,v 3.37 2009/06/25 21:15:37 christos Exp $")
+RCSID("$tcsh: ed.xmap.c,v 3.38 2015/06/06 21:19:07 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"
@@ -743,7 +743,7 @@
 	    *b++ = (unsigned char) p;
 	}
 	else if (p == ' ' || (Isprint(p) && !Isspace(p)))
-	    b += one_wctomb((char *)b, p & CHAR);
+	    b += one_wctomb((char *)b, p);
 	else {
 	    *b++ = '\\';
 	    *b++ = ((p >> 6) & 7) + '0';

Modified: vendor/tcsh/dist/gethost.c
===================================================================
--- vendor/tcsh/dist/gethost.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/gethost.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/gethost.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/gethost.c,v 1.19 2014/03/09 00:11:54 christos Exp $ */
 /*
  * gethost.c: Create version file from prototype
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: gethost.c,v 1.15 2012/01/15 17:14:54 christos Exp $")
+RCSID("$tcsh: gethost.c,v 1.19 2014/03/09 00:11:54 christos Exp $")
 
 #ifdef SCO
 # define perror __perror
@@ -150,11 +150,17 @@
 	char *r;
 
 	if (len == 0)
-		len = strlen(b);
-	l = strlen(a) + len + 1;
+		len = strlen(b) + 1;
+	if (a)
+	    l = strlen(a) + len;
+	else
+	    l = len;
 	if ((r = malloc(l)) == NULL)
 		abort();
-	snprintf(r, l, "%s%.*s", a, (int)len, b);
+	if (a)
+	    snprintf(r, l, "%s%.*s", a, (int)len, b);
+	else
+	    snprintf(r, l, "%.*s", (int)len, b);
 	return r;
 }
 
@@ -165,19 +171,22 @@
 	static char *buf;
 	size_t len;
 	const char *ptr, *bptr, *eptr = NULL, *name;
-	size_t buflen = 0;
 
 	if (strstr(defs, "#machine(" /* ) */))
 		return defs;
+	if (!strstr(defs, def))
+		return defs;
 
 	free(buf);
-	buf = strdup("("); /* ) */
+	buf = NULL;
 	for (ptr = defs; (bptr = strstr(ptr, def)) != NULL; ptr = eptr + 1) {
 		if (ptr != bptr)
-			buf = cat(buf, ptr, bptr - ptr);
+			buf = cat(buf, ptr, bptr - ptr + 1);
+		buf = cat(buf, "(", 0); /* ) */
 		if ((eptr = strchr(ptr + sizeof(def) - 1, ')')) == NULL) {
 			(void) fprintf(stderr, "%s: missing close paren `%s'\n",
 			    pname, defs);
+			free(buf);
 			return defs;
 		}
 		buf = cat(buf, bptr, eptr - bptr + 1);
@@ -186,19 +195,23 @@
 		if (len < 1) {
 			(void) fprintf(stderr, "%s: empty define `%s'\n",
 			    pname, defs);
+			free(buf);
 			return defs;
 		}
-		if (*name != '_') {
+		if (*name != '_' && (*name != 'M' && name[1] != '_')) {
 			char *undername = malloc(len + 10);
-			buf = cat(buf, " || defined(", 0);
+			if (undername == NULL)
+				abort();
+			buf = cat(buf, ") || defined(", 0);
 			snprintf(undername, len + 10, "__%.*s__)", (int)len,
 			    name);
 			buf = cat(buf, undername, len + 5);
-			buf = cat(buf, " || defined(", 0);
+			buf = cat(buf, ") || defined(", 0);
 			snprintf(undername, len + 10, "__%.*s)", (int)len,
 			    name);
 			buf = cat(buf, undername, len + 3);
 		}
+		buf = cat(buf, "))", 0);
 	}
 	if (!eptr) {
 	    (void) fprintf(stderr, "%s: invalid input `%s'\n", pname, defs);
@@ -205,7 +218,6 @@
 	    return defs;
         }
 	buf = cat(buf, eptr + 1, 0);
-	buf = cat(buf, ")", 0);
 	return buf;
 }
 	
@@ -292,8 +304,8 @@
 			       pname, fname, lineno);
 		break;
 	    }
-	    (void) fprintf(stdout, "\n#if %s\n# define %s\n#endif\n\n", stmt,
-			   defs);
+	    (void) fprintf(stdout, "\n#if %s\n# define %s\n#endif\n\n",
+		explode(stmt), defs);
 	    break;
 
 	case T_NONE:
@@ -340,7 +352,7 @@
 #ifdef LINEDIRECTIVE
 		(void) fprintf(stdout, "# %d \"%s\"\n", lineno + 1, fname);
 #endif /* LINEDIRECTIVE */
-		(void) fprintf(stdout, "#if %s\n", defs);
+		(void) fprintf(stdout, "#if (%s)\n", explode(defs));
 		inprocess = 1;
 	    }
 	    else {

Modified: vendor/tcsh/dist/glob.c
===================================================================
--- vendor/tcsh/dist/glob.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/glob.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -59,6 +59,11 @@
 #include "sh.h"
 #include "glob.h"
 
+#ifndef HAVE_MBLEN
+#undef mblen
+#define mblen(_s,_n)	mbrlen((_s),(_n),NULL)
+#endif
+
 #undef Char
 #undef QUOTE
 #undef TILDE
@@ -433,6 +438,7 @@
 	    dest = copy;
 	    src = pattern;
 	    while (*src != EOS) {
+		/* Don't interpret quotes. The spec does not say we should do */
 		if (*src == QUOTE) {
 		    if (*++src == EOS)
 			--src;

Modified: vendor/tcsh/dist/host.defs
===================================================================
--- vendor/tcsh/dist/host.defs	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/host.defs	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,5 +1,5 @@
 newcode :
-/* $Header: /home/cvs/src/contrib/tcsh/host.defs,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/host.defs,v 1.61 2015/05/26 18:56:19 christos Exp $ */
 /*
  * host.defs: Hosttype/Machtype etc.
  */
@@ -33,18 +33,19 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: host.defs,v 1.55 2012/01/11 20:20:15 christos Exp $")
+RCSID("$tcsh: host.defs,v 1.61 2015/05/26 18:56:19 christos Exp $")
 
 endcode :
 
-macro	: M_mips64el : (defined(mips64) || defined(__mips64)) && (defined(MIPSEL) || defined(__MIPSEL))
-macro	: M_mips64eb : (defined(mips64) || defined(__mips64)) && (defined(MIPSEB) || defined(__MIPSEB))
-macro	: M_mipsel : (!defined(M_mips64el)) && (defined(mips) || defined(__mips)) && (defined(MIPSEL) || defined(__MIPSEL))
-macro	: M_mipseb : (!defined(M_mips64eb)) && (defined(mips) || defined(__mips)) && (defined(MIPSEB) || defined(__MIPSEB))
-macro	: M_i386 : (defined(i386) || defined(__i386__))
-macro	: M_i486 : (defined(i486) || defined(__i486__))
-macro	: M_i586 : (defined(i586) || defined(__i586__))
-macro	: M_i686 : (defined(i686) || defined(__i686__))
+macro	: M_mips64el : (defined(mips64) && defined(MIPSEL))
+macro	: M_mips64eb : (defined(mips64) && defined(MIPSEB))
+macro	: M_mipsel : (!defined(M_mips64el) && defined(mips) && defined(MIPSEL))
+macro	: M_mipseb : (!defined(M_mips64eb) && defined(mips) && defined(MIPSEB))
+macro	: M_amd64: (defined(amd64) || defined(x86_64))
+macro	: M_i386 : defined(i386)
+macro	: M_i486 : defined(i486)
+macro	: M_i586 : defined(i586)
+macro	: M_i686 : defined(i686)
 macro	: M_intel : (defined(M_i386) || defined(M_i486) || defined(M_i586))
 
 newdef	: defined(ns32000)
@@ -169,7 +170,7 @@
 endcode :
 enddef	:
 
-newdef : defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(__GLIBC__)
+newdef : defined(linux) || defined(CYGWIN) || defined(GNU) || defined(GLIBC)
 newcode :
 # include "tw.h"
 #include <sys/utsname.h>
@@ -240,7 +241,7 @@
 enddef	:
 
 
-newdef	: defined(__PARAGON__)
+newdef	: defined(PARAGON)
 comment : Intel Paragon running OSF/1
 vendor	:						: "intel"
 hosttype:						: "paragon"
@@ -277,7 +278,7 @@
 enddef	:
 
 
-newdef	: defined(__hp_osf)
+newdef	: defined(hp_osf)
 comment : Hewlett Packard running OSF/1
 vendor	:						: "hp"
 hosttype: defined(pa_risc)				: "hp9000s700-osf1"
@@ -300,7 +301,7 @@
 enddef	:
 
 
-newdef	: defined(hpux) || defined(__hpux)
+newdef	: defined(hpux)
 comment : Hewlett Packard running HP/UX
 vendor	:						: "hp"
 hosttype: defined(hp9000s800)				: "hp9000s800"
@@ -325,14 +326,15 @@
 enddef	:
 
 
-newdef	: defined(sun) || defined(__sun__)
+newdef	: defined(sun)
 comment : Sun Microsystems series 2 workstation (68010 based)
 comment : Sun Microsystems series 3 workstation (68020 based)
 comment : Sun Microsystems 386i workstation (386 based)
 comment : Sun Microsystems series 4 workstation (SPARC based)
 vendor	:						: "sun"
-hosttype: defined(M_i386) && !defined(__SVR4)		: "sun386i"
-hosttype: defined(M_i386) && defined(__SVR4)		: "i86pc"
+hosttype: defined(M_i386) && !defined(SVR4)		: "sun386i"
+hosttype: defined(M_i386) && defined(SVR4)		: "i86pc"
+hosttype: defined(M_amd64)				: "i86pc"
 hosttype: defined(mc68010)				: "sun2"
 hosttype: defined(mc68020)				: "sun3"
 hosttype: defined(sparc)				: "sun4"
@@ -345,6 +347,7 @@
 machtype: defined(sparcv9)				: "sparcv9"
 machtype: defined(sparc)				: "sparc"
 machtype: defined(M_i386)				: "i386"
+machtype: defined(M_amd64)				: "amd64"
 enddef	:
 
 
@@ -488,7 +491,7 @@
 enddef	:
 
 
-newdef	: defined(__gnu_hurd__)
+newdef	: defined(gnu_hurd)
 comment : GNU/HURD
 vendor	: defined(M_intel)				: "intel"
 hosttype: defined(M_i686)				: "i686"
@@ -503,19 +506,19 @@
 enddef	:
 
 
-newdef	: defined(linux) || defined(__GNU__) || defined(__GLIBC__)
+newdef	: defined(linux) || defined(GNU) || defined(GLIBC)
 comment : Linus Torvalds's linux
 vendor	: defined(M_intel)				: "intel"
 hosttype:						: gethost()
 ostype	:						: getostype()
 machtype:						: getmach()
-vendor	: defined(__ANDROID__)				: "linux"
+vendor	: defined(ANDROID)				: "linux"
 vendor	: defined(alpha)				: "dec"
 vendor	: defined(PPC)					: "apple"
 enddef	:
 
 
-newdef	: defined(__EMX__)
+newdef	: defined(EMX)
 comment : OS/2 EMX [unix emulation under OS/2]
 vendor	: defined(M_intel)				: "intel"
 hosttype: defined(M_i386)				: "i386-emx"
@@ -524,10 +527,10 @@
 enddef	:
 
 
-newdef	: defined(__NetBSD__) 
+newdef	: defined(NetBSD) 
 comment : NetBSD
 vendor	: defined(algor)				: "algoritmics"
-vendor	: defined(arm32) || defined(__arm__)		: "acorn"
+vendor	: defined(arm32) || defined(arm)		: "acorn"
 vendor	: defined(alpha)				: "digital"
 vendor	: defined(amiga)				: "commodore"
 vendor	: defined(atari)				: "atari"
@@ -543,13 +546,13 @@
 vendor	: defined(sparc64)				: "sun"
 vendor	: defined(sun3)					: "sun"
 vendor	: defined(vax)					: "digital"
-vendor	: defined(x86_64)				: "amd"
+vendor	: defined(M_amd64)				: "amd"
 hosttype:						: "NetBSD"
 ostype	:						: "NetBSD"
 machtype: defined(alpha)				: "alpha"
 machtype: defined(algor)				: "algor"
-machtype: defined(arm32) || defined(__APCS_32__)	: "arm32"
-machtype: defined(arm26) || defined(__APCS_26__)	: "arm26"
+machtype: defined(arm32) || defined(APCS_32)		: "arm32"
+machtype: defined(arm26) || defined(APCS_26)		: "arm26"
 machtype: defined(arm)					: "arm"
 machtype: defined(sparc)				: "sparc"
 machtype: defined(sparc64)				: "sparc64"
@@ -561,14 +564,46 @@
 machtype: defined(pc532)				: "pc532"
 machtype: defined(powerpc)				: "powerpc"
 machtype: defined(vax)					: "vax"
-machtype: defined(x86_64)				: "x86_64"
+machtype: defined(M_amd64)				: "x86_64"
 enddef	:
 
+newdef : defined(OpenBSD)
+comment        : OpenBSD
+vendor : defined(alpha)					: "digital"
+vendor : defined(M_amd64)				: "amd"
+vendor : defined(arm)					: "arm"
+vendor : defined(hppa) || defined(hppa64)		: "hp"
+vendor : defined(M_intel)				: "intel"
+vendor : defined(m68k)					: "motorola"
+vendor : defined(m88k)					: "motorola"
+vendor : defined(mips) && defined(sgi)			: "sgi"
+vendor : defined(powerpc)				: "motorola"
+vendor : defined(sh)					: "io-data"
+vendor : defined(sparc) || defined(sparc64)		: "sun"
+vendor : defined(vax)					: "digital"
+hosttype:						: "OpenBSD"
+ostype :						: "OpenBSD"
+machtype: defined(alpha)				: "alpha"
+machtype: defined(M_amd64)				: "amd64"
+machtype: defined(arm)					: "arm"
+machtype: defined(hppa)					: "hppa"
+machtype: defined(hppa64)				: "hppa64"
+machtype: defined(M_i386)				: "i386"
+machtype: defined(m68k)					: "m68k"
+machtype: defined(m88k)					: "m88k"
+machtype: defined(mips)					: "mips"
+machtype: defined(sh)					: "sh"
+machtype: defined(sparc64)				: "sparc64"
+machtype: defined(sparc)				: "sparc"
+machtype: defined(powerpc)				: "powerpc"
+machtype: defined(vax)					: "vax"
+enddef :
 
-newdef	: defined(__FreeBSD__) 
+
+newdef	: defined(FreeBSD) 
 comment : FreeBSD
 vendor	: defined(alpha)				: "digital"
-vendor	: defined(arm32) || defined(__arm__)		: "acorn"
+vendor	: defined(arm32) || defined(arm)		: "acorn"
 vendor	: defined(M_intel)				: "intel"
 vendor	: defined(ia64)					: "intel"
 vendor	: defined(mips)					: "mips"
@@ -575,11 +610,11 @@
 vendor	: defined(powerpc)				: "motorola"
 vendor	: defined(sparc)				: "sun"
 vendor	: defined(sparc64)				: "sun"
-vendor	: defined(x86_64)				: "amd"
+vendor	: defined(M_amd64)				: "amd"
 hosttype:						: "FreeBSD"
 ostype	:						: "FreeBSD"
 machtype: defined(alpha)				: "alpha"
-machtype: defined(arm32) || defined(__APCS_32__)	: "arm32"
+machtype: defined(arm32) || defined(APCS_32)		: "arm32"
 machtype: defined(arm)					: "arm"
 machtype: defined(ia64)					: "ia64"
 machtype: defined(M_i386)				: "i386"
@@ -587,11 +622,11 @@
 machtype: defined(powerpc)				: "powerpc"
 machtype: defined(sparc)				: "sparc"
 machtype: defined(sparc64)				: "sparc64"
-machtype: defined(x86_64)				: "x86_64"
+machtype: defined(M_amd64)				: "x86_64"
 enddef	:
 
 
-newdef	: defined(__MidnightBSD__)
+newdef	: defined(MidnightBSD)
 comment : MidnightBSD
 vendor	: defined(M_intel)				: "intel"
 hosttype:						: "MidnightBSD"
@@ -819,13 +854,15 @@
 enddef	:
 
 
-newdef	: defined(__APPLE__) && defined(__MACH__)
+newdef	: defined(APPLE) && defined(MACH)
 comment : OS X
 vendor	:						: "apple"
 hosttype: defined(i386)					: "intel-pc"
 hosttype: defined(ppc)					: "powermac"
+hosttype: defined(M_amd64)				: "amd"
 ostype	:						: "darwin"
 machtype: defined(i386)					: "i386"
+machtype: defined(M_amd64)				: "x86_64"
 machtype: defined(ppc)					: "powerpc"
 enddef	:
 
@@ -855,7 +892,7 @@
 enddef	:
 
 
-newdef	: defined(ultrix) || defined(__ultrix)
+newdef	: defined(ultrix)
 comment : Digital's Ultrix 
 vendor	:						: "dec"
 hosttype: defined(M_mipsel)				: "decstation"
@@ -917,7 +954,7 @@
 ostype	:						: "masscomp"
 enddef	:
 
-newdef	: defined(__MACHTEN__)
+newdef	: defined(MACHTEN)
 comment : Machintosh
 vendor	:						: "Tenon"
 hosttype:						: "Macintosh"
@@ -1040,7 +1077,7 @@
 enddef	:
 
 
-newdef	: defined(__DGUX__)
+newdef	: defined(DGUX)
 comment : Data-General AViiON running DGUX
 hosttype:						: "aviion"
 ostype	:						: "dgux"
@@ -1074,7 +1111,7 @@
 enddef	:
 
 
-newdef	: defined(__clipper__)
+newdef	: defined(clipper)
 comment : Clipper Chipset (Intergraph)
 vendor	:						: "intergraph"
 hosttype:						: "clipper"
@@ -1081,7 +1118,7 @@
 machtype:						: "clipper"
 enddef	:
 
-newdef : defined(__QNX__)
+newdef : defined(QNX)
 ostype :						: "qnx"
 enddef :
 
@@ -1110,7 +1147,7 @@
 machtype:						: "bs2000"
 enddef	:
 
-newdef	: defined(__MVS__)
+newdef	: defined(MVS)
 comment : ibm uss s/390 (mainframe, EBCDIC)
 vendor	:						: "ibm"
 hosttype:						: "s390"
@@ -1134,7 +1171,7 @@
 machtype: defined(M_i386)				: "i386"
 enddef	:
 
-newdef	: defined(__uxp__) || defined(__uxps__)
+newdef	: defined(uxp) || defined(uxps)
 comment : FUJITSU DS/90 7000
 vendor	:						: "fujitsu"
 hosttype:						: "ds90"
@@ -1142,9 +1179,9 @@
 machtype:						: "sparc"
 enddef	:
 
-newdef	: defined(__CYGWIN__)
+newdef	: defined(CYGWIN)
 comment : Cygwin
-vendor	:						: "intel"
+vendor	: defined(M_intel)				: "intel"
 hosttype:						: gethost()
 ostype	:						: getostype()
 machtype:						: getmach()

Index: vendor/tcsh/dist/install-sh
===================================================================
--- vendor/tcsh/dist/install-sh	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/install-sh	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/install-sh
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Modified: vendor/tcsh/dist/mi.termios.c
===================================================================
--- vendor/tcsh/dist/mi.termios.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/mi.termios.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/mi.termios.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/mi.termios.c,v 1.5 2006/03/02 18:46:44 christos Exp $ */
 /* termios.c - fake termios interface using sgtty interface 
  * 	       by Magnus Doell and Bruce Evans.
  *

Modified: vendor/tcsh/dist/mi.varargs.h
===================================================================
--- vendor/tcsh/dist/mi.varargs.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/mi.varargs.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/mi.varargs.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/mi.varargs.h,v 1.2 1996/04/26 19:18:39 christos Exp $ */
 /*
  * mi.varargs.h: Correct varargs for minix
  */

Added: vendor/tcsh/dist/nls/C/charset
===================================================================
--- vendor/tcsh/dist/nls/C/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/C/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/C/set1
===================================================================
--- vendor/tcsh/dist/nls/C/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/C/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.6 2006/03/02 18:46:45 christos Exp $
+$ $tcsh: set1,v 1.7 2015/05/26 17:38:25 christos Exp $
 $ Error messages
 $set 1 
 1 Syntax Error
@@ -8,7 +8,7 @@
 5 No file for $0
 6 Incomplete [] modifier
 7 $ expansion must end before ]
-8 Bad : modifier in $ (%c)
+8 Bad : modifier in $ '%c'
 9 Subscript error
 10 Badly formed number
 11 No more words
@@ -51,8 +51,8 @@
 48 Not in while/foreach
 49 No more processes
 50 No match
-51 Missing %c
-52 Unmatched %c
+51 Missing '%c'
+52 Unmatched '%c'
 53 Out of memory
 54 Can't make pipe
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Bad substitute
 91 No previous left hand side
 92 Right hand side too long
-93 Bad ! modifier: %c
+93 Bad ! modifier: '%c'
 94 Modifier failed
 95 Substitution buffer overflow
 96 Bad ! arg selector
@@ -118,7 +118,7 @@
 115 Out of termcap string space
 116 Usage: settc %s [yes|no]
 117 Unknown capability `%s'
-118 Unknown termcap parameter `%%%c'
+118 Unknown termcap parameter '%%%c'
 119 Too many arguments for `%s' (%d)
 120 `%s' requires %d arguments
 121 Usage: echotc [-v|-s] [<capability> [<args>]]
@@ -137,4 +137,4 @@
 134 Usage: unlimit [-fh] [limits]
 135 $%S is read-only
 136 No such job
-137 Unknown colorls variable `%c%c'
+137 Unknown colorls variable '%c%c'

Modified: vendor/tcsh/dist/nls/C/set20
===================================================================
--- vendor/tcsh/dist/nls/C/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/C/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.3 2006/03/02 18:46:45 christos Exp $
+$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Invalid key name `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interpret COMMAND as a builtin or external command\n
 17     -v   bind all keys to vi bindings\n
 18     -e   bind all keys to emacs bindings\n
-19     -d   bind all keys to default editor's bindings\n
+19     -d   bind all keys to default editor's bindings (%s)\n
 20     -l   list editor commands with descriptions\n
 21     -r   remove KEY's binding\n
 22     -k   interpret KEY as a symbolic arrow-key name\n

Modified: vendor/tcsh/dist/nls/C/set9
===================================================================
--- vendor/tcsh/dist/nls/C/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/C/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.3 2006/03/02 18:46:45 christos Exp $
+$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: Null extended-key not allowed.\n
@@ -8,5 +8,5 @@
 5 Some extended keys too long for internal print buffer
 6 Enumerate: BUG!! Null ptr passed\n!
 7 no input
-8 Something must follow: %c\n
+8 Something must follow: '%c'\n
 9 Octal constant does not fit in a char.\n

Modified: vendor/tcsh/dist/nls/Makefile.in
===================================================================
--- vendor/tcsh/dist/nls/Makefile.in	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/Makefile.in	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-# $tcsh: Makefile.in,v 1.13 2012/01/05 16:54:25 christos Exp $
+# $tcsh: Makefile.in,v 1.16 2014/07/23 18:18:07 christos Exp $
 
 CATALOGS=	C.cat et.cat finnish.cat french.cat german.cat greek.cat \
 		italian.cat ja.cat pl.cat russian.cat spanish.cat ukrainian.cat
@@ -19,7 +19,7 @@
 INSTALLED+=${localedir}/C/LC_MESSAGES/tcsh.cat
 ${localedir}/C/LC_MESSAGES/tcsh.cat:	C.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 C.cat: ${srcdir}/C/charset ${srcdir}/C/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -27,7 +27,7 @@
 INSTALLED+=${localedir}/et/LC_MESSAGES/tcsh.cat
 ${localedir}/et/LC_MESSAGES/tcsh.cat:	et.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 et.cat: ${srcdir}/et/charset ${srcdir}/et/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -35,7 +35,7 @@
 INSTALLED+=${localedir}/fi/LC_MESSAGES/tcsh.cat
 ${localedir}/fi/LC_MESSAGES/tcsh.cat:	finnish.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 finnish.cat: ${srcdir}/finnish/charset ${srcdir}/finnish/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -43,7 +43,7 @@
 INSTALLED+=${localedir}/fr/LC_MESSAGES/tcsh.cat
 ${localedir}/fr/LC_MESSAGES/tcsh.cat:	french.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 french.cat: ${srcdir}/french/charset ${srcdir}/french/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -51,7 +51,7 @@
 INSTALLED+=${localedir}/de/LC_MESSAGES/tcsh.cat
 ${localedir}/de/LC_MESSAGES/tcsh.cat:	german.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 german.cat: ${srcdir}/german/charset ${srcdir}/german/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -59,7 +59,7 @@
 INSTALLED+=${localedir}/gr/LC_MESSAGES/tcsh.cat
 ${localedir}/gr/LC_MESSAGES/tcsh.cat:	greek.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 greek.cat: ${srcdir}/greek/charset ${srcdir}/greek/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -67,7 +67,7 @@
 INSTALLED+=${localedir}/it/LC_MESSAGES/tcsh.cat
 ${localedir}/it/LC_MESSAGES/tcsh.cat:	italian.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 italian.cat: ${srcdir}/italian/charset ${srcdir}/italian/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -75,7 +75,7 @@
 INSTALLED+=${localedir}/ja/LC_MESSAGES/tcsh.cat
 ${localedir}/ja/LC_MESSAGES/tcsh.cat:	ja.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 ja.cat: ${srcdir}/ja/charset ${srcdir}/ja/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -83,7 +83,7 @@
 INSTALLED+=${localedir}/pl/LC_MESSAGES/tcsh.cat
 ${localedir}/pl/LC_MESSAGES/tcsh.cat:	pl.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 pl.cat: ${srcdir}/pl/charset ${srcdir}/pl/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -91,7 +91,7 @@
 INSTALLED+=${localedir}/ru/LC_MESSAGES/tcsh.cat
 ${localedir}/ru/LC_MESSAGES/tcsh.cat:	russian.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 russian.cat: ${srcdir}/russian/charset ${srcdir}/russian/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
@@ -99,15 +99,15 @@
 INSTALLED+=${localedir}/es/LC_MESSAGES/tcsh.cat
 ${localedir}/es/LC_MESSAGES/tcsh.cat:	spanish.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 spanish.cat: ${srcdir}/spanish/charset ${srcdir}/spanish/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>
 
-INSTALLED+=${localedir}/ru_UA.koi8u/LC_MESSAGES/tcsh.cat
-${localedir}/ru_UA.koi8u/LC_MESSAGES/tcsh.cat:	ukrainian.cat
+INSTALLED+=${localedir}/ru_UA/LC_MESSAGES/tcsh.cat
+${localedir}/ru_UA/LC_MESSAGES/tcsh.cat:	ukrainian.cat
 	mkdir -p $(@D)
-	$(INSTALL) $< $@
+	$(INSTALL) $> $^ $@
 
 ukrainian.cat: ${srcdir}/ukrainian/charset ${srcdir}/ukrainian/*set[0-9]*
 	@${CATGEN} $(GENCAT) $@ $^ $>

Modified: vendor/tcsh/dist/nls/catgen
===================================================================
--- vendor/tcsh/dist/nls/catgen	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/catgen	2018-06-27 00:42:17 UTC (rev 11147)
@@ -3,10 +3,18 @@
 TMP=/tmp/catgen.$$
 trap "rm -f $TMP" 0 1 2 3 15
 
+sortit() {
+	awk '/^\$set/ {print $2, FILENAME}' "$@" | sort -n | cut -d ' ' -f 2
+}
+
 GENCAT="$1"
 shift
 OUT="$1"
 shift
-cat "$@" > "$TMP"
+CHARSET="$1"
+shift
+cat "${CHARSET}" $(sortit "$@") > "$TMP"
+
 echo "$(basename "$OUT" .cat)"
 "${GENCAT}" "$OUT" "$TMP"
+exit 0


Property changes on: vendor/tcsh/dist/nls/catgen
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Added: vendor/tcsh/dist/nls/et/charset
===================================================================
--- vendor/tcsh/dist/nls/et/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/et/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/et/set1
===================================================================
--- vendor/tcsh/dist/nls/et/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/et/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.4 2011/02/04 18:19:33 christos Exp $
+$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
 $ Error messages
 $set 1 
 1 Süntaksi viga
@@ -8,7 +8,7 @@
 5 $0 jaoks pole faili
 6 Mittetäielik [] muutja
 7 $ laiendus peab lõppema enne ]
-8 Halb : täiendaja $ (%c)
+8 Halb : täiendaja $ '%c'
 9 Viga indeksis
 10 Vigane number
 11 Sõnad on otsas
@@ -51,8 +51,8 @@
 48 Pole while/foreach sees
 49 Protsessid on otsas
 50 Ei leia
-51 Puuduv %c
-52 Ei leia sümbolit %c
+51 Puuduv '%c'
+52 Ei leia sümbolit '%c'
 53 Mälu on otsas
 54 Toru ei saa luua
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Vigane asendamine
 91 Eelmist vasakut poolt pole
 92 Parem pool on liiga pikk
-93 Vigane ! modifikaator: %c
+93 Vigane ! modifikaator: '%c'
 94 Modifikaator ebaõnnestus
 95 Asenduse puhvri ületäitumine
 96 Vigane ! argumendi valik
@@ -118,7 +118,7 @@
 115 Termcap sõne on liiga pikk
 116 Kasuta: settc %s [yes|no]
 117 Tundmatu omadus `%s'
-118 Tundmatu termcap parameeter `%%%c'
+118 Tundmatu termcap parameeter '%%%c'
 119 `%s' jaoks on liiga palju argumente (%d)
 120 `%s' nõuab %d argumenti
 121 Kasuta: echotc [-v|-s] [<omadus> [<argumendid>]]
@@ -137,4 +137,4 @@
 134 Kasuta: unlimit [-fh] [limiidid]
 135 $%S on ainult lugemiseks
 136 Pole sellist tööd
-137 Tundmatu colorls muutuja `%c%c'
+137 Tundmatu colorls muutuja '%c%c'

Modified: vendor/tcsh/dist/nls/et/set20
===================================================================
--- vendor/tcsh/dist/nls/et/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/et/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.3 2011/02/04 18:19:33 christos Exp $
+$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Vigane klahvi nimi `%S'\n
@@ -19,7 +19,7 @@
 16     -c   käsitle COMMAND kui sisemist või välist käsku\n
 17     -v   seo kõik klahvid vi seostega\n
 18     -e   seo kõik klahvid emacsi seostega\n
-19     -d   seo kõik klahvid vaikimisi toimeti seostega\n
+19     -d   seo kõik klahvid vaikimisi toimeti seostega (%s)\n
 20     -l   esita toimeti käsud koos kirjeldustega\n
 21     -r   kustuta KLAHVILT seos\n
 22     -k   kasuta KLAHVI kui noole-klahvi sümbolnime\n

Modified: vendor/tcsh/dist/nls/et/set9
===================================================================
--- vendor/tcsh/dist/nls/et/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/et/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.3 2011/02/04 18:19:34 christos Exp $
+$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: Null pikkusega laiend-klahv ei ole lubatud.\n
@@ -8,5 +8,5 @@
 5 Mõned laiendatud klahvid on sisemise trükipuhvri jaoks liiga pikad
 6 Enumerate: BUG!! Null viit anti\n!
 7 sisendit pole
-8 Midagi peab järgnema: %c\n
+8 Midagi peab järgnema: '%c'\n
 9 kaheksand-konstant ei mahu sümbolisse.\n

Added: vendor/tcsh/dist/nls/finnish/charset
===================================================================
--- vendor/tcsh/dist/nls/finnish/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/finnish/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/finnish/set1
===================================================================
--- vendor/tcsh/dist/nls/finnish/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/finnish/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.4 2011/02/04 18:19:34 christos Exp $
+$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
 $ Error messages
 $set 1 
 1 Kielioppivirhe
@@ -8,7 +8,7 @@
 5 Puuttuva tiedosto $0
 6 Vajavainen [] muunnos
 7 $ -laajennuksen on päätyttävä ennen ']'-merkkiä
-8 Virheellinen : -muunnos $ (%c)
+8 Virheellinen : -muunnos $ '%c'
 9 Indeksivirhe
 10 Virheellinen numero
 11 Liian vähän sanoja
@@ -51,8 +51,8 @@
 48 Silmukan (while/foreach) ulkopuolella
 49 Lisää prosesseja ei voida luoda
 50 Ei vastaavuuksia (match)
-51 Puuttuva %c
-52 Ylimääräinen/pariton %c
+51 Puuttuva '%c'
+52 Ylimääräinen/pariton '%c'
 53 Muisti loppu
 54 Putkea ei voida luoda
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Virheellinen korvaava merkkijono
 91 Edellistä vasemmanpuolista merkkijonoa ei ole
 92 Oikeanpuolinen merkkijono on liian pitkä
-93 Virheellinen ! -muunnos: %c
+93 Virheellinen ! -muunnos: '%c'
 94 Muunnos epäonnistui
 95 Korvauspuskurin ylivuoto
 96 Virheellinen ! argumenttivalitsin
@@ -118,7 +118,7 @@
 115 Päätetyypin kuvaukselle (termcap) ei ole tarpeeksi tilaa
 116 Käyttö: settc %s [yes|no]
 117 Tuntematon toiminne `%s'
-118 Tuntematon päätetyypin (termcap) parameteri `%%%c'
+118 Tuntematon päätetyypin (termcap) parameteri '%%%c'
 119 Liian paljon argumentteja käskylle `%s' (%d)
 120 `%s' edellyttää %d argumenttia
 121 Käyttö: echotc [-v|-s] [<toiminne> [<argumentit>]]
@@ -137,4 +137,4 @@
 134 Käyttö: unlimit [-fh] [rajoitteet (limits)]
 135 Muuttujalle $%S ei voida asettaa arvoa
 136 Viitattua työtä ei ole
-137 Tuntematon colorls-muuttuja `%c%c'
+137 Tuntematon colorls-muuttuja '%c%c'

Modified: vendor/tcsh/dist/nls/finnish/set20
===================================================================
--- vendor/tcsh/dist/nls/finnish/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/finnish/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.4 2011/02/04 18:19:34 christos Exp $
+$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Invalid key name `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interpret COMMAND as a builtin or external command\n
 17     -v   bind all keys to vi bindings\n
 18     -e   bind all keys to emacs bindings\n
-19     -d   bind all keys to default editor's bindings\n
+19     -d   bind all keys to default editor's bindings (%s)\n
 20     -l   list editor commands with descriptions\n
 21     -r   remove KEY's binding\n
 22     -k   interpret KEY as a symbolic arrow-key name\n

Modified: vendor/tcsh/dist/nls/finnish/set3
===================================================================
--- vendor/tcsh/dist/nls/finnish/set3	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/finnish/set3	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set3,v 1.4 2011/02/04 18:19:34 christos Exp $
+$ $tcsh: set3,v 1.5 2015/09/01 14:08:28 kim Exp $
 $ Editor function descriptions
 $set 3 
 1 Siirry taaksepäin yksi merkki
@@ -114,11 +114,11 @@
 111 Vi: peruuta muutos
 112 Vi: siirry rivin alkuun
 113 Suorita 'which' tälle komennolle
-114 Liimaa/lisää leikkauspuskurin sisältö kursorin paikalle
+114 Liitä leikkauspuskurin sisältö kursorin paikalle
 115 Korvaa viimeksi liimattu teksti aikaisemmalla leikkauksella
-116 (WIN32 only) Copy cut buffer to system clipboard
-117 (WIN32 only) Paste clipboard buffer at cursor position
-118 (WIN32 only) Convert each '/' in next word to '\\\\'
-119 (WIN32 only) Convert each '/' in previous word to '\\\\'
-120 (WIN32 only) Page visible console window up
-121 (WIN32 only) Page visible console window down
+116 (Vain WIN32) Kopioi leikkauspuskuri leikepöydälle
+117 (Vain WIN32) Liitä leikepöydän sisältö kursorin paikalle
+118 (Vain WIN32) Muuta jokainen '/' seuraavassa sanassa merkkijonoksi '\\\\'
+119 (Vain WIN32) Muuta jokainen '/' edellisessä sanassa merkkijonoksi '\\\\'
+120 (Vain WIN32) Näytä konsoli-ikkunan edellinen sivu
+121 (Vain WIN32) Näytä konsoli-ikkunan seuraava sivu

Modified: vendor/tcsh/dist/nls/finnish/set9
===================================================================
--- vendor/tcsh/dist/nls/finnish/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/finnish/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,12 +1,12 @@
-$ $tcsh: set9,v 1.3 2011/02/04 18:19:34 christos Exp $
+$ $tcsh: set9,v 1.5 2015/09/01 14:08:28 kim Exp $
 $ ed.xmap.c
 $set 9
-1 AddXkey: Null extended-key not allowed.\n
+1 AddXkey: Tyhjää laajennettua näppäintä ei sallita.\n
 2 AddXkey: sequence-lead-in command not allowed\n
-3 DeleteXkey: Null extended-key not allowed.\n
+3 DeleteXkey: Tyhjää laajennettua näppäintä ei sallita.\n
 4 Sitomaton laajennettu näppäin "%S"\n
-5 Jotkin laajennetut näppäimet ovat liian pitkiä sisäiseen tulostuspuskurille
+5 Jotkin laajennetut näppäimet ovat liian pitkiä sisäiselle tulostuspuskurille
 6 Enumerate: VIKA!! Välitetty null-osoitin\n!
 7 ei syötettä
-8 Jotain on seurattava: %c\n
+8 Jotain on seurattava: '%c'\n
 9 Oktaalivakio ei mahdu char-tyypin muuttujaan.\n

Added: vendor/tcsh/dist/nls/french/charset
===================================================================
--- vendor/tcsh/dist/nls/french/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/french/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/french/set1
===================================================================
--- vendor/tcsh/dist/nls/french/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/french/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.5 2011/02/04 18:19:35 christos Exp $
+$ $tcsh: set1,v 1.6 2015/05/26 17:38:25 christos Exp $
 $ Messages d 'erreur
 $set 1 
 1 Erreur de syntaxe
@@ -8,7 +8,7 @@
 5 Pas de fichier pour $0
 6 Modificateur [] incomplet
 7 $ l'expansion doit se terminer avant ]
-8 Mauvais : modificateur dans $ (%c)
+8 Mauvais : modificateur dans $ '%c'
 9 Erreur d'indice
 10 Numéro mal formé
 11 Plus de mots
@@ -51,8 +51,8 @@
 48 Vous n'êtes pas dans une boucle while ou foreach
 49 Plus de processus
 50 Pas de correspondance
-51 %c manquant
-52 %c sans correspondance
+51 '%c' manquant
+52 '%c' sans correspondance
 53 Mémoire insuffisante
 54 Impossible de créer un tube
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Remplacement incorrect
 91 Pas de partie gauche précédente
 92 Partie droite trop longue
-93 Modificateur ! incorrect: %c
+93 Modificateur ! incorrect: '%c'
 94 Echec du modificateur
 95 Dépassement de capacité de la mémoire tampon de substitution
 96 Sélecteur d'argument ! incorrect
@@ -118,7 +118,7 @@
 115 Pas assez de place pour la chaine termcap
 116 Syntaxe: settc %s [yes|no]
 117 Capacité `%s' inconnue
-118 Paramètre termcap inconnu `%%%c'
+118 Paramètre termcap inconnu '%%%c'
 119 Trop d'arguments pour `%s' (%d)
 120 `%s' nécessite %d arguments
 121 Syntaxe: echotc [-v|-s] [<capacité> [<args>]]
@@ -137,4 +137,4 @@
 134 Syntaxe: unlimit [-fh] [limites]
 135 $%S est en lecture seule
 136 Pas de travail de ce type
-137 Unknown colorls variable `%c%c'
+137 Unknown colorls variable '%c%c'

Modified: vendor/tcsh/dist/nls/french/set20
===================================================================
--- vendor/tcsh/dist/nls/french/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/french/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.3 2011/02/04 18:19:35 christos Exp $
+$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Nom de touche incorrect `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interprète COMMANDE comme une commande intégrée ou externe\n
 17     -v   redéfinit toutes les touches pour vi\n
 18     -e   redéfinit toutes les touches pour emacs\n
-19     -d   redéfinit toutes les touches pour de l'éditeur par defaut\n
+19     -d   redéfinit toutes les touches pour de l'éditeur par defaut (%s)\n
 20     -l   liste les commandes de l'éditeur avec descriptions\n
 21     -r   enlève la correspondance pour la TOUCHE\n
 22     -k   interprète TOUCHE comme un nom de touche de direction symbolique\n

Modified: vendor/tcsh/dist/nls/french/set9
===================================================================
--- vendor/tcsh/dist/nls/french/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/french/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.3 2011/02/04 18:19:36 christos Exp $
+$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: touche d'extension nulle pas autorisé.\n
@@ -8,5 +8,5 @@
 5 Certaines touches d'extension trop longues pour tampon d'impression interne
 6 Enumerate: BUG!! Pointeur Null passé!\n
 7 pas d'entrée
-8 Quelque chose doit suivre: %c\n
+8 Quelque chose doit suivre: '%c'\n
 9 Une constante Octale ne peut pas tenir dans un caractère.\n

Added: vendor/tcsh/dist/nls/german/charset
===================================================================
--- vendor/tcsh/dist/nls/german/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/german/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/german/set1
===================================================================
--- vendor/tcsh/dist/nls/german/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/german/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.7 2011/02/04 18:19:36 christos Exp $
+$ $tcsh: set1,v 1.8 2015/05/26 17:38:25 christos Exp $
 $ Error messages
 $set 1
 1 Syntaxfehler
@@ -8,7 +8,7 @@
 5 Keine Datei für $0
 6 Unvollständiger [] Modifizierer
 7 $ Ausweitung muß vor ] enden
-8 Falscher : Modifizierer in $ (%c)
+8 Falscher : Modifizierer in $ '%c'
 9 Indexfehler
 10 Falsche Nummer
 11 Keine Worte mehr
@@ -51,8 +51,8 @@
 48 Nicht in while/foreach
 49 Keine Prozesse mehr
 50 Kein Treffer
-51 Fehlendes %c
-52 Überflüssiges %c
+51 Fehlendes '%c'
+52 Überflüssiges '%c'
 53 Kein Speicher mehr
 54 Kann keine Pipe erzeugen
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Falsche Ersetzung
 91 Keine vorhergehende linke Seite
 92 Rechte Seite zu lang
-93 Falscher ! Modifizierer: %c
+93 Falscher ! Modifizierer: '%c'
 94 Modifizierer fehlgeschlagen
 95 Überlauf des Ersetzungspuffers
 96 Falscher ! Argumentbezeichner
@@ -118,7 +118,7 @@
 115 Kein Platz mehr für Termcap-Eintrag
 116 Benutzung: settc %s [yes|no]
 117 Unbekannte Fähigkeit `%s'
-118 Unbekannter Termcap-Parameter `%%%c'
+118 Unbekannter Termcap-Parameter '%%%c'
 119 Zu viele Argumente für `%s' (%d)
 120 `%s' erfordert %d Argumente
 121 Benutzung: echotc [-v|-s] [<Fähigkeit> [<Argumente>]]
@@ -137,4 +137,4 @@
 134 Benutzung: unlimit [-fh] [Grenzen]
 135 $%S ist nur lesbar
 136 Kein solcher Job
-137 Unknown colorls variable `%c%c'
+137 Unknown colorls variable '%c%c'

Modified: vendor/tcsh/dist/nls/german/set20
===================================================================
--- vendor/tcsh/dist/nls/german/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/german/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.4 2011/02/04 18:19:36 christos Exp $
+$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20
 1 Ungültiger Tastenname `%S'\n
@@ -19,7 +19,7 @@
 16     -c   belege einen Unix-Befehl anstelle eines Befehls\n
 17     -v   initialisiere Belegungen mit Standard-Vi-Belegungen\n
 18     -e   initialisiere Belegungen mit Standard-Emacs-Belegungen\n
-19     -d   initialisiere Belegungen mit Standard-Belegungen\n
+19     -d   initialisiere Belegungen mit Standard-Belegungen (%s)\n
 20     -l   zeige verfügbare Funktionen mit Beschreibungen an\n
 21     -r   entferne Belegung eines Tastes\n
 22     -k   belege Pfeiltaste mit Namen in In-String\n

Modified: vendor/tcsh/dist/nls/german/set9
===================================================================
--- vendor/tcsh/dist/nls/german/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/german/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.5 2011/02/04 18:19:37 christos Exp $
+$ $tcsh: set9,v 1.6 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: Null extended-key not allowed.\n
@@ -8,5 +8,5 @@
 5 Some extended keys too long for internal print buffer
 6 Enumerate: BUG!! Null ptr passed\n!
 7 keine Eingabe
-8 Es muß noch etwas folgen: %c\n
+8 Es muß noch etwas folgen: '%c'\n
 9 Oktal-Konstante paßt nicht in ein Zeichen.\n

Added: vendor/tcsh/dist/nls/greek/charset
===================================================================
--- vendor/tcsh/dist/nls/greek/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/greek/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/greek/set1
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/greek/set1
===================================================================
--- vendor/tcsh/dist/nls/greek/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/greek/set1	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/greek/set1
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: vendor/tcsh/dist/nls/greek/set20
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/greek/set20
===================================================================
--- vendor/tcsh/dist/nls/greek/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/greek/set20	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/greek/set20
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: vendor/tcsh/dist/nls/greek/set9
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/greek/set9
===================================================================
--- vendor/tcsh/dist/nls/greek/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/greek/set9	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/greek/set9
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: vendor/tcsh/dist/nls/italian/charset
===================================================================
--- vendor/tcsh/dist/nls/italian/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/italian/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/italian/set1
===================================================================
--- vendor/tcsh/dist/nls/italian/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/italian/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.3 2011/02/04 18:19:38 christos Exp $
+$ $tcsh: set1,v 1.4 2015/05/26 17:38:25 christos Exp $
 $ Error messages
 $set 1 
 1 Errore di Sintassi
@@ -8,7 +8,7 @@
 5 Nessun file per $0
 6 Modificatore [] incompleto
 7 L'espansione $ deve terminare prima di ]
-8 Modificatore sbagliato in $ (%c)
+8 Modificatore sbagliato in $ '%c'
 9 Errore di indice
 10 Numero non corretto
 11 Sono senza parole
@@ -51,8 +51,8 @@
 48 Non in un while/foreach
 49 Ho finito i processi
 50 Corrispondenza non esistente
-51 %c mancante
-52 %c non corrispondente
+51 '%c' mancante
+52 '%c' non corrispondente
 53 Memoria esaurita
 54 Non posso creare una pipe
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Sostituzione sbagliata
 91 Non esiste il precedente lato sinistro
 92 Lato destro troppo lungo
-93 Modificatore ! errato: %c
+93 Modificatore ! errato: '%c'
 94 Il modificatore non ha funzionato
 95 Overflow di buffer nella sostituzione
 96 Errato selettore ! di argomento
@@ -118,7 +118,7 @@
 115 Al di fuori dello spazio stringa del termcap
 116 Utilizzo: settc %s [yes|no]
 117 Capacità `%s' sconosciuta
-118 Parametro del termcap `%%%c' sconosciuto
+118 Parametro del termcap '%%%c' sconosciuto
 119 Troppi argomenti per `%s' (%d)
 120 `%s' richiede %d argomenti
 121 Utilizzo: echotc [-v|-s] [<capacità> [<argomenti>]]
@@ -137,4 +137,4 @@
 134 Utilizzo: unlimit [-fh] [limiti]
 135 $%S è a sola lettura
 136 Non esiste il lavoro
-137 Variabile `%c%c colorls' sconosciuta
+137 Variabile '%c%c colorls' sconosciuta

Modified: vendor/tcsh/dist/nls/italian/set20
===================================================================
--- vendor/tcsh/dist/nls/italian/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/italian/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.3 2011/02/04 18:19:39 christos Exp $
+$ $tcsh: set20,v 1.4 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Nome di tasto non corretto `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interpreta COMANDO come un comando interno o esterno\n
 17     -v   definisce tutti i tasti alla 'vi'\n
 18     -e   definisce tutti i tasti alla 'emacs'\n
-19     -d   definisce tutti i tasti in base all'editor di default\n
+19     -d   definisce tutti i tasti in base all'editor di default (%s)\n
 20     -l   elenca i comandi di modifica testo con relativa descrizione\n
 21     -r   rimuove la definizione per TASTO\n
 22     -k   interpreta TASTO come un nome simbolico di tasto freccia\n

Modified: vendor/tcsh/dist/nls/italian/set9
===================================================================
--- vendor/tcsh/dist/nls/italian/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/italian/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.2 2006/03/02 18:46:47 christos Exp $
+$ $tcsh: set9,v 1.3 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: tasto esteso nullo non ammesso.\n
@@ -8,5 +8,5 @@
 5 Alcuni tasti estesi sono troppo grandi per il buffer interno di stampa
 6 Enumerate: BACO!! ho ricevuto un puntatore nullo\n!
 7 niente in ingresso
-8 Qualcosa deve seguire: %c\n
+8 Qualcosa deve seguire: '%c'\n
 9 Costante ottale non adeguata per un char.\n

Added: vendor/tcsh/dist/nls/ja/charset
===================================================================
--- vendor/tcsh/dist/nls/ja/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/ja/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/ja/set1
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/ja/set1
===================================================================
--- vendor/tcsh/dist/nls/ja/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/ja/set1	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/ja/set1
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: vendor/tcsh/dist/nls/russian/charset
===================================================================
--- vendor/tcsh/dist/nls/russian/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/russian/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/russian/set1
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/russian/set1
===================================================================
--- vendor/tcsh/dist/nls/russian/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/russian/set1	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/russian/set1
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: vendor/tcsh/dist/nls/russian/set20
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/russian/set20
===================================================================
--- vendor/tcsh/dist/nls/russian/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/russian/set20	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/russian/set20
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: vendor/tcsh/dist/nls/russian/set9
===================================================================
--- vendor/tcsh/dist/nls/russian/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/russian/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.4 2011/02/04 18:19:42 christos Exp $
+$ $tcsh: set9,v 1.5 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: Null extended-key not allowed.\n
@@ -8,5 +8,5 @@
 5 Some extended keys too long for internal print buffer
 6 Enumerate: BUG!! Передан нулевой указатель!\n
 7 нет вводимых данных
-8 Something must follow: %c\n
+8 Something must follow: '%c'\n
 9 Восьмеричная константа не умещается в char.\n

Added: vendor/tcsh/dist/nls/spanish/charset
===================================================================
--- vendor/tcsh/dist/nls/spanish/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/spanish/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/spanish/set1
===================================================================
--- vendor/tcsh/dist/nls/spanish/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/spanish/set1	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set1,v 1.4 2011/02/04 18:19:42 christos Exp $
+$ $tcsh: set1,v 1.5 2015/05/26 17:38:25 christos Exp $
 $ Mensajes de Error
 $set 1 
 1 Error de sintaxis
@@ -8,7 +8,7 @@
 5 No hay fichero para $0
 6 Modificador [] incompleto
 7 $ expansión debe terminar antes de ]
-8 Modificador erróneo : en $ (%c)
+8 Modificador erróneo : en $ '%c'
 9 Error de índice
 10 Número erróneamente formado
 11 No hay más palabras
@@ -51,8 +51,8 @@
 48 No se encuentra en bucle while/foreach
 49 No hay más procesos
 50 No existe correspondencia
-51 Falta %c
-52 No se ha hallado correspondencia con %c
+51 Falta '%c'
+52 No se ha hallado correspondencia con '%c'
 53 Memoria insuficiente
 54 No se puede crear la tubería
 55 %s: %s
@@ -93,7 +93,7 @@
 90 Sustituto erróneo
 91 No existe `lado izquierdo' previo
 92 Valor de asignación demasiado largo
-93 Modificador de ! incorrecto: %c
+93 Modificador de ! incorrecto: '%c'
 94 Error de modificador
 95 Desborde el el buffer de sustitución
 96 Selector de argumento de ! erróneo
@@ -118,7 +118,7 @@
 115 Se ha agotado el espacio para cadenas termcap
 116 Uso: settc %s [yes|no]
 117 Característica `%s' desconocida
-118 Parámetro termcap `%%%c' desconocido
+118 Parámetro termcap '%%%c' desconocido
 119 Demasiados argumentos para `%s' (%d)
 120 `%s' requiere %d argumentos
 121 Uso: echotc [-v|-s] [<característica> [<args>]]
@@ -137,4 +137,4 @@
 134 Uso: unlimit [-fh] [límites]
 135 $%S es de sólo-lectura
 136 No existe ese trabajo
-137 Unknown colorls variable `%c%c'
+137 Unknown colorls variable '%c%c'

Modified: vendor/tcsh/dist/nls/spanish/set20
===================================================================
--- vendor/tcsh/dist/nls/spanish/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/spanish/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.4 2011/02/04 18:19:43 christos Exp $
+$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Nombre de tecla no válido `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interpreta COMANDO como comando interno o externo\n
 17     -v   usa las definiciones del editor vi\n
 18     -e   usa las definiciones del editor vi\n
-19     -d   usa las definiciones del editor por defecto\n
+19     -d   usa las definiciones del editor por defecto (%s)\n
 20     -l   lista los comandos del editor y sus descripciones\n
 21     -r   elimina la definición asociada a TECLA\n
 22     -k   interpreta TECLA como nombre simbólico de tecla de flecha\n

Modified: vendor/tcsh/dist/nls/spanish/set9
===================================================================
--- vendor/tcsh/dist/nls/spanish/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/spanish/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.3 2011/02/04 18:19:43 christos Exp $
+$ $tcsh: set9,v 1.4 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: No se permite una tecla extendida nula.\n
@@ -8,5 +8,5 @@
 5 Algunas teclas extendidas son demasiado grandes para el buffer de impresión interno
 6 Enumerate: ¡¡BUG!! Se ha pasado un puntero nulo!\n
 7 no hay entrada
-8 Falta algo a continuación: %c\n
+8 Falta algo a continuación: '%c'\n
 9 Una constante octal no cabe en un carácter.\n

Added: vendor/tcsh/dist/nls/ukrainian/charset
===================================================================
--- vendor/tcsh/dist/nls/ukrainian/charset	                        (rev 0)
+++ vendor/tcsh/dist/nls/ukrainian/charset	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,3 @@
+$ codeset=UTF-8
+$set 255
+1 UTF-8

Modified: vendor/tcsh/dist/nls/ukrainian/set1
===================================================================
(Binary files differ)

Index: vendor/tcsh/dist/nls/ukrainian/set1
===================================================================
--- vendor/tcsh/dist/nls/ukrainian/set1	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/ukrainian/set1	2018-06-27 00:42:17 UTC (rev 11147)

Property changes on: vendor/tcsh/dist/nls/ukrainian/set1
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Modified: vendor/tcsh/dist/nls/ukrainian/set20
===================================================================
--- vendor/tcsh/dist/nls/ukrainian/set20	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/ukrainian/set20	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set20,v 1.4 2011/02/04 18:19:44 christos Exp $
+$ $tcsh: set20,v 1.5 2015/08/13 08:54:04 christos Exp $
 $ tc.bind.c
 $set 20 
 1 Invalid key name `%S'\n
@@ -19,7 +19,7 @@
 16     -c   interpret COMMAND as a builtin or external command\n
 17     -v   bind all keys to vi bindings\n
 18     -e   bind all keys to emacs bindings\n
-19     -d   bind all keys to default editor's bindings\n
+19     -d   bind all keys to default editor's bindings (%s)\n
 20     -l   list editor commands with descriptions\n
 21     -r   remove KEY's binding\n
 22     -k   interpret KEY as a symbolic arrow-key name\n

Modified: vendor/tcsh/dist/nls/ukrainian/set9
===================================================================
--- vendor/tcsh/dist/nls/ukrainian/set9	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/nls/ukrainian/set9	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-$ $tcsh: set9,v 1.4 2011/02/04 18:19:45 christos Exp $
+$ $tcsh: set9,v 1.5 2015/05/26 17:38:25 christos Exp $
 $ ed.xmap.c
 $set 9
 1 AddXkey: Null extended-key not allowed.\n
@@ -8,5 +8,5 @@
 5 Some extended keys too long for internal print buffer
 6 Enumerate: ПОМИЛКА!! Null ptr passed\n!
 7 no input
-8 Something must follow: %c\n
+8 Something must follow: '%c'\n
 9 Octal constant does not fit in a char.\n

Modified: vendor/tcsh/dist/patchlevel.h
===================================================================
--- vendor/tcsh/dist/patchlevel.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/patchlevel.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/patchlevel.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/patchlevel.h,v 3.187 2016/11/24 15:04:52 christos Exp $ */
 /*
  * patchlevel.h: Our life story.
  */
@@ -7,8 +7,8 @@
 
 #define ORIGIN "Astron"
 #define REV 6
-#define VERS 18
-#define PATCHLEVEL 1
-#define DATE "2012-02-14"
+#define VERS 20
+#define PATCHLEVEL 00
+#define DATE "2016-11-24"
 
 #endif /* _h_patchlevel */

Modified: vendor/tcsh/dist/pathnames.h
===================================================================
--- vendor/tcsh/dist/pathnames.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/pathnames.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/pathnames.h,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/pathnames.h,v 3.22 2011/02/05 20:34:55 christos Exp $ */
 /*
  * pathnames.h: Location of things to find
  */

Modified: vendor/tcsh/dist/sh.c
===================================================================
--- vendor/tcsh/dist/sh.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.c,v 3.189 2016/09/12 16:33:54 christos Exp $ */
 /*
  * sh.c: Main shell routines
  */
@@ -39,7 +39,7 @@
  All rights reserved.\n";
 #endif /* not lint */
 
-RCSID("$tcsh: sh.c,v 3.174 2011/11/29 18:38:54 christos Exp $")
+RCSID("$tcsh: sh.c,v 3.189 2016/09/12 16:33:54 christos Exp $")
 
 #include "tc.h"
 #include "ed.h"
@@ -78,7 +78,8 @@
  * ported to Apple Unix (TM) (OREO)  26 -- 29 Jun 1987
  */
 
-jmp_buf_t reslab;
+jmp_buf_t reslab IZERO_STRUCT;
+struct wordent paraml IZERO_STRUCT;
 
 static const char tcshstr[] = "tcsh";
 
@@ -247,13 +248,15 @@
     char *tcp, *ttyn;
     int f, reenter;
     char **tempv;
+    const char *targinp = NULL;
     int osetintr;
     struct sigaction oparintr;
 
-    (void)memset(&reslab, 0, sizeof(reslab));
 #ifdef WINNT_NATIVE
     nt_init();
 #endif /* WINNT_NATIVE */
+
+    (void)memset(&reslab, 0, sizeof(reslab));
 #if defined(NLS_CATALOGS) && defined(LC_MESSAGES)
     (void) setlocale(LC_MESSAGES, "");
 #endif /* NLS_CATALOGS && LC_MESSAGES */
@@ -272,6 +275,7 @@
 #endif
 
     nlsinit();
+    initlex(&paraml);
 
 #ifdef MALLOC_TRACE
     mal_setstatsfile(fdopen(dmove(xopen("/tmp/tcsh.trace", 
@@ -343,6 +347,7 @@
 # endif
 #endif
     STR_WORD_CHARS = SAVE(WORD_CHARS);
+    STR_WORD_CHARS_VI = SAVE(WORD_CHARS_VI);
 
     HIST = '!';
     HISTSUB = '^';
@@ -355,6 +360,7 @@
 
     /* Default history size to 100 */
     setcopy(STRhistory, str2short("100"), VAR_READWRITE);
+    sethistory(100);
 
     tempv = argv;
     ffile = SAVE(tempv[0]);
@@ -477,6 +483,9 @@
      */
     initdesc();
 
+    cdtohome = 1;
+    setv(STRcdtohome, SAVE(""), VAR_READWRITE);
+
     /*
      * Get and set the tty now
      */
@@ -493,6 +502,7 @@
     }
     else
 	setv(STRtty, cp = SAVE(""), VAR_READWRITE);
+
     /*
      * Initialize the shell variables. ARGV and PROMPT are initialized later.
      * STATUS is also munged in several places. CHILD is munged when
@@ -588,19 +598,22 @@
      */
     shlvl(1);
 
-    if ((tcp = getenv("HOME")) != NULL)
-	cp = quote(SAVE(tcp));
-    else
 #ifdef __ANDROID__
-	/* On Android, $HOME usually isn't set, so we can't load user RC files.
-	   Check for the environment variable EXTERNAL_STORAGE, which contains
-	   the mount point of the external storage (SD card, mostly).  If
-	   EXTERNAL_STORAGE isn't set fall back to "/sdcard". */
-    if ((tcp = getenv("EXTERNAL_STORAGE")) != NULL)
+    /* On Android, $HOME either isn't set or set to /data, a R/O location.
+       Check for the environment variable EXTERNAL_STORAGE, which contains
+       the mount point of the external storage (SD card, mostly).  If
+       EXTERNAL_STORAGE isn't set fall back to "/sdcard".  Eventually
+       override $HOME so the environment is on the same page. */
+    if (((tcp = getenv("HOME")) != NULL && strcmp (tcp, "/data") != 0)
+	|| (tcp = getenv("EXTERNAL_STORAGE")) != NULL) {
 	cp = quote(SAVE(tcp));
-    else
+    } else
 	cp = quote(SAVE("/sdcard"));
+    tsetenv(STRKHOME, cp);
 #else
+    if ((tcp = getenv("HOME")) != NULL)
+	cp = quote(SAVE(tcp));
+    else
 	cp = NULL;
 #endif
 
@@ -797,9 +810,12 @@
 #ifdef COLOR_LS_F
     if ((tcp = getenv("LS_COLORS")) != NULL)
 	parseLS_COLORS(str2short(tcp));
+    if ((tcp = getenv("LSCOLORS")) != NULL)
+	parseLSCOLORS(str2short(tcp));
 #endif /* COLOR_LS_F */
 
-    doldol = putn((tcsh_number_t)getpid());	/* For $$ */
+    mainpid = getpid();
+    doldol = putn((tcsh_number_t)mainpid);	/* For $$ */
 #ifdef WINNT_NATIVE
     {
 	char *tmp;
@@ -818,7 +834,7 @@
 #else /* !WINNT_NATIVE */
 #ifdef HAVE_MKSTEMP
     {
-	char *tmpdir = getenv ("TMPDIR");
+	const char *tmpdir = getenv ("TMPDIR");
 	if (!tmpdir)
 	    tmpdir = "/tmp";
 	shtemp = Strspl(SAVE(tmpdir), SAVE("/sh" TMP_TEMPLATE)); /* For << */
@@ -922,30 +938,7 @@
 		      *p &= ASCII;
 		  }
 #endif
-		arginp = SAVE(tempv[0]);
-
-		/*
-		 * we put the command into a variable
-		 */
-		if (arginp != NULL)
-		    setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
-
-		/*
-		 * * Give an error on -c arguments that end in * backslash to
-		 * ensure that you don't make * nonportable csh scripts.
-		 */
-		{
-		    int count;
-
-		    cp = Strend(arginp);
-		    count = 0;
-		    while (cp > arginp && *--cp == '\\')
-			++count;
-		    if ((count & 1) != 0) {
-			exiterr = 1;
-			stderror(ERR_ARGC);
-		    }
-		}
+		targinp = tempv[0];
 		prompt = 0;
 		nofile = 1;
 		break;
@@ -1190,7 +1183,7 @@
 	    sigset_interrupting(SIGXFSZ, queue_phup);
 #endif
 
-	if (quitit == 0 && arginp == 0) {
+	if (quitit == 0 && targinp == 0) {
 #ifdef SIGTSTP
 	    (void) signal(SIGTSTP, SIG_IGN);
 #endif
@@ -1215,7 +1208,7 @@
 
 #ifdef NeXT
 	    /* NeXT 2.0 /usr/etc/rlogind, does not set our process group! */
-	    if (shpgrp == 0) {
+	    if (f != -1 && shpgrp == 0) {
 	        shpgrp = getpid();
 		(void) setpgid(0, shpgrp);
 	        (void) tcsetpgrp(f, shpgrp);
@@ -1222,7 +1215,7 @@
 	    }
 #endif /* NeXT */
 #ifdef BSDJOBS			/* if we have tty job control */
-	    if (grabpgrp(f, shpgrp) != -1) {
+	    if (f != -1 && grabpgrp(f, shpgrp) != -1) {
 		/*
 		 * Thanks to Matt Day for the POSIX references, and to
 		 * Paul Close for the SGI clarification.
@@ -1308,7 +1301,7 @@
  */
     sigset_interrupting(SIGCHLD, queue_pchild);
 
-    if (intty && !arginp) 	
+    if (intty && !targinp) 	
 	(void) ed_Setup(editing);/* Get the tty state, and set defaults */
 				 /* Only alter the tty state if editing */
     
@@ -1343,7 +1336,7 @@
 #ifdef _PATH_DOTCSHRC
 	    (void) srcfile(_PATH_DOTCSHRC, 0, 0, NULL);
 #endif
-	    if (!arginp && !onelflg && !havhash)
+	    if (!targinp && !onelflg && !havhash)
 		dohash(NULL,NULL);
 #ifndef LOGINFIRST
 #ifdef _PATH_DOTLOGIN
@@ -1363,7 +1356,7 @@
 	if (!srccat(varval(STRhome), STRsldottcshrc))
 	    (void) srccat(varval(STRhome), STRsldotcshrc);
 
-	if (!arginp && !onelflg && !havhash)
+	if (!targinp && !onelflg && !havhash)
 	    dohash(NULL,NULL);
 
 	/*
@@ -1383,7 +1376,7 @@
     exitset--;
 
     /* Initing AFTER .cshrc is the Right Way */
-    if (intty && !arginp) {	/* PWP setup stuff */
+    if (intty && !targinp) {	/* PWP setup stuff */
 	ed_Init();		/* init the new line editor */
 #ifdef SIG_WINDOW
 	check_window_size(1);	/* mung environment */
@@ -1398,6 +1391,32 @@
     if (nexececho)
 	setNS(STRecho);
     
+
+    if (targinp) {
+	arginp = SAVE(targinp);
+	/*
+	 * we put the command into a variable
+	 */
+	if (arginp != NULL)
+	    setv(STRcommand, quote(Strsave(arginp)), VAR_READWRITE);
+
+	/*
+	 * * Give an error on -c arguments that end in * backslash to
+	 * ensure that you don't make * nonportable csh scripts.
+	 */
+	{
+	    int count;
+
+	    cp = Strend(arginp);
+	    count = 0;
+	    while (cp > arginp && *--cp == '\\')
+		++count;
+	    if ((count & 1) != 0) {
+		exiterr = 1;
+		stderror(ERR_ARGC);
+	    }
+	}
+    }
     /*
      * All the rest of the world is inside this call. The argument to process
      * indicates whether it should catch "error unwinds".  Thus if we are a
@@ -1904,6 +1923,8 @@
     {
 	(void) Cookedmode();
 	GettingInput = 0;
+	if (evalvec)
+	    doneinp = 1;
     }
     drainoline();
 #ifdef HAVE_GETPWENT
@@ -2037,6 +2058,7 @@
 	 */
 	if (setintr)
 	    pintr_push_enable(&old_pintr_disabled);
+	freelex(&paraml);
 	hadhist = lex(&paraml);
 	if (setintr)
 	    cleanup_until(&old_pintr_disabled);
@@ -2178,6 +2200,7 @@
     cleanup_push(file, xfree);
     xfree(f);
     t = glob_all_or_error(t);
+    cleanup_push(t, blk_cleanup);
     if ((!srcfile(file, 0, hflg, t)) && (!hflg) && (!bequiet))
 	stderror(ERR_SYSTEM, file, strerror(errno));
     cleanup_until(file);

Modified: vendor/tcsh/dist/sh.char.c
===================================================================
--- vendor/tcsh/dist/sh.char.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.char.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.char.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.c,v 3.21 2010/02/09 20:32:34 christos Exp $ */
 /*
  * sh.char.c: Character classification tables
  */

Modified: vendor/tcsh/dist/sh.char.h
===================================================================
--- vendor/tcsh/dist/sh.char.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.char.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.char.h,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.char.h,v 3.37 2014/05/09 19:22:49 christos Exp $ */
 /*
  * sh.char.h: Table for spotting special characters quickly
  * 	      Makes for very obscure but efficient coding.
@@ -167,15 +167,15 @@
 #define iscmdmeta(c)	cmap((c), _CMD)
 #ifdef WIDE_STRINGS
 #define letter(c)	(((c) & QUOTE) ? 0 :  \
-			 (iswalpha((tcshuc) (c)) || (c) == '_'))
+			 (iswalpha((c)) || (c) == '_'))
 #define alnum(c)	(((c) & QUOTE) ? 0 :  \
-		         (iswalnum((tcshuc) (c)) || (c) == '_'))
+		         (iswalnum((c)) || (c) == '_'))
 #else
 #define letter(c)	(((Char)(c) & QUOTE) ? 0 :  \
-			 ((isalpha((tcshuc) (c)) && !(cmap((c), _PUN))) \
+			 ((isalpha((c)) && !(cmap((c), _PUN))) \
 			  || (c) == '_'))
 #define alnum(c)	(((Char)(c) & QUOTE) ? 0 :  \
-		         ((isalnum((tcshuc) (c)) && !(cmap((c), _PUN))) \
+		         ((isalnum((c)) && !(cmap((c), _PUN))) \
 			  || (c) == '_'))
 
 #endif

Modified: vendor/tcsh/dist/sh.decls.h
===================================================================
--- vendor/tcsh/dist/sh.decls.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.decls.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.decls.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.decls.h,v 3.68 2016/08/01 16:21:09 christos Exp $ */
 /*
  * sh.decls.h	 External declarations from sh*.c
  */
@@ -78,6 +78,7 @@
 extern	void		  Dfix		(struct command *);
 extern	Char		 *Dfix1		(Char *);
 extern	void		  heredoc	(Char *);
+extern  Char		 *randsuf	(void);
 
 /*
  * sh.err.c
@@ -184,6 +185,7 @@
 extern	void		  wfree		(void);
 extern	void		  dobuiltins	(Char **, struct command *);
 extern	void		  reexecute	(struct command *);
+extern  int		  getYN		(const char *);
 
 /*
  * sh.glob.c
@@ -221,6 +223,7 @@
 extern	void		  rechist	(Char *, int);
 extern	void		  loadhist	(Char *, int);
 extern	void		  displayHistStats(const char *);
+extern	void		  sethistory	(int);
 
 /*
  * sh.init.c
@@ -236,6 +239,7 @@
 extern	void		  btoeof	(void);
 extern	void		  copylex	(struct wordent *, struct wordent *);
 extern	Char		 *domod		(Char *, Char);
+extern	void		  initlex	(struct wordent *);
 extern	void		  freelex	(struct wordent *);
 extern	int		  lex		(struct wordent *);
 extern	void		  lex_cleanup	(void *);
@@ -243,6 +247,7 @@
 extern	eChar		  readc		(int);
 extern	void		  settell	(void);
 extern	void		  unreadc	(Char);
+extern	ssize_t		  wide_read	(int, Char *, size_t, int);
 
 
 /*
@@ -397,6 +402,7 @@
 #if defined(AUTOSET_KANJI)
 extern	void		  autoset_kanji	(void);
 #endif
+extern	void		  update_wordchars	(void);
 
 /*
  * sh.time.c

Modified: vendor/tcsh/dist/sh.dir.c
===================================================================
--- vendor/tcsh/dist/sh.dir.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.dir.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.dir.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.c,v 3.85 2016/04/08 16:10:52 christos Exp $ */
 /*
  * sh.dir.c: Directory manipulation functions
  */
@@ -33,7 +33,7 @@
 #include "sh.h"
 #include "ed.h"
 
-RCSID("$tcsh: sh.dir.c,v 3.82 2011/10/16 16:25:05 christos Exp $")
+RCSID("$tcsh: sh.dir.c,v 3.85 2016/04/08 16:10:52 christos Exp $")
 
 /*
  * C Shell - directory management
@@ -501,7 +501,9 @@
     cp = (dflag & DIR_OLD) ? varval(STRowd) : *v;
 
     if (cp == NULL) {
-	if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
+	if (!cdtohome)
+	    stderror(ERR_NAME | ERR_TOOFEW);
+	else if ((cp = varval(STRhome)) == STRNULL || *cp == 0)
 	    stderror(ERR_NAME | ERR_NOHOMEDIR);
 	if (chdir(short2str(cp)) < 0)
 	    stderror(ERR_NAME | ERR_CANTCHANGE);
@@ -674,6 +676,7 @@
 		cleanup_until(cp);
 		return dgoto(cp);
 	    }
+	    xfree(dp);
 	}
 	xfree(buf.s);
     }

Modified: vendor/tcsh/dist/sh.dir.h
===================================================================
--- vendor/tcsh/dist/sh.dir.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.dir.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.dir.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dir.h,v 3.6 2002/03/08 17:36:46 christos Exp $ */
 /*
  * sh.dir.h: Directory data structures and globals
  */

Modified: vendor/tcsh/dist/sh.dol.c
===================================================================
--- vendor/tcsh/dist/sh.dol.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.dol.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.dol.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.dol.c,v 3.87 2014/08/13 23:39:34 amold Exp $ */
 /*
  * sh.dol.c: Variable substitutions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.dol.c,v 3.83 2011/01/25 20:10:46 christos Exp $")
+RCSID("$tcsh: sh.dol.c,v 3.87 2014/08/13 23:39:34 amold Exp $")
 
 /*
  * C shell
@@ -825,9 +825,8 @@
 		    (void) Strcpy(np + diff, rhsub);
 		    (void) Strcpy(np + diff + rhlen, dp + lhlen);
 
-		    dp = np + diff + 1;
 		    xfree(cp);
-		    cp = np;
+		    dp = cp = np;
 		    cp[--len] = '\0';
 		    didmod = 1;
 		    if (diff >= (ssize_t)len)
@@ -920,6 +919,19 @@
     inheredoc = 0;
 }
 
+Char *
+randsuf(void) {
+#ifndef WINNT_NATIVE
+	struct timeval tv;
+	(void) gettimeofday(&tv, NULL);
+	return putn((((tcsh_number_t)tv.tv_sec) ^ 
+	    ((tcsh_number_t)tv.tv_usec) ^
+	    ((tcsh_number_t)getpid())) & 0x00ffffff);
+#else
+    return putn(getpid());
+#endif
+}
+
 /*
  * Form a shell temporary file (in unit 0) from the words
  * of the shell input up to EOF or a line the same as "term".
@@ -950,7 +962,6 @@
 #else /* !HAVE_MKSTEMP */
     char   *tmp;
 # ifndef WINNT_NATIVE
-    struct timeval tv;
 
 again:
 # endif /* WINNT_NATIVE */
@@ -966,11 +977,8 @@
 # ifndef WINNT_NATIVE
 	if (errno == EEXIST) {
 	    if (unlink(tmp) == -1) {
-		(void) gettimeofday(&tv, NULL);
 		xfree(shtemp);
-		mbp = putn((((tcsh_number_t)tv.tv_sec) ^ 
-		    ((tcsh_number_t)tv.tv_usec) ^
-		    ((tcsh_number_t)getpid())) & 0x00ffffff);
+		mbp = randsuf();
 		shtemp = Strspl(STRtmpsh, mbp);
 		xfree(mbp);
 	    }

Modified: vendor/tcsh/dist/sh.err.c
===================================================================
--- vendor/tcsh/dist/sh.err.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.err.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.err.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.err.c,v 3.57 2015/05/26 17:32:45 christos Exp $ */
 /*
  * sh.err.c: Error printing routines. 
  */
@@ -34,7 +34,7 @@
 #include "sh.h"
 #include <assert.h>
 
-RCSID("$tcsh: sh.err.c,v 3.55 2011/02/25 23:58:34 christos Exp $")
+RCSID("$tcsh: sh.err.c,v 3.57 2015/05/26 17:32:45 christos Exp $")
 
 /*
  * C Shell
@@ -218,7 +218,7 @@
     elst[ERR_DOLZERO] = CSAVS(1, 5, "No file for $0");
     elst[ERR_INCBR] = CSAVS(1, 6, "Incomplete [] modifier");
     elst[ERR_EXPORD] = CSAVS(1, 7, "$ expansion must end before ]");
-    elst[ERR_BADMOD] = CSAVS(1, 8, "Bad : modifier in $ (%c)");
+    elst[ERR_BADMOD] = CSAVS(1, 8, "Bad : modifier in $ '%c'");
     elst[ERR_SUBSCRIPT] = CSAVS(1, 9, "Subscript error");
     elst[ERR_BADNUM] = CSAVS(1, 10, "Badly formed number");
     elst[ERR_NOMORE] = CSAVS(1, 11, "No more words");
@@ -262,8 +262,8 @@
     elst[ERR_NOTWHILE] = CSAVS(1, 48, "Not in while/foreach");
     elst[ERR_NOPROC] = CSAVS(1, 49, "No more processes");
     elst[ERR_NOMATCH] = CSAVS(1, 50, "No match");
-    elst[ERR_MISSING] = CSAVS(1, 51, "Missing %c");
-    elst[ERR_UNMATCHED] = CSAVS(1, 52, "Unmatched %c");
+    elst[ERR_MISSING] = CSAVS(1, 51, "Missing '%c'");
+    elst[ERR_UNMATCHED] = CSAVS(1, 52, "Unmatched '%c'");
     elst[ERR_NOMEM] = CSAVS(1, 53, "Out of memory");
     elst[ERR_PIPE] = CSAVS(1, 54, "Can't make pipe");
     elst[ERR_SYSTEM] = CSAVS(1, 55, "%s: %s");
@@ -309,7 +309,7 @@
     elst[ERR_BADSUBST] = CSAVS(1, 90, "Bad substitute");
     elst[ERR_LHS] = CSAVS(1, 91, "No previous left hand side");
     elst[ERR_RHSLONG] = CSAVS(1, 92, "Right hand side too long");
-    elst[ERR_BADBANGMOD] = CSAVS(1, 93, "Bad ! modifier: %c");
+    elst[ERR_BADBANGMOD] = CSAVS(1, 93, "Bad ! modifier: '%c'");
     elst[ERR_MODFAIL] = CSAVS(1, 94, "Modifier failed");
     elst[ERR_SUBOVFL] = CSAVS(1, 95, "Substitution buffer overflow");
     elst[ERR_BADBANGARG] = CSAVS(1, 96, "Bad ! arg selector");
@@ -335,7 +335,7 @@
     elst[ERR_TCNOSTR] = CSAVS(1, 115, "Out of termcap string space");
     elst[ERR_SETTCUS] = CSAVS(1, 116, "Usage: settc %s [yes|no]");
     elst[ERR_TCCAP] = CSAVS(1, 117, "Unknown capability `%s'");
-    elst[ERR_TCPARM] = CSAVS(1, 118, "Unknown termcap parameter `%%%c'");
+    elst[ERR_TCPARM] = CSAVS(1, 118, "Unknown termcap parameter '%%%c'");
     elst[ERR_TCARGS] = CSAVS(1, 119, "Too many arguments for `%s' (%d)");
     elst[ERR_TCNARGS] = CSAVS(1, 120, "`%s' requires %d arguments");
     elst[ERR_TCUSAGE] = CSAVS(1, 121,
@@ -365,7 +365,7 @@
     elst[ERR_ULIMUS] = CSAVS(1, 134, "Usage: unlimit [-fh] [limits]");
     elst[ERR_READONLY] = CSAVS(1, 135, "$%S is read-only");
     elst[ERR_BADJOB] = CSAVS(1, 136, "No such job (badjob)");
-    elst[ERR_BADCOLORVAR] = CSAVS(1, 137, "Unknown colorls variable `%c%c'");
+    elst[ERR_BADCOLORVAR] = CSAVS(1, 137, "Unknown colorls variable '%c%c'");
     elst[ERR_EOF] = CSAVS(1, 138, "Unexpected end of file");
 }
 
@@ -380,10 +380,10 @@
 #endif
 };
 
-static struct cleanup_entry *cleanup_stack; /* = NULL; */
-static size_t cleanup_sp; /* = 0; Next free entry */
-static size_t cleanup_mark; /* = 0; Last entry to handle before unwinding */
-static size_t cleanup_stack_size; /* = 0 */
+static struct cleanup_entry *cleanup_stack INIT_ZERO; /* = NULL; */
+static size_t cleanup_sp INIT_ZERO; /* = 0; Next free entry */
+static size_t cleanup_mark INIT_ZERO; /* = 0; Last entry to handle before unwinding */
+static size_t cleanup_stack_size INIT_ZERO; /* = 0 */
 
 /* fn() will be run with all signals blocked, so it should not do anything
    risky. */

Modified: vendor/tcsh/dist/sh.exec.c
===================================================================
--- vendor/tcsh/dist/sh.exec.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.exec.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.exec.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.exec.c,v 3.81 2016/09/12 16:33:54 christos Exp $ */
 /*
  * sh.exec.c: Search, find, and execute a command!
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.exec.c,v 3.79 2011/02/25 23:58:34 christos Exp $")
+RCSID("$tcsh: sh.exec.c,v 3.81 2016/09/12 16:33:54 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -606,9 +606,10 @@
     cleanup_push(&state, execash_cleanup);
 
     /*
-     * Decrement the shell level
+     * Decrement the shell level, if not in a subshell
      */
-    shlvl(-1);
+    if (mainpid == getpid())
+	shlvl(-1);
 #ifdef WINNT_NATIVE
     __nt_really_exec=1;
 #endif /* WINNT_NATIVE */
@@ -1070,6 +1071,9 @@
 {
     int found = 1;
     USE(c);
+
+    if (adrof(STRautorehash))
+	dohash(NULL, NULL);
     for (v++; *v; v++)
 	found &= find_cmd(*v, 1);
     /* Make status nonzero if any command is not found. */
@@ -1166,7 +1170,11 @@
 		return rval;
 	}
     }
-    if (adrof(STRautorehash) && !rehashed && havhash) {
+    /*
+     * If we are printing, we are being called from dowhere() which it 
+     * has rehashed already
+     */
+    if (!prt && adrof(STRautorehash) && !rehashed && havhash) {
 	dohash(NULL, NULL);
 	rehashed = 1;
 	goto retry;

Modified: vendor/tcsh/dist/sh.exp.c
===================================================================
--- vendor/tcsh/dist/sh.exp.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.exp.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.exp.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.exp.c,v 3.63 2015/12/09 17:17:43 christos Exp $ */
 /*
  * sh.exp.c: Expression evaluations
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.exp.c,v 3.58 2011/12/25 15:21:50 christos Exp $")
+RCSID("$tcsh: sh.exp.c,v 3.63 2015/12/09 17:17:43 christos Exp $")
 
 #include "tw.h"
 
@@ -172,6 +172,7 @@
 		    mode <<= 3;
 		    break;
 		}
+	    xfree(groups);
 	}
     }
 # endif /* NGROUPS_MAX */
@@ -322,7 +323,7 @@
 	cleanup_push(p2, xfree);
 	etracc("exp2c p2", p2, vp);
 	if (!(ignore & TEXP_IGNORE))
-	    switch (i) {
+	    switch ((int)i) {
 
 	    case EQEQ:
 		i = eq(p1, p2);
@@ -367,7 +368,7 @@
 	cleanup_push(p2, xfree);
 	etracc("exp3 p2", p2, vp);
 	if (!(ignore & TEXP_IGNORE))
-	    switch (i) {
+	    switch ((int)i) {
 
 	    case GTR:
 		i = egetn(p1) > egetn(p2);
@@ -632,7 +633,7 @@
     int altout = 0;
     Char *ft = cp, *dp, *ep, *strdev, *strino, *strF, *str, valtest = '\0',
     *errval = STR0;
-    char *string, string0[22 + MB_LEN_MAX + 1];	// space for 64 bit octal
+    char *string, string0[22 + MB_LEN_MAX + 1];	/* space for 64 bit octal */
     time_t footime;
     struct passwd *pw;
     struct group *gr;
@@ -954,8 +955,7 @@
     struct wordent *wdp = hp;
 
     setcopy(STRstatus, STR0, VAR_READWRITE);
-    hp->prev = hp->next = hp;
-    hp->word = STRNULL;
+    initlex(hp);
     while (*v) {
 	struct wordent *new = xcalloc(1, sizeof *wdp);
 

Modified: vendor/tcsh/dist/sh.file.c
===================================================================
--- vendor/tcsh/dist/sh.file.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.file.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.file.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.file.c,v 3.40 2016/04/16 14:08:14 christos Exp $ */
 /*
  * sh.file.c: File completion for csh. This file is not used in tcsh.
  */
@@ -33,7 +33,7 @@
 #include "sh.h"
 #include "ed.h"
 
-RCSID("$tcsh: sh.file.c,v 3.37 2010/02/09 20:21:49 christos Exp $")
+RCSID("$tcsh: sh.file.c,v 3.40 2016/04/16 14:08:14 christos Exp $")
 
 #if defined(FILEC) && defined(TIOCSTI)
 
@@ -231,7 +231,7 @@
 # ifdef POSIX
     (void) tcgetattr(SHOUT, &tty);
 # else
-    (void) ioctl(SHOUT, TCSETAW, (ioctl_t) &tty);
+    (void) ioctl(SHOUT, TCGETA, (ioctl_t) &tty);
 # endif /* POSIX */
     tty_normal = tty;
     tty.c_lflag &= ~(ECHOKE | ECHO | ECHOE | ECHOK | ECHONL |
@@ -249,7 +249,7 @@
 	char buf[MB_LEN_MAX];
 	size_t i, len;
 
-	len = one_wctomb(buf, *p & CHAR);
+	len = one_wctomb(buf, *p);
 	for (i = 0; i < len; i++)
 	    (void) ioctl(SHOUT, TIOCSTI, (ioctl_t) &buf[i]);
     }
@@ -564,7 +564,7 @@
     }
 
     if (looking_for_lognames) {
-#ifndef HAVE_GETPWENT
+#ifdef HAVE_GETPWENT
 	(void) endpwent();
 #endif
     } else

Modified: vendor/tcsh/dist/sh.func.c
===================================================================
--- vendor/tcsh/dist/sh.func.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.func.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.func.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.func.c,v 3.176 2016/10/18 17:26:42 christos Exp $ */
 /*
  * sh.func.c: csh builtin functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.func.c,v 3.162 2011/02/26 00:07:06 christos Exp $")
+RCSID("$tcsh: sh.func.c,v 3.176 2016/10/18 17:26:42 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -799,8 +799,16 @@
 	    break;
 
 	case TC_IF:
-	    while (getword(&word))
+	    while (getword(&word)) {
+		if (intty) {
+		    histent->word = Strsave(word.s);
+		    histent->next = xmalloc(sizeof(*histent));
+		    histent->next->prev = histent;
+		    histent = histent->next;
+		}
 		continue;
+	    }
+	    
 	    if ((type == TC_IF || type == TC_ELSE) &&
 		eq(word.s, STRthen))
 		level++;
@@ -893,7 +901,7 @@
 static struct wordent *
 histgetword(struct wordent *histent) 
 {
-    int found = 0, first;
+    int first;
     eChar c, d;
     int e;
     struct Strbuf *tmp;
@@ -917,7 +925,6 @@
 	if (c == '\n') 
 	    goto nl;
 	unreadc(c);
-	found = 1;
 	first = 1;
 	do {
 	    e = (c == '\\');
@@ -1038,6 +1045,17 @@
 		goto past;
 	    if (wp)
 		Strbuf_append1(wp, (Char) c);
+	    if (!d && c == ')') {
+		if (!first && wp) {
+		    goto past_word_end;
+		} else {
+		    if (wp) {
+			wp->len = 1;
+			Strbuf_terminate(wp);
+		    }
+		    return found;
+		}
+	    }
 	    if (!first && !d && c == '(') {
 		if (wp)
 		    goto past_word_end;
@@ -1381,7 +1399,7 @@
 	stderror(ERR_NAME | ERR_VARBEGIN);
     do {
 	lp++;
-    } while (alnum(*lp));
+    } while (alnum(*lp) || *lp == '.');
     if (*lp != '\0')
 	stderror(ERR_NAME | ERR_VARALNUM);
 
@@ -1543,6 +1561,11 @@
 	cleanup_until(lp);
 	return;
     }
+    if (eq(vp, STRLSCOLORS)) {
+        parseLSCOLORS(lp);
+	cleanup_until(lp);
+	return;
+    }
 #endif /* COLOR_LS_F */
 
 #ifdef SIG_WINDOW
@@ -1670,6 +1693,8 @@
 #ifdef COLOR_LS_F
 		else if (eq(name, STRLS_COLORS))
 		    parseLS_COLORS(n);
+		else if (eq(name, STRLSCOLORS))
+		    parseLSCOLORS(n);
 #endif /* COLOR_LS_F */
 #ifdef NLS_CATALOGS
 		else if (eq(name, STRNLSPATH)) {
@@ -1927,6 +1952,14 @@
     { RLIMIT_NOFILE, 	"descriptors", 1,	""		},
 # endif /* RLIMIT_NOFILE */
 
+# ifdef RLIMIT_NPTS
+    { RLIMIT_NPTS,	"pseudoterminals", 1,	""		},
+# endif /* RLIMIT_NPTS */
+
+# ifdef RLIMIT_KQUEUES
+    { RLIMIT_KQUEUES,	"kqueues",	1,	""		},
+# endif /* RLIMIT_KQUEUES */
+
 # ifdef RLIMIT_CONCUR
     { RLIMIT_CONCUR, 	"concurrency", 1,	"thread(s)"	},
 # endif /* RLIMIT_CONCUR */
@@ -1939,6 +1972,10 @@
     { RLIMIT_NPROC,	"maxproc",	1,	""		},
 # endif /* RLIMIT_NPROC */
 
+# ifdef RLIMIT_NTHR
+    { RLIMIT_NTHR,	"maxthread",	1,	""		},
+# endif /* RLIMIT_NTHR */
+
 # if defined(RLIMIT_OFILE) && !defined(RLIMIT_NOFILE)
     { RLIMIT_OFILE,	"openfiles",	1,	""		},
 # endif /* RLIMIT_OFILE && !defined(RLIMIT_NOFILE) */
@@ -1955,6 +1992,10 @@
     { RLIMIT_LOCKS,	"maxlocks",	1,	""		}, 
 # endif /* RLIMIT_LOCKS */ 
 
+# ifdef RLIMIT_POSIXLOCKS
+    { RLIMIT_POSIXLOCKS,"posixlocks",	1,	""		},
+# endif /* RLIMIT_POSIXLOCKS */
+
 # ifdef RLIMIT_SIGPENDING 
     { RLIMIT_SIGPENDING,"maxsignal",	1,	""		}, 
 # endif /* RLIMIT_SIGPENDING */ 
@@ -2407,12 +2448,20 @@
     didcch = state->didcch;
 #endif /* CLOSE_ON_EXEC */
     didfds = state->didfds;
-    xclose(SHIN);
-    xclose(SHOUT);
-    xclose(SHDIAG);
+    if (state->saveIN != SHIN)
+	xclose(SHIN);
+    if (state->saveOUT != SHOUT)
+	xclose(SHOUT);
+    if (state->saveDIAG != SHDIAG)
+	xclose(SHDIAG);
     close_on_exec(SHIN = dmove(state->saveIN, state->SHIN), 1);
     close_on_exec(SHOUT = dmove(state->saveOUT, state->SHOUT), 1);
     close_on_exec(SHDIAG = dmove(state->saveDIAG, state->SHDIAG), 1);
+    if (didfds) {
+	close_on_exec(dcopy(SHIN, 0), 1);
+	close_on_exec(dcopy(SHOUT, 1), 1);
+	close_on_exec(dcopy(SHDIAG, 2), 1);
+    }
 }
 
 static Char **Ggv;
@@ -2681,3 +2730,22 @@
     }
 #endif /* NLS_CATALOGS */
 }
+
+int
+getYN(const char *prompt)
+{
+    int doit;
+    char c;
+
+    xprintf("%s", prompt);
+    flush();
+    (void) force_read(SHIN, &c, sizeof(c));
+    /* 
+     * Perhaps we should use the yesexpr from the
+     * actual locale
+     */
+    doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
+    while (c != '\n' && force_read(SHIN, &c, sizeof(c)) == sizeof(c))
+	continue;
+    return doit;
+}

Modified: vendor/tcsh/dist/sh.glob.c
===================================================================
--- vendor/tcsh/dist/sh.glob.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.glob.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.glob.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.glob.c,v 3.95 2016/08/01 16:21:09 christos Exp $ */
 /*
  * sh.glob.c: Regular expression expansion
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.glob.c,v 3.82 2011/02/27 00:15:17 christos Exp $")
+RCSID("$tcsh: sh.glob.c,v 3.95 2016/08/01 16:21:09 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -594,8 +594,13 @@
     Char *p;
 
     while ((p = *t++) != '\0')
-	while (*p)
-	    *p++ &= TRIM;
+	while (*p) {
+#if INVALID_BYTE != 0
+	    if ((*p & INVALID_BYTE) != INVALID_BYTE)	/* *p < INVALID_BYTE */
+#endif
+		*p &= TRIM;
+	    p++;
+	}
 }
 
 int
@@ -699,11 +704,15 @@
     int    hadnl;
     int     pvec[2], quoted;
     Char   *fakecom[2], ibuf[BUFSIZE];
-    char    tibuf[BUFSIZE];
 
     hadnl = 0;
     icnt = 0;
-    quoted = (literal || (cp[0] & QUOTE)) ? QUOTE : 0;
+    if (!literal) {
+	for (ip = cp; (*ip & QUOTE) != 0; ip++)
+		continue;
+	quoted = *ip == '\0';
+    } else
+	quoted = literal;
     faket.t_dtyp = NODE_COMMAND;
     faket.t_dflg = F_BACKQ;
     faket.t_dlef = 0;
@@ -760,6 +769,9 @@
 	omark = cleanup_push_mark();
 	getexit(osetexit);
 	for (;;) {
+	    struct wordent paraml1;
+	    initlex(&paraml1);
+
 	    (void) setexit();
 	    justpr = 0;
 	    
@@ -775,19 +787,19 @@
 		seterr = NULL;
 	    }
 
-	    (void) lex(&paraml);
-	    cleanup_push(&paraml, lex_cleanup);
+	    freelex(&paraml1);
+	    (void) lex(&paraml1);
+	    cleanup_push(&paraml1, lex_cleanup);
 	    if (seterr)
 		stderror(ERR_OLD);
-	    alias(&paraml);
-	    t = syntax(paraml.next, &paraml, 0);
-	    if (t == NULL)
-		return;
+	    alias(&paraml1);
+	    t = syntax(paraml1.next, &paraml1, 0);
 	    cleanup_push(t, syntax_cleanup);
 	    /* The F_BACKQ flag must set so the job output is correct if
 	     * printexitvalue is set.  If it's not set, the job output
 	     * will have "Exit N" appended where N is the exit status. */
-	    t->t_dflg = F_BACKQ|F_NOFORK;
+	    if (t)
+		    t->t_dflg = F_BACKQ|F_NOFORK;
 	    if (seterr)
 		stderror(ERR_OLD);
 #ifdef SIGTSTP
@@ -801,7 +813,7 @@
 #endif
 	    execute(t, -1, NULL, NULL, TRUE);
 
-	    cleanup_until(&paraml);
+	    cleanup_until(&paraml1);
 	}
     }
     cleanup_until(&pvec[1]);
@@ -809,45 +821,13 @@
     ip = NULL;
     do {
 	ssize_t     cnt = 0;
-	char   *tmp;
 
-	tmp = tibuf;
 	for (;;) {
-	    while (icnt == 0) {
-		int     i, eof;
-
+	    if (icnt == 0) {
 		ip = ibuf;
-		icnt = xread(pvec[0], tmp, tibuf + BUFSIZE - tmp);
-		eof = 0;
-		if (icnt <= 0) {
-		    if (tmp == tibuf)
-			goto eof;
-		    icnt = 0;
-		    eof = 1;
-		}
-		icnt += tmp - tibuf;
-		i = 0;
-		tmp = tibuf;
-		while (tmp < tibuf + icnt) {
-		    int len;
-
-		    len = normal_mbtowc(&ip[i], tmp, tibuf + icnt - tmp);
-		    if (len == -1) {
-		        reset_mbtowc();
-		        if (!eof && (size_t)(tibuf + icnt - tmp) < MB_CUR_MAX) {
-			    break; /* Maybe a partial character */
-			}
-			ip[i] = (unsigned char) *tmp | INVALID_BYTE; /* Error */
-		    }
-		    if (len <= 0)
-		        len = 1;
-		    i++;
-		    tmp += len;
-		}
-		if (tmp != tibuf)
-		    memmove (tibuf, tmp, tibuf + icnt - tmp);
-		tmp = tibuf + (tibuf + icnt - tmp);
-		icnt = i;
+		icnt = wide_read(pvec[0], ibuf, BUFSIZE, 0);
+		if (icnt <= 0)
+		    goto eof;
 	    }
 	    if (hadnl)
 		break;
@@ -870,7 +850,9 @@
 	    if (!quoted && (c == ' ' || c == '\t'))
 		break;
 	    cnt++;
-	    Strbuf_append1(word, c | quoted);
+	    if (c == '\\' || quoted)
+		c |= QUOTE;
+	    Strbuf_append1(word, c);
 	}
 	/*
 	 * Unless at end-of-file, we will form a new word here if there were

Modified: vendor/tcsh/dist/sh.h
===================================================================
--- vendor/tcsh/dist/sh.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.h,v 3.178 2016/09/12 16:33:54 christos Exp $ */
 /*
  * sh.h: Catch it all globals and includes file!
  */
@@ -127,6 +127,11 @@
 #if !defined(__inline) && !defined(__GNUC__) && !defined(_MSC_VER)
 #define __inline
 #endif
+#ifdef _MSC_VER
+#define TCSH_PTRDIFF_T_FMT "I"
+#else
+#define TCSH_PTRDIFF_T_FMT "t"
+#endif
 /* Elide unused argument warnings */
 #define USE(a)	(void) (a)
 #define TCSH_IGNORE(a)	tcsh_ignore((intptr_t)a)
@@ -188,6 +193,11 @@
 # endif /* SYSVREL */
 #endif /* ECHO_STYLE */
 
+/* values for noclobber */
+#define NOCLOBBER_DEFAULT  1
+#define NOCLOBBER_NOTEMPTY 2
+#define NOCLOBBER_ASK      4
+
 /*
  * The shell moves std in/out/diag and the old std input away from units
  * 0, 1, and 2 so that it is easy to set up these standards for invoked
@@ -428,9 +438,7 @@
 # if (defined(_SS_SIZE) || defined(_SS_MAXSIZE)) && defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY)
 #  if !defined(__APPLE__) /* Damnit, where is getnameinfo() folks? */
 #   if !defined(sgi)
-#    if !defined(__CYGWIN__)
-#     define INET6
-#    endif /* __CYGWIN__ */
+#    define INET6
 #   endif /* sgi */
 #  endif /* __APPLE__ */
 # endif
@@ -440,21 +448,7 @@
 #ifdef PURIFY
 /* exit normally, allowing purify to trace leaks */
 # define _exit		exit
-typedef  int		pret_t;
-#else /* !PURIFY */
-/*
- * If your compiler complains, then you can either
- * throw it away and get gcc or, use the following define
- * and get rid of the typedef.
- * [The 4.2/3BSD vax compiler does not like that]
- * Both MULTIFLOW and PCC compilers exhbit this bug.  -- sterling at netcom.com
- */
-# if (defined(vax) || defined(uts) || defined(MULTIFLOW) || defined(PCC)) && !defined(__GNUC__)
-#  define pret_t void
-# else /* !((vax || uts || MULTIFLOW || PCC) && !__GNUC__) */
-typedef void pret_t;
-# endif /* (vax || uts || MULTIFLOW || PCC) && !__GNUC__ */
-#endif /* PURIFY */
+#endif /* !PURIFY */
 
 /*
  * ASCII vs. EBCDIC
@@ -573,7 +567,7 @@
 EXTERN int    noexec IZERO;	/* Don't execute, just syntax check */
 EXTERN int    pjobs IZERO;	/* want to print jobs if interrupted */
 EXTERN int    setintr IZERO;	/* Set interrupts on/off -> Wait intr... */
-EXTERN int    handle_intr IZERO;/* Are we currently handling an interrupt? */
+EXTERN int    handle_interrupt IZERO;/* Are we currently handling an interrupt? */
 EXTERN int    havhash IZERO;	/* path hashing is available */
 EXTERN int    editing IZERO;	/* doing filename expansion and line editing */
 EXTERN int    noediting IZERO;	/* initial $term defaulted to noedit */
@@ -585,8 +579,10 @@
 EXTERN int    is1atty IZERO;	/* is file descriptor 1 a tty (didfds mode) */
 EXTERN int    is2atty IZERO;	/* is file descriptor 2 a tty (didfds mode) */
 EXTERN int    arun IZERO;	/* Currently running multi-line-aliases */
-EXTERN int     implicit_cd IZERO;/* implicit cd enabled?(1=enabled,2=verbose) */
+EXTERN int    implicit_cd IZERO;/* implicit cd enabled?(1=enabled,2=verbose) */
+EXTERN int    cdtohome IZERO;	/* cd without args goes home */
 EXTERN int    inheredoc IZERO;	/* Currently parsing a heredoc */
+EXTERN int    no_clobber IZERO;	/* no clobber enabled? 1=yes 2=notempty, 4=ask*/
 /* We received a window change event */
 EXTERN volatile sig_atomic_t windowchg IZERO;
 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
@@ -635,9 +631,11 @@
 /*
  * Miscellany
  */
+EXTERN pid_t   mainpid;		/* pid of the main shell ($$) */
 EXTERN Char   *doldol;		/* Character pid for $$ */
 EXTERN pid_t   backpid;		/* pid of the last background job */
 
+
 /*
  * Ideally these should be uid_t, gid_t, pid_t. I cannot do that right now
  * cause pid's could be unsigned and that would break our -1 flag, and 
@@ -717,14 +715,21 @@
 #define		ASCII		0177
 #ifdef WIDE_STRINGS		/* Implies SHORT_STRINGS */
 /* 31st char bit used for 'ing (not 32nd, we want all values nonnegative) */
-# define	QUOTE		0x40000000
-# define	TRIM		0x3FFFFFFF /* Mask to strip quote bit */
+/*
+ * Notice
+ *
+ * By fix for handling unicode name file, 32nd bit is used.
+ * We need use '&' instead of '> or <' when comparing with INVALID_BYTE etc..
+ * Cast to uChar is not recommended,
+ *  becase Char is 4bytes but uChar is 8bytes on I32LP64. */
+# define	QUOTE		0x80000000
+# define	TRIM		0x7FFFFFFF /* Mask to strip quote bit */
 # define	UNDER		0x08000000 /* Underline flag */
 # define	BOLD		0x04000000 /* Bold flag */
 # define	STANDOUT	0x02000000 /* Standout flag */
 # define	LITERAL		0x01000000 /* Literal character flag */
 # define	ATTRIBUTES	0x0F000000 /* The bits used for attributes */
-# define	INVALID_BYTE	0x00800000 /* Invalid character on input */
+# define	INVALID_BYTE	0xF0000000 /* Invalid character on input */
 # ifdef SOLARIS2
 #  define	CHAR		0x30FFFFFF /* Mask to mask out the character */
 # else
@@ -753,6 +758,8 @@
 #endif
 #define		CHAR_DBWIDTH	(LITERAL|(LITERAL-1))
 
+# define 	MAX_UTF32	0x7FFFFFFF	/* max UTF32 is U+7FFFFFFF */
+
 EXTERN int     AsciiOnly;	/* If set only 7 bits expected in characters */
 
 /*
@@ -1020,10 +1027,6 @@
  * Filename/command name expansion variables
  */
 
-#ifdef __CYGWIN__
-# undef MAXPATHLEN
-#endif /* __CYGWIN__ */
-
 #ifndef MAXPATHLEN
 # ifdef PATH_MAX
 #  define MAXPATHLEN PATH_MAX
@@ -1065,7 +1068,7 @@
     unsigned Hhash;                     /* hash value of command line */
 }       Histlist IZERO_STRUCT;
 
-EXTERN struct wordent paraml;	/* Current lexical word list */
+extern struct wordent paraml;	/* Current lexical word list */
 EXTERN int     eventno;		/* Next events number */
 EXTERN int     lastev;		/* Last event reference (default) */
 
@@ -1166,12 +1169,14 @@
     const char *pname;		/* print name */
 } mesg[];
 
-/* word_chars is set by default to WORD_CHARS but can be overridden by
-   the worchars variable--if unset, reverts to WORD_CHARS */
+/* word_chars is set by default to WORD_CHARS (or WORD_CHARS_VI) but can
+   be overridden by the wordchars variable--if unset, reverts to
+   WORD_CHARS (or WORD_CHARS_VI) */
 
 EXTERN Char   *word_chars;
 
 #define WORD_CHARS "*?_-.[]~="	/* default chars besides alnums in words */
+#define WORD_CHARS_VI "_"	/* default chars besides alnums in words */
 
 EXTERN Char   *STR_SHELLPATH;
 
@@ -1179,6 +1184,7 @@
 EXTERN Char   *STR_BSHELL;
 #endif 
 EXTERN Char   *STR_WORD_CHARS;
+EXTERN Char   *STR_WORD_CHARS_VI;
 EXTERN Char  **STR_environ IZERO;
 
 extern int     dont_free;	/* Tell free that we are in danger if we free */

Modified: vendor/tcsh/dist/sh.hist.c
===================================================================
--- vendor/tcsh/dist/sh.hist.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.hist.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.hist.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.hist.c,v 3.61 2015/06/06 21:19:08 christos Exp $ */
 /*
  * sh.hist.c: Shell history expansions and substitutions
  */
@@ -32,10 +32,12 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.hist.c,v 3.53 2011/01/24 18:10:26 christos Exp $")
+RCSID("$tcsh: sh.hist.c,v 3.61 2015/06/06 21:19:08 christos Exp $")
 
+#include <stdio.h>	/* for rename(2), grr. */
 #include <assert.h>
 #include "tc.h"
+#include "dotlock.h"
 
 extern int histvalid;
 extern struct Strbuf histline;
@@ -68,12 +70,12 @@
 
 static const int fastMergeErase = 1;
 static unsigned histCount = 0;		/* number elements on history list */
+static int histlen = 0;
 static struct Hist *histTail = NULL;     /* last element on history list */
 static struct Hist *histMerg = NULL;	 /* last element merged by Htime */
 
 static void insertHistHashTable(struct Hist *, unsigned);
 
-
 /* Insert new element (hp) in history list after specified predecessor (pp). */
 static void
 hinsert(struct Hist *hp, struct Hist *pp)
@@ -107,7 +109,7 @@
 
 /* Prune length of history list to specified size by history variable. */
 PG_STATIC void
-discardExcess(int histlen)
+discardExcess(int hlen)
 {
     struct Hist *hp, *np;
     if (histTail == NULL) {
@@ -117,23 +119,23 @@
     /* Prune dummy entries from the front, then old entries from the back. If
      * the list is still too long scan the whole list as before.  But only do a
      * full scan if the list is more than 6% (1/16th) too long. */
-    while (histCount > (unsigned)histlen && (np = Histlist.Hnext)) {
-        if (eventno - np->Href >= histlen || histlen == 0)
+    while (histCount > (unsigned)hlen && (np = Histlist.Hnext)) {
+        if (eventno - np->Href >= hlen || hlen == 0)
             hremove(np), hfree(np);
         else
             break;
     }
-    while (histCount > (unsigned)histlen && (np = histTail) != &Histlist) {
-        if (eventno - np->Href >= histlen || histlen == 0)
+    while (histCount > (unsigned)hlen && (np = histTail) != &Histlist) {
+        if (eventno - np->Href >= hlen || hlen == 0)
             hremove(np), hfree(np);
         else
             break;
     }
-    if (histCount - (histlen >> 4) <= (unsigned)histlen)
+    if (histCount - (hlen >> 4) <= (unsigned)hlen)
 	return;				/* don't bother doing the full scan */
-    for (hp = &Histlist; histCount > (unsigned)histlen &&
+    for (hp = &Histlist; histCount > (unsigned)hlen &&
 	(np = hp->Hnext) != NULL;)
-        if (eventno - np->Href >= histlen || histlen == 0)
+        if (eventno - np->Href >= hlen || hlen == 0)
             hremove(np), hfree(np);
         else
             hp = np;
@@ -145,20 +147,9 @@
   struct wordent *sp,
   int mflg)				/* true if -m (merge) specified */
 {
-    int histlen = 0;
-    Char   *cp;
-
     /* throw away null lines */
     if (sp && sp->next->word[0] == '\n')
 	return;
-    cp = varval(STRhistory);
-    while (*cp) {
-	if (!Isdigit(*cp)) {
-	    histlen = 0;
-	    break;
-	}
-	histlen = histlen * 10 + *cp++ - '0';
-    }
     if (sp)
         (void) enthist(++eventno, sp, 1, mflg, histlen);
     discardExcess(histlen);
@@ -711,9 +702,9 @@
 
 /* Computes a new hash table size, when the current one is too small. */
 static unsigned
-getHashTableSize(int histlen)
+getHashTableSize(int hlen)
 {
-    unsigned target = histlen * 2;
+    unsigned target = hlen * 2;
     unsigned e = 5;
     unsigned size;
     while ((size = 1<<e) < target)
@@ -729,17 +720,16 @@
 
 /* Create the hash table or resize, if necessary. */
 static void
-createHistHashTable(int histlen)
+createHistHashTable(int hlen)
 {
-    if (histlen == 0) {
+    if (hlen == 0) {
 	discardHistHashTable();
         return;
     }
-    if (histlen < 0) {
-        histlen = getn(varval(STRhistory));
-	if (histlen == 0)
+    if (hlen < 0) {
+	if (histlen <= 0)
 	    return;			/* no need for hash table */
-	assert(histlen > 0);
+	hlen = histlen;
     }
     if (histHashTable != NULL) {
 	if (histCount < histHashTableLength * 3 / 4)
@@ -747,7 +737,7 @@
 	discardHistHashTable();		/* too small */
     }
     histHashTableLength = getHashTableSize(
-	histlen > (int)histCount ? histlen : (int)histCount);
+	hlen > (int)histCount ? hlen : (int)histCount);
     histHashTable = xmalloc(histHashTableLength * sizeof(struct Hist *));
     memset(histHashTable, 0, histHashTableLength * sizeof(struct Hist *));
     assert(histHashTable[0] == emptyHTE);
@@ -934,7 +924,7 @@
   struct wordent *lp,
   int docopy,
   int mflg,				/* true if merge requested */
-  int histlen)				/* -1 if unknown */
+  int hlen)				/* -1 if unknown */
 {
     struct Hist *p = NULL, *pp = &Histlist, *pTime = NULL;
     struct Hist *np;
@@ -944,7 +934,7 @@
     if ((dp = varval(STRhistdup)) != STRNULL) {
 	if (eq(dp, STRerase)) {
 	    /* masaoki at akebono.tky.hp.com (Kobayashi Masaoki) */
-            createHistHashTable(histlen);
+            createHistHashTable(hlen);
             lpHash = hashhist(lp);
             assert(lpHash != 0);
             p = findHistHashTable(lp, lpHash);
@@ -963,7 +953,7 @@
 	    }
 	}
 	else if (eq(dp, STRall)) {
-            createHistHashTable(histlen);
+            createHistHashTable(hlen);
             lpHash = hashhist(lp);
             assert(lpHash != 0);
             p = findHistHashTable(lp, lpHash);
@@ -1031,7 +1021,7 @@
     else
         pp = &Histlist;                 /* insert at beginning of history */
     hinsert(np, pp);
-    if (lpHash && histlen != 0)		/* erase & all modes use hash table */
+    if (lpHash && hlen != 0)		/* erase & all modes use hash table */
         insertHistHashTable(np, lpHash);
     else
         discardHistHashTable();
@@ -1053,6 +1043,8 @@
 PG_STATIC void
 phist(struct Hist *hp, int hflg)
 {
+    if (hp->Href < 0)
+	return;
     if (hflg & HIST_ONLY) {
 	int old_output_raw;
 
@@ -1207,7 +1199,7 @@
 	    buf = xmalloc(Strlen(istr) * MB_LEN_MAX + 1);
 
 	    for (p = buf, ip = istr; *ip != '\0'; ip++)
-		p += one_wctomb(p, CHAR & *ip);
+		p += one_wctomb(p, *ip);
 
 	    *p = '\0';
 	    xfree(istr);
@@ -1220,13 +1212,21 @@
     }
 }
 
+static void
+dotlock_cleanup(void* lockpath)
+{
+	dot_unlock((char*)lockpath);
+}
+
 /* Save history before exiting the shell. */
 void
 rechist(Char *fname, int ref)
 {
-    Char    *snum;
+    Char    *snum, *rs;
     int     fp, ftmp, oldidfds;
     struct varent *shist;
+    char path[MAXPATHLEN];
+    struct stat st;
     static Char   *dumphist[] = {STRhistory, STRmhT, 0, 0};
 
     if (fname == NULL && !ref) 
@@ -1255,12 +1255,14 @@
      * with numerous shells being in simultaneous use. Imagine
      * any kind of window system. All these shells 'share' the same 
      * ~/.history file for recording their command line history. 
-     * Currently the automatic merge can only succeed when the shells
-     * nicely quit one after another. 
+     * We try to handle the case of multiple shells trying to merge
+     * histories at the same time, by creating semi-unique filenames
+     * and saving the history there first and then trying to rename
+     * them in the proper history file.
      *
      * Users that like to nuke their environment require here an atomic
-     * 	loadhist-creat-dohist(dumphist)-close
-     * sequence.
+     * loadhist-creat-dohist(dumphist)-close sequence which is given
+		 * by optional lock parameter to savehist.
      *
      * jw.
      */ 
@@ -1271,16 +1273,49 @@
      */
     oldidfds = didfds;
     didfds = 0;
-    if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL)
-	if (shist->vec[1] && eq(shist->vec[1], STRmerge))
+    if ((shist = adrof(STRsavehist)) != NULL && shist->vec != NULL) {
+	size_t i;
+	int merge = 0, lock = 0;
+
+	for (i = 1; shist->vec[i]; i++) {
+	    if (eq(shist->vec[i], STRmerge))
+		merge++;
+	    if (eq(shist->vec[i], STRlock))
+		lock++;
+	}
+
+	if (merge) {
+	    if (lock) {
+#ifndef WINNT_NATIVE
+		char *lockpath = strsave(short2str(fname));
+		cleanup_push(lockpath, xfree);
+		/* Poll in 100 miliseconds interval to obtain the lock. */
+		if ((dot_lock(lockpath, 100) == 0))
+		    cleanup_push(lockpath, dotlock_cleanup);
+#endif
+	    }
 	    loadhist(fname, 1);
+	}
+    }
+    rs = randsuf();
+    xsnprintf(path, sizeof(path), "%S.%S", fname, rs);
+    xfree(rs);
 
-    fp = xcreat(short2str(fname), 0600);
-    cleanup_until(fname);
+    fp = xcreat(path, 0600);
     if (fp == -1) {
 	didfds = oldidfds;
+	cleanup_until(fname);
 	return;
     }
+    /* Try to preserve ownership and permissions of the original history file */
+#ifndef WINNT_NATIVE
+    if (stat(short2str(fname), &st) != -1) {
+	TCSH_IGNORE(fchown(fp, st.st_uid, st.st_gid));
+	TCSH_IGNORE(fchmod(fp, st.st_mode));
+    }
+#else
+    UNREFERENCED_PARAMETER(st);
+#endif
     ftmp = SHOUT;
     SHOUT = fp;
     dumphist[2] = snum;
@@ -1288,6 +1323,8 @@
     xclose(fp);
     SHOUT = ftmp;
     didfds = oldidfds;
+    (void)rename(path, short2str(fname));
+    cleanup_until(fname);
 }
 
 
@@ -1317,3 +1354,10 @@
 	    hp->Hnum = hp->Href = n--;
     }
 }
+
+void
+sethistory(int n)
+{
+    histlen = n;
+    discardExcess(histlen);
+}

Modified: vendor/tcsh/dist/sh.init.c
===================================================================
--- vendor/tcsh/dist/sh.init.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.init.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.init.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.init.c,v 3.64 2013/02/11 13:51:16 christos Exp $ */
 /*
  * sh.init.c: Function and signal tables
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.init.c,v 3.63 2006/08/23 01:49:32 mitr Exp $")
+RCSID("$tcsh: sh.init.c,v 3.64 2013/02/11 13:51:16 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -214,7 +214,7 @@
  */
 
 /* We define NUMSIG to avoid changing NSIG or MAXSIG */
-#if defined(POSIX) && !defined(__CYGWIN__)
+#if defined(POSIX) && (!defined(__CYGWIN__) || defined (__x86_64__))
 # define NUMSIG 65
 #else /* !POSIX */
 # define NUMSIG 33

Modified: vendor/tcsh/dist/sh.lex.c
===================================================================
--- vendor/tcsh/dist/sh.lex.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.lex.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.lex.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.lex.c,v 3.91 2016/08/01 16:21:09 christos Exp $ */
 /*
  * sh.lex.c: Lexical analysis into tokens
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.lex.c,v 3.87 2011/01/24 17:48:15 christos Exp $")
+RCSID("$tcsh: sh.lex.c,v 3.91 2016/08/01 16:21:09 christos Exp $")
 
 #include "ed.h"
 
@@ -66,7 +66,6 @@
 static	struct wordent	*getsub		(struct wordent *);
 static	Char 		*subword	(Char *, Char, int *, size_t *);
 static	struct wordent	*dosub		(Char, struct wordent *, int);
-static	ssize_t		 wide_read	(int, Char *, size_t, int);
 
 /*
  * Peekc is a peek character for getC, peekread for readc.
@@ -258,6 +257,14 @@
 }
 
 void
+initlex(struct wordent *vp)
+{
+	vp->word = STRNULL;
+	vp->prev = vp;
+	vp->next = vp;
+}
+
+void
 freelex(struct wordent *vp)
 {
     struct wordent *fp;
@@ -378,7 +385,7 @@
 			     */
 			    c |= QUOTE;
 			ungetC(c);
-			c = '\\';
+			c = '\\' | QUOTE;
 		    }
 		}
 	    }
@@ -1539,7 +1546,7 @@
     }
 }
 
-static ssize_t
+ssize_t
 wide_read(int fildes, Char *buf, size_t nchars, int use_fclens)
 {
     char cbuf[BUFSIZE + 1];

Modified: vendor/tcsh/dist/sh.misc.c
===================================================================
--- vendor/tcsh/dist/sh.misc.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.misc.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.misc.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.misc.c,v 3.50 2015/06/06 21:19:08 christos Exp $ */
 /*
  * sh.misc.c: Miscelaneous functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.misc.c,v 3.46 2010/05/08 00:41:58 christos Exp $")
+RCSID("$tcsh: sh.misc.c,v 3.50 2015/06/06 21:19:08 christos Exp $")
 
 static	int	renum	(int, int);
 static  Char  **blkend	(Char **);
@@ -450,8 +450,13 @@
 
     if (!cp)
 	return (cp);
-    while ((*dp++ &= TRIM) != '\0')
-	continue;
+    while (*dp != '\0') {
+#if INVALID_BYTE != 0
+	if ((*dp & INVALID_BYTE) != INVALID_BYTE)    /* *dp < INVALID_BYTE */
+#endif
+		*dp &= TRIM;
+	dp++;
+    }
     return (cp);
 }
 
@@ -462,8 +467,17 @@
 
     if (!cp)
 	return (cp);
-    while (*dp != '\0')
-	*dp++ |= QUOTE;
+    while (*dp != '\0') {
+#ifdef WIDE_STRINGS
+	if ((*dp & 0xffffff80) == 0)	/* *dp < 0x80 */
+#elif defined SHORT_STRINGS
+	if ((*dp & 0xff80) == 0)	/* *dp < 0x80 */
+#else
+	if ((*dp & 0x80) == 0)		/* *dp < 0x80 */
+#endif
+	    *dp |= QUOTE;
+	dp++;
+    }
     return (cp);
 }
 
@@ -533,7 +547,8 @@
     if (fildes < 0)
 	return;
     while (close(fildes) == -1 && errno == EINTR)
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
 }
 
 void
@@ -540,7 +555,8 @@
 xclosedir(DIR *dirp)
 {
     while (closedir(dirp) == -1 && errno == EINTR)
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
 }
 
 int
@@ -549,7 +565,8 @@
     int res;
 
     while ((res = creat(path, mode)) == -1 && errno == EINTR)
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
     return res;
 }
 
@@ -560,7 +577,8 @@
     int res;
 
     while ((res = dup2(fildes, fildes2)) == -1 && errno == EINTR)
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
     return res;
 }
 #endif
@@ -572,7 +590,8 @@
 
     errno = 0;
     while ((res = getgrgid(xgid)) == NULL && errno == EINTR) {
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
 	errno = 0;
     }
     return res;
@@ -585,7 +604,8 @@
 
     errno = 0;
     while ((res = getpwnam(name)) == NULL && errno == EINTR) {
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
 	errno = 0;
     }
     return res;
@@ -598,7 +618,8 @@
 
     errno = 0;
     while ((res = getpwuid(xuid)) == NULL && errno == EINTR) {
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
 	errno = 0;
     }
     return res;
@@ -611,7 +632,8 @@
 
     if ((oflag & O_CREAT) == 0) {
 	while ((res = open(path, oflag)) == -1 && errno == EINTR)
-	    handle_pending_signals();
+	    if (handle_pending_signals())
+		break;
     } else {
 	va_list ap;
 	mode_t mode;
@@ -623,7 +645,8 @@
 	mode = va_arg(ap, int);
 	va_end(ap);
 	while ((res = open(path, oflag, mode)) == -1 && errno == EINTR)
-	    handle_pending_signals();
+	    if (handle_pending_signals())
+		break;
     }
     return res;
 }
@@ -636,7 +659,8 @@
     /* This is where we will be blocked most of the time, so handle signals
        that didn't interrupt any system call. */
     do
-      handle_pending_signals();
+      if (handle_pending_signals())
+	  break;
     while ((res = read(fildes, buf, nbyte)) == -1 && errno == EINTR);
     return res;
 }
@@ -649,7 +673,8 @@
 
     while ((res = tcsetattr(fildes, optional_actions, termios_p)) == -1 &&
 	   errno == EINTR)
-	handle_pending_signals();
+	if (handle_pending_signals())
+	    break;
     return res;
 }
 #endif
@@ -662,7 +687,8 @@
     /* This is where we will be blocked most of the time, so handle signals
        that didn't interrupt any system call. */
     do
-      handle_pending_signals();
+      if (handle_pending_signals())
+	  break;
     while ((res = write(fildes, buf, nbyte)) == -1 && errno == EINTR);
     return res;
 }

Modified: vendor/tcsh/dist/sh.parse.c
===================================================================
--- vendor/tcsh/dist/sh.parse.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.parse.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.parse.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.parse.c,v 3.19 2011/03/30 16:21:37 christos Exp $ */
 /*
  * sh.parse.c: Interpret a list of tokens
  */

Modified: vendor/tcsh/dist/sh.print.c
===================================================================
--- vendor/tcsh/dist/sh.print.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.print.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.print.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.print.c,v 3.37 2015/05/10 13:29:28 christos Exp $ */
 /*
  * sh.print.c: Primitive Output routines.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.print.c,v 3.36 2011/05/25 20:17:20 christos Exp $")
+RCSID("$tcsh: sh.print.c,v 3.37 2015/05/10 13:29:28 christos Exp $")
 
 #include "ed.h"
 
@@ -231,13 +231,13 @@
 	return;
     if (GettingInput && !Tty_raw_mode && linp < &linbuf[sizeof linbuf - 10])
 	return;
-    if (handle_intr)
-	exitset = 1;
+    if (handle_interrupt)
+       exitset = 1;
 
     if (interrupted) {
 	interrupted = 0;
 	linp = linbuf;		/* avoid recursion as stderror calls flush */
-	if (handle_intr)
+	if (handle_interrupt)
 	    fixerror();
 	else
 	    stderror(ERR_SILENT);
@@ -298,11 +298,11 @@
 	case EDQUOT:
 #endif
 	/* Nothing to do, but die */
-	    if (handle_intr == 0)
+	    if (handle_interrupt == 0)
 		xexit(1);
 	    /*FALLTHROUGH*/
 	default:
-	    if (handle_intr)
+	    if (handle_interrupt)
 		fixerror();
 	    else
 		stderror(ERR_SILENT);

Modified: vendor/tcsh/dist/sh.proc.c
===================================================================
--- vendor/tcsh/dist/sh.proc.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.proc.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.proc.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.c,v 3.134 2016/09/23 19:17:28 christos Exp $ */
 /*
  * sh.proc.c: Job manipulations
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.proc.c,v 3.121 2012/01/25 15:34:41 christos Exp $")
+RCSID("$tcsh: sh.proc.c,v 3.134 2016/09/23 19:17:28 christos Exp $")
 
 #include "ed.h"
 #include "tc.h"
@@ -47,11 +47,9 @@
 # define HZ 16
 #endif /* aiws */
 
-#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
-# if !defined(__ANDROID__)
-#  define BSDWAIT
-# endif
-#endif /* _BSD || (IRIS4D && __STDC__) || __lucid || glibc */
+#if defined(_BSD) || (defined(IRIS4D) && __STDC__) || defined(__lucid)
+# define BSDWAIT
+#endif /* _BSD || (IRIS4D && __STDC__) || __lucid */
 #ifndef WTERMSIG
 # define WTERMSIG(w)	(((union wait *) &(w))->w_termsig)
 # ifndef BSDWAIT
@@ -191,8 +189,13 @@
 #   else
     /* both a wait3 and rusage */
 #    if !defined(BSDWAIT) || defined(NeXT) || defined(MACH) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || (defined(IRIS4D) && SYSVREL <= 3) || defined(__lucid) || defined(__osf__)
+#ifdef __ANDROID__ /* no wait3, only wait4 */
+    pid = wait4(-1, &w,
+       (setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
+#else
     pid = wait3(&w,
        (setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
+#endif /* __ANDROID__ */
 #    else /* BSDWAIT */
     pid = wait3(&w.w_status,
        (setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), &ru);
@@ -507,6 +510,7 @@
     cleanup_push(&oset, sigprocmask_cleanup);
     pause_mask = oset;
     sigdelset(&pause_mask, SIGCHLD);
+    sigaddset(&pause_mask, SIGINT);
     for (;;) {
 	(void)handle_pending_signals();
 	jobflags = 0;
@@ -593,22 +597,44 @@
 dowait(Char **v, struct command *c)
 {
     struct process *pp;
+
+    /* the current block mask to be able to restore */
+    sigset_t old_mask;
+
+    /* block mask for critical section: OLD_MASK U {SIGCHLD} */
+    sigset_t block_mask;
+
+    /* ignore those during blocking sigsuspend:
+       OLD_MASK / {SIGCHLD, possibly(SIGINT)} */
     sigset_t pause_mask;
+
     int opintr_disabled, gotsig;
 
     USE(c);
     USE(v);
     pjobs++;
+
     sigprocmask(SIG_BLOCK, NULL, &pause_mask);
     sigdelset(&pause_mask, SIGCHLD);
     if (setintr)
 	sigdelset(&pause_mask, SIGINT);
+
+    /* critical section, block also SIGCHLD */
+    sigprocmask(SIG_BLOCK, NULL, &block_mask);
+    sigaddset(&block_mask, SIGCHLD);
+    sigprocmask(SIG_BLOCK, &block_mask, &old_mask);
+
+    /* detect older SIGCHLDs and remove PRUNNING flag from proclist */
+    (void)handle_pending_signals();
+
 loop:
     for (pp = proclist.p_next; pp; pp = pp->p_next)
 	if (pp->p_procid &&	/* pp->p_procid == pp->p_jobid && */
 	    pp->p_flags & PRUNNING) {
-	    (void)handle_pending_signals();
+	    /* wait for (or pick up alredy blocked) SIGCHLD */
 	    sigsuspend(&pause_mask);
+
+	    /* make the 'wait' interuptable by CTRL-C */
 	    opintr_disabled = pintr_disabled;
 	    pintr_disabled = 0;
 	    gotsig = handle_pending_signals();
@@ -618,6 +644,8 @@
 	    goto loop;
 	}
     pjobs = 0;
+
+    sigprocmask(SIG_SETMASK, &old_mask, NULL);
 }
 
 /*
@@ -963,6 +991,7 @@
     struct process *tp;
     int     jobflags, pstatus, pcond;
     const char *format;
+    int ohaderr;
 
 #ifdef BACKPIPE
     struct process *pipehead = NULL, *pipetail = NULL, *pmarker = NULL;
@@ -978,6 +1007,9 @@
     tp = pp;
     status = reason = -1;
     jobflags = 0;
+    ohaderr = haderr;
+    /* Print status to stderr, except for jobs built-in */
+    haderr = !(flag & JOBLIST);
     do {
 #ifdef BACKPIPE
 	/*
@@ -1186,6 +1218,7 @@
 	    xprintf("       ");
 	ptprint(tp);
     }
+    haderr = ohaderr;
     return (jobflags);
 }
 
@@ -1284,7 +1317,7 @@
 dojobs(Char **v, struct command *c)
 {
     struct process *pp;
-    int flag = NUMBER | NAME | REASON;
+    int flag = NUMBER | NAME | REASON | JOBLIST;
     int     i;
 
     USE(c);
@@ -1833,12 +1866,12 @@
 	    (void) signal(SIGHUP, SIG_IGN);
 	if (t->t_dflg & F_NICE) {
 	    int nval = SIGN_EXTEND_CHAR(t->t_nice);
-#ifdef HAVE_SETPRIORITY
+#if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
 	    if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
 		stderror(ERR_SYSTEM, "setpriority", strerror(errno));
-#else /* !HAVE_SETPRIORITY */
+#else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
 	    (void) nice(nval);
-#endif /* !HAVE_SETPRIORITY */
+#endif /* HAVE_SETPRIORITY  && PRIO_PROCESS */
 	}
 #ifdef F_VER
         if (t->t_dflg & F_VER) {

Modified: vendor/tcsh/dist/sh.proc.h
===================================================================
--- vendor/tcsh/dist/sh.proc.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.proc.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.proc.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.16 2016/05/24 17:41:12 christos Exp $ */
 /*
  * sh.proc.h: Process data structures and variables
  */
@@ -106,14 +106,15 @@
 #define PBRACE		(1<<18)	/* Process is {} evaluation */
 
 /* defines for arguments to pprint */
-#define	NUMBER		01
-#define	NAME		02
-#define	REASON		04
-#define	AMPERSAND	010
-#define	FANCY		020
-#define	SHELLDIR	040	/* print shell's dir if not the same */
-#define	JOBDIR		0100	/* print job's dir if not the same */
-#define	AREASON		0200
+#define	NUMBER		0x001
+#define	NAME		0x002
+#define	REASON		0x004
+#define	AMPERSAND	0x008
+#define	FANCY		0x010
+#define	SHELLDIR	0x020	/* print shell's dir if not the same */
+#define	JOBDIR		0x040	/* print job's dir if not the same */
+#define	AREASON		0x080
+#define	JOBLIST		0x100
 
 EXTERN struct process proclist IZERO_STRUCT;/* list head of all processes */
 

Modified: vendor/tcsh/dist/sh.sem.c
===================================================================
--- vendor/tcsh/dist/sh.sem.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.sem.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.sem.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.sem.c,v 3.90 2015/10/31 18:54:42 christos Exp $ */
 /*
  * sh.sem.c: I/O redirections and job forking. A touchy issue!
  *	     Most stuff with builtins is incorrect
@@ -33,7 +33,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.sem.c,v 3.86 2011/02/25 23:24:19 christos Exp $")
+RCSID("$tcsh: sh.sem.c,v 3.90 2015/10/31 18:54:42 christos Exp $")
 
 #include "tc.h"
 #include "tw.h"
@@ -212,8 +212,14 @@
 	 * If noexec then this is all we do.
 	 */
 	if (t->t_dflg & F_READ) {
+	    int old_pintr_disabled;
+
 	    xclose(0);
+	    if (setintr)
+		pintr_push_enable(&old_pintr_disabled);
 	    heredoc(t->t_dlef);
+	    if (setintr)
+		cleanup_until(&old_pintr_disabled);
 	    if (noexec)
 		xclose(0);
 	}
@@ -346,10 +352,6 @@
 	 * not pipedout, niced, nohupped, or &'d. It would be nice(?) to not
 	 * fork in some of these cases.
 	 */
-	/*
-	 * Prevent forking cd, pushd, popd, chdir cause this will cause the
-	 * shell not to change dir!
-	 */
 #ifdef BACKPIPE
 	/*
 	 * Can't have NOFORK for the tail of a pipe - because it is not the
@@ -358,11 +360,26 @@
 	 */
 	if (t->t_dflg & F_PIPEIN)
 	    t->t_dflg &= ~(F_NOFORK);
+#else
+	/*
+	 * "command | builtin" may cause major misbehaviour as noted in
+	 * in the BUGS file entry
+	 * Subject: Redirected input to built-in functions misbehaves badly
+	 * forking when the builtin is the end of the pipe corrects the
+	 * problem.
+	 */
+	if (bifunc && (t->t_dflg & F_PIPEIN))
+	    t->t_dflg &= ~(F_NOFORK);
 #endif /* BACKPIPE */
+	/*
+	 * Prevent forking cd, pushd, popd, chdir cause this will cause the
+	 * shell not to change dir! (XXX: but only for nice?)
+	 */
 	if (bifunc && (bifunc->bfunct == (bfunc_t)dochngd ||
 		       bifunc->bfunct == (bfunc_t)dopushd ||
 		       bifunc->bfunct == (bfunc_t)dopopd))
 	    t->t_dflg &= ~(F_NICE);
+
 	if (((t->t_dflg & F_TIME) || ((t->t_dflg & F_NOFORK) == 0 &&
 	     (!bifunc || t->t_dflg &
 	      (F_PIPEOUT | F_AMPERSAND | F_NICE | F_NOHUP | F_HUP)))) ||
@@ -560,13 +577,13 @@
 			(void) signal(SIGHUP, SIG_DFL);
 		    if (t->t_dflg & F_NICE) {
 			int nval = SIGN_EXTEND_CHAR(t->t_nice);
-# ifdef HAVE_SETPRIORITY
+# if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
 			if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
 				stderror(ERR_SYSTEM, "setpriority",
 				    strerror(errno));
-# else /* !HAVE_SETPRIORITY */
+# else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
 			(void) nice(nval);
-# endif /* HAVE_SETPRIORITY */
+# endif /* HAVE_SETPRIORITY && PRIO_PROCESS */
 		    }
 # ifdef F_VER
 		    if (t->t_dflg & F_VER) {
@@ -898,7 +915,7 @@
 	else
 	    fd = 0;
 	if ((flags & F_APPEND) == 0 || fd == -1) {
-	    if (!(flags & F_OVERWRITE) && adrof(STRnoclobber)) {
+	    if (!(flags & F_OVERWRITE) && no_clobber) {
 		if (flags & F_APPEND)
 		    stderror(ERR_SYSTEM, tmp, strerror(errno));
 		chkclob(tmp);
@@ -970,5 +987,13 @@
 	return;
     if (S_ISCHR(stb.st_mode))
 	return;
+    if (no_clobber & NOCLOBBER_NOTEMPTY && stb.st_size == 0)
+	return;
+    if (no_clobber & NOCLOBBER_ASK) {
+	if (getYN(CGETS(22, 15,
+	    "Do you really want to overwrite an existing file? [N/y] ")))
+	    return;
+    }
+
     stderror(ERR_EXISTS, cp);
 }

Modified: vendor/tcsh/dist/sh.set.c
===================================================================
--- vendor/tcsh/dist/sh.set.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.set.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.set.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.set.c,v 3.89 2015/09/08 15:49:53 christos Exp $ */
 /*
  * sh.set.c: Setting and Clearing of variables
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.set.c,v 3.83 2012/01/15 17:15:28 christos Exp $")
+RCSID("$tcsh: sh.set.c,v 3.89 2015/09/08 15:49:53 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -55,6 +55,7 @@
 static	void		 unsetv1	(struct varent *);
 static	void		 exportpath	(Char **);
 static	void		 balance	(struct varent *, int, int);
+static	int		 set_noclobber  (Char **);
 
 /*
  * C Shell
@@ -72,6 +73,13 @@
 	    dohash(NULL, NULL);
 	}
     }
+    else if (eq(vp, STRnoclobber)) {
+	struct varent *p = adrof(STRnoclobber);
+	if (p == NULL)
+	    stderror(ERR_NAME | ERR_UNDVAR);
+	else
+	    no_clobber = set_noclobber(p->vec);
+    }
     else if (eq(vp, STRhistchars)) {
 	Char *pn = varval(vp);
 
@@ -165,6 +173,10 @@
 	noediting = 0;
 	/* PWP: add more stuff in here later */
     }
+    else if (eq(vp, STRvimode)) {
+	VImode = 1;
+	update_wordchars();
+    }
     else if (eq(vp, STRshlvl)) {
 	tsetenv(STRKSHLVL, varval(vp));
     }
@@ -195,6 +207,9 @@
     else if (eq(vp, STRkillring)) {
 	SetKillRing((int)getn(varval(vp)));
     }
+    else if (eq(vp, STRhistory)) {
+	sethistory((int)getn(varval(vp)));
+    }
 #ifndef HAVENOUTMP
     else if (eq(vp, STRwatch)) {
 	resetwatch();
@@ -203,6 +218,9 @@
     else if (eq(vp, STRimplicitcd)) {
 	implicit_cd = ((eq(varval(vp), STRverbose)) ? 2 : 1);
     }
+    else if (eq(vp, STRcdtohome)) {
+	cdtohome = 1;
+    }
 #ifdef COLOR_LS_F
     else if (eq(vp, STRcolor)) {
 	set_color_context();
@@ -762,6 +780,8 @@
 	PRCH = tcsh ? '>' : '%';
 	PRCHROOT = '#';
     }
+    if (adrof(STRnoclobber) == 0)
+	no_clobber = 0;
     if (adrof(STRhistlit) == 0)
 	HistLit = 0;
     if (adrof(STRloginsh) == 0)
@@ -780,12 +800,18 @@
 	symlinks = 0;
     if (adrof(STRimplicitcd) == 0)
 	implicit_cd = 0;
+    if (adrof(STRcdtohome) == 0)
+	cdtohome = 0;
     if (adrof(STRkillring) == 0)
 	SetKillRing(0);
     if (did_edit && noediting && adrof(STRedit) == 0)
 	noediting = 0;
+    if (adrof(STRvimode) == 0)
+	VImode = 0;
     if (did_roe && adrof(STRrecognize_only_executables) == 0)
 	tw_cmd_free();
+    if (adrof(STRhistory) == 0)
+	sethistory(0);
 #ifdef COLOR_LS_F
     if (adrof(STRcolor) == 0)
 	set_color_context();
@@ -793,6 +819,7 @@
 #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE)
     update_dspmbyte_vars();
 #endif
+    update_wordchars();
 #ifdef NLS_CATALOGS
     nlsclose();
     nlsinit();
@@ -920,6 +947,28 @@
     cleanup_until(exppath);
 }
 
+static int
+set_noclobber(Char **val)
+{
+    Char *option;
+    int nc = NOCLOBBER_DEFAULT;
+
+    if (val == NULL)
+	return nc;
+    while (*val) {
+	if (*val == 0 || eq(*val, STRRparen))
+	    return nc;
+
+	option = *val++;
+
+	if (eq(option, STRnotempty))
+	    nc |= NOCLOBBER_NOTEMPTY;
+	else if (eq(option, STRask))
+	    nc |= NOCLOBBER_ASK;
+    }
+    return nc;
+}
+
 #ifndef lint
  /*
   * Lint thinks these have null effect
@@ -1301,3 +1350,11 @@
 }
 #endif
 #endif
+
+void
+update_wordchars(void)
+{
+    if ((word_chars == STR_WORD_CHARS) || (word_chars == STR_WORD_CHARS_VI)) {
+	word_chars = (VImode ? STR_WORD_CHARS_VI : STR_WORD_CHARS);
+    }
+}

Modified: vendor/tcsh/dist/sh.time.c
===================================================================
--- vendor/tcsh/dist/sh.time.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.time.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.time.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.time.c,v 3.37 2016/07/09 00:45:29 christos Exp $ */
 /*
  * sh.time.c: Shell time keeping and printing.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: sh.time.c,v 3.35 2010/12/09 15:39:29 christos Exp $")
+RCSID("$tcsh: sh.time.c,v 3.37 2016/07/09 00:45:29 christos Exp $")
 
 #ifdef SUNOS4
 # include <machine/param.h>
@@ -158,12 +158,12 @@
 	nval = 4;
     else if (*v	== 0 &&	any("+-", cp[0]))
 	nval = getn(cp);
-#ifdef HAVE_SETPRIORITY
+#if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS)
     if (setpriority(PRIO_PROCESS, 0, nval) == -1 && errno)
 	stderror(ERR_SYSTEM, "setpriority", strerror(errno));
-#else /* !HAVE_SETPRIORITY */
+#else /* !HAVE_SETPRIORITY || !PRIO_PROCESS */
     (void) nice(nval);
-#endif /* HAVE_SETPRIORITY */
+#endif /* HAVE_SETPRIORITY && PRIO_PROCESS */
 }
 
 #ifdef BSDTIMES
@@ -293,6 +293,7 @@
 # endif	/* _SEQUENT_ */
 #endif /* BSDTIMES */
 {
+    int ohaderr = haderr;
 #ifdef BSDTIMES
     time_t t =
     (r1->ru_utime.tv_sec - r0->ru_utime.tv_sec)	* 100 +
@@ -334,6 +335,7 @@
     ((e->tv_sec	- b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
 
     cp = "%Uu %Ss %E %P	%X+%Dk %I+%Oio %Fpf+%Ww";
+    haderr = 0;
 #else /* !BSDTIMES */
 # ifdef	_SEQUENT_
     int	    ms = (int)
@@ -340,6 +342,7 @@
     ((e->tv_sec	- b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000);
 
     cp = "%Uu %Ss %E %P	%I+%Oio	%Fpf+%Ww";
+    haderr = 0;
 # else /* !_SEQUENT_ */
 #  ifndef POSIX
     time_t ms = ((time_t)((e - b) / HZ) * 100) +
@@ -350,6 +353,7 @@
 #  endif /* POSIX */
 
     cp = "%Uu %Ss %E %P";
+    haderr = 0;
 
     /*
      * the tms stuff is	not very precise, so we	fudge it.
@@ -678,6 +682,7 @@
 		break;
 	    }
     xputchar('\n');
+    haderr = ohaderr;
 }
 
 #if defined(BSDTIMES) || defined(_SEQUENT_)

Modified: vendor/tcsh/dist/sh.types.h
===================================================================
--- vendor/tcsh/dist/sh.types.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/sh.types.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/sh.types.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/sh.types.h,v 3.43 2006/01/12 19:55:38 christos Exp $ */
 /* sh.types.h: Do the necessary typedefs for each system.
  *             Up till now I avoided making this into a separate file
  *	       But I just wanted to eliminate the whole mess from sh.h

Modified: vendor/tcsh/dist/snames.h
===================================================================
--- vendor/tcsh/dist/snames.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/snames.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/snames.h,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/snames.h,v 1.4 2008/10/17 20:25:00 christos Exp $ */
 /*
  * snames.h: Short names for old compilers
  */

Modified: vendor/tcsh/dist/tc.alloc.c
===================================================================
--- vendor/tcsh/dist/tc.alloc.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.alloc.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.alloc.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.alloc.c,v 3.56 2016/03/08 12:47:43 christos Exp $ */
 /*
  * tc.alloc.c (Caltech) 2/21/82
  * Chris Kingsley, kingsley at cit-20.
@@ -42,8 +42,11 @@
 #ifdef HAVE_MALLINFO
 #include <malloc.h>
 #endif
+#if defined(HAVE_SBRK) && !defined(__APPLE__)
+#define USE_SBRK
+#endif
 
-RCSID("$tcsh: tc.alloc.c,v 3.50 2011/12/30 20:55:24 christos Exp $")
+RCSID("$tcsh: tc.alloc.c,v 3.56 2016/03/08 12:47:43 christos Exp $")
 
 #define RCHECK
 #define DEBUG
@@ -66,7 +69,7 @@
 {
     static const char msg[] = "Out of memory\n";
 
-    write(didfds ? 2 : SHDIAG, msg, strlen(msg));
+    TCSH_IGNORE(write(didfds ? 2 : SHDIAG, msg, strlen(msg)));
     _exit(1);
 }
 #endif
@@ -131,7 +134,11 @@
 #endif
 
 
+#ifdef _LP64
+#define ROUNDUP	15
+#else
 #define ROUNDUP	7
+#endif
 
 /*
  * nextf[i] is the pointer to the next free block of size 2^(i+3).  The
@@ -345,10 +352,13 @@
 {
 #ifndef lint
     char *cp;
+    volatile size_t k;
 
     i *= j;
     cp = xmalloc(i);
-    memset(cp, 0, i);
+    /* Stop gcc 5.x from optimizing malloc+memset = calloc */
+    k = i;
+    memset(cp, 0, k);
 
     return ((memalign_t) cp);
 #else
@@ -459,7 +469,7 @@
     const union overhead *op = (const union overhead *)
 	(((const char *) ptr) - MEMALIGN(sizeof(*op)));
     if (op->ov_magic == MAGIC)
-	    return 1 << (op->ov_index + 2);
+	    return 1 << (op->ov_index + 3);
     else
 	    return 0;
 }
@@ -513,19 +523,19 @@
 
     n = n ? n : 1;
 
-#ifdef HAVE_SBRK
+#ifdef USE_SBRK
     if (membot == NULL)
 	membot = sbrk(0);
-#endif /* HAVE_SBRK */
+#endif /* USE_SBRK */
 
     if ((ptr = malloc(n)) == NULL)
 	out_of_memory();
-#ifndef HAVE_SBRK
+#ifndef USE_SBRK
     if (memtop < ((char *) ptr) + n)
 	memtop = ((char *) ptr) + n;
     if (membot == NULL)
 	membot = ptr;
-#endif /* !HAVE_SBRK */
+#endif /* !USE_SBRK */
     return ((memalign_t) ptr);
 }
 
@@ -536,19 +546,19 @@
 
     n = n ? n : 1;
 
-#ifdef HAVE_SBRK
+#ifdef USE_SBRK
     if (membot == NULL)
 	membot = sbrk(0);
-#endif /* HAVE_SBRK */
+#endif /* USE_SBRK */
 
     if ((ptr = (p ? realloc(p, n) : malloc(n))) == NULL)
 	out_of_memory();
-#ifndef HAVE_SBRK
+#ifndef USE_SBRK
     if (memtop < ((char *) ptr) + n)
 	memtop = ((char *) ptr) + n;
     if (membot == NULL)
 	membot = ptr;
-#endif /* !HAVE_SBRK */
+#endif /* !USE_SBRK */
     return ((memalign_t) ptr);
 }
 
@@ -560,10 +570,10 @@
     n *= s;
     n = n ? n : 1;
 
-#ifdef HAVE_SBRK
+#ifdef USE_SBRK
     if (membot == NULL)
 	membot = sbrk(0);
-#endif /* HAVE_SBRK */
+#endif /* USE_SBRK */
 
     if ((ptr = malloc(n)) == NULL)
 	out_of_memory();
@@ -570,12 +580,12 @@
 
     memset (ptr, 0, n);
 
-#ifndef HAVE_SBRK
+#ifndef USE_SBRK
     if (memtop < ((char *) ptr) + n)
 	memtop = ((char *) ptr) + n;
     if (membot == NULL)
 	membot = ptr;
-#endif /* !HAVE_SBRK */
+#endif /* !USE_SBRK */
 
     return ((memalign_t) ptr);
 }
@@ -625,9 +635,9 @@
 	    (unsigned long) sbrk(0));
 #else /* SYSMALLOC */
 #ifndef HAVE_MALLINFO
-#ifdef HAVE_SBRK
+#ifdef USE_SBRK
     memtop = sbrk(0);
-#endif /* HAVE_SBRK */
+#endif /* USE_SBRK */
     xprintf(CGETS(19, 12, "Allocated memory from 0x%lx to 0x%lx (%ld).\n"),
 	    (unsigned long) membot, (unsigned long) memtop, 
 	    (unsigned long) (memtop - membot));

Modified: vendor/tcsh/dist/tc.bind.c
===================================================================
--- vendor/tcsh/dist/tc.bind.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.bind.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.bind.c,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.bind.c,v 3.46 2015/08/13 08:54:04 christos Exp $ */
 /*
  * tc.bind.c: Key binding functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.bind.c,v 3.45 2009/06/25 21:15:37 christos Exp $")
+RCSID("$tcsh: tc.bind.c,v 3.46 2015/08/13 08:54:04 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"
@@ -506,8 +506,14 @@
 	    "    -v   bind all keys to vi bindings\n"));
     xprintf("%s", CGETS(20, 18,
 	    "    -e   bind all keys to emacs bindings\n"));
-    xprintf("%s", CGETS(20, 19,
-	    "    -d   bind all keys to default editor's bindings\n"));
+    xprintf(CGETS(20, 19,
+	    "    -d   bind all keys to default editor's bindings (%s)\n"),
+#ifdef VIDEFAULT
+	    "vi"
+#else /* EMACSDEFAULT */
+	    "emacs"
+#endif /* VIDEFAULT */
+	    );
     xprintf("%s", CGETS(20, 20,
 	    "    -l   list editor commands with descriptions\n"));
     xprintf("%s", CGETS(20, 21,

Modified: vendor/tcsh/dist/tc.const.c
===================================================================
--- vendor/tcsh/dist/tc.const.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.const.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.const.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.const.c,v 3.107 2015/09/08 15:49:53 christos Exp $ */
 /*
  * sh.const.c: String constants for tcsh.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.const.c,v 3.98 2011/04/14 18:25:26 christos Exp $")
+RCSID("$tcsh: tc.const.c,v 3.107 2015/09/08 15:49:53 christos Exp $")
 
 Char STRlogout[]	= { 'l', 'o', 'g', 'o', 'u', 't', '\0' };
 Char STRautologout[]	= { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't', 
@@ -85,6 +85,8 @@
 Char STRMACHTYPE[]	= { 'M', 'A', 'C', 'H', 'T', 'Y', 'P', 'E', '\0' };
 Char STROSTYPE[]	= { 'O', 'S', 'T', 'Y', 'P', 'E', '\0' };
 Char STRedit[]		= { 'e', 'd', 'i', 't', '\0' };
+Char STReditors[]	= { 'e', 'd', 'i', 't', 'o', 'r', 's', '\0' };
+Char STRvimode[]	= { 'v', 'i', 'm', 'o', 'd', 'e', '\0' };
 Char STRaddsuffix[]	= { 'a', 'd', 'd', 's', 'u', 'f', 'f', 'i', 'x',
 			    '\0' };
 Char STRcsubstnonl[]	= { 'c', 's', 'u', 'b', 's', 't', 'n', 'o', 'n', 'l',
@@ -113,6 +115,7 @@
 Char STRmm[]		= { '-', 'm', '\0' };
 Char STRmr[]		= { '-', 'r', '\0' };
 Char STRmerge[]		= { 'm', 'e', 'r', 'g', 'e', '\0' };
+Char STRlock[]		= { 'l', 'o', 'c', 'k', '\0' };
 Char STRtildothist[]	= { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r', 
 			    'y', '\0' };
 
@@ -369,6 +372,8 @@
 Char STRsldotlogin[]	= { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
 Char STRignoreeof[]	= { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
 Char STRnoclobber[]	= { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
+Char STRnotempty[]	= { 'n', 'o', 't', 'e', 'm', 'p', 't', 'y', '\0' };
+Char STRask[]		= { 'a', 's', 'k', '\0' };
 Char STRhelpcommand[]	= { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n', 
 			    'd', '\0' };
 Char STRfignore[]	= { 'f', 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
@@ -430,8 +435,9 @@
 Char STRrm[]		= { 'r', 'm', '\0' };
 Char STRhighlight[]	= { 'h', 'i', 'g', 'h', 'l', 'i', 'g', 'h', 't', '\0' };
 
-Char STRimplicitcd[] = { 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't',
-                         'c', 'd', '\0' };
+Char STRimplicitcd[]	= { 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't',
+			    'c', 'd', '\0' };
+Char STRcdtohome[]	= { 'c', 'd', 't', 'o', 'h', 'o', 'm', 'e', '\0' };
 Char STRkillring[] 	= { 'k', 'i', 'l', 'l', 'r', 'i', 'n', 'g', '\0' };
 Char STRkilldup[] 	= { 'k', 'i', 'l', 'l', 'd', 'u', 'p', '\0' };
 Char STRshlvl[]		= { 's', 'h', 'l', 'v', 'l', '\0' };
@@ -450,12 +456,12 @@
 			    'R', 'Y', '\0' };
 Char STRNOREBIND[] 	= { 'N', 'O', 'R', 'E', 'B', 'I', 'N', 'D', '\0' };
 
-#if defined(SIG_WINDOW) || defined (_VMS_POSIX)	 
+#if defined(SIG_WINDOW) || defined(SIGWINCH) || defined(SIGWINDOW) || defined (_VMS_POSIX) || defined(_SIGWINCH)
 /* atp - problem with declaration of str{lines,columns} in sh.func.c (1277) */
 Char STRLINES[]		= { 'L', 'I', 'N', 'E', 'S', '\0'};
 Char STRCOLUMNS[]	= { 'C', 'O', 'L', 'U', 'M', 'N', 'S', '\0'};
 Char STRTERMCAP[]	= { 'T', 'E', 'R', 'M', 'C', 'A', 'P', '\0'};
-#endif /* SIG_WINDOW  || _VMS_POSIX */
+#endif /* SIG_WINDOW  || SIGWINCH || SIGWINDOW || _VMS_POSIX */
 
 #if defined (_OSD_POSIX)  /* BS2000 needs this variable set to "SHELL" */
 Char STRPROGRAM_ENVIRONMENT[] = { 'P', 'R', 'O', 'G', 'R', 'A', 'M',
@@ -491,6 +497,7 @@
 Char STRmmcolormauto[]	= { '-', '-', 'c', 'o', 'l', 'o', 'r', '=', 'a', 'u', 't', 'o', '\0' };
 #endif /* BSD_STYLE_COLORLS */
 Char STRLS_COLORS[]	= { 'L', 'S', '_', 'C', 'O', 'L', 'O', 'R', 'S', '\0' };
+Char STRLSCOLORS[]	= { 'L', 'S', 'C', 'O', 'L', 'O', 'R', 'S', '\0' };
 #endif /* COLOR_LS_F */
 
 Char STRls[]		= { 'l', 's', '\0' };

Modified: vendor/tcsh/dist/tc.decls.h
===================================================================
--- vendor/tcsh/dist/tc.decls.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.decls.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.decls.h,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.decls.h,v 3.66 2012/06/21 18:49:11 christos Exp $ */
 /*
  * tc.decls.h: Function declarations from all the tcsh modules
  */
@@ -226,15 +226,15 @@
 #ifndef __GNUC__
 #define __attribute__(a)
 #endif
-extern	pret_t		  xprintf	(const char *, ...)
+extern	int		  xprintf	(const char *, ...)
     __attribute__((__format__(__printf__, 1, 2)));
-extern	pret_t		  xsnprintf	(char *, size_t, const char *, ...)
+extern	int		  xsnprintf	(char *, size_t, const char *, ...)
     __attribute__((__format__(__printf__, 3, 4)));
 extern	char		 *xasprintf	(const char *, ...)
     __attribute__((__format__(__printf__, 1, 2)));
-extern	pret_t		  xvprintf	(const char *, va_list)
+extern	int		  xvprintf	(const char *, va_list)
     __attribute__((__format__(__printf__, 1, 0)));
-extern	pret_t		  xvsnprintf	(char *, size_t, const char *, va_list)
+extern	int		  xvsnprintf	(char *, size_t, const char *, va_list)
     __attribute__((__format__(__printf__, 3, 0)));
 extern	char		 *xvasprintf	(const char *, va_list)
     __attribute__((__format__(__printf__, 1, 0)));

Modified: vendor/tcsh/dist/tc.disc.c
===================================================================
--- vendor/tcsh/dist/tc.disc.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.disc.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.disc.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.disc.c,v 3.18 2011/01/09 16:25:29 christos Exp $ */
 /*
  * tc.disc.c: Functions to set/clear line disciplines
  *

Modified: vendor/tcsh/dist/tc.func.c
===================================================================
--- vendor/tcsh/dist/tc.func.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.func.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.func.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.func.c,v 3.158 2016/05/13 15:08:12 christos Exp $ */
 /*
  * tc.func.c: New tcsh builtins.
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.func.c,v 3.148 2011/12/14 16:36:44 christos Exp $")
+RCSID("$tcsh: tc.func.c,v 3.158 2016/05/13 15:08:12 christos Exp $")
 
 #include "ed.h"
 #include "ed.defns.h"		/* for the function names */
@@ -120,11 +120,17 @@
 		if ((*s & QUOTE)
 		    && (((*s & TRIM) == HIST && HIST != '\0') ||
 			(((*s & TRIM) == '\'') && (prev_c != '\\')) ||
-			(((*s & TRIM) == '\"') && (prev_c != '\\')) ||
-			(((*s & TRIM) == '\\') && (prev_c != '\\')))) {
+			(((*s & TRIM) == '\"') && (prev_c != '\\')))) {
 		    Strbuf_append1(&buf, '\\');
 		}
+#if INVALID_BYTE != 0
+		if ((*s & INVALID_BYTE) != INVALID_BYTE) /* *s < INVALID_BYTE */
+		    Strbuf_append1(&buf, *s & TRIM);
+		else
+		    Strbuf_append1(&buf, *s);
+#else
 		Strbuf_append1(&buf, *s & TRIM);
+#endif
 		prev_c = *s;
 	    }
 	    Strbuf_append1(&buf, ' ');
@@ -193,7 +199,7 @@
 dolist(Char **v, struct command *c)
 {
     Char **globbed;
-    int     i, k;
+    int     i, k, ret = 0;
     struct stat st;
 
     USE(c);
@@ -333,8 +339,11 @@
 			xputchar('\n');
 		    print_by_column(STRNULL, &v[i], k - i, FALSE);
 		}
+		haderr = 1;
 		xprintf("%S: %s.\n", tmp, strerror(err));
+		haderr = 0;
 		i = k + 1;
+		ret = 1;
 	    }
 	    else if (S_ISDIR(st.st_mode)) {
 		Char   *cp;
@@ -372,6 +381,8 @@
 		xputchar('\n');
 	    print_by_column(STRNULL, &v[i], k - i, FALSE);
 	}
+	if (ret)
+	    stderror(ERR_SILENT);
     }
 
     cleanup_until(globbed);
@@ -481,6 +492,19 @@
 	setcopy(STRstatus, STR1, VAR_READWRITE);
 }
 
+static int
+findvv(Char **vv, const char *cp)
+{
+    for (; vv && *vv; vv++) {
+	size_t i;
+	for (i = 0; (*vv)[i] && (*vv)[i] == cp[i]; i++)
+	    continue;
+	if ((*vv)[i] == '\0' && cp[i] == '\0')
+	    return 1;
+    }
+    return 0;
+}
+
 /* PWP: a hack to start up your stopped editor on a single keystroke */
 /* jbs - fixed hack so it worked :-) 3/28/89 */
 
@@ -488,33 +512,42 @@
 find_stop_ed(void)
 {
     struct process *pp, *retp;
-    const char *ep, *vp;
+    const char *ep = NULL, *vp = NULL;
     char *cp, *p;
-    size_t epl, vpl;
+    size_t epl = 0, vpl = 0;
     int pstatus;
+    struct varent *varp;
+    Char **vv;
 
-    if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
-	if ((p = strrchr(ep, '/')) != NULL) 	/* if it has a path */
-	    ep = p + 1;		/* then we want only the last part */
-    }
-    else 
-	ep = "ed";
+    if (pcurrent == NULL)	/* see if we have any jobs */
+	return NULL;		/* nope */
 
-    if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
-	if ((p = strrchr(vp, '/')) != NULL) 	/* and it has a path */
-	    vp = p + 1;		/* then we want only the last part */
-    }
-    else 
-	vp = "vi";
+    if ((varp = adrof(STReditors)) != NULL)
+	vv = varp->vec;
+    else
+	vv = NULL;
 
-    for (vpl = 0; vp[vpl] && !isspace((unsigned char)vp[vpl]); vpl++)
-	continue;
-    for (epl = 0; ep[epl] && !isspace((unsigned char)ep[epl]); epl++)
-	continue;
+    if (! vv) {
+	if ((ep = getenv("EDITOR")) != NULL) {	/* if we have a value */
+	    if ((p = strrchr(ep, '/')) != NULL) 	/* if it has a path */
+		ep = p + 1;		/* then we want only the last part */
+	}
+	else
+	    ep = "ed";
 
-    if (pcurrent == NULL)	/* see if we have any jobs */
-	return NULL;		/* nope */
+	if ((vp = getenv("VISUAL")) != NULL) {	/* if we have a value */
+	    if ((p = strrchr(vp, '/')) != NULL) 	/* and it has a path */
+		vp = p + 1;		/* then we want only the last part */
+	}
+	else
+	    vp = "vi";
 
+	for (vpl = 0; vp[vpl] && !isspace((unsigned char)vp[vpl]); vpl++)
+	    continue;
+	for (epl = 0; ep[epl] && !isspace((unsigned char)ep[epl]); epl++)
+	    continue;
+    }
+
     retp = NULL;
     for (pp = proclist.p_next; pp; pp = pp->p_next)
 	if (pp->p_procid == pp->p_jobid) {
@@ -540,10 +573,13 @@
 	    else
 		cp = p;			/* else we get all of it */
 
-	    /* if we find either in the current name, fg it */
-	    if (strncmp(ep, cp, epl) == 0 ||
-		strncmp(vp, cp, vpl) == 0) {
-
+	    /*
+	     * If we find the current name in the $editors array (if set)
+	     * or as $EDITOR or $VISUAL (if $editors not set), fg it.
+	     */
+	    if ((vv && findvv(vv, cp)) ||
+	        (epl && strncmp(ep, cp, epl) == 0 && cp[epl] == '\0') ||
+		(vpl && strncmp(vp, cp, vpl) == 0 && cp[vpl] == '\0')) {
 		/*
 		 * If there is a choice, then choose the current process if
 		 * available, or the previous process otherwise, or else
@@ -733,7 +769,7 @@
 	pp = xgetpass("Password:");
 
 	crpp = XCRYPT(pw, pp, srpp);
-	if ((strcmp(crpp, srpp) == 0)
+	if ((crpp && strcmp(crpp, srpp) == 0)
 #ifdef AFS
 	    || (ka_UserAuthenticateGeneral(KA_USERAUTH_VERSION,
 					   afsname,     /* name */
@@ -1108,8 +1144,7 @@
     Char   *tag;
 #endif /* RMDEBUG */
     Char   *charac;
-    char    c;
-    int     ask, doit, star = 0, silent = 0;
+    int     ask, doit, star = 0, silent = 0, opintr_disabled;
 
     if (!adrof(STRrmstar))
 	return;
@@ -1119,6 +1154,8 @@
     we = cp->next;
     while (*we->word == ';' && we != cp)
 	we = we->next;
+    opintr_disabled = pintr_disabled;
+    pintr_disabled = 0;
     while (we != cp) {
 #ifdef RMDEBUG
 	if (*tag)
@@ -1139,17 +1176,8 @@
 		    if (!Strcmp(args->word, STRstar))
 			star = 1;
 		if (ask && star) {
-		    xprintf("%s", CGETS(22, 8,
-			    "Do you really want to delete all files? [n/y] "));
-		    flush();
-		    (void) force_read(SHIN, &c, 1);
-		    /* 
-		     * Perhaps we should use the yesexpr from the
-		     * actual locale
-		     */
-		    doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
-		    while (c != '\n' && force_read(SHIN, &c, 1) == 1)
-			continue;
+		    doit = getYN(CGETS(22, 8,
+			"Do you really want to delete all files? [N/y] "));
 		    if (!doit) {
 			/* remove the command instead */
 #ifdef RMDEBUG
@@ -1195,6 +1223,7 @@
 	    xprintf("%S ", we->word);
     }
 #endif /* RMDEBUG */
+    pintr_disabled = opintr_disabled;
     return;
 }
 

Modified: vendor/tcsh/dist/tc.h
===================================================================
--- vendor/tcsh/dist/tc.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.h,v 3.8 2006/01/12 19:55:38 christos Exp $ */
 /*
  * tc.h: Tcsh includes
  */

Modified: vendor/tcsh/dist/tc.nls.c
===================================================================
--- vendor/tcsh/dist/tc.nls.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.nls.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.nls.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.c,v 3.27 2016/07/17 15:02:44 christos Exp $ */
 /*
  * tc.nls.c: NLS handling
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.nls.c,v 3.23 2010/02/12 22:17:20 christos Exp $")
+RCSID("$tcsh: tc.nls.c,v 3.27 2016/07/17 15:02:44 christos Exp $")
 
 
 #ifdef WIDE_STRINGS
@@ -64,7 +64,11 @@
 {
 # ifdef HAVE_WCWIDTH
     int l;
+#if INVALID_BYTE != 0
+    if ((c & INVALID_BYTE) == INVALID_BYTE)	/* c >= INVALID_BYTE */
+#else
     if (c & INVALID_BYTE)
+#endif
 	return 1;
     l = xwcwidth((wchar_t) c);
     return l >= 0 ? l : 0;
@@ -116,14 +120,29 @@
 }
 
 int
-NLSClassify(Char c, int nocomb)
+NLSClassify(Char c, int nocomb, int drawPrompt)
 {
     int w;
-    if (c & INVALID_BYTE)
+#ifndef SHORT_STRINGS
+    if ((c & 0x80) != 0)		/* c >= 0x80 */
 	return NLSCLASS_ILLEGAL;
-    w = NLSWidth(c);
-    if ((w > 0 && !(Iscntrl(c) && (c & CHAR) < 0x100)) || (Isprint(c) && !nocomb))
-	return w;
+#endif
+    if (!drawPrompt) {			/* draw command-line */
+#if INVALID_BYTE != 0
+	if ((c & INVALID_BYTE) == INVALID_BYTE)		/* c >= INVALID_BYTE */
+	    return NLSCLASS_ILLEGAL;
+	if ((c & INVALID_BYTE) == QUOTE && (c & 0x80) == 0)	/* c >= QUOTE */
+	    return 1;
+	if (c >= 0x10000000)		/* U+10000000 = FC 90 80 80 80 80 */
+	    return NLSCLASS_ILLEGAL5;
+	if (c >= 0x1000000)		/*  U+1000000 = F9 80 80 80 80 */
+	    return NLSCLASS_ILLEGAL4;
+	if (c >= 0x100000)		/*   U+100000 = F4 80 80 80 */
+	    return NLSCLASS_ILLEGAL3;
+#endif
+	if (c >= 0x10000)		/*    U+10000 = F0 90 80 80 */
+	    return NLSCLASS_ILLEGAL2;
+    }
     if (Iscntrl(c) && (c & CHAR) < 0x100) {
 	if (c == '\n')
 	    return NLSCLASS_NL;
@@ -131,13 +150,14 @@
 	    return NLSCLASS_TAB;
 	return NLSCLASS_CTRL;
     }
-#ifdef WIDE_STRINGS
-    if (c >= 0x1000000)
-	return NLSCLASS_ILLEGAL4;
-    if (c >= 0x10000)
-	return NLSCLASS_ILLEGAL3;
-#endif
-    if (c >= 0x100)
-	return NLSCLASS_ILLEGAL2;
+    w = NLSWidth(c);
+    if (drawPrompt) {			/* draw prompt */
+	if (w > 0)
+	    return w;
+	if (w == 0)
+	    return 1;
+    }
+    if ((w > 0 && !(Iscntrl(c) && (c & CHAR) < 0x100)) || (Isprint(c) && !nocomb))
+	return w;
     return NLSCLASS_ILLEGAL;
 }

Modified: vendor/tcsh/dist/tc.nls.h
===================================================================
--- vendor/tcsh/dist/tc.nls.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.nls.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.nls.h,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.nls.h,v 3.17 2015/06/06 21:19:08 christos Exp $ */
 /*
  * tc.nls.h: NLS support
  *
@@ -43,7 +43,7 @@
 #endif
 
 extern Char *NLSChangeCase (const Char *, int);
-extern int NLSClassify (Char, int);
+extern int NLSClassify (Char, int, int);
 
 #define NLSCLASS_CTRL		(-1)
 #define NLSCLASS_TAB		(-2)
@@ -52,6 +52,7 @@
 #define NLSCLASS_ILLEGAL2	(-5)
 #define NLSCLASS_ILLEGAL3	(-6)
 #define NLSCLASS_ILLEGAL4	(-7)
+#define NLSCLASS_ILLEGAL5	(-8)
 
 #define NLSCLASS_ILLEGAL_SIZE(x) (-(x) - (-(NLSCLASS_ILLEGAL) - 1))
 

Modified: vendor/tcsh/dist/tc.os.c
===================================================================
--- vendor/tcsh/dist/tc.os.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.os.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.os.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.c,v 3.73 2016/04/16 15:44:18 christos Exp $ */
 /*
  * tc.os.c: OS Dependent builtin functions
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.os.c,v 3.72 2011/01/25 13:58:19 christos Exp $")
+RCSID("$tcsh: tc.os.c,v 3.73 2016/04/16 15:44:18 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -1585,28 +1585,6 @@
 }
 #endif
 
-#ifdef __ANDROID__
-#include <stdio.h>
-/* Android (<= 2.1?) has an incomplete ttyname implementation. */
-char *
-ttyname(int fd)
-{
-    char path[64];
-    ssize_t siz;
-    static char ttyname[32];
-
-    if (!isatty(fd))
-	return NULL;
-
-    (void)snprintf(path, sizeof(path), "/proc/self/fd/%d", fd);
-    siz = readlink(path, ttyname, sizeof(ttyname));
-    if (siz < 0 || siz == sizeof(ttyname))
-	return NULL;
-    ttyname[siz] = '\0';
-    return ttyname;
-}
-#endif /* __ANDROID__ */
-
 #if defined(__CYGWIN__) && !defined(NO_CRYPT)
 #undef CHAR		/* Collides with Win32 API */
 #define WIN32_LEAN_AND_MEAN

Modified: vendor/tcsh/dist/tc.os.h
===================================================================
--- vendor/tcsh/dist/tc.os.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.os.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.os.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.os.h,v 3.105 2011/02/04 18:00:26 christos Exp $ */
 /*
  * tc.os.h: Shell os dependent defines
  */

Modified: vendor/tcsh/dist/tc.printf.c
===================================================================
--- vendor/tcsh/dist/tc.printf.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.printf.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.printf.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.printf.c,v 3.38 2015/06/06 21:19:08 christos Exp $ */
 /*
  * tc.printf.c: A public-domain, minimal printf/sprintf routine that prints
  *	       through the putchar() routine.  Feel free to use for
@@ -34,7 +34,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.printf.c,v 3.35 2006/03/02 18:46:45 christos Exp $")
+RCSID("$tcsh: tc.printf.c,v 3.38 2015/06/06 21:19:08 christos Exp $")
 
 #ifdef lint
 #undef va_arg
@@ -46,9 +46,9 @@
 static char snil[] = "(nil)";
 
 static	void	xaddchar	(int);
-static	void	doprnt		(void (*) (int), const char *, va_list);
+static	int	doprnt		(void (*) (int), const char *, va_list);
 
-static void
+static int
 doprnt(void (*addchar) (int), const char *sfmt, va_list ap)
 {
     char *bp;
@@ -68,8 +68,8 @@
     int fmt;
     unsigned char pad = ' ';
     int     flush_left = 0, f_width = 0, prec = INF, hash = 0;
-    int	    do_long = 0, do_size_t = 0;
-    int     sign = 0;
+    int	    do_long = 0, do_size_t = 0, do_ptrdiff_t = 0;
+    int     sign = 0, count = 0;
     int     attributes = 0;
 
 
@@ -77,6 +77,7 @@
     for (; *f; f++) {
 	if (*f != '%') {	/* then just out the char */
 	    (*addchar) (((unsigned char)*f) | attributes);
+	    count++;
 	}
 	else {
 	    f++;		/* skip the % */
@@ -131,6 +132,10 @@
 		do_size_t++;
 		f++;
 	    }
+	    if (*f == 't') {	/* ptrdiff_t format */
+		do_ptrdiff_t++;
+		f++;
+	    }
 
 	    fmt = (unsigned char) *f;
 	    if (fmt != 'S' && fmt != 'Q' && isupper(fmt)) {
@@ -171,13 +176,19 @@
 		    *bp++ = '-';
 		f_width = f_width - (int) (bp - buf);
 		if (!flush_left)
-		    while (f_width-- > 0) 
+		    while (f_width-- > 0)  {
 			(*addchar) (pad | attributes);
-		for (bp--; bp >= buf; bp--) 
+			count++;
+		    }
+		for (bp--; bp >= buf; bp--)  {
 		    (*addchar) (((unsigned char) *bp) | attributes);
+		    count++;
+		}
 		if (flush_left)
-		    while (f_width-- > 0)
+		    while (f_width-- > 0) {
 			(*addchar) (' ' | attributes);
+			count++;
+		    }
 		break;
 
 	    case 'p':
@@ -192,6 +203,8 @@
 		case 0:
 		    if (do_size_t)
 			u = va_arg(ap, size_t);
+		    else if (do_ptrdiff_t)
+			u = va_arg(ap, ptrdiff_t);
 		    else
 			u = va_arg(ap, unsigned int);
 		    break;
@@ -234,13 +247,17 @@
 		}
 		i = f_width - (int) (bp - buf);
 		if (!flush_left)
-		    while (i-- > 0)
+		    while (i-- > 0) {
 			(*addchar) (pad | attributes);
+			count++;
+		    }
 		for (bp--; bp >= buf; bp--)
 		    (*addchar) (((unsigned char) *bp) | attributes);
 		if (flush_left)
-		    while (i-- > 0)
+		    while (i-- > 0) {
 			(*addchar) (' ' | attributes);
+			count++;
+		    }
 		break;
 
 
@@ -247,6 +264,7 @@
 	    case 'c':
 		i = va_arg(ap, int);
 		(*addchar) (i | attributes);
+		count++;
 		break;
 
 	    case 'S':
@@ -259,23 +277,31 @@
 	        }
 		f_width = f_width - Strlen(Bp);
 		if (!flush_left)
-		    while (f_width-- > 0)
+		    while (f_width-- > 0) {
 			(*addchar) ((int) (pad | attributes));
+			count++;
+		    }
 		for (i = 0; *Bp && i < prec; i++) {
 		    char cbuf[MB_LEN_MAX];
 		    size_t pos, len;
 
-		    if (fmt == 'Q' && *Bp & QUOTE)
+		    if (fmt == 'Q' && *Bp & QUOTE) {
 			(*addchar) ('\\' | attributes);
-		    len = one_wctomb(cbuf, *Bp & CHAR);
-		    for (pos = 0; pos < len; pos++)
+			count++;
+		    }
+		    len = one_wctomb(cbuf, *Bp);
+		    for (pos = 0; pos < len; pos++) {
 			(*addchar) ((unsigned char)cbuf[pos] | attributes
 				    | (*Bp & ATTRIBUTES));
+			count++;
+		    }
 		    Bp++;
 		}
 		if (flush_left)
-		    while (f_width-- > 0)
+		    while (f_width-- > 0) {
 			(*addchar) (' ' | attributes);
+			count++;
+		    }
 		break;
 #endif /* SHORT_STRINGS */
 
@@ -287,17 +313,24 @@
 		    bp = snil;
 		f_width = f_width - strlen(bp);
 		if (!flush_left)
-		    while (f_width-- > 0)
+		    while (f_width-- > 0) {
 			(*addchar) (pad | attributes);
+			count++;
+		    }
 		for (i = 0; *bp && i < prec; i++) {
-		    if (fmt == 'q' && *bp & QUOTE)
+		    if (fmt == 'q' && *bp & QUOTE) {
 			(*addchar) ('\\' | attributes);
+			count++;
+		    }
 		    (*addchar) (((unsigned char) *bp & TRIM) | attributes);
+		    count++;
 		    bp++;
 		}
 		if (flush_left)
-		    while (f_width-- > 0)
+		    while (f_width-- > 0) {
 			(*addchar) (' ' | attributes);
+			count++;
+		    }
 		break;
 
 	    case 'a':
@@ -306,6 +339,7 @@
 
 	    case '%':
 		(*addchar) ('%' | attributes);
+		count++;
 		break;
 
 	    default:
@@ -312,11 +346,12 @@
 		break;
 	    }
 	    flush_left = 0, f_width = 0, prec = INF, hash = 0;
-	    do_size_t = 0, do_long = 0;
+	    do_ptrdiff_t = 0, do_size_t = 0, do_long = 0;
 	    sign = 0;
 	    pad = ' ';
 	}
     }
+    return count;
 }
 
 
@@ -331,56 +366,49 @@
 }
 
 
-pret_t
+int
 /*VARARGS*/
 xsnprintf(char *str, size_t size, const char *fmt, ...)
 {
+    int count;
     va_list va;
     va_start(va, fmt);
 
     xstring = str;
     xestring = str + size - 1;
-    doprnt(xaddchar, fmt, va);
+    count = doprnt(xaddchar, fmt, va);
     va_end(va);
     *xstring++ = '\0';
-#ifdef PURIFY
-    return 1;
-#endif
+    return count;
 }
 
-pret_t
+int
 /*VARARGS*/
 xprintf(const char *fmt, ...)
 {
+    int count;
     va_list va;
     va_start(va, fmt);
-    doprnt(xputchar, fmt, va);
+    count = doprnt(xputchar, fmt, va);
     va_end(va);
-#ifdef PURIFY
-    return 1;
-#endif
+    return count;
 }
 
-
-pret_t
+int
 xvprintf(const char *fmt, va_list va)
 {
-    doprnt(xputchar, fmt, va);
-#ifdef PURIFY
-    return 1;
-#endif
+    return doprnt(xputchar, fmt, va);
 }
 
-pret_t
+int
 xvsnprintf(char *str, size_t size, const char *fmt, va_list va)
 {
+    int count;
     xstring = str;
     xestring = str + size - 1;
-    doprnt(xaddchar, fmt, va);
+    count = doprnt(xaddchar, fmt, va);
     *xstring++ = '\0';
-#ifdef PURIFY
-    return 1;
-#endif
+    return count;
 }
 
 char *
@@ -435,18 +463,18 @@
 int 
 fprintf(FILE *fp, const char* fmt, ...)
 {
+    int count;
     va_list va;
     va_start(va, fmt);
-    doprnt(xputchar, fmt, va);
+    count = doprnt(xputchar, fmt, va);
     va_end(va);
-    return 1;
+    return count;
 }
 
 int 
 vfprintf(FILE *fp, const char *fmt, va_list va)
 {
-    doprnt(xputchar, fmt, va);
-    return 1;
+    return doprnt(xputchar, fmt, va);
 }
 
 #endif	/* PURIFY */

Modified: vendor/tcsh/dist/tc.prompt.c
===================================================================
--- vendor/tcsh/dist/tc.prompt.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.prompt.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.prompt.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.prompt.c,v 3.71 2014/08/23 09:07:57 christos Exp $ */
 /*
  * tc.prompt.c: Prompt printing stuff
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.prompt.c,v 3.70 2011/10/27 22:41:06 christos Exp $")
+RCSID("$tcsh: tc.prompt.c,v 3.71 2014/08/23 09:07:57 christos Exp $")
 
 #include "ed.h"
 #include "tw.h"
@@ -213,7 +213,22 @@
 		}
 		break;
 	    case '#':
+#ifdef __CYGWIN__
+		/* Check for being member of the Administrators group */
+		{
+			gid_t grps[NGROUPS_MAX];
+			int grp, gcnt;
+
+			gcnt = getgroups(NGROUPS_MAX, grps);
+# define DOMAIN_GROUP_RID_ADMINS 544
+			for (grp = 0; grp < gcnt; ++grp)
+				if (grps[grp] == DOMAIN_GROUP_RID_ADMINS)
+					break;
+			Scp = (grp < gcnt) ? PRCHROOT : PRCH;
+		}
+#else
 		Scp = (uid == 0 || euid == 0) ? PRCHROOT : PRCH;
+#endif
 		if (Scp != '\0')
 		    Strbuf_append1(&buf, attributes | Scp);
 		break;

Modified: vendor/tcsh/dist/tc.sched.c
===================================================================
--- vendor/tcsh/dist/tc.sched.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.sched.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.sched.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.sched.c,v 3.25 2006/03/02 18:46:45 christos Exp $ */
 /*
  * tc.sched.c: Scheduled command execution
  *

Modified: vendor/tcsh/dist/tc.sig.c
===================================================================
--- vendor/tcsh/dist/tc.sig.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.sig.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.sig.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.sig.c,v 3.40 2012/01/25 15:34:41 christos Exp $ */
 /*
  * tc.sig.c: Signal routine emulations
  */

Modified: vendor/tcsh/dist/tc.sig.h
===================================================================
--- vendor/tcsh/dist/tc.sig.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.sig.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.sig.h,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.sig.h,v 3.34 2010/11/29 15:28:58 christos Exp $ */
 /*
  * tc.sig.h: Signal handling
  *

Modified: vendor/tcsh/dist/tc.str.c
===================================================================
--- vendor/tcsh/dist/tc.str.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.str.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.str.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.str.c,v 3.47 2015/06/06 21:19:08 christos Exp $ */
 /*
  * tc.str.c: Short string package
  * 	     This has been a lesson of how to write buggy code!
@@ -36,7 +36,7 @@
 #include <assert.h>
 #include <limits.h>
 
-RCSID("$tcsh: tc.str.c,v 3.42 2012/01/10 21:34:31 christos Exp $")
+RCSID("$tcsh: tc.str.c,v 3.47 2015/06/06 21:19:08 christos Exp $")
 
 #define MALLOC_INCR	128
 #ifdef WIDE_STRINGS
@@ -66,10 +66,24 @@
 {
     int len;
 
-    if (wchar & INVALID_BYTE) {
-	s[0] = wchar & 0xFF;
+#if INVALID_BYTE != 0
+    if ((wchar & INVALID_BYTE) == INVALID_BYTE) {    /* wchar >= INVALID_BYTE */
+	/* invalid char
+	 * exmaple)
+	 * if wchar = f0000090(=90|INVALID_BYTE), then *s = ffffff90 */
+	*s = (char)wchar;
 	len = 1;
+#else
+    if (wchar & (CHAR & INVALID_BYTE)) {
+	s[0] = wchar & (CHAR & 0xFF);
+	len = 1;
+#endif
     } else {
+#if INVALID_BYTE != 0
+	wchar &= MAX_UTF32;
+#else
+	wchar &= CHAR;
+#endif
 #ifdef UTF16_STRINGS
 	if (wchar >= 0x10000) {
 	    /* UTF-16 systems can't handle these values directly in calls to
@@ -224,7 +238,7 @@
     dst = sdst;
     edst = &dst[dstsize];
     while (*src) {
-	dst += one_wctomb(dst, *src & CHAR);
+	dst += one_wctomb(dst, *src);
 	src++;
 	if (dst >= edst) {
 	    char *wdst = dst;
@@ -544,7 +558,7 @@
 		dst = &edst[-MALLOC_INCR];
 	    }
 	}
-	dst += one_wctomb(dst, *src & CHAR);
+	dst += one_wctomb(dst, *src);
 	src++;
 	if (dst >= edst) {
 	    ptrdiff_t i = dst - edst;
@@ -559,7 +573,7 @@
 }
 
 struct blk_buf *
-bb_alloc()
+bb_alloc(void)
 {
     return xcalloc(1, sizeof(struct blk_buf));
 }
@@ -590,10 +604,14 @@
     struct blk_buf *bb;
     size_t i;
 
-    bb = xbb;
-    for (i = 0; i < bb->len; i++)
-	xfree(bb->vec[i]);
-    xfree(bb->vec);
+    bb = (struct blk_buf *)xbb;
+    if (bb->vec) {
+	for (i = 0; i < bb->len; i++)
+	    xfree(bb->vec[i]);
+	xfree(bb->vec);
+    }
+    bb->vec = NULL;
+    bb->len = 0;
 }
 
 void

Modified: vendor/tcsh/dist/tc.vers.c
===================================================================
--- vendor/tcsh/dist/tc.vers.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.vers.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.vers.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.vers.c,v 3.54 2006/03/02 18:46:45 christos Exp $ */
 /*
  * tc.vers.c: Version dependent stuff
  */

Modified: vendor/tcsh/dist/tc.wait.h
===================================================================
--- vendor/tcsh/dist/tc.wait.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.wait.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.wait.h,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.wait.h,v 3.15 2011/02/04 18:00:26 christos Exp $ */
 /*
  * tc.wait.h: <sys/wait.h> for machines that don't have it or have it and
  *	      is incorrect.

Modified: vendor/tcsh/dist/tc.who.c
===================================================================
--- vendor/tcsh/dist/tc.who.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tc.who.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tc.who.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tc.who.c,v 3.59 2012/11/15 02:55:08 christos Exp $ */
 /*
  * tc.who.c: Watch logins and logouts...
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tc.who.c,v 3.57 2012/01/17 20:53:38 christos Exp $")
+RCSID("$tcsh: tc.who.c,v 3.59 2012/11/15 02:55:08 christos Exp $")
 
 #include "tc.h"
 
@@ -65,6 +65,8 @@
 #  define TCSH_PATH_UTMP "/var/run/utx.active"
 # elif defined(__hpux)
 #  define TCSH_PATH_UTMP "/etc/utmpx"
+# elif defined(IBMAIX) && defined(UTMP_FILE)
+#  define TCSH_PATH_UTMP UTMP_FILE
 # endif
 # if defined(TCSH_PATH_UTMP) || !defined(HAVE_UTMP_H)
 #  define utmp utmpx

Modified: vendor/tcsh/dist/tcsh.man
===================================================================
--- vendor/tcsh/dist/tcsh.man	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tcsh.man	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,3 +1,5 @@
+.\" $tcsh: tcsh.man,v 3.266 2016/11/24 15:04:52 christos Exp $
+.\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -42,6 +44,10 @@
 .\" 
 .\" - Use `', not '' or "", except of course in shell syntax examples.
 .\"   '' at the beginning of a line will vanish!
+.\"
+.\" - Use \` for literal back-quote (`).
+.\"
+.\" - Use \e for literal backslash (\).
 .\" 
 .\" - Use \-, not -.
 .\" 
@@ -72,7 +78,7 @@
 .\"   used here if you can. In particular, please don't use nroff commands
 .\"   which aren't already used herein.
 .\" 
-.TH TCSH 1 "14 February 2012" "Astron 6.18.01"
+.TH TCSH 1 "24 November 2016" "Astron 6.20.00"
 .SH NAME
 tcsh \- C shell with file name completion and command line editing
 .SH SYNOPSIS
@@ -160,7 +166,7 @@
 Command input is taken from the standard input.
 .TP 4
 .B \-t
-The shell reads and executes a single line of input.  A `\\' may be used to
+The shell reads and executes a single line of input.  A `\e' may be used to
 escape the newline at the end of this line and continue onto another line.
 .TP 4
 .B \-v
@@ -201,7 +207,7 @@
 It then executes commands from files in the user's \fBhome\fR directory:
 first \fI~/.tcshrc\fR (+)
 or, if \fI~/.tcshrc\fR is not found, \fI~/.cshrc\fR,
-then \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable),
+then the contents of \fI~/.history\fR (or the value of the \fBhistfile\fR shell variable) are loaded into memory,
 then \fI~/.login\fR,
 and finally \fI~/.cshdirs\fR (or the value of the \fBdirsfile\fR shell variable) (+).
 The shell may read \fI/etc/csh.login\fR before instead of after
@@ -251,13 +257,13 @@
 the editor commands specific to the shell and their default bindings.
 .SS "The command-line editor (+)"
 Command-line input can be edited using key sequences much like those used in
-GNU Emacs or \fIvi\fR(1).
+\fIemacs\fR(1) or \fIvi\fR(1).
 The editor is active only when the \fBedit\fR shell variable is set, which
 it is by default in interactive shells.
 The \fIbindkey\fR builtin can display and change key bindings.
-Emacs-style key bindings are used by default
+\fIemacs\fR(1)\-style key bindings are used by default
 (unless the shell was compiled otherwise; see the \fBversion\fR shell variable),
-but \fIbindkey\fR can change the key bindings to \fIvi\fR-style bindings en masse.
+but \fIbindkey\fR can change the key bindings to \fIvi\fR(1)\-style bindings en masse.
 .PP
 The shell always binds the arrow keys (as defined in the \fBTERMCAP\fR
 environment variable) to
@@ -284,10 +290,12 @@
 to prevent these bindings.
 The ANSI/VT100 sequences for arrow keys are always bound.
 .PP
-Other key bindings are, for the most part, what Emacs and \fIvi\fR(1)
+Other key bindings are, for the most part, what \fIemacs\fR(1) and \fIvi\fR(1)
 users would expect and can easily be displayed by \fIbindkey\fR, so there
 is no need to list them here.  Likewise, \fIbindkey\fR can list the editor
 commands with a short description of each.
+Certain key bindings have different behavior depending if \fIemacs\fR(1) or \fIvi\fR(1)
+style bindings are being used; see \fBvimode\fR for more information.
 .PP
 Note that editor commands do not have the same notion of a ``word'' as does the
 shell.  The editor delimits words with any non-alphanumeric characters not in
@@ -408,7 +416,7 @@
 .br
 condiments.h    main.c~
 .br
-> set fignore = (.o \\~)
+> set fignore = (.o \e~)
 .br
 > emacs ma[^D]
 .br
@@ -420,7 +428,7 @@
 .PP
 `main.c~' and `main.o' are ignored by completion (but not listing),
 because they end in suffixes in \fBfignore\fR.
-Note that a `\\' was needed in front of `~' to prevent it from being
+Note that a `\e' was needed in front of `~' to prevent it from being
 expanded to \fBhome\fR as described under \fBFilename substitution\fR.
 \fBfignore\fR is ignored if only one completion is possible.
 .PP
@@ -534,10 +542,6 @@
 Like completion, spelling correction works anywhere in the line,
 pushing the rest of the line to the right and possibly leaving
 extra characters to the right of the cursor.
-.PP
-Beware: spelling correction is not guaranteed to work the way one intends,
-and is provided mostly as an experimental feature.
-Suggestions and improvements are welcome.
 .SS "Editor commands (+)"
 `bindkey' lists key bindings and `bindkey \-l' lists and briefly describes
 editor commands.
@@ -552,6 +556,26 @@
 to letters by default are bound to both lower- and uppercase letters for
 convenience.
 .TP 8
+.B backward-char \fR(^B, left)
+Move back a character.
+Cursor behavior modified by \fBvimode\fR.
+.TP 8
+.B backward-delete-word \fR(M-^H, M-^?)
+Cut from beginning of current word to cursor \- saved in cut buffer.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
+.B backward-word \fR(M-b, M-B)
+Move to beginning of current word.
+Word boundary and cursor behavior modified by \fBvimode\fR.
+.TP 8
+.B beginning-of-line \fR(^A, home)
+Move to beginning of line.
+Cursor behavior modified by \fBvimode\fR.
+.TP 8
+.B capitalize-word \fR(M-c, M-C)
+Capitalize the characters from cursor to end of current word.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
 .B complete-word \fR(tab)
 Completes a word as described under \fBCompletion and listing\fR.
 .TP 8
@@ -569,6 +593,7 @@
 .B copy-prev-word \fR(M-^_)
 Copies the previous word in the current line into the input buffer.
 See also \fIinsert-last-word\fR.
+Word boundary behavior modified by \fBvimode\fR.
 .TP 8
 .B dabbrev-expand \fR(M-/)
 Expands the current word to the most recent preceding one for which
@@ -581,11 +606,13 @@
 .B delete-char \fR(not bound)
 Deletes the character under the cursor.
 See also \fIdelete-char-or-list-or-eof\fR.
+Cursor behavior modified by \fBvimode\fR.
 .TP 8
 .B delete-char-or-eof \fR(not bound)
 Does \fIdelete-char\fR if there is a character under the cursor
 or \fIend-of-file\fR on an empty line.
 See also \fIdelete-char-or-list-or-eof\fR.
+Cursor behavior modified by \fBvimode\fR.
 .TP 8
 .B delete-char-or-list \fR(not bound)
 Does \fIdelete-char\fR if there is a character under the cursor
@@ -600,14 +627,26 @@
 \fIdelete-char-or-eof\fR, \fIdelete-char-or-list\fR and \fIlist-or-eof\fR,
 each of which does a different two out of the three.
 .TP 8
+.B delete-word \fR(M-d, M-D)
+Cut from cursor to end of current word \- save in cut buffer.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
 .B down-history \fR(down-arrow, ^N)
 Like \fIup-history\fR, but steps down, stopping at the original input line.
 .TP 8
+.B downcase-word \fR(M-l, M-L)
+Lowercase the characters from cursor to end of current word.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
 .B end-of-file \fR(not bound)
 Signals an end of file, causing the shell to exit unless the \fBignoreeof\fR
 shell variable (q.v.) is set to prevent this.
 See also \fIdelete-char-or-list-or-eof\fR.
 .TP 8
+.B end-of-line \fR(^E, end)
+Move cursor to end of line.
+Cursor behavior modified by \fBvimode\fR.
+.TP 8
 .B expand-history \fR(M-space)
 Expands history substitutions in the current word.
 See \fBHistory substitution\fR.
@@ -626,6 +665,14 @@
 Expands the variable to the left of the cursor.
 See \fBVariable substitution\fR.
 .TP 8
+.B forward-char \fR(^F, right)
+Move forward one character.
+Cursor behavior modified by \fBvimode\fR.
+.TP 8
+.B forward-word \fR(M-f, M-F)
+Move forward to end of current word.
+Word boundary and cursor behavior modified by \fBvimode\fR.
+.TP 8
 .B history-search-backward \fR(M-p, M-P)
 Searches backwards through the history list for a command beginning with
 the current contents of the input buffer up to the cursor and copies it
@@ -674,12 +721,13 @@
 search, leaving the current line in the input buffer, and
 is then interpreted as normal input.  In particular, a carriage return
 causes the current line to be executed.
-Emacs mode only.
 See also \fIi-search-fwd\fR and \fIhistory-search-backward\fR.
+Word boundary behavior modified by \fBvimode\fR.
 .RE
 .TP 8
 .B i-search-fwd \fR(not bound)
 Like \fIi-search-back\fR, but searches forward.
+Word boundary behavior modified by \fBvimode\fR.
 .TP 8
 .B insert-last-word \fR(M-_)
 Inserts the last word of the previous input line (`!$') into the input buffer.
@@ -722,9 +770,13 @@
 .TP 8
 .B run-fg-editor \fR(M-^Z)
 Saves the current input line and
-looks for a stopped job with a name equal to the last component of the
-file name part of the \fBEDITOR\fR or \fBVISUAL\fR environment variables,
-or, if neither is set, `ed' or `vi'.
+looks for a stopped job where the file name portion of its first word
+is found in the \fBeditors\fR shell variable.
+If \fBeditors\fR is not set, then the file name portion of the
+\fBEDITOR\fR environment variable (`ed' if unset)
+and the
+\fBVISUAL\fR environment variable (`vi' if unset)
+will be used.
 If such a job is found, it is restarted as if `fg %\fIjob\fR' had been
 typed.  This is used to toggle back and forth between an editor and
 the shell easily.  Some people bind this command to `^Z' so they
@@ -760,7 +812,7 @@
 .B spell-line \fR(M-$)
 Attempts to correct the spelling of each word in the input buffer, like
 \fIspell-word\fR, but ignores words whose first character is one of
-`\-', `!', `^' or `%', or which contain `\\', `*' or `?', to avoid problems
+`\-', `!', `^' or `%', or which contain `\e', `*' or `?', to avoid problems
 with switches, substitutions and the like.
 See \fBSpelling correction\fR.
 .TP 8
@@ -781,6 +833,18 @@
 If \fBhistlit\fR is set, uses the literal form of the entry.
 May be repeated to step up through the history list, stopping at the top.
 .TP 8
+.B upcase-word \fR(M-u, M-U)
+Uppercase the characters from cursor to end of current word.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
+.B vi-beginning-of-next-word \fR(not bound)
+Vi goto the beginning of next word.
+Word boundary and cursor behavior modified by \fBvimode\fR.
+.TP 8
+.B vi-eword \fR(not bound)
+Vi move to the end of the current word.
+Word boundary behavior modified by \fBvimode\fR.
+.TP 8
 .B vi-search-back \fR(?)
 Prompts with `?' for a search string (which may be a glob-pattern, as with
 \fIhistory-search-backward\fR), searches for it and copies it into the
@@ -816,8 +880,8 @@
 .PP
 A special character (including a blank or tab) may be prevented from having
 its special meaning, and possibly made part of another word, by preceding it
-with a backslash (`\\') or enclosing it in single (`''), double (`"') or
-backward (``') quotes.  When not otherwise quoted a newline preceded by a `\\'
+with a backslash (`\e') or enclosing it in single (`''), double (`"') or
+backward (`\`') quotes.  When not otherwise quoted a newline preceded by a `\e'
 is equivalent to a blank, but inside quotes this sequence results in a
 newline.
 .PP
@@ -824,8 +888,8 @@
 Furthermore, all \fBSubstitutions\fR (see below) except \fBHistory substitution\fR
 can be prevented by enclosing the strings (or parts of strings)
 in which they appear with single quotes or by quoting the crucial character(s)
-(e.g., `$' or ``' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively)
-with `\\'.  (\fBAlias substitution\fR is no exception: quoting in any way any
+(e.g., `$' or `\`' for \fBVariable substitution\fR or \fBCommand substitution\fR respectively)
+with `\e'.  (\fBAlias substitution\fR is no exception: quoting in any way any
 character of a word for which an \fIalias\fR has been defined prevents
 substitution of the alias.  The usual way of quoting an alias is to precede it
 with a backslash.) \fBHistory substitution\fR is prevented by
@@ -847,7 +911,7 @@
 to do so if appropriate.
 .PP
 The \fBbackslash_quote\fR shell variable (q.v.) can be set to make backslashes
-always quote `\\', `'', and `"'.  (+) This may make complex quoting tasks
+always quote `\e', `'', and `"'.  (+) This may make complex quoting tasks
 easier, but it can cause syntax errors in \fIcsh\fR(1) scripts.
 .SS Substitutions
 We now describe the various transformations the shell performs on the input in
@@ -880,7 +944,7 @@
 command with little typing and a high degree of confidence.
 .PP
 History substitutions begin with the character `!'.  They may begin anywhere in
-the input stream, but they do not nest.  The `!' may be preceded by a `\\' to
+the input stream, but they do not nest.  The `!' may be preceded by a `\e' to
 prevent its special meaning; for convenience, a `!' is passed unchanged when it
 is followed by a blank, tab, newline, `=' or `('.  History substitutions also
 occur when an input line begins with `^'.  This special abbreviation will be
@@ -1046,8 +1110,8 @@
 \fIl\fR is simply a string like \fIr\fR, not a regular expression as in
 the eponymous \fIed\fR(1) command.
 Any character may be used as the delimiter in place of `/';
-a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR.
-The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'.
+a `\e' can be used to quote the delimiter inside \fIl\fR and \fIr\fR.
+The character `&' in the \fIr\fR is replaced by \fIl\fR; `\e' also quotes `&'.
 If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the
 \fIs\fR from a previous search or event number in event specification is used.
 The trailing delimiter may be omitted if it is immediately followed by a newline.
@@ -1187,7 +1251,7 @@
 executed, variable substitution is performed keyed by `$' characters.  This
 expansion can be prevented by preceding the `$' with a `\e' except within `"'s
 where it \fIalways\fR occurs, and within `''s where it \fInever\fR occurs.
-Strings quoted by ``' are interpreted later (see \fBCommand substitution\fR
+Strings quoted by `\`' are interpreted later (see \fBCommand substitution\fR
 below) so `$' substitution does not occur there until later,
 if at all.  A `$' is passed unchanged if followed by a blank, tab, or
 end-of-line.
@@ -1316,7 +1380,7 @@
 occurs very late, after input-output redirection is performed, and in a child
 of the main shell.
 .SS "Command substitution"
-Command substitution is indicated by a command enclosed in ``'.  The output
+Command substitution is indicated by a command enclosed in `\`'.  The output
 from such a command is broken into separate words at blanks, tabs and newlines,
 and null words are discarded.  The output is variable and command substituted
 and put in place of the original string.
@@ -1401,7 +1465,7 @@
 a file glob pattern that matches any string of characters including `/',
 recursively traversing any existing sub-directories.  For example, 
 `ls **.c' will list all the .c files in the current directory tree.
-If used by itself, it will match match zero or more sub-directories
+If used by itself, it will match zero or more sub-directories
 (e.g. `ls /usr/include/**/time.h' will list any file named `time.h'
 in the /usr/include directory tree; `ls /usr/include/**time.h' will match 
 any file in the /usr/include directory tree ending in `time.h'; and
@@ -1549,9 +1613,9 @@
 Read the shell input up to a line which is identical to \fIword\fR.  \fIword\fR
 is not subjected to variable, filename or command substitution, and each input
 line is compared to \fIword\fR before any substitutions are done on this input
-line.  Unless a quoting `\e', `"', `' or ``' appears in \fIword\fR variable and
+line.  Unless a quoting `\e', `"', `' or `\`' appears in \fIword\fR variable and
 command substitution is performed on the intervening lines, allowing `\e' to
-quote `$', `\e' and ``'.  Commands which are substituted have all blanks, tabs,
+quote `$', `\e' and `\`'.  Commands which are substituted have all blanks, tabs,
 and newlines preserved, except for the final newline which is dropped.  The
 resultant text is placed in an anonymous temporary file which is given to the
 command as standard input.
@@ -1573,6 +1637,9 @@
 character special file (e.g., a terminal or `/dev/null') or an error results.
 This helps prevent accidental destruction of files.  In this case the `!' forms
 can be used to suppress this check.
+If \fBnotempty\fR is given in \fBnoclobber\fR, `>' is allowed on empty files;
+if \fBask\fR is set, an interacive confirmation is presented, rather than an
+error.
 .PP
 The forms involving `&' route the diagnostic output into the specified file as
 well as the standard output.  \fIname\fR is expanded in the same way as `<'
@@ -1746,7 +1813,7 @@
 see if it has the specified relationship to the real user.  If \fIfile\fR
 does not exist or is inaccessible or, for the operators indicated by `*',
 if the specified file type does not exist on the current system,
-then all enquiries return false, i.e., `0'.
+then all inquiries return false, i.e., `0'.
 .PP
 These operators may be combined for conciseness: `\-\fIxy file\fR' is
 equivalent to `\-\fIx file\fR && \-\fIy file\fR'.  (+) For example, `\-fx' is true
@@ -2174,17 +2241,20 @@
 Lists all editor commands and a short description of each.
 .TP 4
 .B \-d
-Binds all keys to the standard bindings for the default editor.
+Binds all keys to the standard bindings for the default editor,
+as per \fB-e\fR and \fB-v\fR below.
 .TP 4
 .B \-e
-Binds all keys to the standard GNU Emacs-like bindings.
+Binds all keys to \fIemacs\fR(1)\-style bindings.
+Unsets \fBvimode\fR.
 .TP 4
 .B \-v
-Binds all keys to the standard \fIvi\fR(1)-like bindings.
+Binds all keys to \fIvi\fR(1)\-style bindings.
+Sets \fBvimode\fR.
 .TP 4
 .B \-a
 Lists or changes key-bindings in the alternative key map.
-This is the key map used in \fIvi\fR command mode.
+This is the key map used in \fBvimode\fR command mode.
 .TP 4
 .B \-b
 \fIkey\fR is interpreted as
@@ -2262,7 +2332,7 @@
 .RE
 .PP
 `\e' nullifies the special meaning of the following character, if it has
-any, notably `\\' and `^'.
+any, notably `\e' and `^'.
 .RE
 .TP 8
 .B bs2cmd \fIbs2000-command\fR (+)
@@ -2293,7 +2363,8 @@
 .TP 8
 .B cd \fR[\fB\-p\fR] [\fB\-l\fR] [\fB\-n\fR|\fB\-v\fR] [\I--\fR] [\fIname\fR]
 If a directory \fIname\fR is given, changes the shell's working directory
-to \fIname\fR.  If not, changes to \fBhome\fR.
+to \fIname\fR.  If not, changes to \fBhome\fR, unless the \fBcdtohome\fR
+variable is not set, in which case a \fIname\fR is required.
 If \fIname\fR is `\-' it is interpreted as the previous working directory
 (see \fBOther substitutions\fR).  (+)
 If \fIname\fR is not a subdirectory of the current directory
@@ -2300,7 +2371,8 @@
 (and does not begin with `/', `./' or `../'), each component of the variable
 \fBcdpath\fR is checked to see if it has a subdirectory \fIname\fR.  Finally, if
 all else fails but \fIname\fR is a shell variable whose value
-begins with `/', then this is tried to see if it is a directory.
+begins with `/' or '.', then this is tried to see if it is a directory, and
+the \fB\-p\fR option is implied.
 .RS +8
 .PP
 With \fB\-p\fR, prints the final directory stack, just like \fIdirs\fR.
@@ -2309,7 +2381,7 @@
 Using \fB\-\-\fR forces a break from option processing so the next word
 is taken as the directory \fIname\fR even if it begins with '\-'. (+)
 .PP
-See also the \fBimplicitcd\fR shell variable.
+See also the \fBimplicitcd\fR and \fBcdtohome\fR shell variables.
 .RE
 .TP 8
 .B chdir
@@ -2428,7 +2500,7 @@
 (...)
 Words from the given list
 .TP 8
-`...`
+\`...\`
 Words from the output of command
 .PD
 .RE
@@ -2445,7 +2517,7 @@
 case the fourth delimiter can also be omitted), a slash is appended to
 directories and a space to other words.
 .PP
-\fIcommand\fR invoked from `...` version has additional environment
+\fIcommand\fR invoked from \`...\` version has additional environment
 variable set, the variable name is \%\fBCOMMAND_LINE\fR\% and
 contains (as its name indicates) contents of the current (already
 typed in) command line. One can examine and use contents of the
@@ -2526,7 +2598,7 @@
 .PP
 or from a command run at completion time:
 .IP "" 4
-> complete kill 'p/*/`ps | awk \\{print\\ \\$1\\}`/'
+> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
 .br
 > kill \-9 [^D]
 .br
@@ -2587,7 +2659,7 @@
 .PP
 Finally, here's a complex example for inspiration:
 .IP "" 4
-> complete find \\
+> complete find \e
 .br
 \&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
 .br
@@ -2618,8 +2690,6 @@
 .PP
 Remember that programmed completions are ignored if the word being completed
 is a tilde substitution (beginning with `~') or a variable (beginning with `$').
-\fIcomplete\fR is an experimental feature, and the syntax may change
-in future versions of the shell.
 See also the \fIuncomplete\fR builtin command.
 .RE
 .TP 8
@@ -2684,7 +2754,7 @@
 from a shell script less verbose on slow terminals, or limit command
 output to the number of lines on the screen:
 .IP "" 4
-> set history=`echotc lines`
+> set history=\`echotc lines\`
 .br
 > @ history\-\-
 .PP
@@ -2693,9 +2763,9 @@
 capability string, as in the following example that places the date in
 the status line:
 .IP "" 4
-> set tosl="`echotc ts 0`"
+> set tosl="\`echotc ts 0\`"
 .br
-> set frsl="`echotc fs`"
+> set frsl="\`echotc fs\`"
 .br
 > echo \-n "$tosl";date; echo \-n "$frsl"
 .PP
@@ -2814,8 +2884,10 @@
 existing history file instead of replacing it (if there is one) and
 sorted by time stamp.  (+) Merging is intended for an environment like
 the X Window System
-with several shells in simultaneous use.  Currently it succeeds
-only when the shells quit nicely one after another.
+with several shells in simultaneous use.  If the second word of \fBsavehist\fR
+is `merge' and the third word is set to `lock', the history file update
+will be serialized with other shell sessions that would possibly like
+to merge history at exactly the same time.
 .PP
 With \fB\-L\fR, the shell appends \fIfilename\fR, which is presumably a
 history list saved by the \fB\-S\fR option or the \fBsavehist\fR mechanism,
@@ -2958,6 +3030,12 @@
 \fIdescriptors\fR or \fIopenfiles\fR
 the maximum number of open files for this process
 .TP
+\fIpseudoterminals\fR
+the maximum number of pseudo-terminals for this user
+.TP
+\fIkqueues\fR
+the maximum number of kqueues allocated for this process
+.TP
 \fIconcurrency\fR
 the maximum number of threads for this process
 .TP
@@ -2967,6 +3045,13 @@
 \fImaxproc\fR
 the maximum number of simultaneous processes for this user id
 .TP
+\fImaxthread\fR
+the maximum number of simultaneous threads (lightweight processes) for this
+user id
+.TP
+\fIthreads\fR
+the maximum number of threads for this process
+.TP
 \fIsbsize\fR
 the maximum size of socket buffer usage for this user
 .TP
@@ -2976,6 +3061,9 @@
 \fImaxlocks\fR
 the maximum number of locks for this user
 .TP
+\fIposixlocks\fR
+the maximum number of POSIX advisory locks for this user
+.TP
 \fImaxsignal\fR
 the maximum number of pending signals for this user
 .TP
@@ -3212,12 +3300,13 @@
 .PD
 .RS +8
 .IP "" 4
-> sched 11:00 echo It\\'s eleven o\\'clock.
+> sched 11:00 echo It\e's eleven o\e'clock.
 .PP
 causes the shell to echo `It's eleven o'clock.' at 11 AM.
 The time may be in 12-hour AM/PM format
 .IP "" 4
-> sched 5pm set prompt='[%h] It\\'s after 5; go home: >'
+.\" TODO
+> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
 .PP
 or may be relative to the current time:
 .IP "" 4
@@ -3615,7 +3704,7 @@
 shell variable to match (unless the shell variable is read-only) and vice
 versa.  Note that although \fBcwd\fR and \fBPWD\fR have identical meanings, they
 are not synchronized in this manner, and that the shell automatically
-interconverts the different formats of \fBpath\fR and \fBPATH\fR.
+converts between the different formats of \fBpath\fR and \fBPATH\fR.
 .TP 8
 .B addsuffix \fR(+)
 If set, filename completion adds `/' to the end of directories and a space
@@ -3629,6 +3718,11 @@
 .B ampm \fR(+)
 If set, all times are shown in 12-hour AM/PM format.
 .TP 8
+.B anyerror \fR(+)
+This variable selects what is propagated to the value of the
+\fBstatus\fR variable. For more information see the description of the
+\fBstatus\fR variable below.
+.TP 8
 .B argv
 The arguments to the shell.  Positional parameters are taken from \fBargv\fR,
 i.e., `$1' is replaced by `$argv[1]', etc.
@@ -3672,7 +3766,8 @@
 cases.
 .TP 8
 .B backslash_quote \fR(+)
-If set, backslashes (`\\') always quote `\\', `'', and `"'.  This may make
+.\" TODO
+If set, backslashes (`\e') always quote `\e', `'', and `"'.  This may make
 complex quoting tasks easier, but it can cause syntax errors in \fIcsh\fR(1)
 scripts.
 .TP 8
@@ -3685,6 +3780,11 @@
 A list of directories in which \fIcd\fR should search for
 subdirectories if they aren't found in the current directory.
 .TP 8
+.B cdtohome \fR(+)
+If not set, \fIcd\fR requires a directory \fIname\fR, and will not go to the
+\fBhome\fR directory if it's omitted.
+This is set by default.
+.TP 8
 .B color
 If set, it enables color display for the builtin \fBls\-F\fR and it passes
 \fB\-\-color=auto\fR to \fBls\fR.  Alternatively, it can be set to only
@@ -3710,7 +3810,7 @@
 separators.
 If set to `Enhance', completion matches uppercase and underscore
 characters explicitly and matches lowercase and hyphens in a
-case-insensivite manner; it will treat periods, hypens and underscores
+case-insensitive manner; it will treat periods, hyphens and underscores
 as word separators.
 .TP 8
 .B continue \fR(+)
@@ -3721,7 +3821,7 @@
 Same as continue, but the shell will execute:
 .RS +8
 .IP "" 4
-echo `pwd` $argv > ~/.<cmd>_pause; %<cmd>
+echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
 .RE
 .TP 8
 .B correct \fR(+)
@@ -3831,13 +3931,14 @@
 .PD 0
 .TP 8
 bsd
-Don't echo a newline if the first argument is `\-n'.
+Don't echo a newline if the first argument is `\-n'; the default for \fIcsh\fR.
 .TP 8
 sysv
 Recognize backslashed escape sequences in echo strings.
 .TP 8
 both
-Recognize both the `\-n' flag and backslashed escape sequences; the default.
+Recognize both the `\-n' flag and backslashed escape sequences; the default
+for \fItcsh\fR.
 .TP 8
 none
 Recognize neither.
@@ -3852,6 +3953,11 @@
 If set, the command-line editor is used.  Set by default in interactive
 shells.
 .TP 8
+.B editors \fR(+)
+A list of command names for the \fIrun-fg-editor\fR editor command to match.
+If not set, the \fBEDITOR\fR (`ed' if unset) and \fBVISUAL\fR (`vi' if unset)
+environment variables will be used instead.
+.TP 8
 .B ellipsis \fR(+)
 If set, the `%c'/`%.' and `%C' prompt sequences (see the \fBprompt\fR
 shell variable) indicate skipped directories with an ellipsis (`...')
@@ -3884,7 +3990,7 @@
 If set, the `**' and `***' file glob patterns will match any string of 
 characters including `/' traversing any existing sub-directories.  (e.g. 
 `ls **.c' will list all the .c files in the current directory tree).
-If used by itself, it will match match zero or more sub-directories
+If used by itself, it will match zero or more sub-directories
 (e.g. `ls /usr/include/**/time.h' will list any file named `time.h'
 in the /usr/include directory tree; whereas `ls /usr/include/**time.h'
 will match any file in the /usr/include directory tree ending in `time.h').
@@ -3937,7 +4043,7 @@
 .B history
 The first word indicates the number of history events to save.  The
 optional second word (+) indicates the format in which history is
-printed; if not given, `%h\\t%T\\t%R\\n' is used.  The format sequences
+printed; if not given, `%h\et%T\et%R\en' is used.  The format sequences
 are described below under \fBprompt\fR; note the variable meaning of
 `%R'.  Set to `100' by default.
 .TP 8
@@ -4278,7 +4384,7 @@
 .TP 8
 .B prompt2 \fR(+)
 The string with which to prompt in \fIwhile\fR and \fIforeach\fR loops and
-after lines ending in `\\'.
+after lines ending in `\e'.
 The same format sequences may be used as in \fBprompt\fR (q.v.);
 note the variable meaning of `%R'.
 Set by default to `%R? ' in interactive shells.
@@ -4329,14 +4435,19 @@
 .B savehist
 If set, the shell does `history \-S' before exiting.
 If the first word is set to a number, at most that many lines are saved.
-(The number must be less than or equal to \fBhistory\fR.)
+(The number should be less than or equal to the number \fBhistory\fR entries;
+if it is set to greater than the number of \fBhistory\fR settings, only
+\fBhistory\fR entries will be saved)
 If the second word is set to `merge', the history list is merged with
 the existing history file instead of replacing it (if there is one) and
-sorted by time stamp and the most recent events are retained.  (+)
+sorted by time stamp and the most recent events are retained.
+If the second word of \fBsavehist\fR is `merge' and the third word is set to
+`lock', the history file update will be serialized with other shell sessions
+that would possibly like to merge history at exactly the same time. (+)
 .TP 8
 .B sched \fR(+)
 The format in which the \fIsched\fR builtin command prints scheduled events;
-if not given, `%h\\t%T\\t%R\\n' is used.
+if not given, `%h\et%T\et%R\en' is used.
 The format sequences are described above under \fBprompt\fR;
 note the variable meaning of `%R'.
 .TP 8
@@ -4353,17 +4464,22 @@
 See also \fBloginsh\fR.
 .TP 8
 .B status
-The status returned by the last command, unless the variable
-.B anyerror
-is set, and any error in a pipeline or a backquote expansion will be
-propagated (this is the default
-.B csh
-behavior, and the current
-.B tcsh
-default). If it terminated
-abnormally, then 0200 is added to the status.  Builtin commands
-which fail return exit status `1', all other builtin commands
-return status `0'.
+The exit status from the last command or backquote expansion, or any
+command in a pipeline is propagated to \fBstatus\fR.  (This is also the
+default \fBcsh\fR behavior.)
+This default does not match what POSIX mandates (to return the
+status of the last command only). To match the POSIX behavior, you need
+to unset \fBanyerror\fR.
+.RS +8
+.PP
+If the \fBanyerror\fR variable is unset, the exit status of a pipeline
+is determined only from the last command in the pipeline, and the exit
+status of a backquote expansion is \fInot\fR propagated to \fBstatus\fR.
+.PP
+If a command terminated abnormally, then 0200 is added to the status.
+Builtin commands which fail return exit status `1', all other builtin
+commands return status `0'.
+.RE
 .TP 8
 .B symlinks \fR(+)
 Can be set to several different values to control symbolic link (`symlink')
@@ -4624,7 +4740,7 @@
 `.' is omitted from \fBpath\fR for security
 .TP 6
 vi
-\fIvi\fR-style editing is the default rather than \fIemacs\fR
+\fIvi\fR(1)\-style editing is the default rather than \fIemacs\fR(1)\-style
 .TP 6
 dtr
 Login shells drop DTR when exiting
@@ -4662,6 +4778,23 @@
 in the local version.
 .RE
 .TP 8
+.B vimode \fR(+)
+.RS +8
+If unset, various key bindings change behavior to be more \fBemacs\fR(1)\-style:
+word boundaries are determined by \fBwordchars\fR versus other characters.
+.PP
+If set, various key bindings change behavior to be more \fBvi\fR(1)\-style:
+word boundaries are determined by \fBwordchars\fR versus whitespace
+versus other characters;
+cursor behavior depends upon current vi mode (command, delete, insert, replace).
+.PP
+This variable is unset by \fIbindkey\fR \fB-e\fR and
+set by \fIbindkey\fR \fB-v\fR.
+.B vimode
+may be explicitly set or unset by the user after those \fIbindkey\fR
+operations if required.
+.RE
+.TP 8
 .B visiblebell \fR(+)
 If set, a screen flash is used rather than the audible bell.
 See also \fBnobeep\fR.
@@ -4726,7 +4859,9 @@
 .B wordchars \fR(+)
 A list of non-alphanumeric characters to be considered part of a word by the
 \fIforward-word\fR, \fIbackward-word\fR etc., editor commands.
-If unset, `*?_\-.[]~=' is used.
+If unset, the default value is determined based on the state of \fBvimode\fR:
+if \fBvimode\fR is unset, `*?_\-.[]~=' is used as the default;
+if \fBvimode\fR is set, `_' is used as the default.
 .SH ENVIRONMENT
 .TP 8
 .B AFSUSER \fR(+)
@@ -4741,8 +4876,9 @@
 .TP 8
 .B EDITOR
 The pathname to a default editor.
-See also the \fBVISUAL\fR environment variable
-and the \fIrun-fg-editor\fR editor command.
+Used by the \fIrun-fg-editor\fR editor command if the
+the \fBeditors\fR shell variable is unset.
+See also the \fBVISUAL\fR environment variable.
 .TP 8
 .B GROUP \fR(+)
 Equivalent to the \fBgroup\fR shell variable.
@@ -4978,8 +5114,9 @@
 .TP 8
 .B VISUAL
 The pathname to a default full-screen editor.
-See also the \fBEDITOR\fR environment variable
-and the \fIrun-fg-editor\fR editor command.
+Used by the \fIrun-fg-editor\fR editor command if the
+the \fBeditors\fR shell variable is unset.
+See also the \fBEDITOR\fR environment variable.
 .SH FILES
 .PD 0
 .TP 16
@@ -5047,8 +5184,9 @@
 but experienced \fIcsh\fR(1) users will want to pay special attention to
 \fItcsh\fR's new features.
 .PP
-A command-line editor, which supports GNU Emacs or \fIvi\fR(1)-style
-key bindings.  See \fBThe command-line editor\fR and \fBEditor commands\fR.
+A command-line editor, which supports \fIemacs\fR(1)\-style
+or \fIvi\fR(1)\-style key bindings.
+See \fBThe command-line editor\fR and \fBEditor commands\fR.
 .PP
 Programmable, interactive word completion and listing.
 See \fBCompletion and listing\fR and the \fIcomplete\fR and \fIuncomplete\fR
@@ -5201,7 +5339,7 @@
 malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
 termio(7), Introduction to the C Shell
 .SH VERSION
-This manual documents tcsh 6.18.01 (Astron) 2012-02-14.
+This manual documents tcsh 6.20.00 (Astron) 2016-11-24.
 .SH AUTHORS
 .PD 0
 .TP 2

Added: vendor/tcsh/dist/tcsh.man.new
===================================================================
--- vendor/tcsh/dist/tcsh.man.new	                        (rev 0)
+++ vendor/tcsh/dist/tcsh.man.new	2018-06-27 00:42:17 UTC (rev 11147)
@@ -0,0 +1,9866 @@
+.\" $tcsh: tcsh.man.new,v 1.5 2016/11/24 15:06:09 christos Exp $
+.\" From: tcsh: tcsh.man,v 3.266 2016/11/24 15:04:52 christos Exp
+.\" Copyright (c) 1980, 1990, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LESS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" - Indent in multiples of 4, usually 8.
+.\"
+.\" - Use \` for literal back-quote (`).
+.\"
+.\" - Use \e for literal backslash (\).
+.\"
+.\" - Use \-, not -.
+.\"
+.\" - Include the tilde when naming dot files. .Pa ~/.login , not .Pa .login
+.\"
+.\" - Refer to external commands in man page format, e.g., .Xr csh 1
+.\" However, tcsh is .Nm , because this is the tcsh man page (and
+.\" see the next note anyway).
+.\"
+.\" - Say .Sq the shell , not .Sq tcsh ,
+.\" unless distinguishing between tcsh and csh.
+.\"
+.\" - Say .Sq shell variable / .Sq environment variable instead of
+.\" .Sq variable and .Sq builtin command / .Sq editor command instead of
+.\" .Sq builtin or .Sq command
+.\"   unless the distinction is absolutely clear from context.
+.\"
+.\" - Use the simple present tense.
+.\" .Sq The shell uses , not .Sq The shell will use
+.\"
+.\" - IMPORTANT: Cross-reference as much as possible. Commands, variables,
+.\"   etc. in the reference section should be mentioned in the appropriate
+.\"   descriptive section, or at least in the reference-section description
+.\"   of another command (or whatever) which is mentioned in a description
+.\"   section. Remember to note OS-specific things in "OS variant support",
+.\"   new features in NEW FEATURES and referenced external commands in SEE
+.\"   ALSO.
+.\"
+.\" - tcsh.man2html depends heavily on the specific nroff commands used in the
+.\"   man page when the script was written. Please stick closely to the style
+.\"   used here if you can. In particular, please don't use nroff commands
+.\"   which aren't already used herein.
+.\"
+.Dd November 24, 2016
+.Dt TCSH 1
+.Os Astron 6.20.00
+.Sh NAME
+.Nm tcsh
+.Nd C shell with file name completion and command line editing
+.Sh SYNOPSIS
+.Nm
+.Op Fl bcdefFimnqstvVxX
+.Op Fl Dname Ns Op =value
+.Op Ar arg ...
+.Nm
+.Fl l
+.Ek
+.Sh DESCRIPTION
+.Nm
+is an enhanced but completely compatible version of the Berkeley
+UNIX C shell,
+.Xr csh 1 .
+It is a command language interpreter usable both as an interactive login
+shell and a shell script command processor.
+It includes a command-line editor (see
+.Sx The command-line editor )
+programmable word completion (see
+.Sx Completion and listing )
+spelling correction (see
+.Sx Spelling correction ) ,
+a history mechanism (see
+.Sx History substitution ) ,
+job control (see
+.Sx Jobs )
+and a C-like syntax.
+The
+.Sx NEW FEATURES
+section describes major enhancements of
+.Nm
+over
+.Xr csh 1 .
+Throughout this manual, features of
+.Nm
+not found in most
+.Xr csh 1
+implementations
+(specifically, the 4.4BSD one)
+are labeled with
+.Sq (+) ,
+and features which are present in
+.Xr csh 1
+but not usually documented are labeled with
+.Sq (u) .
+.Bl -tag
+.Ss Argument list processing
+If the first argument (argument 0) to the shell is
+.Sq \-
+then it is a login shell.
+A login shell can be also specified by invoking the shell with
+the
+.Fl l
+flag as the only argument.
+.Pp
+The rest of the flag arguments are interpreted as follows:
+.Bl -tag -width indent
+.It Fl b
+Forces a
+.Dq break
+from option processing, causing any
+further shell arguments to be treated as non-option arguments.
+The remaining arguments will not be interpreted as shell options.
+This may be used to pass options to a shell script without confusion
+or possible subterfuge.
+The shell will not run a set-user ID script without this option.
+.It Fl c
+Commands are read from the following argument (which must be present, and
+must be a single argument),
+stored in the
+.Va command
+shell variable for reference, and executed.
+Any remaining arguments are placed in the
+.Va argv
+shell variable.
+.It Fl d
+The shell loads the directory stack from
+.Pa ~/.cshdirs
+as described under
+.Sx Startup and shutdown ,
+whether or not it is a login shell. (+)
+.It Fl Dname Ns Op =value
+Sets the environment variable
+.Va name
+.Dv value .
+(Domain/OS only) (+)
+.It Fl e
+The shell exits if any invoked command terminates abnormally or
+yields a non-zero exit status.
+.It Fl f
+The shell does not load any resource or startup files, or perform any
+command hashing, and thus starts faster.
+.It Fl F
+The shell uses
+.Xr fork 2
+instead of
+.Xr vfork 2
+to spawn processes. (+)
+.It Fl i
+The shell is interactive and prompts for its top-level input, even if
+it appears to not be a terminal.
+Shells are interactive without this option if
+their inputs and outputs are terminals.
+.It Fl l
+The shell is a login shell.
+Applicable only if
+.Fl l
+is the only
+flag specified.
+.It Fl m
+The shell loads
+.Pa ~/.tcshrc
+even if it does not belong to the effective user.
+Newer versions of
+.Xr su 1
+can pass
+.Fl m
+to the shell. (+)
+.It Fl n
+The shell parses commands but does not execute them.
+This aids in debugging shell scripts.
+.It Fl q
+The shell accepts SIGQUIT (see
+.Sx Signal handling )
+and behaves when it is used under a debugger.
+Job control is disabled. (u)
+.It Fl s
+Command input is taken from the standard input.
+.It Fl t
+The shell reads and executes a single line of input.
+A
+.Sq \e
+may be used to
+escape the newline at the end of this line and continue onto another line.
+.It Fl v
+Sets the
+.Va verbose
+shell variable, so that
+command input is echoed after history substitution.
+.It Fl x
+Sets the
+.Va echo
+shell variable, so that commands are echoed
+immediately before execution.
+.It Fl V
+Sets the
+.Va verbose
+shell variable even before executing
+.Pa ~/.tcshrc .
+.It Fl X
+Is to
+.Fl x
+as
+.Fl V
+is to
+.Fl v .
+.TP 4
+.It Fl \-help
+Print a help message on the standard output and exit. (+)
+.It Fl \-version
+Print the version/platform/compilation options on the standard output and exit.
+This information is also contained in the
+.Va version
+shell variable. (+)
+.El
+.Pp
+After processing of flag arguments, if arguments remain but none of the
+.Fl c ,
+.Fl i ,
+.Fl s ,
+or
+.Fl t
+options were given, the first argument is taken as the name of a file of
+commands, or
+.Dq script ,
+to be executed.
+The shell opens this file and saves its name for possible
+resubstitution by
+.Sq $0 .
+Because many systems use either the standard
+version 6 or version 7 shells whose shell scripts are not compatible
+with this shell, the shell uses such a
+.Sq standard
+shell to execute a script
+whose first character is not a
+.Sq # ,
+i.e., that does not start with a
+comment.
+.Pp
+Remaining arguments are placed in the
+.Va argv
+shell variable.
+.Ss Startup and shutdown
+A login shell begins by executing commands from the system files
+.Pa /etc/csh.cshrc
+and
+.Pa /etc/csh.login .
+It then executes commands from files in the user's
+.Pa home
+directory:
+first
+.Pa ~/.tcshrc (+)
+or, if
+.Pa ~/.tcshrc
+is not found,
+.Pa ~/.cshrc ,
+then
+.Pa ~/.history
+(or the value of the
+.Va histfile
+shell variable), then
+.Pa ~/.login ,
+and finally
+.Pa ~/.cshdirs
+(or the value of the
+.Va dirsfile
+shell variable) (+).
+The shell may read
+.Pa /etc/csh.login
+before instead of after
+.Pa /etc/csh.cshrc ,
+and
+.Pa ~/.login
+before instead of after
+.Pa ~/.tcshrc
+or
+.Pa ~/.cshrc
+and
+.Pa ~/.history ,
+if so compiled;
+see the
+.Va version
+shell variable. (+)
+.Pp
+Non-login shells read only
+.Pa /etc/csh.cshrc
+and
+.Pa ~/.tcshrc
+or
+.Pa ~/.cshrc
+on startup.
+.Pp
+For examples of startup files, please consult:
+.Lk http://tcshrc.sourceforge.net
+.Pp
+Commands like
+.Xr stty 1
+and
+.Xr tset 1 ,
+which need be run only once per login, usually go in one's
+.Pa ~/.login
+file.
+Users who need to use the same set of files with both
+.Xr csh 1
+and
+.Nm
+can have only a
+.Pa ~/.cshrc
+which checks for the existence of the
+.Va tcsh
+shell variable (q.v.) before using
+.Nm \-
+specific commands,
+or can have both a
+.Pa ~/.cshrc
+and a
+.Pa ~/.tcshrc
+which
+.Ic sources
+(see the builtin command)
+.Pa ~/.cshrc .
+The rest of this manual uses
+.Pa ~/.tcshrc
+to mean
+.Pa ~/.tcshrc
+or,
+if
+.Pa ~/.tcshrc
+is not found,
+.Pa ~/.cshrc .
+.Pp
+In the normal case, the shell begins reading commands from the terminal,
+prompting with
+.Sq >\~ .
+(Processing of arguments and the use of the shell to
+process files containing command scripts are described later.)
+The shell repeatedly reads a line of command input, breaks it into words,
+places it on the command history list, parses it and executes each command
+in the line.
+.Pp
+One can log out by typing
+.Sq ^D
+on an empty line,
+.Sq logout
+or
+.Sq login
+or
+via the shell's autologout mechanism (see the
+.Va autologout
+shell variable).
+When a login shell terminates it sets the
+.Va logout
+shell variable to
+.Sq normal
+or
+.Sq automatic
+as appropriate, then executes commands from the files
+.Pa /etc/csh.logout
+and
+.Pa ~/.logout .
+The shell may drop DTR on logout
+if so compiled; see the
+.Va version
+shell variable.
+.Pp
+The names of the system login and logout files vary from system to system for
+compatibility with different
+.Xr csh 1
+variants; see
+.Sx FILES .
+.Ss Editing
+We first describe
+.Sx The command-line editor" 
+The
+.Sx Completion and listing
+and
+.Sx Spelling correction
+sections describe two sets of functionality that are implemented as editor
+commands but which deserve their own treatment.
+Finally,
+.Sx Editor commands
+lists and describes
+the editor commands specific to the shell and their default bindings.
+.It Sx The command-line editor (+)
+Command-line input can be edited using key sequences much like those used in
+.Xr emacs 1
+or
+.Xr vi 1 .
+The editor is active only when the
+.Va edit
+shell variable is set, which it is by default in interactive shells.
+The
+.Ic bindkey
+builtin can display and change key bindings.
+.Xr emacs 1
+style key bindings are used by default
+(unless the shell was compiled otherwise; see the
+.Va version
+shell variable),
+but
+.Ic bindkey
+can change the key bindings to
+.Xr vi 1
+style bindings en masse.
+.Pp
+The shell always binds the arrow keys (as defined in the
+.Va TERMCAP
+environment variable) to:
+.Pp
+.Bl -tag -width right -compact -offset indent
+.It down
+.Ic down-history
+.It up
+.Ic up-history
+.It left
+.Ic backward-char
+.It right
+.Ic forward-char
+.El
+.Pp
+unless doing so would alter another single-character binding.
+One can set the arrow key escape sequences to the empty string with
+.Va settc
+to prevent these bindings.
+The ANSI/VT100 sequences for arrow keys are always bound.
+.Pp
+Other key bindings are, for the most part, what
+.Xr emacs 1
+and
+.Xr vi 1
+users would expect and can easily be displayed by
+.Ic bindkey ,
+so there
+is no need to list them here.
+Likewise,
+.Ic bindkey
+can list the editor
+commands with a short description of each.
+Certain key bindings have different behavior depending if
+.Xr emacs 1
+or
+.Xr vi 1
+style bindings are being used; see
+.Va vimode
+for more information.
+.Pp
+Note that editor commands do not have the same notion of a
+.Dq word
+as does the shell.
+The editor delimits words with any non-alphanumeric characters not in
+the shell variable
+.Va wordchars ,
+while the shell recognizes only whitespace
+and some of the characters with special meanings to it, listed under
+.Sx Lexical structure .
+.Ss Completion and listing (+)
+The shell is often able to complete words when given a unique abbreviation.
+Type part of a word (for example
+.Ic ls
+.Pa /usr/lost )
+and hit the tab key to run the
+.Ic complete-word
+editor command.
+The shell completes the filename
+.Pa /usr/lost
+to
+.Pa /usr/lost+found/ ,
+replacing the incomplete word with the complete word in the input buffer.
+(Note the terminal
+.Sq / ;
+completion adds a
+.Sq /
+to the end of completed directories and a space to the end of other completed
+words, to speed typing and provide a visual indicator of successful completion.
+The
+.Va addsuffix
+shell variable can be unset to prevent this.)
+If no match is found (perhaps
+.Pa /usr/lost+found
+doesn't exist), the terminal bell rings.
+If the word is already complete (perhaps there is a
+.Pa /usr/lost
+on your
+system, or perhaps you were thinking too far ahead and typed the whole thing)
+a
+.Sq /
+or space is added to the end if it isn't already there.
+.Pp
+Completion works anywhere in the line, not at just the end; completed
+text pushes the rest of the line to the right.
+Completion in the middle of a word
+often results in leftover characters to the right of the cursor that need
+to be deleted.
+.Pp
+Commands and variables can be completed in much the same way.
+For example, typing
+.Sq em[tab]
+would complete
+.Sq em
+to
+.Sq emacs
+if
+.Pa emacs
+were the only command on your system beginning with
+.Sq em .
+Completion can find a command in any directory in
+.Pa path
+or if given a full pathname.
+Typing
+.Sq echo $ar[tab]
+would complete
+.Sq $ar
+to
+.Sq $argv
+if no other variable began with
+.Sq ar .
+.Pp
+The shell parses the input buffer to determine whether the word you want to
+complete should be completed as a filename, command or variable.
+The first word in the buffer and the first word following
+.Sq \&; ,
+.Sq | ,
+.Sq |& ,
+.Sq &&
+or
+.Sq ||
+is considered to be a command.
+A word beginning with
+.Sq $
+is considered to be a variable.
+Anything else is a filename.
+An empty line is
+.Sq completed
+as a filename.
+.Pp
+You can list the possible completions of a word at any time by typing
+.Sq ^D
+to run the
+.Ic delete-char-or-list-or-eof
+editor command.
+The shell lists the possible completions using the
+.Ic ls\-F
+builtin (q.v.)
+and reprints the prompt and unfinished command line, for example:
+.Bd -literal -offset indent
+> ls /usr/l[^D]
+lbin/       lib/        local/      lost+found/
+> ls /usr/l
+.Ed
+.Pp
+If the
+.Va autolist
+shell variable is set, the shell lists the remaining
+choices (if any) whenever completion fails:
+.Bd -literal -offset indent
+> set autolist
+> nm /usr/lib/libt[tab]
+libtermcap.a@ libtermlib.a@
+> nm /usr/lib/libterm
+.Ed
+.Pp
+If
+.Va autolist
+shell variable is set to
+.Sq ambiguous ,
+choices are listed only when
+completion fails and adds no new characters to the word being completed.
+.Pp
+A filename to be completed can contain variables, your own or others' home
+directories abbreviated with
+.Sq ~
+(see
+.Sx Filename substitution )
+and directory stack entries abbreviated with
+.Sq =
+(see
+.Sx Directory stack substitution ) .
+For example,
+.Bd -literal -offset indent
+> ls ~k[^D]
+kahn    kas     kellogg
+> ls ~ke[tab]
+> ls ~kellogg/
+.Ed
+or
+.Bd -literal -offset indent
+> set local = /usr/local
+> ls $lo[tab]
+> ls $local/[^D]
+bin/ etc/ lib/ man/ src/
+> ls $local/
+.Ed
+.Pp
+Note that variables can also be expanded explicitly with the
+.Ic expand-variables
+editor command.
+.Pp
+.Ic delete-char-or-list-or-eof
+lists at only the end of the line;
+in the middle of a line it deletes the character under the cursor and
+on an empty line it logs one out or, if then
+.Va ignoreeof
+variable is set, does nothing.
+.Sq M-^D ,
+bound to the editor command
+.Ic list-choices ,
+lists completion
+possibilities anywhere on a line, and
+.Ic list-choices
+(or any one of the
+related editor commands that do or don't delete, list and/or log out,
+listed under
+.Ic delete-char-or-list-or-eof )
+can be bound to
+.Sq ^D
+with the
+.Ic bindkey
+builtin command if so desired.
+.Pp
+The
+.Ic complete-word-fwd
+and
+.Ic complete-word-back
+editor commands
+(not bound to any keys by default) can be used to cycle up and down through
+the list of possible completions, replacing the current word with the next or
+previous word in the list.
+.Pp
+The shell variable
+.Va fignore
+can be set to a list of suffixes to be ignored by completion.
+Consider the following:
+.Bd -literal -offset indent
+> ls
+Makefile        condiments.h~   main.o          side.c
+README          main.c          meal            side.o
+condiments.h    main.c~
+> set fignore = (.o \e~)
+> emacs ma[^D]
+main.c   main.c~  main.o
+> emacs ma[tab]
+> emacs main.c
+.Ed
+.Pp
+.Sq main.c~
+and
+.Sq main.o
+are ignored by completion (but not listing),
+because they end in suffixes in
+.Va fignore .
+Note that a
+.Sq \e
+was needed in front of
+.Sq ~
+to prevent it from being expanded to
+.Va home
+as described under
+.Sx Filename substitution .
+.Va fignore
+is ignored if only one completion is possible.
+.Pp
+If the
+.Va complete
+shell variable is set to
+.Sq enhance ,
+completion
+1) ignores case and 2) considers periods, hyphens and underscores
+.Sq ( . ,
+.Sq \&-
+and
+.Sq _ )
+to be word separators and hyphens and underscores to be equivalent.
+If you had the following files
+.Bd -literal -offset indent
+comp.lang.c      comp.lang.perl   comp.std.c++
+comp.lang.c++    comp.std.c
+.Ed
+.Pp
+and typed
+.Sq mail \-f c.l.c[tab] ,
+it would be completed to
+.Sq mail \-f comp.lang.c ,
+and
+.Sq ^D
+would list
+.Sq comp.lang.c
+and
+.Sq comp.lang.c++ .
+.Sq mail \-f c..c++[^D]
+would list
+.Sq comp.lang.c++
+and
+.Sq comp.std.c++ .
+Typing
+.Sq rm a\-\-file[^D]
+in the following directory
+.Bd -literal -offset indent
+A_silly_file    a-hyphenated-file    another_silly_file
+.Ed
+.Pp
+would list all three files, because case is ignored and hyphens and
+underscores are equivalent.
+Periods, however, are not equivalent to
+hyphens or underscores.
+.Pp
+If the
+.Va complete
+shell variable is set to
+.Sq enhance ,
+completion
+ignores case and differences between a hyphen and an underscore word
+separator only when the user types a lowercase character or a hyphen.
+Entering an uppercase character or an underscore will not match the
+corresponding lowercase character or hyphen word separator.
+Typing
+.Sq rm a\-\-file[^D]
+in the directory of the previous example would
+still list all three files, but typing
+.Sq rm A\-\-file
+would match only
+.Sq A_silly_file
+and typing
+.Sq rm a__file[^D]
+would match just
+.Sq A_silly_file
+and
+.Sq another_silly_file
+because the user explicitly used an uppercase
+or an underscore character.
+.Pp
+Completion and listing are affected by several other shell variables:
+.Va recexact
+can be set to complete on the shortest possible unique
+match, even if more typing might result in a longer match:
+.Bd -literal -offset indent
+> ls
+fodder   foo      food     foonly
+> set recexact
+> rm fo[tab]
+.Ed
+.Pp
+just beeps, because
+.Sq fo
+could expand to
+.Sq fod
+or
+.Sq foo ,
+but if we type another
+.Sq o ,
+.Bd -literal -offset indent
+> rm foo[tab]
+> rm foo
+.Ed
+.Pp
+the completion completes on
+.Sq foo ,
+even though
+.Sq food
+and
+.Sq foonly
+also match.
+.Va autoexpand
+can be set to run the
+.Ic expand-history
+editor command
+before each completion attempt,
+.Va autocorrect
+can be set to
+spelling-correct the word to be completed (see
+.Sx Spelling correction )
+before each completion attempt and
+.Va correct
+can be set to complete commands automatically after one hits
+.Sq return .
+.Va matchbeep
+can be set to make completion beep or not beep in a variety
+of situations, and
+.Va nobeep
+can be set to never beep at all.
+.Va nostat
+can be set to a list of directories and/or patterns that
+match directories to prevent the completion mechanism from
+.Xr stat 2
+ing
+those directories.
+.Va listmax
+and
+.Va listmaxrows
+can be set to limit the number of items
+and rows (respectively) that are listed without asking first.
+.Va recognize_only_executables
+can be set to make the shell list only
+executables when listing commands, but it is quite slow.
+.Pp
+Finally, the
+.Ic complete
+builtin command can be used to tell the shell how
+to complete words other than filenames, commands and variables.
+Completion and listing do not work on glob-patterns (see
+.Sx Filename substitution ) ,
+but the
+.Ic list-glob
+and
+.Ic expand-glob
+editor commands perform
+equivalent functions for glob-patterns.
+.Ss Spelling correction (+)
+The shell can sometimes correct the spelling of filenames, commands and
+variable names as well as completing and listing them.
+.Pp
+Individual words can be spelling-corrected with the
+.Ic spell-word
+editor command (usually bound to M-s and M-S)
+and the entire input buffer with
+.Ic spell-line
+(usually bound to M-$).
+The
+.Va correct
+shell variable can be set to
+.Dv cmd
+to correct the command name or
+.Dv all
+to correct the entire line each time return is typed, and
+.Va autocorrect
+can be set to correct the word to be completed
+before each completion attempt.
+.Pp
+When spelling correction is invoked in any of these ways and
+the shell thinks that any part of the command line is misspelled,
+it prompts with the corrected line:
+.Bd -literal -offset indent
+> set correct = cmd
+> lz /usr/bin
+CORRECT>ls /usr/bin (y|n|e|a)?
+.Ed
+.Pp
+One can answer
+.Sq y
+or space to execute the corrected line,
+.Sq e
+to leave the uncorrected command in the input buffer,
+.Sq a
+to abort the command as if
+.Sq ^C
+had been hit, and
+anything else to execute the original line unchanged.
+.Pp
+Spelling correction recognizes user-defined completions (see the
+.Ic complete
+builtin command).
+If an input word in a position for
+which a completion is defined resembles a word in the completion list,
+spelling correction registers a misspelling and suggests the latter
+word as a correction.
+However, if the input word does not match any of
+the possible completions for that position, spelling correction does
+not register a misspelling.
+.Pp
+Like completion, spelling correction works anywhere in the line,
+pushing the rest of the line to the right and possibly leaving
+extra characters to the right of the cursor.
+.Ss Editor commands (+)
+.Ic bindkey
+lists key bindings and
+.Ic bindkey \-l
+lists and briefly describes editor commands.
+Only new or especially interesting editor commands are described here.
+See
+.Xr emacs 1
+and
+.Xr vi 1
+for descriptions of each editor's key bindings.
+.Pp
+The character or characters to which each command is bound by default is
+given in parentheses.
+.Sq ^character
+means a control character and
+.Sq M-character
+a meta character, typed as
+.Sq escape-character
+on terminals without a meta key.
+Case counts, but commands that are bound
+to letters by default are bound to both lower- and uppercase letters for
+convenience.
+.Bl -tag -width indent
+.It Ic backward-char Ar (^B, left)
+Move back a character.
+Cursor behavior modified by
+.Va vimode
+.It Ic backward-delete-word Ar (M-^H, M-^?)
+Cut from beginning of current word to cursor \- saved in cut buffer.
+Word boundary behavior modified by
+.Va vimode
+.It Ic backward-word Ar (M-b, M-B)
+Move to beginning of current word.
+Word boundary and cursor behavior modified by
+.Va vimode
+.It Ic beginning-of-line Ar (^A, home)
+Move to beginning of line.
+Cursor behavior modified by
+.Va vimode
+.It Ic capitalize-word Ar (M-c, M-C)
+Capitalize the characters from cursor to end of current word.
+Word boundary behavior modified by
+.Va vimode
+.It Ic complete-word Ar (tab)
+Completes a word as described under
+.Sx Completion and listing
+.It Ic complete-word-back Ar (not bound)
+Like
+.Ic complete-word-fwd ,
+but steps up from the end of the list.
+.It Ic complete-word-fwd Ar (not bound)
+Replaces the current word with the first word in the list of possible
+completions.
+May be repeated to step down through the list.
+At the end of the list, beeps and reverts to the incomplete word.
+.It Ic complete-word-raw Ar (^X-tab)
+Like
+.Ic complete-word ,
+but ignores user-defined completions.
+.It Ic copy-prev-word Ar (M-^_)
+Copies the previous word in the current line into the input buffer.
+See also
+.Ic insert-last-word
+Word boundary behavior modified by
+.Va vimode
+.It Ic dabbrev-expand Ar (M-/)
+Expands the current word to the most recent preceding one for which
+the current is a leading substring, wrapping around the history list
+(once) if necessary.
+Repeating
+.Ic dabbrev-expand
+without any intervening typing
+changes to the next previous word etc., skipping identical matches
+much like
+.Ic history-search-backward
+does.
+.It Ic delete-char Ar (not bound)
+Deletes the character under the cursor.
+See also
+.Ic delete-char-or-list-or-eof
+Cursor behavior modified by
+.Va vimode
+.It Ic delete-char-or-eof Ar (not bound)
+Does
+.Ic delete-char
+if there is a character under the cursor or
+.Ic end-of-file
+on an empty line.
+See also
+.Ic delete-char-or-list-or-eof
+Cursor behavior modified by
+.Va vimode
+.It Ic delete-char-or-list Ar (not bound)
+Does
+.Ic delete-char
+if there is a character under the cursor
+or
+.Ic list-choices
+at the end of the line.
+See also
+.Ic delete-char-or-list-or-eof
+.It Ic delete-char-or-list-or-eof Ar (^D)
+Does
+.Ic delete-char
+if there is a character under the cursor,
+.Ic list-choices
+at the end of the line or
+.Ic end-of-file
+on an empty line.
+See also those three commands, each of which does only a single action, and
+.Ic delete-char-or-eof ,
+.Ic delete-char-or-list
+and
+.Ic list-or-eof ,
+each of which does a different two out of the three.
+.It Ic delete-word Ar (M-d, M-D)
+Cut from cursor to end of current word \- save in cut buffer.
+Word boundary behavior modified by
+.Va vimode
+.It Ic down-history Ar (down-arrow, ^N)
+Like
+.Ic up-history ,
+but steps down, stopping at the original input line.
+.It Ic downcase-word Ar (M-l, M-L)
+Lowercase the characters from cursor to end of current word.
+Word boundary behavior modified by
+.Va vimode
+.It Ic end-of-file Ar (not bound)
+Signals an end of file, causing the shell to exit unless the
+.Va ignoreeof
+shell variable (q.v.) is set to prevent this.
+See also
+.Ic delete-char-or-list-or-eof
+.It Ic end-of-line Ar (^E, end)
+Move cursor to end of line.
+Cursor behavior modified by
+.Va vimode
+.It Ic expand-history Ar (M-space)
+Expands history substitutions in the current word.
+See
+.Sx History substitution
+See also
+.Ic magic-space ,
+.Ic toggle-literal-history
+and the
+.Va autoexpand
+shell variable.
+.It Ic expand-glob Ar (^X-*)
+Expands the glob-pattern to the left of the cursor.
+See
+.Sx Filename substitution
+.It Ic expand-line Ar (not bound)
+Like
+.Ic expand-history ,
+but expands history substitutions in each word in the input buffer.
+.It Ic expand-variables Ar (^X-$)
+Expands the variable to the left of the cursor.
+See
+.Sx Variable substitution
+.It Ic forward-char Ar (^F, right)
+Move forward one character.
+Cursor behavior modified by
+.Va vimode
+.It Ic forward-word Ar (M-f, M-F)
+Move forward to end of current word.
+Word boundary and cursor behavior modified by
+.Va vimode
+.It Ic history-search-backward Ar (M-p, M-P)
+Searches backwards through the history list for a command beginning with
+the current contents of the input buffer up to the cursor and copies it
+into the input buffer.
+The search string may be a glob-pattern (see
+.Sx Filename substitution )
+containing
+.Sq * ,
+.Sq \&?  ,
+.Sq []
+or
+.Sq {}
+.Ic up-history
+and
+.Ic down-history
+will proceed from the
+appropriate point in the history list.
+Emacs mode only.
+See also
+.Ic history-search-forward
+and
+.Ic i-search-back
+.It Ic history-search-forward Ar (M-n, M-N)
+Like
+.Ic history-search-backward ,
+but searches forward.
+.It Ic i-search-back Ar (not bound)
+Searches backward like
+.Ic history-search-backward ,
+copies the first match
+into the input buffer with the cursor positioned at the end of the pattern,
+and prompts with
+.Sq bck:
+and the first match.
+Additional characters may be
+typed to extend the search,
+.Ic i-search-back
+may be typed to continue
+searching with the same pattern, wrapping around the history list if
+necessary,
+.Ic ( i-search-back
+must be bound to a
+single character for this to work) or one of the following special characters
+may be typed:
+.Pp
+.Sq ^W
+Appends the rest of the word under the cursor to the search pattern.
+delete (or any character bound to
+.Ic backward-delete-char )
+Undoes the effect of the last character typed and deletes a character
+from the search pattern if appropriate.
+.Sq ^G
+If the previous search was successful, aborts the entire search.
+If not, goes back to the last successful search.
+escape
+Ends the search, leaving the current line in the input buffer.
+.Pp
+Any other character not bound to
+.Ic self-insert-command
+terminates the
+search, leaving the current line in the input buffer, and
+is then interpreted as normal input.
+In particular, a carriage return
+causes the current line to be executed.
+See also
+.Ic i-search-fwd
+and
+.Ic history-search-backward
+Word boundary behavior modified by
+.Va vimode
+.It Ic i-search-fwd Ar (not bound)
+Like
+.Ic i-search-back ,
+but searches forward.
+Word boundary behavior modified by
+.Va vimode
+.It Ic insert-last-word Ar (M-_)
+Inserts the last word of the previous input line
+.Sq ( \&!$ )
+into the input buffer.
+See also
+.Ic copy-prev-word
+.It Ic list-choices Ar (M-^D)
+Lists completion possibilities as described under
+.Sx Completion and listing
+See also
+.Ic delete-char-or-list-or-eof
+and
+.Ic list-choices-raw
+.It Ic list-choices-raw Ar (^X-^D)
+Like
+.Ic list-choices ,
+but ignores user-defined completions.
+.It Ic list-glob Ar (^X-g, ^X-G)
+Lists (via the
+.Ic ls\-F
+builtin) matches to the glob-pattern
+(see
+.Sx Filename substitution )
+to the left of the cursor.
+.It Ic list-or-eof Ar (not bound)
+Does
+.Ic list-choices
+or
+.Ic end-of-file
+on an empty line.
+See also
+.Ic delete-char-or-list-or-eof
+.It Ic magic-space Ar (not bound)
+Expands history substitutions in the current line,
+like
+.Ic expand-history ,
+and inserts a space.
+.Ic magic-space
+is designed to be bound to the space bar,
+but is not bound by default.
+.It Ic normalize-command Ar (^X-?)
+Searches for the current word in PATH and, if it is found, replaces it with
+the full path to the executable.
+Special characters are quoted.
+Aliases are
+expanded and quoted but commands within aliases are not.
+This command is
+useful with commands that take commands as arguments, e.g.,
+.Sq dbx
+and
+.Sq sh \-x
+.It Ic normalize-path Ar (^X-n, ^X-N)
+Expands the current word as described under the
+.Sq expand
+setting
+of the
+.Va symlinks
+shell variable.
+.It Ic overwrite-mode Ar (unbound)
+Toggles between input and overwrite modes.
+.It Ic run-fg-editor Ar (M-^Z)
+Saves the current input line and
+looks for a stopped job where the file name portion of its first word
+is found in the
+.Va editors
+shell variable.
+If
+.Va editors
+is not set, then the file name portion of the
+.Va EDITOR
+environment variable
+.Sq ( ed
+if unset)
+and the
+.Va VISUAL
+environment variable
+Sq ( vi
+if unset)
+will be used.
+If such a job is found, it is restarted as if
+.Sq fg %
+.Ic job
+had been typed.
+This is used to toggle back and forth between an editor and
+the shell easily.
+Some people bind this command to
+.Sq ^Z
+so they
+can do this even more easily.
+.It Ic run-help Ar (M-h, M-H)
+Searches for documentation on the current command, using the same notion of
+.Sq current command
+as the completion routines, and prints it.
+There is no way
+to use a pager;
+.Ic run-help
+is designed for short help files.
+If the special alias
+.Va helpcommand
+is defined, it is run with the
+command name as a sole argument.
+Else,
+documentation should be in a file named
+.Sq command.help ,
+.Sq command.1 ,
+.Sq command.6 ,
+.Sq command.8 ,
+or
+.Sq command ,
+which should be in one
+of the directories listed in the
+.Va HPATH
+environment variable.
+If there is more than one help file only the first is printed.
+.It Ic self-insert-command Ar (text characters)
+In insert mode (the default), inserts the typed character into the input line after the character under the cursor.
+In overwrite mode, replaces the character under the cursor with the typed character.
+The input mode is normally preserved between lines, but the
+.Va inputmode
+shell variable can be set to
+.Dv insert
+or
+.Dv overwrite
+to put the
+editor in that mode at the beginning of each line.
+See also
+.Ic overwrite-mode
+.It Ic sequence-lead-in Ar (arrow prefix, meta prefix, ^X)
+Indicates that the following characters are part of a
+multi-key sequence.
+Binding a command to a multi-key sequence really creates
+two bindings: the first character to
+.Ic sequence-lead-in
+and the
+whole sequence to the command.
+All sequences beginning with a character
+bound to
+.Ic sequence-lead-in
+are effectively bound to
+.Ic undefined-key
+unless bound to another command.
+.It Ic spell-line Ar (M-$)
+Attempts to correct the spelling of each word in the input buffer, like
+.Ic spell-word ,
+but ignores words whose first character is one of
+.Sq \- ,
+.Sq \ ! ,
+.Sq ^
+or
+.Sq % ,
+or which contain
+.Sq \e ,
+.Sq *
+or
+.Sq \&? ,
+to avoid problems with switches, substitutions and the like.
+See
+.Sx Spelling correction
+.It Ic spell-word Ar (M-s, M-S)
+Attempts to correct the spelling of the current word as described under
+.Sx Spelling correction
+Checks each component of a word which appears to be a pathname.
+.It Ic toggle-literal-history Ar (M-r, M-R)
+Expands or
+.Sq unexpands
+history substitutions in the input buffer.
+See also
+.Ic expand-history
+and the
+.Va autoexpand
+shell variable.
+.It Ic undefined-key Ar (any unbound key)
+Beeps.
+.It Ic up-history Ar (up-arrow, ^P)
+Copies the previous entry in the history list into the input buffer.
+If
+.Va histlit
+is set, uses the literal form of the entry.
+May be repeated to step up through the history list, stopping at the top.
+.It Ic upcase-word Ar (M-u, M-U)
+Uppercase the characters from cursor to end of current word.
+Word boundary behavior modified by
+.Va vimode
+.It Ic vi-beginning-of-next-word Ar (not bound)
+Vi goto the beginning of next word.
+Word boundary and cursor behavior modified by
+.Va vimode
+.It Ic vi-eword Ar (not bound)
+Vi move to the end of the current word.
+Word boundary behavior modified by
+.Va vimode
+.It Ic vi-search-back Ar (?)
+Prompts with
+.Sq \&?
+for a search string (which may be a glob-pattern, as with
+.Ic history-search-backward ),
+searches for it and copies it into the input buffer.
+The bell rings if no match is found.
+Hitting return ends the search and leaves the last match in the input
+buffer.
+Hitting escape ends the search and executes the match.
+.Ic vi
+mode only.
+.It Ic vi-search-fwd Ar (/)
+Like
+.Ic vi-search-back ,
+but searches forward.
+.It Ic which-command Ar (M-?)
+Does a
+.Ic which
+(see the description of the builtin command) on the
+first word of the input buffer.
+.It Ic yank-pop Ar (M-y)
+When executed immediately after a
+.Ic yank
+or another
+.Ic yank-pop ,
+replaces the yanked string with the next previous string from the
+killring. This also has the effect of rotating the killring, such that
+this string will be considered the most recently killed by a later
+.Ic yank
+command. Repeating
+.Ic yank-pop
+will cycle through the
+killring any number of times.
+.El
+.Ss Lexical structure
+The shell splits input lines into words at blanks and tabs.
+The special
+characters
+.Sq \&& ,
+.Sq | ,
+.Sq \&; ,
+.Sq < ,
+.Sq > ,
+.Sq \&( ,
+and
+.Sq \&)
+and the doubled characters
+.Sq && ,
+.Sq || ,
+.Sq <<
+and
+.Sq >>
+are always separate words, whether or not they are
+surrounded by whitespace.
+.Pp
+When the shell's input is not a terminal, the character
+.Sq #
+is taken to begin a
+comment.
+Each
+.Sq #
+and the rest of the input line on which it appears is
+discarded before further parsing.
+.Pp
+A special character (including a blank or tab) may be prevented from having
+its special meaning, and possibly made part of another word, by preceding it
+with a backslash
+.Sq ( \e )
+or enclosing it in single
+.Sq ( \&' ) ,
+, double
+.Sq ( \&" )
+or
+backward
+.Sq ( \&` )
+quotes.
+When not otherwise quoted a newline preceded by a
+.Sq \e
+is equivalent to a blank, but inside quotes this sequence results in a
+newline.
+.Pp
+Furthermore, all
+.Sx Substitutions
+(see below) except
+.Sx History substitution
+can be prevented by enclosing the strings (or parts of strings)
+in which they appear with single quotes or by quoting the crucial character(s)
+(e.g.,
+.Sq $
+or
+.Sq \&`
+for
+.Sx Variable substitution
+or
+.Sx Command substitution
+respectively)
+with
+.Sq \e
+.Sx ( Alias substitution
+is no exception: quoting in any way any
+character of a word for which an
+.Va alias
+has been defined prevents
+substitution of the alias.
+The usual way of quoting an alias is to precede it
+with a backslash.)
+.Sx History substitution
+is prevented by
+backslashes but not by single quotes.
+Strings quoted with double or backward
+quotes undergo
+.Sx Variable substitution
+and
+.Sx Command substitution ,
+but other substitutions are prevented.
+.Pp
+Text inside single or double quotes becomes a single word (or part of one).
+Metacharacters in these strings, including blanks and tabs, do not form
+separate words.
+Only in one special case (see
+.Sx Command substitution
+below) can a double-quoted string yield parts of more than one word;
+single-quoted strings never do.
+Backward quotes are special: they signal
+.Sx Command substitution
+(q.v.), which may result in more than one word.
+.Pp
+Quoting complex strings, particularly strings which themselves contain quoting
+characters, can be confusing.
+Remember that quotes need not be used as they are
+in human writing!
+It may be easier to quote not an entire string, but only
+those parts of the string which need quoting, using different types of quoting
+to do so if appropriate.
+.Pp
+The
+.Va backslash_quote
+shell variable (q.v.) can be set to make backslashes
+always quote
+.Sq \e ,
+.Sq \&' ,
+and
+.Sq \&"
+(+) This may make complex quoting tasks
+easier, but it can cause syntax errors in
+.Xr csh 1
+scripts.
+.Ss Substitutions
+We now describe the various transformations the shell performs on the input in
+the order in which they occur.
+We note in passing the data structures involved
+and the commands and variables which affect them.
+Remember that substitutions
+can be prevented by quoting as described under
+.Sx Lexical structure .
+.Ss History substitution
+Each command, or
+.Sq event ,
+input from the terminal is saved in the history list.
+The previous command is always saved, and the
+.Va history
+shell
+variable can be set to a number to save that many commands.
+The
+.Va histdup
+shell variable can be set to not save duplicate events or consecutive duplicate
+events.
+.Pp
+Saved commands are numbered sequentially from 1 and stamped with the time.
+It is not usually necessary to use event numbers, but the current event number
+can be made part of the prompt by placing an
+.Sq \&!
+in the
+.Va prompt
+shell variable.
+.Pp
+The shell actually saves history in expanded and literal (unexpanded) forms.
+If the
+.Va histlit
+shell variable is set, commands that display and store
+history use the literal form.
+.Pp
+The
+.Va history
+builtin command can print, store in a file, restore
+and clear the history list at any time,
+and the
+.Va savehist
+and
+.Va histfile
+shell variables can be set to
+store the history list automatically on logout and restore it on login.
+.Pp
+History substitutions introduce words from the history list into the input
+stream, making it easy to repeat commands, repeat arguments of a previous
+command in the current command, or fix spelling mistakes in the previous
+command with little typing and a high degree of confidence.
+.Pp
+History substitutions begin with the character
+.Sq \&!
+They may begin anywhere in
+the input stream, but they do not nest.
+The
+.Sq \&!
+may be preceded by a
+.Sq \e
+to
+prevent its special meaning; for convenience, a
+.Sq \&!
+is passed unchanged when it
+is followed by a blank, tab, newline,
+.Sq =
+or
+.Sq \&(
+History substitutions also
+occur when an input line begins with
+.Sq ^
+This special abbreviation will be
+described later.
+The characters used to signal history substitution 
+.Sq ( \&!
+and
+.Sq ^ )
+can be changed by setting the
+.Va histchars
+shell variable.
+Any input
+line which contains a history substitution is printed before it is executed.
+.Pp
+A history substitution may have an
+.Sq event specification ,
+which indicates the event from which words are to be taken, a
+.Sq word designator ,
+which selects particular words from the chosen event, and/or a
+.Sq modifier ,
+which manipulates the selected words.
+.Pp
+An event specification can be
+.Pp
+.Bl -tag -width XXXX -offset indent -compact
+.It Ar n
+A number, referring to a particular event
+.It Ar \-n
+An offset, referring to the event
+.Ar n
+before the current event
+.It Ar #
+The current event.
+This should be used carefully in
+.Xr csh 1 ,
+where there is no check for recursion.
+.Nm
+allows 10 levels of recursion.
+(+)
+.It Ar \&!
+The previous event (equivalent to
+.Sq \-1 )
+.It Ar s
+The most recent event whose first word begins with the string
+.Va s
+.It Ar ?s?
+The most recent event which contains the string
+.Va s
+The second
+.Sq \&?
+can be omitted if it is immediately followed by a newline.
+.El
+.Pp
+For example, consider this bit of someone's history list:
+.Bd -literal -offset indent
+ 9  8:30    nroff \-man wumpus.man
+10  8:31    cp wumpus.man wumpus.man.old
+11  8:36    vi wumpus.man
+12  8:37    diff wumpus.man.old wumpus.man
+.Ed
+.Pp
+The commands are shown with their event numbers and time stamps.
+The current event, which we haven't typed in yet, is event 13.
+.Sq !11
+and
+.Sq !\-2
+refer to event 11.
+.Sq \&!!
+refers to the previous event, 12.
+.Sq \&!!
+can be abbreviated
+.Sq \&!
+if it is
+followed by
+.Sq \&: 
+.Sq ( \&:
+is described below).
+.Sq !n
+refers to event 9, which begins with
+.Sq n
+.Sq !?old?
+also refers to event 12, which contains
+.Sq old
+Without word designators or modifiers history references simply expand to the
+entire event, so we might type
+.Sq !cp
+to redo the copy command or
+.Sq !!|more
+if the
+.Sq diff
+output scrolled off the top of the screen.
+.Pp
+History references may be insulated from the surrounding text with braces if
+necessary.
+For example,
+.Sq !vdoc
+would look for a command beginning with
+.Sq vdoc ,
+and, in this example, not find one, but
+.Sq !{v}doc
+would expand
+unambiguously to
+.Sq vi wumpus.mandoc
+Even in braces, history substitutions do not nest.
+.Pp
+(+) While
+.Xr csh 1
+expands, for example,
+.Sq !3d
+to event 3 with the
+letter
+.Sq d
+appended to it,
+.Nm
+expands it to the last event beginning
+with
+.Sq 3d ;
+only completely numeric arguments are treated as event numbers.
+This makes it possible to recall events beginning with numbers.
+To expand
+.Sq !3d
+as in
+.Xr csh 1
+say
+.Sq !{3}d
+.Pp
+To select words from an event we can follow the event specification by a
+.Sq \&:
+and a designator for the desired words.
+The words of an input line are
+numbered from 0, the first (usually command) word being 0, the second word
+(first argument) being 1, etc.
+The basic word designators are:
+.Bl -tag -width XXXX -offset indent -compact
+.It Ar 0
+The first (command) word
+.It Ar n
+The
+.Va n
+th argument
+.It Ar ^
+The first argument, equivalent to
+.Sq 1
+.It Ar $
+The last argument
+.It Ar %
+The word matched by an ?
+.Va s
+? search
+.It Ar x\-y
+A range of words
+.It Ar \-y
+Equivalent to
+.Sq 0\-y
+.It Ar *
+Equivalent to
+.Sq ^\-$ ,
+but returns nothing if the event contains only 1 word
+.It Ar x*
+Equivalent to
+.Sq x\-$
+.It Ar x\-
+Equivalent to
+.Sq x* ,
+but omitting the last word
+.Sq ( $ )
+.El
+.Pp
+Selected words are inserted into the command line separated by single blanks.
+For example, the
+.Sq diff
+command in the previous example might have been
+typed as
+.Sq diff !!:1.old !!:1
+(using
+.Sq \&:1
+to select the first argument
+from the previous event) or
+.Sq diff !\-2:2 !\-2:1
+to select and swap the
+arguments from the
+.Sq cp
+command.
+If we didn't care about the order of the
+`diff' we might have said
+.Sq diff !\-2:1\-2
+or simply
+.Sq diff !\-2:*
+The
+.Sq cp
+command might have been written
+.Sq cp wumpus.man !#:1.old
+, using
+.Sq #
+to refer to the current event.
+`!n:\- hurkle.man' would reuse the first two words from the
+.Sq nroff
+command
+to say
+.Sq nroff \-man hurkle.man
+.Pp
+The
+.Sq \&:
+separating the event specification from the word designator can be
+omitted if the argument selector begins with a
+.Sq ^ ,
+.Sq $ ,
+.Sq * ,
+.Sq %
+or
+.Sq \&-
+For example, our
+.Sq diff
+command might have been
+.Sq diff !!^.old !!^
+or,
+equivalently,
+.Sq diff !!$.old !!$
+However, if
+.Sq \&!!
+is abbreviated
+.Sq \&!
+,
+an argument selector beginning with
+.Sq \-
+will be interpreted as an event
+specification.
+.Pp
+A history reference may have a word designator but no event specification.
+It then references the previous command.
+Continuing our
+.Sq diff
+example, we could have said simply `diff
+!^.old !^' or, to get the arguments in the opposite order, just
+.Sq diff !*
+.Pp
+The word or words in a history reference can be edited, or
+.Sq `modified
+',
+by following it with one or more modifiers, each preceded by a
+.Sq \&: :
+.Pp
+.Bl -tag -width XXXXXX -offset indent -compact
+.It Ar h
+Remove a trailing pathname component, leaving the head.
+.It Ar t
+Remove all leading pathname components, leaving the tail.
+.It Ar r
+Remove a filename extension
+.Sq .xxx ,
+leaving the root name.
+.It Ar e
+Remove all but the extension.
+.It Ar u
+Uppercase the first lowercase letter.
+.It Ar l
+Lowercase the first uppercase letter.
+.It Ar s/l/r/
+Substitute
+.Ar l
+for
+.Ar r
+.Ar l
+is simply a string like
+.Ar r
+, not a regular expression as in
+the eponymous
+.Xr ed 1
+command.
+Any character may be used as the delimiter in place of
+.Sq / ;
+a
+.Sq \e
+can be used to quote the delimiter inside
+.Va l
+and
+.Va r
+The character
+.Sq &
+in the
+.Va r
+is replaced by
+.Va l ;
+.Sq \e
+also quotes
+.Sq &
+If
+.Va l
+is empty (
+.Dq \& ) ,
+the
+.Va l
+from a previous substitution or the
+.Va s
+from a previous search or event number in event specification is used.
+The trailing delimiter may be omitted if it is immediately followed by a
+newline.
+.It Ar \&&
+Repeat the previous substitution.
+.It Ar g
+Apply the following modifier once to each word.
+.It Ar a (+)
+Apply the following modifier as many times as possible to a single word.
+.Sq a
+and
+.Sq g
+can be used together to apply a modifier globally.
+With the
+.Sq s
+modifier, only the patterns contained in the original word are
+substituted, not patterns that contain any substitution result.
+.It Ar p
+Print the new command line but do not execute it.
+.It Ar q
+Quote the substituted words, preventing further substitutions.
+.It Ar x
+Like 
+.Ar q ,
+but break into words at blanks, tabs and newlines.
+.El
+.Pp
+Modifiers are applied to only the first modifiable word (unless
+.Sq g
+is used).
+It is an error for no word to be modifiable.
+.Pp
+For example, the
+.Sq diff
+command might have been written as `diff wumpus.man.old
+!#^:r', using
+.Sq \&:r
+to remove
+.Sq .old
+from the first argument on the same line
+(`!#^').
+We could say
+.Sq echo hello out there
+, then
+.Sq echo !*:u
+to capitalize
+`hello',
+.Sq echo !*:au
+to say it out loud, or
+.Sq echo !*:agu
+to really shout.
+We might follow
+.Sq mail \-s "I forgot my password" rot
+with
+.Sq !:s/rot/root
+to
+correct the spelling of
+.Sq root
+(but see
+.Sx Spelling correction
+for a
+different approach).
+.Pp
+There is a special abbreviation for substitutions.
+.Sq ^ ,
+when it is the first character on an input line, is equivalent to
+.Sq !:s^
+Thus we might have said
+.Sq ^rot^root
+to make the spelling correction in the
+previous example.
+This is the only history substitution which does not explicitly begin with
+.Sq \&!
+.Pp
+(+) In
+.Xr csh 1
+as such, only one modifier may be applied to each history
+or variable expansion.
+In
+.Nm ,
+more than one may be used, for example
+.Bd -literal -offset indent
+% mv wumpus.man /usr/man/man1/wumpus.1
+% man !$:t:r
+man wumpus
+.Ed
+.Pp
+In
+.Xr csh 1 ,
+the result would be
+.Sq wumpus.1:r
+A substitution followed by a
+colon may need to be insulated from it with braces:
+.Bd -literal -offset indent
+> mv a.out /usr/games/wumpus
+> setenv PATH !$:h:$PATH
+Bad ! modifier: $.
+> setenv PATH !{\-2$:h}:$PATH
+setenv PATH /usr/games:/bin:/usr/bin:.
+.Ed
+.Pp
+The first attempt would succeed in
+.Xr csh 1
+but fails in
+.Nm ,
+because
+.Nm
+expects another modifier after the second colon
+rather than
+.Sq $
+.Pp
+Finally, history can be accessed through the editor as well as through
+the substitutions just described.
+The
+.Ic up-
+and
+.Ic down-history ,
+.Ic history-search-backward
+and
+.Va -forward ,
+.Ic i-search-back
+and
+.Ic -fwd ,
+.Ic vi-search-back
+and
+.Ic -fwd ,
+.Ic copy-prev-word
+and
+.Ic insert-last-word
+editor commands search for
+events in the history list and copy them into the input buffer.
+The
+.Ic toggle-literal-history
+editor command switches between the
+expanded and literal forms of history lines in the input buffer.
+.Ic expand-history
+and
+.Ic expand-line
+expand history substitutions
+in the current word and in the entire input buffer respectively.
+.Ss Alias substitution
+The shell maintains a list of aliases which can be set, unset and printed by
+the
+.Ic alias
+and
+.Ic unalias
+commands.
+After a command line is parsed
+into simple commands (see
+.Sx Commands )
+the first word of each command,
+left-to-right, is checked to see if it has an alias.
+If so, the first word is
+replaced by the alias.
+If the alias contains a history reference, it undergoes
+.Va History substitution
+(q.v.) as though the original command were the
+previous input line.
+If the alias does not contain a history reference, the
+argument list is left untouched.
+.Pp
+Thus if the alias for
+.Sq ls
+were
+.Sq ls \-l
+the command
+.Sq ls /usr
+would become `ls
+\-l /usr', the argument list here being undisturbed.
+If the alias for
+.Sq lookup
+were
+.Sq grep !/etc/passwd
+then
+.Sq lookup bill
+would become `grep bill
+/etc/passwd'.
+Aliases can be used to introduce parser metasyntax.
+For
+example,
+.Sq alias print
+pr \e!* | lpr'' defines a
+.Sq `command
+' (`print') which
+.Va pr
+(1)s its arguments to the line printer.
+.Pp
+Alias substitution is repeated until the first word of the command has no
+alias.
+If an alias substitution does not change the first word (as in the
+previous example) it is flagged to prevent a loop.
+Other loops are detected and
+cause an error.
+.Pp
+Some aliases are referred to by the shell; see
+.Va Special aliases
+.Sx Variable substitution
+The shell maintains a list of variables, each of which has as value a list of
+zero or more words.
+The values of shell variables can be displayed and changed with the
+.Va set
+and
+.Va unset
+commands.
+The system maintains its own list of
+.Sq `environment
+' variables.
+These can be displayed and changed with
+.Va printenv
+,
+.Va setenv
+and
+.Va unsetenv
+.Pp
+(+) Variables may be made read-only with
+.Sq set \-r
+(q.v.).
+Read-only variables may not be modified or unset;
+attempting to do so will cause an error.
+Once made read-only, a variable cannot be made writable,
+so
+.Sq set \-r
+should be used with caution.
+Environment variables cannot be made read-only.
+.Pp
+Some variables are set by the shell or referred to by it.
+For instance, the
+.Va argv
+variable is an image of the shell's argument
+list, and words of this variable's value are referred to in special ways.
+Some of the variables referred to by the shell are toggles;
+the shell does not care what their value is, only whether they are set or not.
+For instance, the
+.Va verbose
+variable is a toggle which causes command
+input to be echoed.
+The
+.Fl v\fR command line option sets this variable.
+.Va Special shell variables
+lists all variables which are referred to by the shell.
+.Pp
+Other operations treat variables numerically.
+The
+.Sq @
+command permits numeric
+calculations to be performed and the result assigned to a variable.
+Variable
+values are, however, always represented as (zero or more) strings.
+For the
+purposes of numeric operations, the null string is considered to be zero, and
+the second and subsequent words of multi-word values are ignored.
+.Pp
+After the input line is aliased and parsed, and before each command is
+executed, variable substitution is performed keyed by
+.Sq $
+characters.
+This
+expansion can be prevented by preceding the
+.Sq $
+with a
+.Sq \e
+except within
+.Sq "
+s
+where it
+.Va always
+occurs, and within
+.Sq
+'s where it
+.Va never
+occurs.
+Strings quoted by
+.Sq \`
+are interpreted later (see
+.Sx Command substitution
+below) so
+.Sq $
+substitution does not occur there until later,
+if at all.
+A
+.Sq $
+is passed unchanged if followed by a blank, tab, or
+end-of-line.
+.Pp
+Input/output redirections are recognized before variable expansion, and are
+variable expanded separately.
+Otherwise, the command name and entire argument
+list are expanded together.
+It is thus possible for the first (command) word
+(to this point) to generate more than one word, the first of which becomes the
+command name, and the rest of which become arguments.
+.Pp
+Unless enclosed in
+.Sq "
+or given the
+.Sq \&:q
+modifier the results of variable
+substitution may eventually be command and filename substituted.
+Within
+.Sq "
+, a
+variable whose value consists of multiple words expands to a (portion of a)
+single word, with the words of the variable's value separated by blanks.
+When
+the
+.Sq \&:q
+modifier is applied to a substitution the variable will expand to
+multiple words with each word separated by a blank and quoted to prevent later
+command or filename substitution.
+.Pp
+The following metasequences are provided for introducing variable values into
+the shell input.
+Except as noted, it is an error to reference a variable which
+is not set.
+.Pp
+.Bl -tag -width XXXXXXXXXX -offset indent -compact
+.PD 0
+.It Ar $name
+.It Ar ${name}
+Substitutes the words of the value of variable
+.Va name ,
+each separated
+by a blank.
+Braces insulate
+.Va name
+from following characters which would
+otherwise be part of it.
+Shell variables have names consisting of
+letters and digits starting with a letter.
+The underscore character is
+considered a letter.
+If
+.Va name
+is not a shell variable, but is set in the
+environment, then that value is returned (but some of the other forms
+given below are not available in this case).
+.It Ar $name[selector]
+.It Ar ${name[selector]}
+Substitutes only the selected words from the value of
+.Va name
+The
+.Va selector
+is subjected to
+.Sq $
+substitution and may consist of
+a single number or two numbers separated by a
+.Sq \&-
+The first word of a variable's value is numbered
+.Sq 1
+If the first number of a range is omitted it defaults to
+.Sq 1
+If the last member of a range is omitted it defaults to
+.Sq $#
+.Va name
+The
+.Va selector
+.Sq *
+selects all words.
+It is not an error for a range to be empty if the
+second argument is omitted or in range.
+.It Ar $0
+Substitutes the name of the file from which command input
+is being read.
+An error occurs if the name is not known.
+.It Ar $number
+.It Ar ${number}
+Equivalent to
+.Sq $argv[number]
+.It Ar $*
+Equivalent to
+.Sq $argv ,
+which is equivalent to
+.Sq $argv[*]
+.El
+.Pp
+The
+.Sq \&:
+modifiers described under
+.Sx History substitution ,
+except for
+.Sq \&:p ,
+can be applied to the substitutions above.
+More than one may be used.
+(+)
+Braces may be needed to insulate a variable substitution from a literal colon
+just as with
+.Sx History substitution
+(q.v.); any modifiers must appear
+within the braces.
+.Pp
+The following substitutions can not be modified with
+.Sq \&:
+modifiers.
+.Pp
+.Bl -tag -width XXXXXXXX -offset indent -compact
+.It Ar $?name
+.It Ar ${?name}
+Substitutes the string
+.Sq 1
+if
+.Va name
+is set,
+.Sq 0
+if it is not.
+.It Ar $?0
+Substitutes
+.Sq 1
+if the current input filename is known,
+.Sq 0
+if it is not.
+Always
+.Sq 0
+in interactive shells.
+.It Ar
+$#name
+${#name}
+Substitutes the number of words in
+.Va name
+.It Ar
+$#
+Equivalent to
+.Sq $#argv
+(+)
+.It Ar
+$%
+.Va name
+.It Ar ${%name}
+Substitutes the number of characters in
+.Va name
+(+)
+.Pp
+$%
+.Va number
+.TP 8
+.It Ar ${%number}
+Substitutes the number of characters in
+.Va $argv[number] .
+(+)
+.It Ar $?
+Equivalent to
+.Sq $status
+(+)
+.It Ar $$
+Substitutes the (decimal) process number of the (parent) shell.
+.It Ar $!
+Substitutes the (decimal) process number of the last
+background process started by this shell.
+(+)
+.It Ar $_
+Substitutes the command line of the last command executed.
+(+)
+.It Ar $<
+Substitutes a line from the standard input, with no further interpretation
+thereafter.
+It can be used to read from the keyboard in a shell script.
+(+) While
+.Xr csh 1
+always quotes $<, as if it were equivalent to
+.Sq $<:q ,
+.Nm
+does not.
+Furthermore, when
+.Nm
+is waiting for a line to be
+typed the user may type an interrupt to interrupt the sequence into
+which the line is to be substituted, but
+.Xr csh 1
+does not allow this.
+.El
+.Pp
+The editor command
+.Va expand-variables
+, normally bound to
+.Sq ^X-$ ,
+can be used to interactively expand individual variables.
+.Ss "Command, filename and directory stack substitution"
+The remaining substitutions are applied selectively to the arguments
+of builtin commands.
+This means that portions of expressions which are not evaluated are
+not subjected to these expansions.
+For commands which are not internal to the
+shell, the command name is substituted separately from the argument list.
+This occurs very late, after input-output redirection is performed, andk
+in a child of the main shell.
+.Ss "Command substitution"
+Command substitution is indicated by a command enclosed in
+.Sq \&`
+The output
+from such a command is broken into separate words at blanks, tabs and newlines,
+and null words are discarded.
+The output is variable and command substituted
+and put in place of the original string.
+.Pp
+Command substitutions inside double
+quotes
+.Sq ( \&" )
+retain blanks and tabs; only newlines force new words.
+The single
+final newline does not force a new word in any case.
+It is thus possible for a
+command substitution to yield only part of a word, even if the command outputs
+a complete line.
+.Pp
+By default, the shell since version 6.12 replaces all newline and carriage
+return characters in the command by spaces.
+If this is switched off by
+unsetting
+.Va csubstnonl ,
+newlines separate commands as usual.
+.Ss "Filename substitution"
+If a word contains any of the characters
+.Sq * ,
+.Sq \&? ,
+.Sq \&[
+or
+.Sq {
+or begins with
+the character
+.Sq ~
+it is a candidate for filename substitution, also known as
+.Dq globbing .
+This word is then regarded as a pattern
+.Dq ( glob-pattern ) ,
+and
+replaced with an alphabetically sorted list of file names which match the
+pattern.
+.Pp
+In matching filenames, the character
+.Sq .
+at the beginning of a filename or
+immediately following a
+.Sq / ,
+as well as the character
+.Sq /
+must be matched
+explicitly (unless either
+.Va globdot
+or
+.Va globstar
+or both are set(+)).
+The character
+.Sq *
+matches any string of characters,
+including the null string.
+The character
+.Sq \&?
+matches any single character.
+The sequence
+.Sq [...]
+matches any one of the characters enclosed.
+Within
+.Sq [...]
+, a pair of
+characters separated by
+.Sq \&-
+matches any character lexically between the two.
+.Pp
+(+) Some glob-patterns can be negated:
+The sequence
+.Sq [^...]
+matches any single character
+.Va not
+specified by the
+characters and/or ranges of characters in the braces.
+.Pp
+An entire glob-pattern can also be negated with
+.Sq ^ :
+.Bd -literal -offset indent
+> echo *
+bang crash crunch ouch
+> echo ^cr*
+bang ouch
+.Ed
+.Pp
+Glob-patterns which do not use
+.Sq \&? ,
+.Sq * , or
+.Sq []
+or which use
+.Sq {}
+or
+.Sq ~
+(below) are not negated correctly.
+.Pp
+The metanotation
+.Sq a{b,c,d}e
+is a shorthand for
+.Sq abe ace ade
+Left-to-right order is preserved:
+.Sq /usr/source/s1/{oldls,ls}.c
+expands
+to
+.Sq /usr/source/s1/oldls.c /usr/source/s1/ls.c
+The results of matches are
+sorted separately at a low level to preserve this order:
+.Sq ../{memo,*box}
+might expand to
+.Sq ../memo ../box ../mbox
+(Note that
+.Sq memo
+was not sorted with the results of matching
+.Sq *box . )
+It is not an error when this construct expands to files which do not exist,
+but it is possible to get an error from a command to which the expanded list
+is passed.
+This construct may be nested.
+As a special case the words
+.Sq { ,
+.Sq }
+and
+.Sq {}
+are passed undisturbed.
+.Pp
+The character
+.Sq ~
+at the beginning of a filename refers to home directories.
+Standing alone, i.e.,
+.Sq ~ ,
+it expands to the invoker's home directory as
+reflected in the value of the
+.Va home
+shell variable.
+When followed by a
+name consisting of letters, digits and
+.Sq \&-
+characters the shell searches for a
+user with that name and substitutes their home directory; thus
+.Sq ~ken
+might
+expand to
+.Sq /usr/ken
+and
+.Sq ~ken/chmach
+to
+.Sq /usr/ken/chmach
+If the character
+.Sq ~
+is followed by a character other than a letter or
+.Sq /
+or appears elsewhere
+than at the beginning of a word, it is left undisturbed.
+A command like
+.Sq setenv MANPATH /usr/man:/usr/local/man:~/lib/man
+does not,
+therefore, do home directory substitution as one might hope.
+.Pp
+It is an error for a glob-pattern containing
+.Sq * ,
+.Sq \&?  ,
+.Sq \&[
+or
+.Sq ~ ,
+with or
+without
+.Sq ^ ,
+not to match any files.
+However, only one pattern in a list of
+glob-patterns must match a file (so that, e.g.,
+.Sq rm *.a *.c *.o
+would fail
+only if there were no files in the current directory ending in
+.Sq .a ,
+.Sq .c ,
+or
+.Sq .o ) ,
+and if the
+.Va nonomatch
+shell variable is set a pattern (or list
+of patterns) which matches nothing is left unchanged rather than causing
+an error.
+.Pp
+The
+.Va globstar
+shell variable can be set to allow
+.Sq **
+or
+.Sq ***
+as
+a file glob pattern that matches any string of characters including
+.Sq / ,
+recursively traversing any existing sub-directories.
+For example,
+.Sq ls **.c
+will list all the .c files in the current directory tree.
+If used by itself, it will match zero or more sub-directories
+(e.g.
+.Sq ls /usr/include/**/time.h
+will list any file named
+.Sq time.h
+in the /usr/include directory tree;
+.Sq ls /usr/include/**time.h
+will match
+any file in the /usr/include directory tree ending in
+.Sq time.h ;
+and
+.Sq ls /usr/include/**time**.h
+will match any .h file with
+.Sq time
+either
+in a subdirectory name or in the filename itself).
+To prevent problems with recursion, the
+.Sq **
+glob-pattern will not
+descend into a symbolic link containing a directory.
+To override this,
+use
+.Sq ***
+(+)
+.Pp
+The
+.Va noglob
+shell variable can be set to prevent filename substitution,
+and the
+.Va expand-glob
+editor command, normally bound to
+.Sq ^X-* ,
+can be
+used to interactively expand individual filename substitutions.
+.Ss "Directory stack substitution (+)"
+The directory stack is a list of directories, numbered from zero, used by the
+.Va pushd ,
+.Va popd
+and
+.Va dirs
+builtin commands (q.v.).
+.Va dirs
+can print, store in a file, restore and clear the directory stack
+at any time, and the
+.Va savedirs
+and
+.Va dirsfile
+shell variables can be set to
+store the directory stack automatically on logout and restore it on login.
+The
+.Va dirstack
+shell variable can be examined to see the directory stack and
+set to put arbitrary directories into the directory stack.
+.Pp
+The character
+.Sq =
+followed by one or more digits expands to an entry in
+the directory stack.
+The special case
+.Sq =-
+expands to the last directory in
+the stack.
+For example,
+.Bd -literal -offset indent
+> dirs \&-v
+0       /usr/bin
+1       /usr/spool/uucp
+2       /usr/accts/sys
+> echo =1
+/usr/spool/uucp
+> echo =0/calendar
+/usr/bin/calendar
+> echo =\-
+/usr/accts/sys
+.Ed
+.Pp
+The
+.Va noglob
+and
+.Va nonomatch
+shell variables and the
+.Va expand-glob
+editor command apply to directory stack as well as filename substitutions.
+.Ss "Other substitutions (+)"
+There are several more transformations involving filenames, not strictly
+related to the above but mentioned here for completeness.
+.Va Any
+filename may be expanded to a full path when the
+.Va symlinks
+variable (q.v.) is set to
+.Sq expand
+Quoting prevents this expansion, and
+the
+.Va normalize-path
+editor command does it on demand.
+The
+.Va normalize-command
+editor command expands commands in PATH into
+full paths on demand.
+Finally,
+.Va cd
+and
+.Va pushd
+interpret
+.Sq \&-
+as the old working directory
+(equivalent to the shell variable
+.Va owd ) .
+This is not a substitution at all, but an abbreviation recognized by only
+those commands.
+Nonetheless, it too can be prevented by quoting.
+.Ss "Commands"
+The next three sections describe how the shell executes commands and
+deals with their input and output.
+.Ss "Simple commands, pipelines and sequences"
+A simple command is a sequence of words, the first of which specifies the
+command to be executed.
+A series of simple commands joined by
+.Sq |
+characters
+forms a pipeline.
+The output of each command in a pipeline is connected to the
+input of the next.
+.Pp
+Simple commands and pipelines may be joined into sequences with
+.Sq ; ,
+and will
+be executed sequentially.
+Commands and pipelines can also be joined into
+sequences with
+.Sq ||
+or
+.Sq && ,
+indicating, as in the C language, that the second
+is to be executed only if the first fails or succeeds respectively.
+.Pp
+A simple command, pipeline or sequence may be placed in parentheses,
+.Sq () ,
+to form a simple command, which may in turn be a component of a pipeline or
+sequence.
+A command, pipeline or sequence can be executed
+without waiting for it to terminate by following it with an
+.Sq \&& .
+.Ss "Builtin and non-builtin command execution"
+Builtin commands are executed within the shell.
+If any component of a
+pipeline except the last is a builtin command, the pipeline is executed
+in a subshell.
+.Pp
+Parenthesized commands are always executed in a subshell.
+.Bd -literal -offset indent
+(cd; pwd); pwd
+.Ed
+.Pp
+thus prints the
+.Va home
+directory, leaving you where you were
+(printing this after the home directory), while
+.Bd -literal -offset indent
+cd; pwd
+.Ed
+.Pp
+leaves you in the
+.Va home
+directory.
+Parenthesized commands are most often
+used to prevent
+.Va cd
+from affecting the current shell.
+.Pp
+When a command to be executed is found not to be a builtin command the shell
+attempts to execute the command via
+.Xr execve 2 .
+Each word in the variable
+.Va path
+names a directory in which the shell will look for the
+command.
+If the shell is not given a
+.Fl f
+option, the shell
+hashes the names in these directories into an internal table so that it will
+try an
+.Xr execve 2
+in only a directory where there is a possibility that the
+command resides there.
+This greatly speeds command location when a large
+number of directories are present in the search path. This hashing mechanism is
+not used:
+.TP 4
+.Bl -enum -width indent
+.It
+If hashing is turned explicitly off via
+.Va unhash
+.It
+If the shell was given a
+.Fl f Ar argument
+.It 
+For each directory component of
+.Va path
+which does not begin with a
+.Sq /
+.It
+If the command contains a
+.Sq /
+.El
+.Pp
+In the above four cases the shell concatenates each component of the path
+vector with the given command name to form a path name of a file which it
+then attempts to execute it. If execution is successful, the search stops.
+.Pp
+If the file has execute permissions but is not an executable to the system
+(i.e., it is neither an executable binary nor a script that specifies its
+interpreter), then it is assumed to be a file containing shell commands and
+a new shell is spawned to read it.
+The
+.Va shell
+special alias may be set
+to specify an interpreter other than the shell itself.
+.Pp
+On systems which do not understand the
+.Sq #!
+script interpreter convention
+the shell may be compiled to emulate it; see the
+.Va version
+shell
+variable.
+If so, the shell checks the first line of the file to
+see if it is of the form
+.Sq #!interpreter arg ...
+If it is,
+the shell starts
+.Va interpreter
+with the given
+.Va arg
+s and feeds the
+file to it on standard input.
+.Ss "Input/output"
+The standard input and standard output of a command may be redirected with the
+following syntax:
+.Pp
+.Bl -tag -width XXXXXX -offset indent -compact
+.It Ar < name
+Open file
+.Va name
+(which is first variable, command and filename
+expanded) as the standard input.
+.It Ar << word
+Read the shell input up to a line which is identical to
+.Va word .
+.Va word
+is not subjected to variable, filename or command substitution, and each input
+line is compared to
+.Va word
+before any substitutions are done on this input
+line.
+Unless a quoting
+.Sq \e ,
+.Sq \&"
+,
+.Sq \&'
+or
+.Sq \&`
+appears in
+.Va word
+variable and
+command substitution is performed on the intervening lines, allowing
+.Sq \e
+to
+quote
+.Sq $ ,
+.Sq \e
+and
+.Sq \&` .
+Commands which are substituted have all blanks, tabs,
+and newlines preserved, except for the final newline which is dropped.
+The
+resultant text is placed in an anonymous temporary file which is given to the
+command as standard input.
+.Pp
+.It Ar > name
+.It Ar >! name
+.It Ar >& name
+.It Ar >&! name
+The file
+.Va name
+is used as standard output.
+If the file does not exist
+then it is created; if the file exists, it is truncated, its previous contents
+being lost.
+.Pp
+If the shell variable
+.Va noclobber
+is set, then the file must not exist or be a
+character special file (e.g., a terminal or
+.Sq /dev/null )
+or an error results.
+This helps prevent accidental destruction of files.
+In this case the
+.Sq \&!
+forms
+can be used to suppress this check.
+If
+.Va notempty
+is given in
+.Va noclobber ,
+.Sq >
+is allowed on empty files;
+if
+.Va ask
+is set, an interacive confirmation is presented, rather than an
+error.
+.Pp
+The forms involving
+.Sq \&&
+route the diagnostic output into the specified file as
+well as the standard output.
+.Va name
+is expanded in the same way as
+.Sq <
+input filenames are.
+.Pp
+.It Ar >> name
+.It Ar >>& name
+.It Ar >>! name
+.It Ar >>&! name
+Like
+.Sq >
+, but appends output to the end of
+.Va name
+If the shell variable
+.Va noclobber
+is set, then it is an error for
+the file
+.Va not
+to exist, unless one of the
+.Sq \&!
+forms is given.
+.El
+.Pp
+A command receives the environment in which the shell was invoked as modified
+by the input-output parameters and the presence of the command in a pipeline.
+Thus, unlike some previous shells, commands run from a file of shell commands
+have no access to the text of the commands by default; rather they receive the
+original standard input of the shell.
+The
+.Sq <<
+mechanism should be used to
+present inline data.
+This permits shell command scripts to function as
+components of pipelines and allows the shell to block read its input.
+Note
+that the default standard input for a command run detached is
+.Va not
+the empty file
+.Va /dev/null ,
+but the original standard input of the shell.
+If this is a terminal and if the process attempts to read from the terminal,
+then the process will block and the user will be notified (see
+.Sx Jobs ) .
+.Pp
+Diagnostic output may be directed through a pipe with the standard output.
+Simply use the form
+.Sq |&
+rather than just
+.Sq | .
+.Pp
+The shell cannot presently redirect diagnostic output without also redirecting
+standard output, but
+.Sq \&( command > output-file ) >&  error-file
+is often an acceptable workaround.
+Either
+.Va output-file
+or
+.Va error-file
+may be
+.Sq /dev/tty
+to send output to the terminal.
+.Ss "Features"
+Having described how the shell accepts, parses and executes
+command lines, we now turn to a variety of its useful features.
+.Ss "Control flow"
+The shell contains a number of commands which can be used to regulate the
+flow of control in command files (shell scripts) and (in limited but
+useful ways) from terminal input.
+These commands all operate by forcing the
+shell to reread or skip in its input and, due to the implementation,
+restrict the placement of some of the commands.
+.Pp
+The
+.Va foreach ,
+.Va switch ,
+and
+.Va while
+statements, as well as the
+.Va if-then-else
+form of the
+.Va if
+statement, require that the major
+keywords appear in a single simple command on an input line as shown below.
+.Pp
+If the shell's input is not seekable, the shell buffers up input whenever
+a loop is being read and performs seeks in this internal buffer to
+accomplish the rereading implied by the loop.
+(To the extent that this allows, backward
+.Va goto
+s will succeed on non-seekable inputs.)
+.Ss "Expressions"
+The
+.Va if ,
+.Va while
+and
+.Va exit
+builtin commands
+use expressions with a common syntax.
+The expressions can include any
+of the operators described in the next three sections.
+Note that the
+.Va @
+builtin command (q.v.) has its own separate syntax.
+.Ss "Logical, arithmetical and comparison operators"
+These operators are similar to those of C and have the same precedence.
+They include
+.IP "" 4
+.Bl -tag -width XXXXXX -offset indent -compact
+.It ||  &&  |   &  ==  !=  =~  !~  <=  >=
+.It <  > <<  >>  +  \-  *  /  %  !  ~  (  )
+.El
+.Pp
+Here the precedence increases to the right,
+.Sq ==
+.Sq \&!=
+.Sq =~
+and
+.Sq \&!~ ,
+.Sq <=
+.Sq >=
+.Sq <
+and
+.Sq > ,
+.Sq <<
+.Sq >> ,
+.Sq +
+and
+.Sq \&- ,
+.Sq *
+.Sq /
+and
+.Sq %
+being, in
+groups, at the same level.
+The
+.Sq ==
+.Sq \&!=
+.Sq =~
+and
+.Sq \&!~
+operators compare
+their arguments as strings; all others operate on numbers.
+The operators
+.Sq =~
+and
+.Sq \&!~
+are like
+.Sq \&!=
+and
+.Sq ==
+except that the right hand side is a
+glob-pattern (see
+.Sx Filename substitution )
+against which the left hand operand is matched.
+This reduces the need for use of the
+.Va switch
+builtin command in shell scripts when all that is really needed is
+pattern matching.
+.Pp
+Null or
+missing arguments are considered
+.Sq 0
+The results of all expressions are
+strings, which represent decimal numbers.
+It is important to note that
+no two components of an expression can appear in the same word; except
+when adjacent to components of expressions which are syntactically
+significant to the parser
+.Sq ( \&&
+.Sq |
+.Sq <
+.Sq >
+.Sq \&(
+.Sq \&) )
+they should be
+surrounded by spaces.
+.Ss "Command exit status"
+Commands can be executed in expressions and their exit status
+returned by enclosing them in braces 
+.Sq ( {} ) .
+Remember that the braces should
+be separated from the words of the command by spaces.
+Command executions
+succeed, returning true, i.e.,
+.Sq 1 ,
+if the command exits with status 0,
+otherwise they fail, returning false, i.e.,
+.Sq 0 .
+If more detailed status
+information is required then the command should be executed outside of an
+expression and the
+.Va status
+shell variable examined.
+.Ss "File inquiry operators"
+Some of these operators perform true/false tests on files and related
+objects.
+They are of the form
+.Fl
+.Va op file
+, where
+.Va op
+is one of
+.Bl -tag -width XXX -offset indent -compact
+.It Ar r
+Read access
+.It Ar w
+Write access
+.It Ar x
+Execute access
+.It Ar X
+Executable in the path or shell builtin, e.g.,
+.Sq \&-X ls
+and
+.Sq \&-X ls\&-F
+are
+generally true, but
+.Sq \&-X /bin/ls
+is not (+)
+.It Ar e
+Existence
+.It Ar o
+Ownership
+.It Ar z
+Zero size
+.It Ar s
+Non-zero size (+)
+.It Ar f
+Plain file
+.It Ar d
+Directory
+.It Ar l
+Symbolic link (+) *
+.It Ar b
+Block special file (+)
+.It Ar c
+Character special file (+)
+.It Ar p
+Named pipe (fifo) (+) *
+.It Ar S
+Socket special file (+) *
+.It Ar u
+Set-user-ID bit is set (+)
+.It Ar g
+Set-group-ID bit is set (+)
+.It Ar k
+Sticky bit is set (+)
+.It Ar t file
+(which must be a digit) is an open file descriptor
+for a terminal device (+)
+.It Ar R
+Has been migrated (Convex only) (+)
+.It Ar L
+Applies subsequent operators in a multiple-operator test to a symbolic link
+rather than to the file to which the link points (+) *
+.El
+.Pp
+.Va file
+is command and filename expanded and then tested to
+see if it has the specified relationship to the real user.
+If
+.Va file
+does not exist or is inaccessible or, for the operators indicated by
+.Sq * ,
+if the specified file type does not exist on the current system,
+then all inquiries return false, i.e.,
+.Sq 0 .
+.Pp
+These operators may be combined for conciseness:
+.Sq \&-
+.Va xy file
+is
+equivalent to
+.Sq \&-x file && \&-y file .
+(+) For example,
+.Sq \&-fx
+is true
+(returns
+.Sq 1 )
+for plain executable files, but not for directories.
+.Pp
+.Va L
+may be used in a multiple-operator test to apply subsequent operators
+to a symbolic link rather than to the file to which the link points.
+For example,
+.Sq \&-lLo
+is true for links owned by the invoking user.
+.Va Lr ,
+.Va Lw
+and
+.Va Lx
+are always true for links and false for
+non-links.
+.Va L
+has a different meaning when it is the last operator
+in a multiple-operator test; see below.
+.Pp
+It is possible but not useful, and sometimes misleading, to combine operators
+which expect
+.Va file
+to be a file with operators which do not
+(e.g.,
+.Va X
+and
+.Va t ) .
+Following
+.Va L
+with a non-file operator
+can lead to particularly strange results.
+.Pp
+Other operators return other information, i.e., not just
+.Sq 0
+or
+.Sq 1
+(+)
+They have the same format as before;
+.Va op
+may be one of
+.Pp
+.PD 0
+.RS +4
+.TP 8
+.B A
+Last file access time, as the number of seconds since the epoch
+.TP 8
+.B A:
+Like
+.Va A
+, but in timestamp format, e.g.,
+.Sq Fri May 14 16:36:10 1993
+.TP 8
+.B M
+Last file modification time
+.TP 8
+.B M:
+Like
+.Va M
+, but in timestamp format
+.TP 8
+.B C
+Last inode modification time
+.TP 8
+.B C:
+Like
+.Va C
+, but in timestamp format
+.TP 8
+.B D
+Device number
+.TP 8
+.B I
+Inode number
+.TP 8
+.B F
+Composite
+.Va f
+ile identifier, in the form
+.Va device
+:
+.Va inode
+.TP 8
+.B L
+The name of the file pointed to by a symbolic link
+.TP 8
+.B N
+Number of (hard) links
+.TP 8
+.B P
+Permissions, in octal, without leading zero
+.TP 8
+.B P:
+Like
+.Va P
+, with leading zero
+.TP 8
+.B P\fImode
+Equivalent to
+.Sq \-P
+.Va file
+&
+.Va mode
+, e.g.,
+.Sq \-P22
+.Va file
+returns
+`22' if
+.Va file
+is writable by group and other,
+.Sq 20
+if by group only,
+and
+.Sq 0
+if by neither
+.TP 8
+.B P\fImode\fB:
+Like \fBP
+.Va mode
+, with leading zero
+.TP 8
+.B U
+Numeric userid
+.TP 8
+.B U:
+Username, or the numeric userid if the username is unknown
+.TP 8
+.B G
+Numeric groupid
+.TP 8
+.B G:
+Groupname, or the numeric groupid if the groupname is unknown
+.TP 8
+.B Z
+Size, in bytes
+.RE
+.PD
+.Pp
+Only one of these operators may appear in a multiple-operator test, and it
+must be the last.
+Note that
+.Va L
+has a different meaning at the end of and
+elsewhere in a multiple-operator test.
+Because
+.Sq 0
+is a valid return value
+for many of these operators, they do not return
+.Sq 0
+when they fail: most
+return
+.Sq \&-1
+, and
+.Va F
+returns
+.Sq \&:
+.Pp
+If the shell is compiled with POSIX defined (see the
+.Va version
+shell
+variable), the result of a file inquiry is based on the permission bits of
+the file and not on the result of the
+.Va access
+(2) system call.
+For example, if one tests a file with
+.Fl w\fR whose permissions would
+ordinarily allow writing but which is on a file system mounted read-only,
+the test will succeed in a POSIX shell but fail in a non-POSIX shell.
+.Pp
+File inquiry operators can also be evaluated with the
+.Va filetest
+builtin
+command (q.v.) (+).
+.Ss Jobs
+The shell associates a
+.Va job
+with each pipeline.
+It keeps a table of
+current jobs, printed by the
+.Va jobs
+command, and assigns them small integer
+numbers.
+When a job is started asynchronously with
+.Sq &
+, the shell prints a
+line which looks like
+.IP "" 4
+[1] 1234
+.Pp
+indicating that the job which was started asynchronously was job number 1 and
+had one (top-level) process, whose process id was 1234.
+.Pp
+If you are running a job and wish to do something else you may hit the suspend
+key (usually
+.Sq ^Z ) ,
+which sends a STOP signal to the current job.
+The shell will then normally
+indicate that the job has been
+.Sq Suspended
+and print another prompt.
+If the
+.Va listjobs
+shell variable is set, all jobs will be listed
+like the
+.Va jobs
+builtin command; if it is set to
+.Sq long
+the listing will
+be in long format, like
+.Sq jobs \&-l
+You can then manipulate the state of the suspended job.
+You can put it in the
+.Dq background
+ with the
+.Va bg
+command or run some other commands and
+eventually bring the job back into the
+.Sq foreground
+' with
+.Va fg
+(See also the
+.Va run-fg-editor
+editor command.)
+A
+.Sq ^Z
+takes effect immediately and is like an interrupt
+in that pending output and unread input are discarded when it is typed.
+The
+.Va wait
+builtin command causes the shell to wait for all background
+jobs to complete.
+.Pp
+The
+.Sq ^]
+key sends a delayed suspend signal, which does not generate a STOP
+signal until a program attempts to
+.Va read
+(2) it, to the current job.
+This can usefully be typed ahead when you have prepared some commands for a
+job which you wish to stop after it has read them.
+The
+.Sq ^Y
+key performs this function in
+.Xr csh 1
+; in
+.Nm
+,
+`^Y' is an editing command.
+(+)
+.Pp
+A job being run in the background stops if it tries to read from the
+terminal.
+Background jobs are normally allowed to produce output, but this can
+be disabled by giving the command
+.Sq stty tostop
+If you set this tty option,
+then background jobs will stop when they try to produce output like they do
+when they try to read input.
+.Pp
+There are several ways to refer to jobs in the shell.
+The character
+.Sq %
+introduces a job name.
+If you wish to refer to job number 1, you can name it
+as
+.Sq %1
+Just naming a job brings it to the foreground; thus
+.Sq %1
+is a synonym
+for
+.Sq fg %1
+, bringing job 1 back into the foreground.
+Similarly, saying
+.Sq %1 &
+resumes job 1 in the background, just like
+.Sq bg %1
+A job can also be named
+by an unambiguous prefix of the string typed in to start it:
+.Sq %ex
+would
+normally restart a suspended
+.Va ex
+(1) job, if there were only one suspended
+job whose name began with the string
+.Sq ex
+It is also possible to say
+`%?
+.Va string
+' to specify a job whose text contains
+.Va string
+, if there
+is only one such job.
+.Pp
+The shell maintains a notion of the current and previous jobs.
+In output
+pertaining to jobs, the current job is marked with a
+.Sq +
+and the previous job
+with a
+.Sq \-
+The abbreviations
+.Sq %+
+,
+.Sq %
+, and (by analogy with the syntax of
+the
+.Va history
+mechanism)
+.Sq %%
+all refer to the current job, and
+.Sq %\-
+refers
+to the previous job.
+.Pp
+The job control mechanism requires that the
+.Va stty
+(1) option
+.Sq new
+be set
+on some systems.
+It is an artifact from a
+.Sq new
+implementation of the tty
+driver which allows generation of interrupt characters from the keyboard to
+tell jobs to stop.
+See
+.Va stty
+(1) and the
+.Va setty
+builtin command for
+details on setting options in the new tty driver.
+.Ss "Status reporting"
+The shell learns immediately whenever a process changes state.
+It normally
+informs you whenever a job becomes blocked so that no further progress is
+possible, but only right before it prints a prompt.
+This is done so that it
+does not otherwise disturb your work.
+If, however, you set the shell variable
+.Va notify
+, the shell will notify you immediately of changes of status in
+background jobs.
+There is also a shell command
+.Va notify
+which marks a
+single process so that its status changes will be immediately reported.
+By
+default
+.Va notify
+marks the current process; simply say
+.Sq notify
+after
+starting a background job to mark it.
+.Pp
+When you try to leave the shell while jobs are stopped, you will be
+warned that
+.Sq There are suspended jobs.
+You may use the
+.Va jobs
+command to
+see what they are.
+If you do this or immediately try to exit again, the shell
+will not warn you a second time, and the suspended jobs will be terminated.
+.Ss "Automatic, periodic and timed events (+)"
+There are various ways to run commands and take other actions automatically
+at various times in the
+.Sq `life cycle
+' of the shell.
+They are summarized here,
+and described in detail under the appropriate
+.Va Builtin commands
+,
+.Va Special shell variables
+and
+.Va Special aliases
+.Pp
+The
+.Va sched
+builtin command puts commands in a scheduled-event list,
+to be executed by the shell at a given time.
+.Pp
+The
+.Va beepcmd
+,
+.Va cwdcmd
+,
+.Va periodic
+,
+.Va precmd
+,
+.Va postcmd
+,
+and
+.Va jobcmd
+.Va Special aliases
+can be set, respectively, to execute commands when the shell wants
+to ring the bell, when the working directory changes, every
+.Va tperiod
+minutes, before each prompt, before each command gets executed, after each
+command gets executed, and when a job is started or is brought into the
+foreground.
+.Pp
+The
+.Va autologout
+shell variable can be set to log out or lock the shell
+after a given number of minutes of inactivity.
+.Pp
+The
+.Va mail
+shell variable can be set to check for new mail periodically.
+.Pp
+The
+.Va printexitvalue
+shell variable can be set to print the exit status
+of commands which exit with a status other than zero.
+.Pp
+The
+.Va rmstar
+shell variable can be set to ask the user, when
+.Sq rm *
+is
+typed, if that is really what was meant.
+.Pp
+The
+.Va time
+shell variable can be set to execute the
+.Va time
+builtin
+command after the completion of any process that takes more than a given
+number of CPU seconds.
+.Pp
+The
+.Va watch
+and
+.Va who
+shell variables can be set to report when
+selected users log in or out, and the
+.Va log
+builtin command reports
+on those users at any time.
+.Ss "Native Language System support (+)"
+The shell is eight bit clean
+(if so compiled; see the
+.Va version
+shell variable)
+and thus supports character sets needing this capability.
+NLS support differs depending on whether or not
+the shell was compiled to use the system's NLS (again, see
+.Va version
+).
+In either case, 7-bit ASCII is the default character code
+(e.g., the classification of which characters are printable) and sorting,
+and changing the
+.Va LANG
+or
+.Va LC_CTYPE
+environment variables
+causes a check for possible changes in these respects.
+.Pp
+When using the system's NLS, the
+.Va setlocale
+(3) function is called
+to determine appropriate character code/classification and sorting
+(e.g., a 'en_CA.UTF-8' would yield "UTF-8" as a character code).
+This function typically examines the
+.Va LANG
+and
+.Va LC_CTYPE
+environment variables; refer to the system documentation for further details.
+When not using the system's NLS, the shell simulates it by assuming that the
+ISO 8859-1 character set is used
+whenever either of the
+.Va LANG
+and
+.Va LC_CTYPE
+variables are set, regardless of
+their values.
+Sorting is not affected for the simulated NLS.
+.Pp
+In addition, with both real and simulated NLS, all printable
+characters in the range \e200\-\e377, i.e., those that have
+M-
+.Va char
+bindings, are automatically rebound to
+.Va self-insert-command
+The corresponding binding for the escape-
+.Va char
+sequence, if any, is
+left alone.
+These characters are not rebound if the
+.Va NOREBIND
+environment variable
+is set.
+This may be useful for the simulated NLS or a primitive real NLS
+which assumes full ISO 8859-1.
+Otherwise, all M-
+.Va char
+bindings in the
+range \e240\-\e377 are effectively undone.
+Explicitly rebinding the relevant keys with
+.Va bindkey
+is of course still possible.
+.Pp
+Unknown characters (i.e., those that are neither printable nor control
+characters) are printed in the format \ennn.
+If the tty is not in 8 bit mode, other 8 bit characters are printed by
+converting them to ASCII and using standout mode.
+The shell
+never changes the 7/8 bit mode of the tty and tracks user-initiated
+changes of 7/8 bit mode.
+NLS users (or, for that matter, those who want to
+use a meta key) may need to explicitly set
+the tty in 8 bit mode through the appropriate
+.Va stty
+(1)
+command in, e.g., the
+.Va ~/.login
+file.
+.Ss "OS variant support (+)"
+A number of new builtin commands are provided to support features in
+particular operating systems.
+All are described in detail in the
+.Va Builtin commands
+section.
+.Pp
+On systems that support TCF (aix-ibm370, aix-ps2),
+.Va getspath
+and
+.Va setspath
+get and set the system execution path,
+.Va getxvers
+and
+.Va setxvers
+get and set the experimental version prefix
+and
+.Va migrate
+migrates processes between sites.
+The
+.Va jobs
+builtin
+prints the site on which each job is executing.
+.Pp
+Under BS2000,
+.Va bs2cmd
+executes commands of the underlying BS2000/OSD
+operating system.
+.Pp
+Under Domain/OS,
+.Va inlib
+adds shared libraries to the current environment,
+.Va rootnode
+changes the rootnode and
+.Va ver
+changes the systype.
+.Pp
+Under Mach,
+.Va setpath
+is equivalent to Mach's
+.Va setpath
+(1).
+.Pp
+Under Masscomp/RTU and Harris CX/UX,
+.Va universe
+sets the universe.
+.Pp
+Under Harris CX/UX,
+.Va ucb
+or
+.Va att
+runs a command under the specified
+universe.
+.Pp
+Under Convex/OS,
+.Va warp
+prints or sets the universe.
+.Pp
+The
+.Va VENDOR
+,
+.Va OSTYPE
+and
+.Va MACHTYPE
+environment variables
+indicate respectively the vendor, operating system and machine type
+(microprocessor class or machine model) of the
+system on which the shell thinks it is running.
+These are particularly useful when sharing one's home directory between several
+types of machines; one can, for example,
+.IP "" 4
+set path = (~/bin.$MACHTYPE /usr/ucb /bin /usr/bin .)
+.Pp
+in one's
+.Va ~/.login
+and put executables compiled for each machine in the
+appropriate directory.
+.Pp
+The
+.Va version
+shell
+variable indicates what options were chosen when the shell was compiled.
+.Pp
+Note also the
+.Va newgrp
+builtin, the
+.Va afsuser
+and
+.Va echo_style
+shell variables and the system-dependent locations of
+the shell's input files (see
+.Va FILES
+).
+.Ss "Signal handling"
+Login shells ignore interrupts when reading the file
+.Va ~/.logout
+The shell ignores quit signals unless started with
+.Fl q\fR.
+Login shells catch the terminate signal, but non-login shells inherit the
+terminate behavior from their parents.
+Other signals have the values which the shell inherited from its parent.
+.Pp
+In shell scripts, the shell's handling of interrupt and terminate signals
+can be controlled with
+.Va onintr
+, and its handling of hangups can be
+controlled with
+.Va hup
+and
+.Va nohup
+.Pp
+The shell exits on a hangup (see also the
+.Va logout
+shell variable).
+By
+default, the shell's children do too, but the shell does not send them a
+hangup when it exits.
+.Va hup
+arranges for the shell to send a hangup to
+a child when it exits, and
+.Va nohup
+sets a child to ignore hangups.
+.Ss "Terminal management (+)"
+The shell uses three different sets of terminal (
+.Dq tty
+) modes:
+`edit', used when editing,
+.Sq quote
+, used when quoting literal characters,
+and
+.Sq execute
+, used when executing commands.
+The shell holds some settings in each mode constant, so commands which leave
+the tty in a confused state do not interfere with the shell.
+The shell also matches changes in the speed and padding of the tty.
+The list of tty modes that are kept constant
+can be examined and modified with the
+.Va setty
+builtin.
+Note that although the editor uses CBREAK mode (or its equivalent),
+it takes typed-ahead characters anyway.
+.Pp
+The
+.Va echotc
+,
+.Va settc
+and
+.Va telltc
+commands can be used to
+manipulate and debug terminal capabilities from the command line.
+.Pp
+On systems that support SIGWINCH or SIGWINDOW, the shell
+adapts to window resizing automatically and adjusts the environment
+variables
+.Va LINES
+and
+.Va COLUMNS
+if set.
+If the environment
+variable
+.Va TERMCAP
+contains li# and co# fields, the shell adjusts
+them to reflect the new window size.
+.Sh REFERENCE
+The next sections of this manual describe all of the available
+.Va Builtin commands
+,
+.Va Special aliases
+and
+.Va Special shell variables
+.Ss "Builtin commands"
+.TP 8
+.B %\fIjob
+A synonym for the
+.Va fg
+builtin command.
+.TP 8
+.B %\fIjob \fB&
+A synonym for the
+.Va bg
+builtin command.
+.TP 8
+.B :
+Does nothing, successfully.
+.Pp
+.B @
+.br
+.B @ \fIname\fB = \fIexpr
+.br
+.B @
+.Va name
+[
+.Va index
+]\fB = \fIexpr
+.br
+.B @ \fIname
+.Va ++
+|\fB--
+.PD 0
+.TP 8
+.B @
+.Va name
+[
+.Va index
+]
+.Va ++
+|\fB--
+The first form prints the values of all shell variables.
+.PD
+.RS +8
+.Pp
+The second form assigns the value of
+.Va expr
+to
+.Va name
+The third form assigns the value of
+.Va expr
+to the
+.Va index
+'th
+component of
+.Va name
+; both
+.Va name
+and its
+.Va index
+'th component
+must already exist.
+.Pp
+.Va expr
+may contain the operators
+.Sq *
+,
+.Sq +
+, etc., as in C.
+If
+.Va expr
+contains
+.Sq <
+,
+.Sq >
+,
+.Sq &
+or
+.Sq
+then at least that part of
+.Va expr
+must be placed within
+.Sq ()
+Note that the syntax of
+.Va expr
+has nothing to do with that described
+under
+.Va Expressions
+.Pp
+The fourth and fifth forms increment (`++') or decrement (`\-\-')
+.Va name
+or its
+.Va index
+'th component.
+.Pp
+The space between
+.Sq @
+and
+.Va name
+is required.
+The spaces between
+.Va name
+and
+.Sq =
+and between
+.Sq =
+and
+.Va expr
+are optional.
+Components of
+.Va expr
+must be separated by spaces.
+.RE
+.PD
+.TP 8
+.B alias \fR[
+.Va name
+[
+.Va wordlist
+]]
+Without arguments, prints all aliases.
+With
+.Va name
+, prints the alias for name.
+With
+.Va name
+and
+.Va wordlist
+, assigns
+.Va wordlist
+as the alias of
+.Va name
+.Va wordlist
+is command and filename substituted.
+.Va name
+may not be
+.Sq alias
+or
+.Sq unalias
+See also the
+.Va unalias
+builtin command.
+.TP 8
+.B alloc
+Shows the amount of dynamic memory acquired, broken down into used and free
+memory.
+With an argument shows the number of free and used blocks in each size
+category.
+The categories start at size 8 and double at each step.
+This
+command's output may vary across system types, because systems other than the VAX
+may use a different memory allocator.
+.TP 8
+.B bg \fR[\fB%
+.Va job
+...]
+Puts the specified jobs (or, without arguments, the current job)
+into the background, continuing each if it is stopped.
+.Va job
+may be a number, a string,
+.Sq
+,
+.Sq %
+,
+.Sq +
+or
+.Sq \-
+as described
+under
+.Va Jobs
+.Pp
+.B bindkey \fR[
+.Fl l\fR|
+.Fl d\fR|
+.Fl e\fR|
+.Fl v\fR|
+.Fl u\fR] (+)
+.br
+.Va bindkey
+[
+.Fl a\fR] [
+.Fl b\fR] [
+.Fl k\fR] [
+.Fl r\fR] [
+.Fl \-\fR]
+.Va key
+(+)
+.PD 0
+.TP 8
+.Va bindkey
+[
+.Fl a\fR] [
+.Fl b\fR] [
+.Fl k\fR] [
+.Fl c\fR|
+.Fl s\fR] [
+.Fl \-\fR]
+.Va key command
+(+)
+.\" .B macro can't take too many words, so I used \fB in the previous tags
+Without options, the first form lists all bound keys and the editor command to which each is bound,
+the second form lists the editor command to which
+.Va key
+is bound and
+the third form binds the editor command
+.Va command
+to
+.Va key
+Options include:
+.PD
+.Pp
+.PD 0
+.RS +8
+.TP 4
+.Fl l
+Lists all editor commands and a short description of each.
+.TP 4
+.Fl d
+Binds all keys to the standard bindings for the default editor,
+as per
+.Va -e
+and
+.Va -v
+below.
+.TP 4
+.Fl e
+Binds all keys to
+.Va emacs
+(1)\-style bindings.
+Unsets
+.Va vimode
+.TP 4
+.Fl v
+Binds all keys to
+.Va vi
+(1)\-style bindings.
+Sets
+.Va vimode
+.TP 4
+.Fl a
+Lists or changes key-bindings in the alternative key map.
+This is the key map used in
+.Va vimode
+command mode.
+.TP 4
+.Fl b
+.Va key
+is interpreted as
+a control character written ^
+.Va character
+(e.g.,
+.Sq ^A
+) or
+C-
+.Va character
+(e.g.,
+.Sq C-A
+),
+a meta character written M-
+.Va character
+(e.g.,
+.Sq M-A
+),
+a function key written F-
+.Va string
+(e.g.,
+.Sq F-string
+),
+or an extended prefix key written X-
+.Va character
+(e.g.,
+.Sq X-A
+).
+.TP 4
+.Fl k
+.Va key
+is interpreted as a symbolic arrow key name, which may be one of
+`down',
+.Sq up
+,
+.Sq left
+or
+.Sq right
+.TP 4
+.Fl r
+Removes
+.Va key
+'s binding.
+Be careful:
+.Sq bindkey \-r
+does
+.Va not
+bind
+.Va key
+to
+.Va self-insert-command
+(q.v.), it unbinds
+.Va key
+completely.
+.TP 4
+.Fl c
+.Va command
+is interpreted as a builtin or external command instead of an
+editor command.
+.TP 4
+.Fl s
+.Va command
+is taken as a literal string and treated as terminal input
+when
+.Va key
+is typed.
+Bound keys in
+.Va command
+are themselves
+reinterpreted, and this continues for ten levels of interpretation.
+.TP 4
+.Fl \-
+Forces a break from option processing, so the next word is taken as
+.Va key
+even if it begins with '\-'.
+.TP 4
+.Fl u \fR(or any invalid option)
+Prints a usage message.
+.PD
+.Pp
+.Va key
+may be a single character or a string.
+If a command is bound to a string, the first character of the string is bound to
+.Va sequence-lead-in
+and the entire string is bound to the command.
+.Pp
+Control characters in
+.Va key
+can be literal (they can be typed by preceding
+them with the editor command
+.Va quoted-insert
+, normally bound to
+.Sq ^V
+) or
+written caret-character style, e.g.,
+.Sq ^A
+Delete is written
+.Sq ^?
+(caret-question mark).
+.Va key
+and
+.Va command
+can contain backslashed
+escape sequences (in the style of System V
+.Va echo
+(1)) as follows:
+.RS +4
+.TP 8
+.PD 0
+.B \ea
+Bell
+.TP 8
+.B \eb
+Backspace
+.TP 8
+.B \ee
+Escape
+.TP 8
+.B \ef
+Form feed
+.TP 8
+.B \en
+Newline
+.TP 8
+.B \er
+Carriage return
+.TP 8
+.B \et
+Horizontal tab
+.TP 8
+.B \ev
+Vertical tab
+.TP 8
+.B \e\fInnn
+The ASCII character corresponding to the octal number
+.Va nnn
+.PD
+.RE
+.Pp
+`\e' nullifies the special meaning of the following character, if it has
+any, notably
+.Sq \e
+and
+.Sq ^
+.RE
+.TP 8
+.B bs2cmd
+.Va bs2000-command
+(+)
+Passes
+.Va bs2000-command
+to the BS2000 command interpreter for
+execution. Only non-interactive commands can be executed, and it is
+not possible to execute any command that would overlay the image
+of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only)
+.TP 8
+.B break
+Causes execution to resume after the
+.Va end
+of the nearest
+enclosing
+.Va foreach
+or
+.Va while
+The remaining commands on the
+current line are executed.
+Multi-level breaks are thus
+possible by writing them all on one line.
+.TP 8
+.B breaksw
+Causes a break from a
+.Va switch
+, resuming after the
+.Va endsw
+.TP 8
+.B builtins \fR(+)
+Prints the names of all builtin commands.
+.TP 8
+.B bye \fR(+)
+A synonym for the
+.Va logout
+builtin command.
+Available only if the shell was so compiled;
+see the
+.Va version
+shell variable.
+.TP 8
+.B case \fIlabel\fB:
+A label in a
+.Va switch
+statement as discussed below.
+.TP 8
+.B cd \fR[
+.Fl p\fR] [
+.Fl l\fR] [
+.Fl n\fR|
+.Fl v\fR] [\I--\fR] [
+.Va name
+]
+If a directory
+.Va name
+is given, changes the shell's working directory
+to
+.Va name
+If not, changes to
+.Va home
+, unless the
+.Va cdtohome
+variable is not set, in which case a
+.Va name
+is required.
+If
+.Va name
+is
+.Sq \-
+it is interpreted as the previous working directory
+(see
+.Va Other substitutions
+).
+(+)
+If
+.Va name
+is not a subdirectory of the current directory
+(and does not begin with
+.Sq /
+,
+.Sq ./
+or
+.Sq ../
+), each component of the variable
+.Va cdpath
+is checked to see if it has a subdirectory
+.Va name
+Finally, if
+all else fails but
+.Va name
+is a shell variable whose value
+begins with
+.Sq /
+or '.', then this is tried to see if it is a directory, and
+the
+.Fl p\fR option is implied.
+.RS +8
+.Pp
+With
+.Fl p\fR, prints the final directory stack, just like
+.Va dirs
+The
+.Fl l\fR,
+.Fl n\fR and
+.Fl v\fR flags have the same effect on
+.Va cd
+as on
+.Va dirs
+, and they imply
+.Fl p\fR.
+(+)
+Using
+.Fl \-\fR forces a break from option processing so the next word
+is taken as the directory
+.Va name
+even if it begins with '\-'. (+)
+.Pp
+See also the
+.Va implicitcd
+and
+.Va cdtohome
+shell variables.
+.RE
+.TP 8
+.B chdir
+A synonym for the
+.Va cd
+builtin command.
+.TP 8
+.B complete \fR[
+.Va command
+[\fIword\fB/\fIpattern\fB/
+.Va list
+[\fB:
+.Va select
+]
+.Va /
+[[
+.Va suffix
+]
+.Va /
+] ...]] (+)
+Without arguments, lists all completions.
+With
+.Va command
+, lists completions for
+.Va command
+With
+.Va command
+and
+.Va word
+etc., defines completions.
+.RS +8
+.Pp
+.Va command
+may be a full command name or a glob-pattern
+(see
+.Va Filename substitution
+).
+It can begin with
+.Sq \-
+to indicate that
+completion should be used only when
+.Va command
+is ambiguous.
+.Pp
+.Va word
+specifies which word relative to the current word
+is to be completed, and may be one of the following:
+.Pp
+.PD 0
+.RS +4
+.TP 4
+.B c
+Current-word completion.
+.Va pattern
+is a glob-pattern which must match the beginning of the current word on
+the command line.
+.Va pattern
+is ignored when completing the current word.
+.TP 4
+.B C
+Like
+.Va c
+, but includes
+.Va pattern
+when completing the current word.
+.TP 4
+.B n
+Next-word completion.
+.Va pattern
+is a glob-pattern which must match the beginning of the previous word on
+the command line.
+.TP 4
+.B N
+Like
+.Va n
+, but must match the beginning of the word two before the current word.
+.TP 4
+.B p
+Position-dependent completion.
+.Va pattern
+is a numeric range, with the same syntax used to index shell
+variables, which must include the current word.
+.PD
+.RE
+.Pp
+.Va list
+, the list of possible completions, may be one of the following:
+.Pp
+.PD 0
+.RS +4
+.TP 8
+.B a
+Aliases
+.TP 8
+.B b
+Bindings (editor commands)
+.TP 8
+.B c
+Commands (builtin or external commands)
+.TP 8
+.B C
+External commands which begin with the supplied path prefix
+.TP 8
+.B d
+Directories
+.TP 8
+.B D
+Directories which begin with the supplied path prefix
+.TP 8
+.B e
+Environment variables
+.TP 8
+.B f
+Filenames
+.TP 8
+.B F
+Filenames which begin with the supplied path prefix
+.TP 8
+.B g
+Groupnames
+.TP 8
+.B j
+Jobs
+.TP 8
+.B l
+Limits
+.TP 8
+.B n
+Nothing
+.TP 8
+.B s
+Shell variables
+.TP 8
+.B S
+Signals
+.TP 8
+.B t
+Plain (
+.Dq text )
+files
+.TP 8
+.B T
+Plain (
+.Dq text )
+files which begin with the supplied path prefix
+.TP 8
+.B v
+Any variables
+.TP 8
+.B u
+Usernames
+.TP 8
+.B x
+Like
+.Va n ,
+but prints
+.Va select
+when
+.Va list-choices
+is used.
+.TP 8
+.B X
+Completions
+.TP 8
+$
+.Va var
+Words from the variable
+.Va var
+.TP 8
+(...)
+Words from the given list
+.TP 8
+\`...\`
+Words from the output of command
+.PD
+.RE
+.Pp
+.Va select
+is an optional glob-pattern.
+If given, words from only
+.Va list
+that match
+.Va select
+are considered
+and the
+.Va fignore
+shell variable is ignored.
+The last three types of completion may not have a
+.Va select
+pattern, and
+.Va x
+uses
+.Va select
+as an explanatory message when
+the
+.Va list-choices
+editor command is used.
+.Pp
+.Va suffix
+is a single character to be appended to a successful
+completion.
+If null, no character is appended.
+If omitted (in which
+case the fourth delimiter can also be omitted), a slash is appended to
+directories and a space to other words.
+.Pp
+.Va command
+invoked from \`...\` version has additional environment
+variable set, the variable name is \%
+.Va COMMAND_LINE
+\% and
+contains (as its name indicates) contents of the current (already
+typed in) command line. One can examine and use contents of the
+\%
+.Va COMMAND_LINE
+\% variable in her custom script to build more
+sophisticated completions (see completion for svn(1) included in
+this package).
+.Pp
+Now for some examples.
+Some commands take only directories as arguments,
+so there's no point completing plain files.
+.IP "" 4
+> complete cd 'p/1/d/'
+.Pp
+completes only the first word following
+.Sq cd
+(`p/1') with a directory.
+.Va p
+-type completion can also be used to narrow down command completion:
+.IP "" 4
+> co[^D]
+.br
+complete compress
+.br
+> complete \-co* 'p/0/(compress)/'
+.br
+> co[^D]
+.br
+> compress
+.Pp
+This completion completes commands (words in position 0,
+.Sq p/0
+)
+which begin with
+.Sq co
+(thus matching
+.Sq co*
+) to
+.Sq compress
+(the only
+word in the list).
+The leading
+.Sq \-
+indicates that this completion is to be used with only
+ambiguous commands.
+.IP "" 4
+> complete find 'n/\-user/u/'
+.Pp
+is an example of
+.Va n
+-type completion.
+Any word following
+.Sq find
+and
+immediately following
+.Sq \-user
+is completed from the list of users.
+.IP "" 4
+> complete cc 'c/\-I/d/'
+.Pp
+demonstrates
+.Va c
+-type completion.
+Any word following
+.Sq cc
+and beginning
+with
+.Sq \-I
+is completed as a directory.
+`\-I' is not taken as part of the
+directory because we used lowercase
+.Va c
+.Pp
+Different
+.Va list
+s are useful with different commands.
+.IP "" 4
+> complete alias 'p/1/a/'
+.br
+> complete man 'p/*/c/'
+.br
+> complete set 'p/1/s/'
+.br
+> complete true 'p/1/x:Truth has no options./'
+.Pp
+These complete words following
+.Sq alias
+with aliases,
+.Sq man
+with commands,
+and
+.Sq set
+with shell variables.
+`true' doesn't have any options, so
+.Va x
+does nothing when completion
+is attempted and prints
+.Sq Truth has no options.
+when completion choices are listed.
+.Pp
+Note that the
+.Va man
+example, and several other examples below, could
+just as well have used 'c/*' or 'n/*' as 'p/*'.
+.Pp
+Words can be completed from a variable evaluated at completion time,
+.IP "" 4
+> complete ftp 'p/1/$hostnames/'
+.br
+> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu)
+.br
+> ftp [^D]
+.br
+rtfm.mit.edu tesla.ee.cornell.edu
+.br
+> ftp [^C]
+.br
+> set hostnames = (rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net)
+.br
+> ftp [^D]
+.br
+rtfm.mit.edu tesla.ee.cornell.edu uunet.uu.net
+.Pp
+or from a command run at completion time:
+.IP "" 4
+> complete kill 'p/*/\`ps | awk \e{print\e \e$1\e}\`/'
+.br
+> kill \-9 [^D]
+.br
+23113 23377 23380 23406 23429 23529 23530 PID
+.Pp
+Note that the
+.Va complete
+command does not itself quote its arguments,
+so the braces, space and
+.Sq $
+in
+.Sq {print $1}
+must be quoted explicitly.
+.Pp
+One command can have multiple completions:
+.IP "" 4
+> complete dbx 'p/2/(core)/' 'p/*/c/'
+.Pp
+completes the second argument to
+.Sq dbx
+with the word
+.Sq core
+and all other
+arguments with commands.
+Note that the positional completion is specified
+before the next-word completion.
+Because completions are evaluated from left to right, if
+the next-word completion were specified first it would always match
+and the positional completion would never be executed.
+This is a
+common mistake when defining a completion.
+.Pp
+The
+.Va select
+pattern is useful when a command takes files with only
+particular forms as arguments.
+For example,
+.IP "" 4
+> complete cc 'p/*/f:*.[cao]/'
+.Pp
+completes
+.Sq cc
+arguments to files ending in only
+.Sq .c
+,
+.Sq .a
+, or
+.Sq .o
+.Va select
+can also exclude files, using negation of a glob-pattern as
+described under
+.Va Filename substitution
+One might use
+.IP "" 4
+> complete rm 'p/*/f:^*.{c,h,cc,C,tex,1,man,l,y}/'
+.Pp
+to exclude precious source code from
+.Sq rm
+completion.
+Of course, one
+could still type excluded names manually or override the completion
+mechanism using the
+.Va complete-word-raw
+or
+.Va list-choices-raw
+editor commands (q.v.).
+.Pp
+The
+.Sq C
+,
+.Sq D
+,
+.Sq F
+and
+.Sq T
+
+.Va list
+s are like
+.Sq c
+,
+.Sq d
+,
+.Sq f
+and
+.Sq t
+respectively, but they use the
+.Va select
+argument in a different way: to
+restrict completion to files beginning with a particular path prefix.
+For
+example, the Elm mail program uses
+.Sq =
+as an abbreviation for one's mail
+directory.
+One might use
+.IP "" 4
+> complete elm c@=@F:$HOME/Mail/@
+.Pp
+to complete
+.Sq elm \-f =
+as if it were
+.Sq elm \-f ~/Mail/
+Note that we used
+.Sq @
+instead of
+.Sq /
+to avoid confusion with the
+.Va select
+argument, and we used
+`$HOME' instead of
+.Sq ~
+because home directory substitution works at only the
+beginning of a word.
+.Pp
+.Va suffix
+is used to add a nonstandard suffix
+(not space or
+.Sq /
+for directories) to completed words.
+.IP "" 4
+> complete finger 'c/*@/$hostnames/' 'p/1/u/@'
+.Pp
+completes arguments to
+.Sq finger
+from the list of users, appends an
+.Sq @
+,
+and then completes after the
+.Sq @
+from the
+.Sq hostnames
+variable.
+Note
+again the order in which the completions are specified.
+.Pp
+Finally, here's a complex example for inspiration:
+.IP "" 4
+> complete find \e
+.br
+\&'n/\-name/f/' 'n/\-newer/f/' 'n/\-{,n}cpio/f/' \e
+.br
+\&\'n/\-exec/c/' 'n/\-ok/c/' 'n/\-user/u/' \e
+.br
+\&'n/\-group/g/' 'n/\-fstype/(nfs 4.2)/' \e
+.br
+\&'n/\-type/(b c d f l p s)/' \e
+.br
+\'c/\-/(name newer cpio ncpio exec ok user \e
+.br
+group fstype type atime ctime depth inum \e
+.br
+ls mtime nogroup nouser perm print prune \e
+.br
+size xdev)/' \e
+.br
+\&'p/*/d/'
+.Pp
+This completes words following
+.Sq \-name
+,
+.Sq \-newer
+,
+.Sq \-cpio
+or
+.Sq ncpio
+(note the pattern which matches both) to files,
+words following
+.Sq \-exec
+or
+.Sq \-ok
+to commands, words following
+.Sq user
+and
+.Sq group
+to users and groups respectively
+and words following
+.Sq \-fstype
+or
+.Sq \-type
+to members of the
+given lists.
+It also completes the switches themselves from the given list
+(note the use of
+.Va c
+-type completion)
+and completes anything not otherwise completed to a directory.
+Whew.
+.Pp
+Remember that programmed completions are ignored if the word being completed
+is a tilde substitution (beginning with
+.Sq ~
+) or a variable (beginning with
+.Sq $
+).
+See also the
+.Va uncomplete
+builtin command.
+.RE
+.TP 8
+.B continue
+Continues execution of the nearest enclosing
+.Va while
+or
+.Va foreach
+The rest of the commands on the current line are executed.
+.TP 8
+.B default:
+Labels the default case in a
+.Va switch
+statement.
+It should come after all
+.Va case
+labels.
+.Pp
+.B dirs \fR[
+.Fl l\fR] [
+.Fl n\fR|
+.Fl v\fR]
+.br
+.B dirs \-S\fR|
+.Fl L \fR[
+.Va filename
+] (+)
+.PD 0
+.TP 8
+.B dirs \-c \fR(+)
+The first form prints the directory stack.
+The top of the stack is at the
+left and the first directory in the stack is the current directory.
+With
+.Fl l\fR,
+.Sq ~
+or
+.Sq ~\fIname\fP
+in the output is expanded explicitly
+to
+.Va home
+or the pathname of the home directory for user \fIname\fP.
+(+)
+With
+.Fl n\fR, entries are wrapped before they reach the edge of the screen.
+(+)
+With
+.Fl v\fR, entries are printed one per line, preceded by their stack positions.
+(+)
+If more than one of
+.Fl n\fR or
+.Fl v\fR is given,
+.Fl v\fR takes precedence.
+.Fl p\fR is accepted but does nothing.
+.PD
+.RS +8
+.Pp
+With
+.Fl S\fR, the second form saves the directory stack to
+.Va filename
+as a series of
+.Va cd
+and
+.Va pushd
+commands.
+With
+.Fl L\fR, the shell sources
+.Va filename
+, which is presumably
+a directory stack file saved by the
+.Fl S\fR option or the
+.Va savedirs
+mechanism.
+In either case,
+.Va dirsfile
+is used if
+.Va filename
+is not given and
+.Va ~/.cshdirs
+is used if
+.Va dirsfile
+is unset.
+.Pp
+Note that login shells do the equivalent of
+.Sq dirs \-L
+on startup
+and, if
+.Va savedirs
+is set,
+.Sq dirs \-S
+before exiting.
+Because only
+.Va ~/.tcshrc
+is normally sourced before
+.Va ~/.cshdirs
+,
+.Va dirsfile
+should be set in
+.Va ~/.tcshrc
+rather than
+.Va ~/.login
+.Pp
+The last form clears the directory stack.
+.RE
+.TP 8
+.B echo \fR[
+.Fl n\fR]
+.Va word
+...
+Writes each
+.Va word
+to the shell's standard
+output, separated by spaces and terminated with a newline.
+The
+.Va echo_style
+shell variable may be set to emulate (or not) the flags and escape
+sequences of the BSD and/or System V versions of
+.Va echo
+; see
+.Va echo
+(1).
+.TP 8
+.B echotc \fR[
+.Fl sv\fR]
+.Va arg
+... (+)
+Exercises the terminal capabilities (see
+.Va termcap
+(5)) in
+.Va args
+For example, 'echotc home' sends the cursor to the home position,
+\&'echotc cm 3 10' sends it to column 3 and row 10, and
+\&'echotc ts 0; echo "This is a test."; echotc fs' prints "This is a test."
+in the status line.
+.RS +8
+.Pp
+If
+.Va arg
+is 'baud', 'cols', 'lines', 'meta' or 'tabs', prints the
+value of that capability ("yes" or "no" indicating that the terminal does
+or does not have that capability).
+One might use this to make the output
+from a shell script less verbose on slow terminals, or limit command
+output to the number of lines on the screen:
+.IP "" 4
+> set history=\`echotc lines\`
+.br
+> @ history\-\-
+.Pp
+Termcap strings may contain wildcards which will not echo correctly.
+One should use double quotes when setting a shell variable to a terminal
+capability string, as in the following example that places the date in
+the status line:
+.IP "" 4
+> set tosl="\`echotc ts 0\`"
+.br
+> set frsl="\`echotc fs\`"
+.br
+> echo \-n "$tosl";date; echo \-n "$frsl"
+.Pp
+With
+.Fl s\fR, nonexistent capabilities return the empty string rather
+than causing an error.
+With
+.Fl v\fR, messages are verbose.
+.RE
+.Pp
+.B else
+.br
+.B end
+.br
+.B endif
+.PD 0
+.TP 8
+.B endsw
+See the description of the
+.Va foreach
+,
+.Va if
+,
+.Va switch
+, and
+.Va while
+statements below.
+.PD
+.TP 8
+.B eval
+.Va arg
+...
+Treats the arguments as input to the
+shell and executes the resulting command(s) in the context
+of the current shell.
+This is usually used to execute commands
+generated as the result of command or variable substitution,
+because parsing occurs before these substitutions.
+See
+.Va tset
+(1) for a sample use of
+.Va eval
+.TP 8
+.B exec
+.Va command
+Executes the specified command in place of the current shell.
+.TP 8
+.B exit \fR[
+.Va expr
+]
+The shell exits either with the value of the specified
+.Va expr
+(an expression, as described under
+.Va Expressions
+)
+or, without
+.Va expr
+, with the value 0.
+.TP 8
+.B fg \fR[\fB%
+.Va job
+...]
+Brings the specified jobs (or, without arguments, the current job)
+into the foreground, continuing each if it is stopped.
+.Va job
+may be a number, a string,
+.Sq
+,
+.Sq %
+,
+.Sq +
+or
+.Sq \-
+as described
+under
+.Va Jobs
+See also the
+.Va run-fg-editor
+editor command.
+.TP 8
+.B filetest \-
+.Va op file
+... (+)
+Applies
+.Va op
+(which is a file inquiry operator as described under
+.Va File inquiry operators
+) to each
+.Va file
+and returns the results as a
+space-separated list.
+.Pp
+.B foreach \fIname \fB(\fIwordlist\fB)
+.br
+\&...
+.PD 0
+.TP 8
+.B end
+Successively sets the variable
+.Va name
+to each member of
+.Va wordlist
+and executes the sequence of commands between this command
+and the matching
+.Va end
+(Both
+.Va foreach
+and
+.Va end
+must appear alone on separate lines.)  The builtin command
+.Va continue
+may be used to continue the loop prematurely and
+the builtin command
+.Va break
+to terminate it prematurely.
+When this command is read from the terminal, the loop is read once
+prompting with
+.Sq foreach?
+(or
+.Va prompt2
+) before any statements in
+the loop are executed.
+If you make a mistake typing in a
+loop at the terminal you can rub it out.
+.PD
+.TP 8
+.B getspath \fR(+)
+Prints the system execution path.
+(TCF only)
+.TP 8
+.B getxvers \fR(+)
+Prints the experimental version prefix.
+(TCF only)
+.TP 8
+.B glob \fIwordlist
+Like
+.Va echo
+, but the
+.Sq -n
+parameter is not recognized and words are
+delimited by null characters in the output.
+Useful for
+programs which wish to use the shell to filename expand a list of words.
+.TP 8
+.B goto \fIword
+.Va word
+is filename and command-substituted to
+yield a string of the form
+.Sq label
+The shell rewinds its
+input as much as possible, searches for a line of the
+form
+.Sq label:
+, possibly preceded by blanks or tabs, and
+continues execution after that line.
+.TP 8
+.B hashstat
+Prints a statistics line indicating how effective the
+internal hash table has been at locating commands (and avoiding
+.Va exec
+'s).
+An
+.Va exec
+is attempted for each component of the
+.Va path
+where the hash function indicates a possible hit, and
+in each component which does not begin with a
+.Sq /
+.IP
+On machines without
+.Va vfork
+(2), prints only the number and size of
+hash buckets.
+.Pp
+.B history \fR[
+.Fl hTr\fR] [
+.Va n
+]
+.br
+.B history \-S\fR|
+.Fl L|
+.Fl M \fR[
+.Va filename
+] (+)
+.PD 0
+.TP 8
+.B history \-c \fR(+)
+The first form prints the history event list.
+If
+.Va n
+is given only the
+.Va n
+most recent events are printed or saved.
+With
+.Fl h\fR, the history list is printed without leading numbers.
+If
+.Va -T
+is specified, timestamps are printed also in comment form.
+(This can be used to
+produce files suitable for loading with 'history \-L' or 'source \-h'.)
+With
+.Fl r\fR, the order of printing is most recent
+first rather than oldest first.
+.PD
+.RS +8
+.Pp
+With
+.Fl S\fR, the second form saves the history list to
+.Va filename
+If the first word of the
+.Va savehist
+shell variable is set to a
+number, at most that many lines are saved.
+If the second word of
+.Va savehist
+is set to
+.Sq merge
+, the history list is merged with the
+existing history file instead of replacing it (if there is one) and
+sorted by time stamp.
+(+) Merging is intended for an environment like
+the X Window System
+with several shells in simultaneous use.
+If the second word of
+.Va savehist
+is
+.Sq merge
+and the third word is set to
+.Sq lock
+, the history file update
+will be serialized with other shell sessions that would possibly like
+to merge history at exactly the same time.
+.Pp
+With
+.Fl L\fR, the shell appends
+.Va filename
+, which is presumably a
+history list saved by the
+.Fl S\fR option or the
+.Va savehist
+mechanism,
+to the history list.
+.Fl M\fR is like
+.Fl L\fR, but the contents of
+.Va filename
+are merged
+into the history list and sorted by timestamp.
+In either case,
+.Va histfile
+is used if
+.Va filename
+is not given and
+.Va ~/.history
+is used if
+.Va histfile
+is unset.
+`history \-L' is exactly like 'source \-h' except that it does not require a
+filename.
+.Pp
+Note that login shells do the equivalent of
+.Sq history \-L
+on startup
+and, if
+.Va savehist
+is set,
+.Sq history \-S
+before exiting.
+Because only
+.Va ~/.tcshrc
+is normally sourced before
+.Va ~/.history
+,
+.Va histfile
+should be set in
+.Va ~/.tcshrc
+rather than
+.Va ~/.login
+.Pp
+If
+.Va histlit
+is set, the first and second forms print and save the literal
+(unexpanded) form of the history list.
+.Pp
+The last form clears the history list.
+.RE
+.TP 8
+.B hup \fR[
+.Va command
+] \fR(+)
+With
+.Va command
+, runs
+.Va command
+such that it will exit on a hangup
+signal and arranges for the shell to send it a hangup signal when the shell
+exits.
+Note that commands may set their own response to hangups, overriding
+.Va hup
+Without an argument, causes the non-interactive shell only to
+exit on a hangup for the remainder of the script.
+See also
+.Va Signal handling
+and the
+.Va nohup
+builtin command.
+.TP 8
+.B if (\fIexpr\fB) \fIcommand
+If
+.Va expr
+(an expression, as described under
+.Va Expressions
+)
+evaluates true, then
+.Va command
+is executed.
+Variable substitution on
+.Va command
+happens early, at the same time it
+does for the rest of the
+.Va if
+command.
+.Va command
+must be a simple command, not an alias, a pipeline, a command list
+or a parenthesized command list, but it may have arguments.
+Input/output redirection occurs even if
+.Va expr
+is
+false and
+.Va command
+is thus
+.Va not
+executed; this is a bug.
+.Pp
+.B if (\fIexpr\fB) then
+.br
+\&...
+.br
+.B else if (\fIexpr2\fB) then
+.br
+\&...
+.br
+.B else
+.br
+\&...
+.PD 0
+.TP 8
+.B endif
+If the specified
+.Va expr
+is true then the commands to the
+first
+.Va else
+are executed; otherwise if
+.Va expr2
+is true then
+the commands to the second
+.Va else
+are executed, etc.
+Any
+number of
+.Va else-if
+pairs are possible; only one
+.Va endif
+is
+needed.
+The
+.Va else
+part is likewise optional.
+(The words
+.Va else
+and
+.Va endif
+must appear at the beginning of input lines;
+the
+.Va if
+must appear alone on its input line or after an
+.Va else
+.)
+.PD
+.TP 8
+.B inlib
+.Va shared-library
+... (+)
+Adds each
+.Va shared-library
+to the current environment.
+There is no way
+to remove a shared library.
+(Domain/OS only)
+.TP 8
+.B jobs \fR[
+.Fl l\fR]
+Lists the active jobs.
+With
+.Fl l\fR, lists process
+IDs in addition to the normal information.
+On TCF systems, prints
+the site on which each job is executing.
+.Pp
+.PD 0
+.TP 8
+.B kill \fR[
+.Fl s
+.Va signal
+] \fB%
+.Va job
+|
+.Va pid
+...
+.PD 0
+.TP 8
+.B kill \-l
+The first and second forms sends the specified
+.Va signal
+(or, if none
+is given, the TERM (terminate) signal) to the specified jobs or processes.
+.Va job
+may be a number, a string,
+.Sq
+,
+.Sq %
+,
+.Sq +
+or
+.Sq \-
+as described
+under
+.Va Jobs
+Signals are either given by number or by name (as given in
+.Va /usr/include/signal.h
+, stripped of the prefix
+.Sq SIG
+).
+There is no default
+.Va job
+; saying just
+.Sq kill
+does not send a signal
+to the current job.
+If the signal being sent is TERM (terminate)
+or HUP (hangup), then the job or process is sent a
+CONT (continue) signal as well.
+The third form lists the signal names.
+.PD
+.TP 8
+.B limit \fR[
+.Fl h\fR] [
+.Va resource
+[
+.Va maximum-use
+]]
+Limits the consumption by the current process and each
+process it creates to not individually exceed
+.Va maximum-use
+on
+the specified
+.Va resource
+If no
+.Va maximum-use
+is given, then
+the current limit is printed; if no
+.Va resource
+is given, then
+all limitations are given.
+If the
+.Fl h\fR flag is given, the
+hard limits are used instead of the current limits.
+The
+hard limits impose a ceiling on the values of the current
+limits.
+Only the super-user may raise the hard limits, but
+a user may lower or raise the current limits within the legal range.
+.Pp
+Controllable resources currently include (if supported by the OS):
+.Bl -tag -width pseudoterminals -compact -offset indent
+.It Va cputime
+the maximum number of cpu-seconds to be used by each process
+.It Va filesize
+the largest single file which can be created
+.It Va datasize
+the maximum growth of the data+stack region via sbrk(2) beyond
+the end of the program text
+.It Va stacksize
+the maximum size of the automatically-extended stack region
+.It Va coredumpsize
+the size of the largest core dump that will be created
+.It Va memoryuse
+the maximum amount of physical memory a process
+may have allocated to it at a given time
+.It Va vmemoryuse
+the maximum amount of virtual memory a process
+may have allocated to it at a given time (address space)
+.It Va vmemoryuse
+the maximum amount of virtual memory a process
+may have allocated to it at a given time
+.It Va heapsize
+the maximum amount of memory a process
+may allocate per
+.Xr brk 2
+system call
+.It Va descriptors
+or
+.It Va openfiles
+the maximum number of open files for this process
+.It Va pseudoterminals
+the maximum number of pseudo-terminals for this user
+.It Va kqueues
+the maximum number of kqueues allocated for this process
+.It Va concurrency
+the maximum number of threads for this process
+.It Va memorylocked
+the maximum size which a process may lock into memory using mlock(2)
+.It Va maxproc
+the maximum number of simultaneous processes for this user id
+.It Va maxthread
+the maximum number of simultaneous threads (lightweight processes) for this
+user id
+.It Va threads
+the maximum number of threads for this process
+.It Va sbsize
+the maximum size of socket buffer usage for this user
+.It Va swapsize
+the maximum amount of swap space reserved or used for this user
+.It Va maxlocks
+the maximum number of locks for this user
+.It Va posixlocks
+the maximum number of POSIX advisory locks for this user
+.It Va maxsignal
+the maximum number of pending signals for this user
+.It Va maxmessage
+the maximum number of bytes in POSIX mqueues for this user
+.It Va maxnice
+the maximum nice priority the user is allowed to raise mapped from [19...-20]
+to [0...39] for this user
+.It Va maxrtprio
+the maximum realtime priority for this user
+.It Va maxrttime
+the timeout for RT tasks in microseconds for this user.
+.El
+.Pp
+.Va maximum-use
+may be given as a (floating point or
+integer) number followed by a scale factor.
+For all limits
+other than
+.Va cputime
+the default scale is
+.Sq k
+or
+.Sq kilobytes
+(1024 bytes); a scale factor of
+.Sq m
+or
+.Sq megabytes
+or
+.Sq g
+or
+.Sq gigabytes
+may also be used.
+For
+.Va cputime
+the default scaling is
+.Sq seconds ,
+while
+.Sq m
+for minutes or
+.Sq h
+for hours, or a time of the
+form
+.Sq mm:ss
+giving minutes and seconds may be used.
+.Pp
+If
+.Va maximum-use
+is
+.Sq unlimited ,
+then the limitation on the specified
+.Va resource
+is removed (this is equivalent to the
+.Va unlimit
+builtin command).
+.Pp
+For both
+.Va resource
+names and scale factors, unambiguous
+prefixes of the names suffice.
+.RE
+.TP 8
+.B log \fR(+)
+Prints the
+.Va watch
+shell variable and reports on each user indicated
+in
+.Va watch
+who is logged in, regardless of when they last logged in.
+See also
+.Va watchlog
+.TP 8
+.B login
+Terminates a login shell, replacing it with an instance of
+.Va /bin/login
+. This is one way to log off, included for
+compatibility with
+.Xr sh 1 .
+.TP 8
+.B logout
+Terminates a login shell.
+Especially useful if
+.Va ignoreeof
+is set.
+.TP 8
+.B ls\-F \fR[\-
+.Va switch
+...] [
+.Va file
+...] (+)
+Lists files like
+.Sq ls \-F
+, but much faster.
+It identifies each type of
+special file in the listing with a special character:
+.Bl -tag -width x -offset indent -compact
+.It Dv /
+Directory
+.It Dv *
+Executable
+.It Dv #
+Block device
+.It Dv %
+Character device
+.It Dv |
+Named pipe (systems with named pipes only)
+.It Dv =
+Socket (systems with sockets only)
+.It Dv @
+Symbolic link (systems with symbolic links only)
+.It Dv +
+Hidden directory (AIX only) or context dependent (HP/UX only)
+.It Dv :
+Network special (HP/UX only)
+.El
+.Pp
+If the
+.Va listlinks
+shell variable is set, symbolic links are identified
+in more detail (on only systems that have them, of course):
+.Pp
+.PD 0
+.TP 4
+@
+Symbolic link to a non-directory
+.TP 4
+>
+Symbolic link to a directory
+.TP 4
+&
+Symbolic link to nowhere
+.PD
+.Pp
+.Va listlinks
+also slows down \fIls\-F\fR and causes partitions holding
+files pointed to by symbolic links to be mounted.
+.Pp
+If the
+.Va listflags
+shell variable is set to
+.Sq x
+,
+.Sq a
+or
+.Sq A
+, or any
+combination thereof (e.g.,
+.Sq xA
+), they are used as flags to \fIls\-F\fR,
+making it act like
+.Sq ls \-xF
+,
+.Sq ls \-Fa
+,
+.Sq ls \-FA
+or a combination
+(e.g.,
+.Sq ls \-FxA
+).
+On machines where
+.Sq ls \-C
+is not the default, \fIls\-F\fR acts like
+.Sq ls \-CF
+,
+unless
+.Va listflags
+contains an
+.Sq x
+, in which case it acts like
+.Sq ls \-xF
+\fIls\-F\fR passes its arguments to
+.Va ls
+(1) if it is given any switches,
+so
+.Sq alias ls ls\-F
+generally does the right thing.
+.Pp
+The \fBls\-F\fR builtin can list files using different colors depending on the
+filetype or extension.
+See the
+.Va color
+shell variable and the
+.Va LS_COLORS
+environment variable.
+.RE
+.Pp
+.B migrate \fR[
+.Fl
+.Va site
+]
+.Va pid
+|\fB%
+.Va jobid
+... (+)
+.PD 0
+.TP 8
+.B migrate \-
+.Va site
+(+)
+The first form migrates the process or job to the site specified or the
+default site determined by the system path.
+The second form is equivalent to
+.Sq migrate \-
+.Va site
+$$
+: it migrates the
+current process to the specified site.
+Migrating the shell
+itself can cause unexpected behavior, because the shell
+does not like to lose its tty.
+(TCF only)
+.PD
+.TP 8
+.B newgrp \fR[
+.Fl \fR]
+.Va [group]
+(+)
+Equivalent to
+.Sq exec newgrp
+; see
+.Va newgrp
+(1).
+Available only if the shell was so compiled;
+see the
+.Va version
+shell variable.
+.TP 8
+.B nice \fR[\fB+
+.Va number
+] [
+.Va command
+]
+Sets the scheduling priority for the shell to
+.Va number
+, or, without
+.Va number
+, to 4.
+With
+.Va command ,
+runs
+.Va command
+at the appropriate
+priority.
+The greater the
+.Va number
+, the less cpu
+the process gets.
+The super-user may specify negative
+priority by using
+.Sq nice \-number ...
+Command is always
+executed in a sub-shell, and the restrictions placed on
+commands in simple
+.Va if
+statements apply.
+.TP 8
+.B nohup \fR[
+.Va command
+]
+With
+.Va command
+, runs
+.Va command
+such that it will ignore hangup signals.
+Note that commands may set their own response to hangups, overriding
+.Va nohup
+Without an argument, causes the non-interactive shell only to
+ignore hangups for the remainder of the script.
+See also
+.Va Signal handling
+and the
+.Va hup
+builtin command.
+.TP 8
+.B notify \fR[\fB%
+.Va job
+...]
+Causes the shell to notify the user asynchronously when the status of any
+of the specified jobs (or, without %
+.Va job
+, the current job) changes,
+instead of waiting until the next prompt as is usual.
+.Va job
+may be a number, a string,
+.Sq
+,
+.Sq %
+,
+.Sq +
+or
+.Sq \-
+as described
+under
+.Va Jobs
+See also the
+.Va notify
+shell variable.
+.TP 8
+.B onintr \fR[
+.Fl \fR|
+.Va label
+]
+Controls the action of the shell on interrupts.
+Without arguments,
+restores the default action of the shell on interrupts,
+which is to terminate shell scripts or to return to the
+terminal command input level.
+With
+.Sq \-
+, causes all interrupts to be ignored.
+With
+.Va label
+, causes the shell to execute a
+.Sq goto
+.Va label
+when an interrupt is received or a child process terminates because it was
+interrupted.
+.IP "" 8
+.Va onintr
+is ignored if the shell is running detached and in system
+startup files (see
+.Va FILES
+), where interrupts are disabled anyway.
+.TP 8
+.B popd \fR[
+.Fl p\fR] [
+.Fl l\fR] [
+.Fl n\fR|
+.Fl v\fR] \fR[\fB+
+.Va n
+]
+Without arguments, pops the directory stack and returns to the new top directory.
+With a number
+.Sq +
+.Va n
+, discards the
+.Va n
+'th entry in the stack.
+.IP "" 8
+Finally, all forms of
+.Va popd
+print the final directory stack,
+just like
+.Va dirs
+The
+.Va pushdsilent
+shell variable can be set to
+prevent this and the
+.Fl p\fR flag can be given to override
+.Va pushdsilent
+The
+.Fl l\fR,
+.Fl n\fR and
+.Fl v\fR flags have the same effect on
+.Va popd
+as on
+.Va dirs
+(+)
+.TP 8
+.B printenv \fR[
+.Va name
+] (+)
+Prints the names and values of all environment variables or,
+with
+.Va name
+, the value of the environment variable
+.Va name
+.TP 8
+.B pushd \fR[
+.Fl p\fR] [
+.Fl l\fR] [
+.Fl n\fR|
+.Fl v\fR] [
+.Va name
+|\fB+
+.Va n
+]
+Without arguments, exchanges the top two elements of the directory stack.
+If
+.Va pushdtohome
+is set,
+.Va pushd
+without arguments does
+.Sq pushd ~
+,
+like
+.Va cd
+(+)
+With
+.Va name
+, pushes the current working directory onto the directory
+stack and changes to
+.Va name
+If
+.Va name
+is
+.Sq \-
+it is interpreted as the previous working directory
+(see
+.Va Filename substitution
+).
+(+)
+If
+.Va dunique
+is set,
+.Va pushd
+removes any instances of
+.Va name
+from the stack before pushing it onto the stack.
+(+)
+With a number
+.Sq +
+.Va n
+, rotates the
+.Va n
+th element of the
+directory stack around to be the top element and changes to it.
+If
+.Va dextract
+is set, however,
+.Sq pushd +
+.Va n
+extracts the
+.Va n
+th
+directory, pushes it onto the top of the stack and changes to it.
+(+)
+.IP "" 8
+Finally, all forms of
+.Va pushd
+print the final directory stack,
+just like
+.Va dirs
+The
+.Va pushdsilent
+shell variable can be set to
+prevent this and the
+.Fl p\fR flag can be given to override
+.Va pushdsilent
+The
+.Fl l\fR,
+.Fl n\fR and
+.Fl v\fR flags have the same effect on
+.Va pushd
+as on
+.Va dirs
+(+)
+.TP 8
+.B rehash
+Causes the internal hash table of the contents of the
+directories in the
+.Va path
+variable to be recomputed.
+This is
+needed if the
+.Va autorehash
+shell variable is not set and new
+commands are added to directories in
+.Va path
+while you are logged
+in.
+With
+.Va autorehash
+, a new command will be found
+automatically, except in the special case where another command of
+the same name which is located in a different directory already
+exists in the hash table.
+Also flushes the cache of home directories
+built by tilde expansion.
+.TP 8
+.B repeat \fIcount command
+The specified
+.Va command
+,
+which is subject to the same restrictions as the
+.Va command
+in the one line
+.Va if
+statement above, is executed
+.Va count
+times.
+I/O redirections occur exactly once, even if
+.Va count
+is 0.
+.TP 8
+.B rootnode //
+.Va nodename
+(+)
+Changes the rootnode to //
+.Va nodename
+, so that
+.Sq /
+will be interpreted
+as
+.Sq //
+.Va nodename
+(Domain/OS only)
+.Pp
+.B sched \fR(+)
+.br
+.B sched \fR[
+.Va +
+]
+.Va hh:mm command
+\fR(+)
+.PD 0
+.TP 8
+.B sched \-
+.Va n
+(+)
+The first form prints the scheduled-event list.
+The
+.Va sched
+shell variable may be set to define the format in which
+the scheduled-event list is printed.
+The second form adds
+.Va command
+to the scheduled-event list.
+For example,
+.PD
+.RS +8
+.IP "" 4
+> sched 11:00 echo It\e's eleven o\e'clock.
+.Pp
+causes the shell to echo
+.Sq It's eleven o'clock .
+at 11 AM.
+The time may be in 12-hour AM/PM format
+.IP "" 4
+.\" TODO
+> sched 5pm set prompt='[%h] It\e's after 5; go home: >'
+.Pp
+or may be relative to the current time:
+.IP "" 4
+> sched +2:15 /usr/lib/uucp/uucico \-r1 \-sother
+.Pp
+A relative time specification may not use AM/PM format.
+The third form removes item
+.Va n
+from the event list:
+.Bd -literal -offset indent
+> sched
+	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
+	2  Wed Apr  4 17:00  set prompt=[%h] It's after 5; go home: >
+> sched \-2
+> sched
+	1  Wed Apr  4 15:42  /usr/lib/uucp/uucico \-r1 \-sother
+.Ed
+.Pp
+A command in the scheduled-event list is executed just before the first
+prompt is printed after the time when the command is scheduled.
+It is possible to miss the exact time when the command is to be run, but
+an overdue command will execute at the next prompt.
+A command which comes due while the shell
+is waiting for user input is executed immediately.
+However, normal operation of an already-running command will not
+be interrupted so that a scheduled-event list element may be run.
+.Pp
+This mechanism is similar to, but not the same as, the
+.Va at
+(1)
+command on some Unix systems.
+Its major disadvantage is that it may not run a command at exactly the
+specified time.
+Its major advantage is that because
+.Va sched
+runs directly from
+the shell, it has access to shell variables and other structures.
+This provides a mechanism for changing one's working environment
+based on the time of day.
+.RE
+.Pp
+.B set
+.br
+.B set
+.Va name
+...
+.br
+.B set
+.Va name
+\fB=
+.Va word
+...
+.br
+.B set [\-r] [\-f|\-l]
+.Va name
+\fB=(\fIwordlist
+.Va )
+... (+)
+.br
+.B set
+.Va name[index]
+\fB=
+.Va word
+...
+.br
+.B set \-r \fR(+)
+.br
+.B set \-r
+.Va name
+... (+)
+.PD 0
+.TP 8
+.B set \-r
+.Va name
+\fB=
+.Va word
+... (+)
+The first form of the command prints the value of all shell variables.
+Variables which contain more than a single word print as a
+parenthesized word list.
+The second form sets
+.Va name
+to the null string.
+The third form sets
+.Va name
+to the single
+.Va word
+The fourth form sets
+.Va name
+to the list of words in
+.Va wordlist
+In all cases the value is command and filename expanded.
+If
+.Fl r\fR is specified, the value is set read-only.
+If
+.Fl f\fR or
+.Fl l\fR are specified, set only unique words keeping their order.
+.Fl f\fR prefers the first occurrence of a word, and
+.Fl l\fR the last.
+The fifth form sets the
+.Va index
+'th component of
+.Va name
+to
+.Va word
+;
+this component must already exist.
+The sixth form lists only the names of all shell variables that are read-only.
+The seventh form makes
+.Va name
+read-only, whether or not it has a value.
+The eighth form is the same as the third form, but
+make
+.Va name
+read-only at the same time.
+.PD
+.IP "" 8
+These arguments can be repeated to set and/or make read-only multiple variables
+in a single set command.
+Note, however, that variable expansion
+happens for all arguments before any setting occurs.
+Note also that
+.Sq =
+can
+be adjacent to both
+.Va name
+and
+.Va word
+or separated from both by
+whitespace, but cannot be adjacent to only one or the other.
+See also the
+.Va unset
+builtin command.
+.TP 8
+.B setenv \fR[
+.Va name
+[
+.Va value
+]]
+Without arguments, prints the names and values of all environment variables.
+Given
+.Va name
+, sets the environment variable
+.Va name
+to
+.Va value
+or, without
+.Va value
+, to the null string.
+.TP 8
+.B setpath
+.Va path
+(+)
+Equivalent to
+.Va setpath
+(1).
+(Mach only)
+.TP 8
+.B setspath\fR LOCAL|
+.Va site
+|
+.Va cpu
+...
+(+)
+Sets the system execution path.
+(TCF only)
+.TP 8
+.B settc
+.Va cap value
+(+)
+Tells the shell to believe that the terminal capability
+.Va cap
+(as defined in
+.Va termcap
+(5)) has the value
+.Va value
+No sanity checking is done.
+Concept terminal users may have to
+.Sq settc xn no
+to get proper
+wrapping at the rightmost column.
+.TP 8
+.B setty \fR[
+.Fl d\fR|
+.Fl q\fR|
+.Fl x\fR] [
+.Fl a\fR] [[
+.Va +
+|
+.Fl \fR]
+.Va mode
+] (+)
+Controls which tty modes (see
+.Va Terminal management
+)
+the shell does not allow to change.
+.Fl d\fR,
+.Fl q\fR or
+.Fl x\fR tells
+.Va setty
+to act
+on the
+.Sq edit
+,
+.Sq quote
+or
+.Sq execute
+set of tty modes respectively; without
+.Fl d\fR,
+.Fl q\fR or
+.Fl x\fR,
+.Sq execute
+is used.
+.IP "" 8
+Without other arguments,
+.Va setty
+lists the modes in the chosen set
+which are fixed on (`+mode') or off (`\-mode').
+The available modes, and thus the display, vary from system to system.
+With
+.Fl a\fR, lists all tty modes in the chosen set
+whether or not they are fixed.
+With \fB+
+.Va mode
+,
+.Fl
+.Va mode
+or
+.Va mode
+, fixes
+.Va mode
+on or off
+or removes control from
+.Va mode
+in the chosen set.
+For example,
+.Sq setty +echok echoe
+fixes
+.Sq echok
+mode on and allows commands
+to turn
+.Sq echoe
+mode on or off, both when the shell is executing commands.
+.TP 8
+.B setxvers\fR [
+.Va string
+] (+)
+Set the experimental version prefix to
+.Va string
+, or removes it
+if
+.Va string
+is omitted.
+(TCF only)
+.TP 8
+.B shift \fR[
+.Va variable
+]
+Without arguments, discards
+.Va argv
+[1] and shifts the members of
+.Va argv
+to the left.
+It is an error for
+.Va argv
+not to be set or to have
+less than one word as value.
+With
+.Va variable
+, performs the
+same function on
+.Va variable
+.TP 8
+.B source \fR[
+.Fl h\fR]
+.Va name
+[
+.Va args
+...]
+The shell reads and executes commands from
+.Va name
+The commands are not placed on the history list.
+If any
+.Va args
+are given, they are placed in
+.Va argv
+(+)
+.Va source
+commands may be nested;
+if they are nested too deeply the shell may run out of file descriptors.
+An error in a
+.Va source
+at any level terminates all nested
+.Va source
+commands.
+With
+.Fl h\fR, commands are placed on the history list instead of being
+executed, much like
+.Sq history \-L
+.TP 8
+.B stop \fB%
+.Va job
+|
+.Va pid
+...
+Stops the specified jobs or processes which are executing in the background.
+.Va job
+may be a number, a string,
+.Sq
+,
+.Sq %
+,
+.Sq +
+or
+.Sq \-
+as described
+under
+.Va Jobs
+There is no default
+.Va job
+; saying just
+.Sq stop
+does not stop
+the current job.
+.TP 8
+.B suspend
+Causes the shell to stop in its tracks, much as if it had
+been sent a stop signal with
+.Va ^Z
+This is most often used to
+stop shells started by
+.Va su
+(1).
+.Pp
+.B switch (\fIstring\fB)
+.br
+.B case \fIstr1\fB:
+.PD 0
+.IP "" 4
+\&...
+.br
+.B breaksw
+.Pp
+\&...
+.Pp
+.B default:
+.IP "" 4
+\&...
+.br
+.B breaksw
+.TP 8
+.B endsw
+Each case label is successively matched, against the
+specified
+.Va string
+which is first command and filename expanded.
+The file metacharacters
+.Sq *
+,
+.Sq \&?
+and
+.Sq [...]
+may be used
+in the case labels, which are variable expanded.
+If none
+of the labels match before a
+.Sq default
+label is found, then
+the execution begins after the default label.
+Each case
+label and the default label must appear at the beginning of
+a line.
+The command
+.Va breaksw
+causes execution to continue
+after the
+.Va endsw
+Otherwise control may fall through case
+labels and default labels as in C.
+If no label matches and
+there is no default, execution continues after the
+.Va endsw
+.PD
+.TP 8
+.B telltc \fR(+)
+Lists the values of all terminal capabilities (see
+.Va termcap
+(5)).
+.TP 8
+.B termname \fR[
+.Va terminal type
+] \fR(+)
+Tests if
+.Va terminal type
+(or the current value of
+.Va TERM
+if no
+.Va terminal type
+is given) has an entry in the hosts termcap(5) or
+terminfo(5) database. Prints the terminal type to stdout and returns 0
+if an entry is present otherwise returns 1.
+.TP 8
+.B time \fR[
+.Va command
+]
+Executes
+.Va command
+(which must be a simple command, not an alias,
+a pipeline, a command list or a parenthesized command list)
+and prints a time summary as described under the
+.Va time
+variable.
+If necessary, an extra shell is created to print the time statistic when
+the command completes.
+Without
+.Va command
+, prints a time summary for the current shell and its
+children.
+.TP 8
+.B umask \fR[
+.Va value
+]
+Sets the file creation mask to
+.Va value
+, which is given in octal.
+Common values for the mask are
+002, giving all access to the group and read and execute access to others, and
+022, giving read and execute access to the group and others.
+Without
+.Va value
+, prints the current file creation mask.
+.TP 8
+.B unalias
+.Va pattern
+.br
+Removes all aliases whose names match
+.Va pattern
+`unalias *' thus removes all aliases.
+It is not an error for nothing to be
+.Va unalias
+ed.
+.TP 8
+.B uncomplete
+.Va pattern
+(+)
+Removes all completions whose names match
+.Va pattern
+`uncomplete *' thus removes all completions.
+It is not an error for nothing to be
+.Va uncomplete
+d.
+.TP 8
+.B unhash
+Disables use of the internal hash table to speed location of
+executed programs.
+.TP 8
+.B universe
+.Va universe
+(+)
+Sets the universe to
+.Va universe
+(Masscomp/RTU only)
+.TP 8
+.B unlimit \fR[
+.Fl hf\fR] [
+.Va resource
+]
+Removes the limitation on
+.Va resource
+or, if no
+.Va resource
+is
+specified, all
+.Va resource
+limitations.
+With
+.Fl h\fR, the corresponding hard limits are removed.
+Only the super-user may do this.
+Note that
+.Va unlimit
+may not exit successful, since most systems
+do not allow
+.Va descriptors
+to be unlimited.
+With
+.Fl f\fR errors are ignored.
+.TP 8
+.B unset \fIpattern
+Removes all variables whose names match
+.Va pattern
+, unless they are read-only.
+`unset *' thus removes all variables unless they are read-only;
+this is a bad idea.
+It is not an error for nothing to be
+.Va unset
+.TP 8
+.B unsetenv \fIpattern
+Removes all environment variables whose names match
+.Va pattern
+`unsetenv *' thus removes all environment variables;
+this is a bad idea.
+It is not an error for nothing to be
+.Va unsetenv
+ed.
+.TP 8
+.B ver \fR[
+.Va systype
+[
+.Va command
+]] (+)
+Without arguments, prints
+.Va SYSTYPE
+With
+.Va systype
+, sets
+.Va SYSTYPE
+to
+.Va systype
+With
+.Va systype
+and
+.Va command
+, executes
+.Va command
+under
+.Va systype
+.Va systype
+may be
+.Sq bsd4.3
+or
+.Sq sys5.3
+(Domain/OS only)
+.TP 8
+.B wait
+The shell waits for all background jobs.
+If the shell is interactive, an
+interrupt will disrupt the wait and cause the shell to print the names and job
+numbers of all outstanding jobs.
+.TP 8
+.B warp
+.Va universe
+(+)
+Sets the universe to
+.Va universe
+(Convex/OS only)
+.TP 8
+.B watchlog \fR(+)
+An alternate name for the
+.Va log
+builtin command (q.v.).
+Available only if the shell was so compiled;
+see the
+.Va version
+shell variable.
+.TP 8
+.B where
+.Va command
+(+)
+Reports all known instances of
+.Va command
+, including aliases, builtins and
+executables in
+.Va path
+.TP 8
+.B which\fR
+.Va command
+(+)
+Displays the command that will be executed by the shell after substitutions,
+.Va path
+searching, etc.
+The builtin command is just like
+.Va which
+(1), but it correctly reports
+.Nm
+aliases and builtins and is 10 to 100 times faster.
+See also the
+.Va which-command
+editor command.
+.Pp
+.B while (\fIexpr
+.Va )
+.br
+\&...
+.PD 0
+.TP 8
+.B end
+Executes the commands between the
+.Va while
+and the matching
+.Va end
+while
+.Va expr
+(an expression, as described under
+.Va Expressions
+)
+evaluates non-zero.
+.Va while
+and
+.Va end
+must appear alone on their input lines.
+.Va break
+and
+.Va continue
+may be used to terminate or continue the
+loop prematurely.
+If the input is a terminal, the user is prompted the first time
+through the loop as with
+.Va foreach
+.PD
+.Ss "Special aliases (+)"
+If set, each of these aliases executes automatically at the indicated time.
+They are all initially undefined.
+.TP 8
+.B beepcmd
+Runs when the shell wants to ring the terminal bell.
+.TP 8
+.B cwdcmd
+Runs after every change of working directory.
+For example, if the user is
+working on an X window system using
+.Va xterm
+(1) and a re-parenting window
+manager that supports title bars such as
+.Va twm
+(1) and does
+.RS +8
+.IP "" 4
+> alias cwdcmd  'echo \-n "^[]2;${HOST}:$cwd ^G"'
+.Pp
+then the shell will change the title of the running
+.Va xterm
+(1)
+to be the name of the host, a colon, and the full current working directory.
+A fancier way to do that is
+.IP "" 4
+> alias cwdcmd 'echo \-n "^[]2;${HOST}:$cwd^G^[]1;${HOST}^G"'
+.Pp
+This will put the hostname and working directory on the title bar but
+only the hostname in the icon manager menu.
+.Pp
+Note that putting a
+.Va cd
+,
+.Va pushd
+or
+.Va popd
+in
+.Va cwdcmd
+may cause an infinite loop.
+It is the author's opinion that anyone doing
+so will get what they deserve.
+.RE
+.TP 8
+.B jobcmd
+Runs before each command gets executed, or when the command changes state.
+This is similar to
+.Va postcmd
+, but it does not print builtins.
+.RS +8
+.IP "" 4
+> alias jobcmd  'echo \-n "^[]2\e;\e!#:q^G"'
+.Pp
+then executing
+.Va vi foo.c
+will put the command string in the xterm title bar.
+.RE
+.TP 8
+.B helpcommand
+Invoked by the
+.Va run-help
+editor command.
+The command name for which help
+is sought is passed as sole argument.
+For example, if one does
+.RS +8
+.IP "" 4
+> alias helpcommand '\e!:1 --help'
+.Pp
+then the help display of the command itself will be invoked, using the GNU
+help calling convention.
+Currently there is no easy way to account for various calling conventions (e.g.,
+the customary Unix
+.Sq -h
+), except by using a table of many commands.
+.RE
+.TP 8
+.B periodic
+Runs every
+.Va tperiod
+minutes.
+This provides a convenient means for
+checking on common but infrequent changes such as new mail.
+For example,
+if one does
+.RS +8
+.IP "" 4
+> set tperiod = 30
+.br
+> alias periodic checknews
+.Pp
+then the
+.Va checknews
+(1) program runs every 30 minutes.
+If
+.Va periodic
+is set but
+.Va tperiod
+is unset or set to 0,
+.Va periodic
+behaves like
+.Va precmd
+.RE
+.TP 8
+.B precmd
+Runs just before each prompt is printed.
+For example, if one does
+.RS +8
+.IP "" 4
+> alias precmd date
+.Pp
+then
+.Va date
+(1) runs just before the shell prompts for each command.
+There are no limits on what
+.Va precmd
+can be set to do, but discretion
+should be used.
+.RE
+.TP 8
+.B postcmd
+Runs before each command gets executed.
+.RS +8
+.IP "" 4
+> alias postcmd  'echo \-n "^[]2\e;\e!#:q^G"'
+.Pp
+then executing
+.Va vi foo.c
+will put the command string in the xterm title bar.
+.RE
+.TP 8
+.B shell
+Specifies the interpreter for executable scripts which do not themselves
+specify an interpreter.
+The first word should be a full path name to the
+desired interpreter (e.g.,
+.Sq /bin/csh
+or
+.Sq /usr/local/bin/tcsh
+).
+.Ss "Special shell variables"
+The variables described in this section have special meaning to the shell.
+.Pp
+The shell sets
+.Va addsuffix ,
+.Va argv ,
+.Va autologout ,
+.Va csubstnonl ,
+.Va command ,
+.Va echo_style ,
+.Va edit ,
+.Va gid ,
+.Va group ,
+.Va home ,
+.Va loginsh ,
+.Va oid ,
+.Va path ,
+.Va prompt ,
+.Va prompt2 ,
+.Va prompt3 ,
+.Va shell ,
+.Va shlvl ,
+.Va tcsh ,
+.Va term ,
+.Va tty ,
+.Va uid ,
+.Va user
+and
+.Va version
+at
+startup; they do not change thereafter unless changed by the user.
+The shell updates
+.Va cwd ,
+.Va dirstack ,
+.Va owd
+and
+.Va status
+when necessary,
+and sets
+.Va logout
+on logout.
+.Pp
+The shell synchronizes
+.Va group ,
+.Va home ,
+.Va path ,
+.Va shlvl ,
+.Va term and
+.Va user
+with the environment variables of the same names:
+whenever the environment variable changes the shell changes the corresponding
+shell variable to match (unless the shell variable is read-only) and vice
+versa.
+Note that although
+.Va cwd
+and
+.Va PWD
+have identical meanings, they
+are not synchronized in this manner, and that the shell automatically
+converts between the different formats of
+.Va path
+and
+.Va PATH
+.TP 8
+.B addsuffix \fR(+)
+If set, filename completion adds
+.Sq /
+to the end of directories and a space
+to the end of normal files when they are matched exactly.
+Set by default.
+.TP 8
+.B afsuser \fR(+)
+If set,
+.Va autologout
+'s autolock feature uses its value instead of
+the local username for kerberos authentication.
+.TP 8
+.B ampm \fR(+)
+If set, all times are shown in 12-hour AM/PM format.
+.TP 8
+.B anyerror \fR(+)
+This variable selects what is propagated to the value of the
+.Va status
+variable. For more information see the description of the
+.Va status
+variable below.
+.TP 8
+.B argv
+The arguments to the shell.
+Positional parameters are taken from
+.Va argv
+,
+i.e.,
+.Sq $1
+is replaced by
+.Sq $argv[1]
+, etc.
+Set by default, but usually empty in interactive shells.
+.TP 8
+.B autocorrect \fR(+)
+If set, the
+.Va spell-word
+editor command is invoked automatically before
+each completion attempt.
+.TP 8
+.B autoexpand \fR(+)
+If set, the
+.Va expand-history
+editor command is invoked automatically
+before each completion attempt. If this is set to
+.Va onlyhistory
+, then
+only history will be expanded and a second completion will expand filenames.
+.TP 8
+.B autolist \fR(+)
+If set, possibilities are listed after an ambiguous completion.
+If set to
+.Sq ambiguous
+, possibilities are listed only when no new
+characters are added by completion.
+.TP 8
+.B autologout \fR(+)
+The first word is the number of minutes of inactivity before automatic
+logout.
+The optional second word is the number of minutes of inactivity
+before automatic locking.
+When the shell automatically logs out, it prints
+.Sq auto-logout
+, sets the
+variable
+.Va logout
+to
+.Sq automatic
+and exits.
+When the shell automatically locks, the user is required to enter his password
+to continue working.
+Five incorrect attempts result in automatic logout.
+Set to
+.Sq 60
+(automatic logout after 60 minutes, and no locking) by default
+in login and superuser shells, but not if the shell thinks it is running
+under a window system (i.e., the
+.Va DISPLAY
+environment variable is set),
+the tty is a pseudo-tty (pty) or the shell was not so compiled (see the
+.Va version
+shell variable).
+See also the
+.Va afsuser
+and
+.Va logout
+shell variables.
+.TP 8
+.B autorehash \fR(+)
+If set, the internal hash table of the contents of the directories in the
+.Va path
+variable will be recomputed if a command is not found in the hash
+table.
+In addition, the list of available commands will be rebuilt for each
+command completion or spelling correction attempt if set to
+.Sq complete
+or
+`correct' respectively; if set to
+.Sq always
+, this will be done for both
+cases.
+.TP 8
+.B backslash_quote \fR(+)
+.\" TODO
+If set, backslashes (`\e') always quote
+.Sq \e
+,
+.Sq \&' ,
+and
+.Sq \&"
+This may make
+complex quoting tasks easier, but it can cause syntax errors in
+.Xr csh 1
+scripts.
+.TP 8
+.B catalog
+The file name of the message catalog.
+If set, tcsh use
+.Sq tcsh.${catalog}
+as a message catalog instead of
+default
+.Sq tcsh
+.TP 8
+.B cdpath
+A list of directories in which
+.Va cd
+should search for
+subdirectories if they aren't found in the current directory.
+.TP 8
+.B cdtohome \fR(+)
+If not set,
+.Va cd
+requires a directory
+.Va name
+, and will not go to the
+.Va home
+directory if it's omitted.
+This is set by default.
+.TP 8
+.B color
+If set, it enables color display for the builtin \fBls\-F\fR and it passes
+.Fl \-color=auto\fR to
+.Va ls
+Alternatively, it can be set to only
+\fBls\-F\fR or only
+.Va ls
+to enable color to only one command.
+Setting
+it to nothing is equivalent to setting it to \fB(ls\-F ls)\fR.
+.TP 8
+.B colorcat
+If set, it enables color escape sequence for NLS message files.
+And display colorful NLS messages.
+.TP 8
+.B command \fR(+)
+If set, the command which was passed to the shell with the
+.Va -c
+flag (q.v.).
+.TP 8
+.B compat_expr \fR(+)
+If set, the shell will evaluate expressions right to left, like the original
+.Xr csh 1
+.TP 8
+.B complete \fR(+)
+If set to
+.Sq igncase
+, the completion becomes case insensitive.
+If set to
+.Sq enhance
+, completion ignores case and considers
+hyphens and underscores to be equivalent; it will also treat
+periods, hyphens and underscores (`.',
+.Sq \-
+and
+.Sq _
+) as word
+separators.
+If set to
+.Sq Enhance
+, completion matches uppercase and underscore
+characters explicitly and matches lowercase and hyphens in a
+case-insensitive manner; it will treat periods, hyphens and underscores
+as word separators.
+.TP 8
+.B continue \fR(+)
+If set to a list of commands, the shell will continue the listed
+commands, instead of starting a new one.
+.TP 8
+.B continue_args \fR(+)
+Same as continue, but the shell will execute:
+.RS +8
+.IP "" 4
+echo \`pwd\` $argv > ~/.<cmd>_pause; %<cmd>
+.RE
+.TP 8
+.B correct \fR(+)
+If set to
+.Sq cmd
+, commands are automatically spelling-corrected.
+If set to
+.Sq complete
+, commands are automatically completed.
+If set to
+.Sq all
+, the entire command line is corrected.
+.TP 8
+.B csubstnonl \fR(+)
+If set, newlines and carriage returns in command substitution are
+replaced by spaces.
+Set by default.
+.TP 8
+.B cwd
+The full pathname of the current directory.
+See also the
+.Va dirstack
+and
+.Va owd
+shell variables.
+.TP 8
+.B dextract \fR(+)
+If set,
+.Sq pushd +
+.Va n
+extracts the
+.Va n
+th directory from the directory
+stack rather than rotating it to the top.
+.TP 8
+.B dirsfile \fR(+)
+The default location in which
+.Sq dirs \-S
+and
+.Sq dirs \-L
+look for
+a history file.
+If unset,
+.Va ~/.cshdirs
+is used.
+Because only
+.Va ~/.tcshrc
+is normally sourced before
+.Va ~/.cshdirs
+,
+.Va dirsfile
+should be set in
+.Va ~/.tcshrc
+rather than
+.Va ~/.login
+.TP 8
+.B dirstack \fR(+)
+An array of all the directories on the directory stack.
+`$dirstack[1]' is the current working directory,
+.Sq $dirstack[2]
+the first directory on the stack, etc.
+Note that the current working directory is
+.Sq $dirstack[1]
+but
+.Sq =0
+in
+directory stack substitutions, etc.
+One can change the stack arbitrarily by setting
+.Va dirstack
+,
+but the first element (the current working directory) is always correct.
+See also the
+.Va cwd
+and
+.Va owd
+shell variables.
+.TP 8
+.B dspmbyte \fR(+)
+Has an effect iff 'dspm' is listed as part of the
+.Va version
+shell variable.
+If set to
+.Sq euc
+, it enables display and editing EUC-kanji(Japanese) code.
+If set to
+.Sq sjis
+, it enables display and editing Shift-JIS(Japanese) code.
+If set to
+.Sq big5
+, it enables display and editing Big5(Chinese) code.
+If set to
+.Sq utf8
+, it enables display and editing Utf8(Unicode) code.
+If set to the following format, it enables display and editing of original
+multi-byte code format:
+.RS +8
+.IP "" 4
+> set dspmbyte = 0000....(256 bytes)....0000
+.Pp
+The table requires
+.Va just
+256 bytes.
+Each character of 256 characters
+corresponds (from left to right) to the ASCII codes 0x00, 0x01, ... 0xff.
+Each
+character
+.\" (position in this table?)
+is set to number 0,1,2 and 3.
+Each number has the following meaning:
+.br
+0 ... not used for multi-byte characters.
+.br
+1 ... used for the first byte of a multi-byte character.
+.br
+2 ... used for the second byte of a multi-byte character.
+.br
+3 ... used for both the first byte and second byte of a multi-byte character.
+.\" SHK: I tried my best to get the following to be grammatically correct.
+.\" However, I still don't understand what's going on here.
+In the
+.\" following example, there are three bytes, but the text seems to refer to
+.\" each nybble as a character.
+What's going on here?  It this 3-byte code
+.\" in the table?  The text above seems to imply that there are 256
+.\" characters/bytes in the table.
+If I get some more info on this (perhaps
+.\" a complete example), I could fix the text to be grammatically correct.
+.\" (steve.kelem at xilinx.com 1999/09/13)
+.Pp
+Example:
+.br
+If set to
+.Sq 001322
+, the first character (means 0x00 of the ASCII code) and
+second character (means 0x01 of ASCII code) are set to
+.Sq 0
+Then, it is not
+used for multi-byte characters.
+The 3rd character (0x02) is set to '1',
+indicating that it is used for the first byte of a multi-byte character.
+The 4th character(0x03) is set '3'.
+It is used for both the first byte and
+the second byte of a multi-byte character.
+The 5th and 6th characters
+(0x04,0x05) are set to '2', indicating that they are used for the second
+byte of a multi-byte character.
+.Pp
+The GNU fileutils version of ls cannot display multi-byte
+filenames without the -N ( --literal ) option.
+If you are using
+this version, set the second word of dspmbyte to "ls".
+If not, for
+example, "ls-F -l" cannot display multi-byte filenames.
+.Pp
+Note:
+.br
+This variable can only be used if KANJI and DSPMBYTE has been defined at
+compile time.
+.RE
+.TP 8
+.B dunique \fR(+)
+If set,
+.Va pushd
+removes any instances of
+.Va name
+from the stack before pushing it onto the stack.
+.TP 8
+.B echo
+If set, each command with its arguments is echoed just before it is
+executed.
+For non-builtin commands all expansions occur before
+echoing.
+Builtin commands are echoed before command and filename
+substitution, because these substitutions are then done selectively.
+Set by the
+.Fl x\fR command line option.
+.TP 8
+.B echo_style \fR(+)
+The style of the
+.Va echo
+builtin.
+May be set to
+.Pp
+.RS +8
+.PD 0
+.TP 8
+bsd
+Don't echo a newline if the first argument is
+.Sq \-n ;
+the default for
+.Xr csh 1
+.TP 8
+sysv
+Recognize backslashed escape sequences in echo strings.
+.TP 8
+both
+Recognize both the
+.Sq \-n
+flag and backslashed escape sequences; the default
+for
+.Nm
+.TP 8
+none
+Recognize neither.
+.PD
+.Pp
+Set by default to the local system default.
+The BSD and System V
+options are described in the
+.Va echo
+(1) man pages on the appropriate
+systems.
+.RE
+.TP 8
+.B edit \fR(+)
+If set, the command-line editor is used.
+Set by default in interactive
+shells.
+.TP 8
+.B editors \fR(+)
+A list of command names for the
+.Va run-fg-editor
+editor command to match.
+If not set, the
+.Va EDITOR
+(`ed' if unset) and
+.Va VISUAL
+(`vi' if unset)
+environment variables will be used instead.
+.TP 8
+.B ellipsis \fR(+)
+If set, the
+.Sq %c
+/`%.' and
+.Sq %C
+prompt sequences (see the
+.Va prompt
+shell variable) indicate skipped directories with an ellipsis (`...')
+instead of
+.Sq /<skipped>
+.TP 8
+.B euid \fR(+)
+The user's effective user ID.
+.TP 8
+.B euser \fR(+)
+The first matching passwd entry name corresponding to the effective user ID.
+.TP 8
+.B fignore \fR(+)
+Lists file name suffixes to be ignored by completion.
+.TP 8
+.B filec
+In
+.Nm
+, completion is always used and this variable is ignored
+by default. If
+.B edit
+is unset, then the traditional
+.Xr csh 1
+completion is used.
+If set in
+.Xr csh 1
+, filename completion is used.
+.TP 8
+.B gid \fR(+)
+The user's real group ID.
+.TP 8
+.B globdot \fR(+)
+If set, wild-card glob patterns will match files and directories beginning
+with
+.Sq .
+except for
+.Sq .
+and
+.Sq ..
+.TP 8
+.B globstar \fR(+)
+If set, the
+.Sq **
+and
+.Sq ***
+file glob patterns will match any string of
+characters including
+.Sq /
+traversing any existing sub-directories.
+(e.g.
+`ls **.c' will list all the .c files in the current directory tree).
+If used by itself, it will match zero or more sub-directories
+(e.g.
+.Sq ls /usr/include/**/time.h
+will list any file named
+.Sq time.h
+in the /usr/include directory tree; whereas
+.Sq ls /usr/include/**time.h
+will match any file in the /usr/include directory tree ending in
+.Sq time.h
+).
+To prevent problems with recursion, the
+.Sq **
+glob-pattern will not
+descend into a symbolic link containing a directory.
+To override this,
+use
+.Sq ***
+.TP 8
+.B group \fR(+)
+The user's group name.
+.TP 8
+.B highlight
+If set, the incremental search match (in
+.Va i-search-back
+and
+.Va i-search-fwd
+) and the region between the mark and the cursor are
+highlighted in reverse video.
+.IP "" 8
+Highlighting requires more frequent terminal writes, which introduces extra
+overhead. If you care about terminal performance, you may want to leave this
+unset.
+.TP 8
+.B histchars
+A string value determining the characters used in \fBHistory
+substitution\fR (q.v.).
+The first character of its value is used as
+the history substitution character, replacing the default character
+`!'.
+The second character of its value replaces the character
+.Sq ^
+in
+quick substitutions.
+.TP 8
+.B histdup \fR(+)
+Controls handling of duplicate entries in the history list.
+If set to
+`all' only unique history events are entered in the history list.
+If
+set to
+.Sq prev
+and the last history event is the same as the current
+command, then the current command is not entered in the history.
+If
+set to
+.Sq erase
+and the same event is found in the history list, that
+old event gets erased and the current one gets inserted.
+Note that the
+`prev' and
+.Sq all
+options renumber history events so there are no gaps.
+.TP 8
+.B histfile \fR(+)
+The default location in which
+.Sq history \-S
+and
+.Sq history \-L
+look for
+a history file.
+If unset,
+.Va ~/.history
+is used.
+.Va histfile
+is
+useful when sharing the same home directory between different machines,
+or when saving separate histories on different terminals.
+Because only
+.Va ~/.tcshrc
+is normally sourced before
+.Va ~/.history
+,
+.Va histfile
+should be set in
+.Va ~/.tcshrc
+rather than
+.Va ~/.login
+.TP 8
+.B histlit \fR(+)
+If set, builtin and editor commands and the
+.Va savehist
+mechanism
+use the literal (unexpanded) form of lines in the history list.
+See
+also the
+.Va toggle-literal-history
+editor command.
+.TP 8
+.B history
+The first word indicates the number of history events to save.
+The
+optional second word (+) indicates the format in which history is
+printed; if not given,
+.Sq %h\et%T\et%R\en
+is used.
+The format sequences
+are described below under
+.Va prompt
+; note the variable meaning of
+`%R'.
+Set to
+.Sq 100
+by default.
+.TP 8
+.B home
+Initialized to the home directory of the invoker.
+The filename
+expansion of
+.Sq
+.Va ~
+refers to this variable.
+.TP 8
+.B ignoreeof
+If set to the empty string or
+.Sq 0
+and the input device is a terminal,
+the
+.Va end-of-file
+command (usually generated by the user by typing
+`^D' on an empty line) causes the shell to print `Use "exit" to leave
+tcsh.' instead of exiting.
+This prevents the shell from accidentally
+being killed.
+Historically this setting exited after 26 successive
+EOF's to avoid infinite loops.
+If set to a number
+.Va n
+, the shell
+ignores
+.Va n - 1
+consecutive
+.Va end-of-file
+s and exits on the
+.Va n
+th.
+(+) If unset,
+.Sq 1
+is used, i.e., the shell exits on a
+single
+.Sq ^D
+.TP 8
+.B implicitcd \fR(+)
+If set, the shell treats a directory name typed as a command as though
+it were a request to change to that directory.
+If set to
+.Va verbose
+,
+the change of directory is echoed to the standard output.
+This behavior
+is inhibited in non-interactive shell scripts, or for command strings
+with more than one word.
+Changing directory takes precedence over
+executing a like-named command, but it is done after alias
+substitutions.
+Tilde and variable expansions work as expected.
+.TP 8
+.B inputmode \fR(+)
+If set to
+.Sq insert
+or
+.Sq overwrite
+, puts the editor into that input mode
+at the beginning of each line.
+.TP 8
+.B killdup \fR(+)
+Controls handling of duplicate entries in the kill ring.
+If set to
+`all' only unique strings are entered in the kill ring.
+If set to
+`prev' and the last killed string is the same as the current killed
+string, then the current string is not entered in the ring.
+If set
+to
+.Sq erase
+and the same string is found in the kill ring, the old
+string is erased and the current one is inserted.
+.TP 8
+.B killring \fR(+)
+Indicates the number of killed strings to keep in memory.
+Set to
+.Sq 30
+by default.
+If unset or set to less than
+.Sq 2
+, the shell will only
+keep the most recently killed string.
+Strings are put in the killring by the editor commands that delete
+(kill) strings of text, e.g.
+.Va backward-delete-word
+,
+.Va kill-line
+, etc, as well as the
+.Va copy-region-as-kill
+command.
+The
+.Va yank
+editor command will yank the most recently killed string
+into the command-line, while
+.Va yank-pop
+(see
+.Va Editor commands
+)
+can be used to yank earlier killed strings.
+.TP 8
+.B listflags \fR(+)
+If set to
+.Sq x
+,
+.Sq a
+or
+.Sq A
+, or any combination thereof (e.g.,
+.Sq xA
+), they
+are used as flags to \fIls\-F\fR, making it act like
+.Sq ls \-xF
+, `ls
+\-Fa',
+.Sq ls \-FA
+or a combination (e.g.,
+.Sq ls \-FxA
+):
+.Sq a
+shows all
+files (even if they start with a
+.Sq .
+),
+.Sq A
+shows all files but
+.Sq .
+and
+`..', and
+.Sq x
+sorts across instead of down.
+If the second word of
+.Va listflags
+is set, it is used as the path to
+.Sq ls(1)
+.TP 8
+.B listjobs \fR(+)
+If set, all jobs are listed when a job is suspended.
+If set to
+.Sq long
+,
+the listing is in long format.
+.TP 8
+.B listlinks \fR(+)
+If set, the \fIls\-F\fR builtin command shows the type of file to which
+each symbolic link points.
+.TP 8
+.B listmax \fR(+)
+The maximum number of items which the
+.Va list-choices
+editor command
+will list without asking first.
+.TP 8
+.B listmaxrows \fR(+)
+The maximum number of rows of items which the
+.Va list-choices
+editor
+command will list without asking first.
+.TP 8
+.B loginsh \fR(+)
+Set by the shell if it is a login shell.
+Setting or unsetting it
+within a shell has no effect.
+See also
+.Va shlvl
+.TP 8
+.B logout \fR(+)
+Set by the shell to
+.Sq normal
+before a normal logout,
+.Sq automatic
+before
+an automatic logout, and
+.Sq hangup
+if the shell was killed by a hangup
+signal (see
+.Va Signal handling
+).
+See also the
+.Va autologout
+shell variable.
+.TP 8
+.B mail
+A list of files and directories to check for incoming mail, optionally
+preceded by a numeric word.
+Before each prompt, if 10 minutes have
+passed since the last check, the shell checks each file and says `You
+have new mail.' (or, if
+.Va mail
+contains multiple files, `You have
+new mail in
+.Va name
+.') if the filesize is greater than zero in size
+and has a modification time greater than its access time.
+.Pp
+.RS +8
+.PD
+.Pp
+If you are in a login shell, then no mail file is reported unless it has
+been modified after the time the shell has started up, to prevent
+redundant notifications.
+Most login programs will tell you whether or not
+you have mail when you log in.
+.Pp
+If a file specified in
+.Va mail
+is a directory, the shell will count each
+file within that directory as a separate message, and will report `You have
+.Va n
+mails.' or
+.Sq You have
+.Va n
+mails in
+.Va name
+as appropriate.
+This functionality is provided primarily for those systems which store mail
+in this manner, such as the Andrew Mail System.
+.Pp
+If the first word of
+.Va mail
+is numeric it is taken as a different mail
+checking interval, in seconds.
+.Pp
+Under very rare circumstances, the shell may report
+.Sq You have mail.
+instead
+of
+.Sq You have new mail.
+.RE
+.TP 8
+.B matchbeep \fR(+)
+If set to
+.Sq never
+, completion never beeps.
+If set to
+.Sq nomatch
+, it beeps only when there is no match.
+If set to
+.Sq ambiguous
+, it beeps when there are multiple matches.
+If set to
+.Sq notunique
+, it beeps when there is one exact and other longer matches.
+If unset,
+.Sq ambiguous
+is used.
+.TP 8
+.B nobeep \fR(+)
+If set, beeping is completely disabled.
+See also
+.Va visiblebell
+.TP 8
+.B noclobber
+If set, restrictions are placed on output redirection to insure that files
+are not accidentally destroyed and that
+.Sq >>
+redirections refer to existing
+files, as described in the
+.Va Input/output
+section.
+.TP 8
+.B noding
+If set, disable the printing of
+.Sq DING!
+in the
+.Va prompt
+time
+specifiers at the change of hour.
+.TP 8
+.B noglob
+If set,
+.Va Filename substitution
+and
+.Va Directory stack substitution
+(q.v.) are inhibited.
+This is most useful in shell scripts which do not deal
+with filenames, or after a list of filenames has been obtained and further
+expansions are not desirable.
+.TP 8
+.B nokanji \fR(+)
+If set and the shell supports Kanji (see the
+.Va version
+shell variable),
+it is disabled so that the meta key can be used.
+.TP 8
+.B nonomatch
+If set, a
+.Va Filename substitution
+or
+.Va Directory stack substitution
+(q.v.) which does not match any
+existing files is left untouched rather than causing an error.
+It is still an error for the substitution to be
+malformed, e.g.,
+.Sq echo [
+still gives an error.
+.TP 8
+.B nostat \fR(+)
+A list of directories (or glob-patterns which match directories; see
+.Va Filename substitution
+) that should not be
+.Va stat
+(2)ed during a
+completion operation.
+This is usually used to exclude directories which
+take too much time to
+.Va stat
+(2), for example
+.Va /afs
+.TP 8
+.B notify
+If set, the shell announces job completions asynchronously.
+The default is to present job completions just before printing a prompt.
+.TP 8
+.B oid \fR(+)
+The user's real organization ID.
+(Domain/OS only)
+.TP 8
+.B owd \fR(+)
+The old working directory, equivalent to the
+.Sq \-
+used by
+.Va cd
+and
+.Va pushd
+See also the
+.Va cwd
+and
+.Va dirstack
+shell variables.
+.TP 8
+.B padhour
+If set, enable the printing of padding '0' for hours, in 24 and 12 hour
+formats.
+E.G.: 07:45:42 vs. 7:45:42.
+.TP 8
+.B parseoctal
+To retain compatibily with older versions numeric variables starting with
+0 are not interpreted as octal. Setting this variable enables proper octal
+parsing.
+.TP 8
+.B path
+A list of directories in which to look for executable commands.
+A null word specifies the current directory.
+If there is no
+.Va path
+variable then only full path names will execute.
+.Va path
+is set by the shell at startup from the
+.Va PATH
+environment
+variable or, if
+.Va PATH
+does not exist, to a system-dependent default
+something like
+.Sq (/usr/local/bin /usr/bsd /bin /usr/bin .)
+The shell may put
+.Sq .
+first or last in
+.Va path
+or omit it entirely
+depending on how it was compiled; see the
+.Va version
+shell variable.
+A shell which is given neither the
+.Fl c\fR nor the
+.Fl t\fR option
+hashes the contents of the directories in
+.Va path
+after
+reading
+.Va ~/.tcshrc
+and each time
+.Va path
+is reset.
+If one adds a new command to a directory in
+.Va path
+while the shell
+is active, one may need to do a
+.Va rehash
+for the shell to find it.
+.TP 8
+.B printexitvalue \fR(+)
+If set and an interactive program exits with a non-zero status, the shell
+prints
+.Sq Exit
+.Va status
+.TP 8
+.B prompt
+The string which is printed before reading each command from the terminal.
+.Va prompt
+may include any of the following formatting sequences (+), which
+are replaced by the given information:
+.Pp
+.RS +8
+.PD 0
+.TP 4
+%/
+The current working directory.
+.TP 4
+%~
+The current working directory, but with one's home directory
+represented by
+.Sq ~
+and other users' home directories represented by
+`~user' as per
+.Va Filename substitution
+`~user' substitution
+happens only if the shell has already used
+.Sq ~
+.Va user
+in a pathname
+in the current session.
+.TP 4
+%c[[0]
+.Va n
+], %.[[0]
+.Va n
+]
+The trailing component of the current working directory, or
+.Va n
+trailing components if a digit
+.Va n
+is given.
+If
+.Va n
+begins with
+.Sq 0
+, the number of skipped components precede
+the trailing component(s) in the format
+.Sq /<
+.Va skipped
+>trailing
+If the
+.Va ellipsis
+shell variable is set, skipped components
+are represented by an ellipsis so the whole becomes
+.Sq ...trailing
+`~' substitution is done as in
+.Sq %~
+above, but the
+.Sq ~
+component
+is ignored when counting trailing components.
+.TP 4
+%C
+Like %c, but without
+.Sq ~
+substitution.
+.TP 4
+%h, %!, !
+The current history event number.
+.TP 4
+%M
+The full hostname.
+.TP 4
+%m
+The hostname up to the first
+.Sq .
+.TP 4
+%S (%s)
+Start (stop) standout mode.
+.TP 4
+%B (%b)
+Start (stop) boldfacing mode.
+.TP 4
+%U (%u)
+Start (stop) underline mode.
+.TP 4
+%t, %@
+The time of day in 12-hour AM/PM format.
+.TP 4
+%T
+Like
+.Sq %t
+, but in 24-hour format (but see the
+.Va ampm
+shell variable).
+.TP 4
+%p
+The
+.Sq precise
+time of day in 12-hour AM/PM format, with seconds.
+.TP 4
+%P
+Like
+.Sq %p
+, but in 24-hour format (but see the
+.Va ampm
+shell variable).
+.TP 4
+\e
+.Va c
+.Va c
+is parsed as in
+.Va bindkey
+.TP 4
+^
+.Va c
+.Va c
+is parsed as in
+.Va bindkey
+.TP 4
+%%
+A single
+.Sq %
+.TP 4
+%n
+The user name.
+.TP 4
+%N
+The effective user name.
+.TP 4
+%j
+The number of jobs.
+.TP 4
+%d
+The weekday in
+.Sq Day
+format.
+.TP 4
+%D
+The day in
+.Sq dd
+format.
+.TP 4
+%w
+The month in
+.Sq Mon
+format.
+.TP 4
+%W
+The month in
+.Sq mm
+format.
+.TP 4
+%y
+The year in
+.Sq yy
+format.
+.TP 4
+%Y
+The year in
+.Sq yyyy
+format.
+.TP 4
+%l
+The shell's tty.
+.TP 4
+%L
+Clears from the end of the prompt to end of the display or the end of the line.
+.TP 4
+%$
+Expands the shell or environment variable name immediately after the
+.Sq $
+.TP 4
+%#
+`>' (or the first character of the
+.Va promptchars
+shell variable)
+for normal users,
+.Sq #
+(or the second character of
+.Va promptchars
+)
+for the superuser.
+.TP 4
+%{
+.Va string
+%}
+Includes
+.Va string
+as a literal escape sequence.
+It should be used only to change terminal attributes and
+should not move the cursor location.
+This
+cannot be the last sequence in
+.Va prompt
+.TP 4
+%?
+The return code of the command executed just before the prompt.
+.TP 4
+%R
+In
+.Va prompt2
+, the status of the parser.
+In
+.Va prompt3
+, the corrected string.
+In
+.Va history
+, the history string.
+.PD
+.Pp
+`%B',
+.Sq %S
+,
+.Sq %U
+and
+.Sq %{
+.Va string
+%}
+are available in only
+eight-bit-clean shells; see the
+.Va version
+shell variable.
+.Pp
+The bold, standout and underline sequences are often used to distinguish a
+superuser shell.
+For example,
+.IP "" 4
+> set prompt = "%m [%h] %B[%@]%b [%/] you rang? "
+.br
+tut [37]
+.Va [2:54pm]
+[/usr/accts/sys] you rang? _
+.Pp
+If
+.Sq %t
+,
+.Sq %@
+,
+.Sq %T
+,
+.Sq %p
+, or
+.Sq %P
+is used, and
+.Va noding
+is not set,
+then print
+.Sq DING!
+on the change of hour (i.e,
+.Sq \&:00
+minutes) instead of
+the actual time.
+.Pp
+Set by default to
+.Sq %#
+in interactive shells.
+.RE
+.TP 8
+.B prompt2 \fR(+)
+The string with which to prompt in
+.Va while
+and
+.Va foreach
+loops and
+after lines ending in
+.Sq \e
+The same format sequences may be used as in
+.Va prompt
+(q.v.);
+note the variable meaning of
+.Sq %R
+Set by default to
+.Sq %R?
+in interactive shells.
+.TP 8
+.B prompt3 \fR(+)
+The string with which to prompt when confirming automatic spelling correction.
+The same format sequences may be used as in
+.Va prompt
+(q.v.);
+note the variable meaning of
+.Sq %R
+Set by default to
+.Sq CORRECT>%R (y|n|e|a)?
+in interactive shells.
+.TP 8
+.B promptchars \fR(+)
+If set (to a two-character string), the
+.Sq %#
+formatting sequence in the
+.Va prompt
+shell variable is replaced with the first character for
+normal users and the second character for the superuser.
+.TP 8
+.B pushdtohome \fR(+)
+If set,
+.Va pushd
+without arguments does
+.Sq pushd ~
+, like
+.Va cd
+.TP 8
+.B pushdsilent \fR(+)
+If set,
+.Va pushd
+and
+.Va popd
+do not print the directory stack.
+.TP 8
+.B recexact \fR(+)
+If set, completion completes on an exact match even if a longer match is
+possible.
+.TP 8
+.B recognize_only_executables \fR(+)
+If set, command listing displays only files in the path that are
+executable.
+Slow.
+.TP 8
+.B rmstar \fR(+)
+If set, the user is prompted before
+.Sq rm *
+is executed.
+.TP 8
+.B rprompt \fR(+)
+The string to print on the right-hand side of the screen (after
+the command input) when the prompt is being displayed on the left.
+It recognizes the same formatting characters as
+.Va prompt
+It will automatically disappear and reappear as necessary, to ensure that
+command input isn't obscured, and will appear only if the prompt,
+command input, and itself will fit together on the first line.
+If
+.Va edit
+isn't set, then
+.Va rprompt
+will be printed after
+the prompt and before the command input.
+.TP 8
+.B savedirs \fR(+)
+If set, the shell does
+.Sq dirs \-S
+before exiting.
+If the first word is set to a number, at most that many directory stack
+entries are saved.
+.TP 8
+.B savehist
+If set, the shell does
+.Sq history \-S
+before exiting.
+If the first word is set to a number, at most that many lines are saved.
+(The number should be less than or equal to the number
+.Va history
+entries;
+if it is set to greater than the number of
+.Va history
+settings, only
+.Va history
+entries will be saved)
+If the second word is set to
+.Sq merge
+, the history list is merged with
+the existing history file instead of replacing it (if there is one) and
+sorted by time stamp and the most recent events are retained.
+If the second word of
+.Va savehist
+is
+.Sq merge
+and the third word is set to
+`lock', the history file update will be serialized with other shell sessions
+that would possibly like to merge history at exactly the same time. (+)
+.TP 8
+.B sched \fR(+)
+The format in which the
+.Va sched
+builtin command prints scheduled events;
+if not given,
+.Sq %h\et%T\et%R\en
+is used.
+The format sequences are described above under
+.Va prompt
+;
+note the variable meaning of
+.Sq %R
+.TP 8
+.B shell
+The file in which the shell resides.
+This is used in forking
+shells to interpret files which have execute bits set, but
+which are not executable by the system.
+(See the description
+of
+.Va Builtin and non-builtin command execution
+.)  Initialized to the
+(system-dependent) home of the shell.
+.TP 8
+.B shlvl \fR(+)
+The number of nested shells.
+Reset to 1 in login shells.
+See also
+.Va loginsh
+.TP 8
+.B status
+The exit status from the last command or backquote expansion, or any
+command in a pipeline is propagated to
+.Va status
+(This is also the
+default
+.Xr csh 1
+behavior.)
+This default does not match what POSIX mandates (to return the
+status of the last command only). To match the POSIX behavior, you need
+to unset
+.Va anyerror
+.RS +8
+.Pp
+If the
+.Va anyerror
+variable is unset, the exit status of a pipeline
+is determined only from the last command in the pipeline, and the exit
+status of a backquote expansion is
+.Va not
+propagated to
+.Va status
+.Pp
+If a command terminated abnormally, then 0200 is added to the status.
+Builtin commands which fail return exit status
+.Sq 1
+, all other builtin
+commands return status
+.Sq 0
+.RE
+.TP 8
+.B symlinks \fR(+)
+Can be set to several different values to control symbolic link (`symlink')
+resolution:
+.RS +8
+.Pp
+If set to
+.Sq chase
+, whenever the current directory changes to a directory
+containing a symbolic link, it is expanded to the real name of the directory
+to which the link points.
+This does not work for the user's home directory;
+this is a bug.
+.Pp
+If set to
+.Sq ignore
+, the shell tries to construct a current directory
+relative to the current directory before the link was crossed.
+This means that
+.Va cd
+ing through a symbolic link and then
+.Sq cd ..
+ing
+returns one to the original directory.
+This affects only builtin commands
+and filename completion.
+.Pp
+If set to
+.Sq expand
+, the shell tries to fix symbolic links by actually expanding
+arguments which look like path names.
+This affects any command, not just
+builtins.
+Unfortunately, this does not work for hard-to-recognize filenames,
+such as those embedded in command options.
+Expansion may be prevented by
+quoting.
+While this setting is usually the most convenient, it is sometimes
+misleading and sometimes confusing when it fails to recognize an argument
+which should be expanded.
+A compromise is to use
+.Sq ignore
+and use the
+editor command
+.Va normalize-path
+(bound by default to ^X-n) when necessary.
+.Pp
+Some examples are in order.
+First, let's set up some play directories:
+.IP "" 4
+> cd /tmp
+.br
+> mkdir from from/src to
+.br
+> ln \-s from/src to/dst
+.Pp
+Here's the behavior with
+.Va symlinks
+unset,
+.IP "" 4
+> cd /tmp/to/dst; echo $cwd
+.br
+/tmp/to/dst
+.br
+> cd ..; echo $cwd
+.br
+/tmp/from
+.Pp
+here's the behavior with
+.Va symlinks
+set to
+.Sq chase
+,
+.IP "" 4
+> cd /tmp/to/dst; echo $cwd
+.br
+/tmp/from/src
+.br
+> cd ..; echo $cwd
+.br
+/tmp/from
+.Pp
+here's the behavior with
+.Va symlinks
+set to
+.Sq ignore
+,
+.IP "" 4
+> cd /tmp/to/dst; echo $cwd
+.br
+/tmp/to/dst
+.br
+> cd ..; echo $cwd
+.br
+/tmp/to
+.Pp
+and here's the behavior with
+.Va symlinks
+set to
+.Sq expand
+.IP "" 4
+> cd /tmp/to/dst; echo $cwd
+.br
+/tmp/to/dst
+.br
+> cd ..; echo $cwd
+.br
+/tmp/to
+.br
+> cd /tmp/to/dst; echo $cwd
+.br
+/tmp/to/dst
+.br
+> cd ".."; echo $cwd
+.br
+/tmp/from
+.br
+> /bin/echo ..
+.br
+/tmp/to
+.br
+> /bin/echo ".."
+.br
+\&..
+.Pp
+Note that
+.Sq expand
+expansion 1) works just like
+.Sq ignore
+for builtins
+like
+.Va cd
+, 2) is prevented by quoting, and 3) happens before
+filenames are passed to non-builtin commands.
+.RE
+.TP 8
+.B tcsh \fR(+)
+The version number of the shell in the format
+.Sq R.VV.Pp
+,
+where
+.Sq R
+is the major release number,
+.Sq VV
+the current version
+and
+.Sq PP
+the patchlevel.
+.TP 8
+.B term
+The terminal type.
+Usually set in
+.Va ~/.login
+as described under
+.Va Startup and shutdown
+.TP 8
+.B time
+If set to a number, then the
+.Va time
+builtin (q.v.) executes automatically
+after each command which takes more than that many CPU seconds.
+If there is a second word, it is used as a format string for the output
+of the
+.Va time
+builtin.
+(u) The following sequences may be used in the
+format string:
+.Pp
+.RS +8
+.PD 0
+.TP 4
+%U
+The time the process spent in user mode in cpu seconds.
+.TP 4
+%S
+The time the process spent in kernel mode in cpu seconds.
+.TP 4
+%E
+The elapsed (wall clock) time in seconds.
+.TP 4
+%P
+The CPU percentage computed as (%U + %S) / %E.
+.TP 4
+%W
+Number of times the process was swapped.
+.TP 4
+%X
+The average amount in (shared) text space used in Kbytes.
+.TP 4
+%D
+The average amount in (unshared) data/stack space used in Kbytes.
+.TP 4
+%K
+The total space used (%X + %D) in Kbytes.
+.TP 4
+%M
+The maximum memory the process had in use at any time in Kbytes.
+.TP 4
+%F
+The number of major page faults (page needed to be brought from disk).
+.TP 4
+%R
+The number of minor page faults.
+.TP 4
+%I
+The number of input operations.
+.TP 4
+%O
+The number of output operations.
+.TP 4
+%r
+The number of socket messages received.
+.TP 4
+%s
+The number of socket messages sent.
+.TP 4
+%k
+The number of signals received.
+.TP 4
+%w
+The number of voluntary context switches (waits).
+.TP 4
+%c
+The number of involuntary context switches.
+.PD
+.Pp
+Only the first four sequences are supported on systems without BSD resource
+limit functions.
+The default time format is
+.Sq %Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww
+for
+systems that support resource usage reporting and
+.Sq %Uu %Ss %E %P
+for
+systems that do not.
+.Pp
+Under Sequent's DYNIX/ptx, %X, %D, %K, %r and %s are not
+available, but the following additional sequences are:
+.Pp
+.PD 0
+.TP 4
+%Y
+The number of system calls performed.
+.TP 4
+%Z
+The number of pages which are zero-filled on demand.
+.TP 4
+%i
+The number of times a process's resident set size was increased by the kernel.
+.TP 4
+%d
+The number of times a process's resident set size was decreased by the kernel.
+.TP 4
+%l
+The number of read system calls performed.
+.TP 4
+%m
+The number of write system calls performed.
+.TP 4
+%p
+The number of reads from raw disk devices.
+.TP 4
+%q
+The number of writes to raw disk devices.
+.PD
+.Pp
+and the default time format is
+.Sq %Uu %Ss %E %P %I+%Oio %Fpf+%Ww
+Note that the CPU percentage can be higher than 100% on multi-processors.
+.RE
+.TP 8
+.B tperiod \fR(+)
+The period, in minutes, between executions of the
+.Va periodic
+special alias.
+.TP 8
+.B tty \fR(+)
+The name of the tty, or empty if not attached to one.
+.TP 8
+.B uid \fR(+)
+The user's real user ID.
+.TP 8
+.B user
+The user's login name.
+.TP 8
+.B verbose
+If set, causes the words of each
+command to be printed, after history substitution (if any).
+Set by the
+.Fl v\fR command line option.
+.TP 8
+.B version \fR(+)
+The version ID stamp.
+It contains the shell's version number (see
+.Va tcsh
+),
+origin, release date, vendor, operating system and machine (see
+.Va VENDOR
+,
+.Va OSTYPE
+and
+.Va MACHTYPE
+) and a comma-separated
+list of options which were set at compile time.
+Options which are set by default in the distribution are noted.
+.Pp
+.RS +8
+.PD 0
+.TP 6
+8b
+The shell is eight bit clean; default
+.TP 6
+7b
+The shell is not eight bit clean
+.TP 6
+wide
+The shell is multibyte encoding clean (like UTF-8)
+.TP 6
+nls
+The system's NLS is used; default for systems with NLS
+.TP 6
+lf
+Login shells execute
+.Va /etc/csh.login
+before instead of after
+.Va /etc/csh.cshrc
+and
+.Va ~/.login
+before instead of after
+.Va ~/.tcshrc
+and
+.Va ~/.history
+.TP 6
+dl
+`.' is put last in
+.Va path
+for security; default
+.TP 6
+nd
+`.' is omitted from
+.Va path
+for security
+.TP 6
+vi
+.Va vi
+(1)\-style editing is the default rather than
+.Va emacs
+(1)\-style
+.TP 6
+dtr
+Login shells drop DTR when exiting
+.TP 6
+bye
+.Va bye
+is a synonym for
+.Va logout
+and
+.Va log
+is an alternate name for
+.Va watchlog
+.TP 6
+al
+.Va autologout
+is enabled; default
+.TP 6
+kan
+Kanji is used if appropriate according to locale settings,
+unless the
+.Va nokanji
+shell variable is set
+.TP 6
+sm
+The system's
+.Va malloc
+(3) is used
+.TP 6
+hb
+The
+.Sq #!<program> <args>
+convention is emulated when executing shell scripts
+.TP 6
+ng
+The
+.Va newgrp
+builtin is available
+.TP 6
+rh
+The shell attempts to set the
+.Va REMOTEHOST
+environment variable
+.TP 6
+afs
+The shell verifies your password with the kerberos server if local
+authentication fails.
+The
+.Va afsuser
+shell variable or the
+.Va AFSUSER
+environment variable override your local username if set.
+.PD
+.Pp
+An administrator may enter additional strings to indicate differences
+in the local version.
+.RE
+.TP 8
+.B vimode \fR(+)
+.RS +8
+If unset, various key bindings change behavior to be more
+.Va emacs
+(1)\-style:
+word boundaries are determined by
+.Va wordchars
+versus other characters.
+.Pp
+If set, various key bindings change behavior to be more
+.Va vi
+(1)\-style:
+word boundaries are determined by
+.Va wordchars
+versus whitespace
+versus other characters;
+cursor behavior depends upon current vi mode (command, delete, insert, replace).
+.Pp
+This variable is unset by
+.Va bindkey
+
+.Va -e
+and
+set by
+.Va bindkey
+
+.Va -v
+.B vimode
+may be explicitly set or unset by the user after those
+.Va bindkey
+operations if required.
+.RE
+.TP 8
+.B visiblebell \fR(+)
+If set, a screen flash is used rather than the audible bell.
+See also
+.Va nobeep
+.TP 8
+.B watch \fR(+)
+A list of user/terminal pairs to watch for logins and logouts.
+If either the user is
+.Sq any
+all terminals are watched for the given user
+and vice versa.
+Setting
+.Va watch
+to
+.Sq (any any)
+watches all users and terminals.
+For example,
+.RS +8
+.IP "" 4
+set watch = (george ttyd1 any console $user any)
+.Pp
+reports activity of the user
+.Sq george
+on ttyd1, any user on the console, and
+oneself (or a trespasser) on any terminal.
+.Pp
+Logins and logouts are checked every 10 minutes by default, but the first
+word of
+.Va watch
+can be set to a number to check every so many minutes.
+For example,
+.IP "" 4
+set watch = (1 any any)
+.Pp
+reports any login/logout once every minute.
+For the impatient, the
+.Va log
+builtin command triggers a
+.Va watch
+report at any time.
+All current logins
+are reported (as with the
+.Va log
+builtin) when
+.Va watch
+is first set.
+.Pp
+The
+.Va who
+shell variable controls the format of
+.Va watch
+reports.
+.RE
+.TP 8
+.B who \fR(+)
+The format string for
+.Va watch
+messages.
+The following sequences
+are replaced by the given information:
+.Pp
+.RS +8
+.PD 0
+.TP 4
+%n
+The name of the user who logged in/out.
+.TP 4
+%a
+The observed action, i.e.,
+.Sq logged on
+,
+.Sq logged off
+or
+.Sq replaced
+.Va olduser
+on
+.TP 4
+%l
+The terminal (tty) on which the user logged in/out.
+.TP 4
+%M
+The full hostname of the remote host, or
+.Sq local
+if the login/logout was
+from the local host.
+.TP 4
+%m
+The hostname of the remote host up to the first
+.Sq .
+The full name is printed if it is an IP address or an X Window System display.
+.PD
+.Pp
+%M and %m are available on only systems that store the remote hostname in
+.Va /etc/utmp
+If unset,
+.Sq %n has %a %l from %m.
+is used, or
+.Sq %n has %a %l.
+on systems
+which don't store the remote hostname.
+.RE
+.TP 8
+.B wordchars \fR(+)
+A list of non-alphanumeric characters to be considered part of a word by the
+.Va forward-word
+,
+.Va backward-word
+etc., editor commands.
+If unset, the default value is determined based on the state of
+.Va vimode
+:
+if
+.Va vimode
+is unset,
+.Sq *?_\-.[]~=
+is used as the default;
+if
+.Va vimode
+is set,
+.Sq _
+is used as the default.
+.Sh ENVIRONMENT
+.TP 8
+.B AFSUSER \fR(+)
+Equivalent to the
+.Va afsuser
+shell variable.
+.TP 8
+.B COLUMNS
+The number of columns in the terminal.
+See
+.Va Terminal management
+.TP 8
+.B DISPLAY
+Used by X Window System (see
+.Va X
+(1)).
+If set, the shell does not set
+.Va autologout
+(q.v.).
+.TP 8
+.B EDITOR
+The pathname to a default editor.
+Used by the
+.Va run-fg-editor
+editor command if the
+the
+.Va editors
+shell variable is unset.
+See also the
+.Va VISUAL
+environment variable.
+.TP 8
+.B GROUP \fR(+)
+Equivalent to the
+.Va group
+shell variable.
+.TP 8
+.B HOME
+Equivalent to the
+.Va home
+shell variable.
+.TP 8
+.B HOST \fR(+)
+Initialized to the name of the machine on which the shell
+is running, as determined by the
+.Va gethostname
+(2) system call.
+.TP 8
+.B HOSTTYPE \fR(+)
+Initialized to the type of machine on which the shell
+is running, as determined at compile time.
+This variable is obsolete and
+will be removed in a future version.
+.TP 8
+.B HPATH \fR(+)
+A colon-separated list of directories in which the
+.Va run-help
+editor
+command looks for command documentation.
+.TP 8
+.B LANG
+Gives the preferred character environment.
+See
+.Va Native Language System support
+.TP 8
+.B LC_CTYPE
+If set, only ctype character handling is changed.
+See
+.Va Native Language System support
+.TP 8
+.B LINES
+The number of lines in the terminal.
+See
+.Va Terminal management
+.TP 8
+.B LS_COLORS
+The format of this variable is reminiscent of the
+.Va termcap(5)
+file format; a colon-separated list of expressions of the form
+"
+.Va xx=string
+", where "
+.Va xx
+" is a two-character variable name.
+The
+variables with their associated defaults are:
+.Pp
+.RS +8
+.RS +4
+.PD 0
+.TP 12
+no	0
+Normal (non-filename) text
+.TP 12
+fi	0
+Regular file
+.TP 12
+di	01;34
+Directory
+.TP 12
+ln	01;36
+Symbolic link
+.TP 12
+pi	33
+Named pipe (FIFO)
+.TP 12
+so	01;35
+Socket
+.TP 12
+do	01;35
+Door
+.TP 12
+bd	01;33
+Block device
+.TP 12
+cd	01;32
+Character device
+.TP 12
+ex	01;32
+Executable file
+.TP 12
+mi	(none)
+Missing file (defaults to fi)
+.TP 12
+or	(none)
+Orphaned symbolic link (defaults to ln)
+.TP 12
+lc	^[[
+Left code
+.TP 12
+rc	m
+Right code
+.TP 12
+ec	(none)
+End code (replaces lc+no+rc)
+.PD
+.RE
+.Pp
+You need to include only the variables you want to change from
+the default.
+.Pp
+File names can also be colorized based on filename extension.
+This is specified in the
+.Va LS_COLORS
+variable using the syntax
+.Va "*ext=string"
+For example, using ISO 6429 codes, to color
+all C\-language source files blue you would specify
+.Va "*.c=34"
+This would color all files ending in
+.Va .c
+in blue (34) color.
+.Pp
+Control characters can be written either in C\-style\-escaped
+notation, or in stty\-like ^\-notation.
+The C\-style notation
+adds
+.Va ^[
+for Escape, \fB\_\fR for a normal space character,
+and
+.Va ?
+for Delete.
+In addition, the
+.Va ^[
+escape character
+can be used to override the default interpretation of
+.Va ^[
+,
+.Va ^
+,
+.Va :
+and
+.Va =
+.Pp
+Each file will be written as
+.Va <lc>
+
+.Va <color-code>
+.Va <rc>
+
+.Va <filename>
+
+.Va <ec>
+If the
+.Va <ec>
+code is undefined, the sequence
+.Va <lc>
+\fB<no>
+.Va <rc>
+will be used instead.
+This is generally more convenient
+to use, but less general.
+The left, right and end codes are
+provided so you don't have to type common parts over and over
+again and to support weird terminals; you will generally not
+need to change them at all unless your terminal does not use
+ISO 6429 color sequences but a different system.
+.Pp
+If your terminal does use ISO 6429 color codes, you can
+compose the type codes (i.e., all except the
+.Va lc
+,
+.Va rc
+,
+and
+.Va ec
+codes) from numerical commands separated by semicolons.
+The
+most common commands are:
+.Pp
+.RS +8
+.PD 0
+.TP 4
+0
+to restore default color
+.TP 4
+1
+for brighter colors
+.TP 4
+4
+for underlined text
+.TP 4
+5
+for flashing text
+.TP 4
+30
+for black foreground
+.TP 4
+31
+for red foreground
+.TP 4
+32
+for green foreground
+.TP 4
+33
+for yellow (or brown) foreground
+.TP 4
+34
+for blue foreground
+.TP 4
+35
+for purple foreground
+.TP 4
+36
+for cyan foreground
+.TP 4
+37
+for white (or gray) foreground
+.TP 4
+40
+for black background
+.TP 4
+41
+for red background
+.TP 4
+42
+for green background
+.TP 4
+43
+for yellow (or brown) background
+.TP 4
+44
+for blue background
+.TP 4
+45
+for purple background
+.TP 4
+46
+for cyan background
+.TP 4
+47
+for white (or gray) background
+.PD
+.RE
+.Pp
+Not all commands will work on all systems or display devices.
+.Pp
+A few terminal programs do not recognize the default end code
+properly.
+If all text gets colorized after you do a directory
+listing, try changing the
+.Va no
+and
+.Va fi
+codes from 0 to the
+numerical codes for your standard fore- and background colors.
+.RE
+.TP 8
+.B MACHTYPE \fR(+)
+The machine type (microprocessor class or machine model), as determined at compile time.
+.TP 8
+.B NOREBIND \fR(+)
+If set, printable characters are not rebound to
+.Va self-insert-command
+See
+.Va Native Language System support
+.TP 8
+.B OSTYPE \fR(+)
+The operating system, as determined at compile time.
+.TP 8
+.B PATH
+A colon-separated list of directories in which to look for executables.
+Equivalent to the
+.Va path
+shell variable, but in a different format.
+.TP 8
+.B PWD \fR(+)
+Equivalent to the
+.Va cwd
+shell variable, but not synchronized to it;
+updated only after an actual directory change.
+.TP 8
+.B REMOTEHOST \fR(+)
+The host from which the user has logged in remotely, if this is the case and
+the shell is able to determine it.
+Set only if the shell was so compiled;
+see the
+.Va version
+shell variable.
+.TP 8
+.B SHLVL \fR(+)
+Equivalent to the
+.Va shlvl
+shell variable.
+.TP 8
+.B SYSTYPE \fR(+)
+The current system type.
+(Domain/OS only)
+.TP 8
+.B TERM
+Equivalent to the
+.Va term
+shell variable.
+.TP 8
+.B TERMCAP
+The terminal capability string.
+See
+.Va Terminal management
+.TP 8
+.B USER
+Equivalent to the
+.Va user
+shell variable.
+.TP 8
+.B VENDOR \fR(+)
+The vendor, as determined at compile time.
+.TP 8
+.B VISUAL
+The pathname to a default full-screen editor.
+Used by the
+.Va run-fg-editor
+editor command if the
+the
+.Va editors
+shell variable is unset.
+See also the
+.Va EDITOR
+environment variable.
+.Sh FILES
+.PD 0
+.TP 16
+.I /etc/csh.cshrc
+Read first by every shell.
+ConvexOS, Stellix and Intel use
+.Va /etc/cshrc
+and
+NeXTs use
+.Va /etc/cshrc.std
+A/UX, AMIX, Cray and IRIX have no equivalent in
+.Xr csh 1
+,
+but read this file in
+.Nm
+anyway.
+Solaris 2.x does not have it either, but
+.Nm
+reads
+.Va /etc/.cshrc
+(+)
+.TP 16
+.I /etc/csh.login
+Read by login shells after
+.Va /etc/csh.cshrc
+ConvexOS, Stellix and Intel use
+.Va /etc/login
+,
+NeXTs use
+.Va /etc/login.std
+, Solaris 2.x uses
+.Va /etc/.login
+and
+A/UX, AMIX, Cray and IRIX use
+.Va /etc/cshrc
+.TP 16
+.I ~/.tcshrc \fR(+)
+Read by every shell after
+.Va /etc/csh.cshrc
+or its equivalent.
+.TP 16
+.I ~/.cshrc
+Read by every shell, if
+.Va ~/.tcshrc
+doesn't exist,
+after
+.Va /etc/csh.cshrc
+or its equivalent.
+This manual uses
+.Sq
+.Va ~/.tcshrc
+to mean `
+.Va ~/.tcshrc
+or,
+if
+.Va ~/.tcshrc
+is not found,
+.Va ~/.cshrc
+'.
+.TP 16
+.I ~/.history
+Read by login shells after
+.Va ~/.tcshrc
+if
+.Va savehist
+is set, but see also
+.Va histfile
+.TP 16
+.I ~/.login
+Read by login shells after
+.Va ~/.tcshrc
+or
+.Va ~/.history
+The shell may be compiled to read
+.Va ~/.login
+before instead of after
+.Va ~/.tcshrc
+and
+.Va ~/.history
+; see the
+.Va version
+shell variable.
+.TP 16
+.I ~/.cshdirs \fR(+)
+Read by login shells after
+.Va ~/.login
+if
+.Va savedirs
+is set, but see also
+.Va dirsfile
+.TP 16
+.I /etc/csh.logout
+Read by login shells at logout.
+ConvexOS, Stellix and Intel use
+.Va /etc/logout
+and
+NeXTs use
+.Va /etc/logout.std
+A/UX, AMIX, Cray and IRIX have no equivalent in
+.Xr csh 1
+,
+but read this file in
+.Nm
+anyway.
+Solaris 2.x does not have it either, but
+.Nm
+reads
+.Va /etc/.logout
+(+)
+.TP 16
+.I ~/.logout
+Read by login shells at logout after
+.Va /etc/csh.logout
+or its equivalent.
+.TP 16
+.I /bin/sh
+Used to interpret shell scripts not starting with a
+.Sq #
+.TP 16
+.I /tmp/sh*
+Temporary file for
+.Sq <<
+.TP 16
+.I /etc/passwd
+Source of home directories for
+.Sq ~name
+substitutions.
+.PD
+.Pp
+The order in which startup files are read may differ if the shell was so
+compiled; see
+.Va Startup and shutdown
+and the
+.Va version
+shell variable.
+.Sh "NEW FEATURES (+)"
+This manual describes
+.Nm
+as a single entity,
+but experienced
+.Xr csh 1
+users will want to pay special attention to
+.Nm
+'s new features.
+.Pp
+A command-line editor, which supports
+.Va emacs
+(1)\-style
+or
+.Va vi
+(1)\-style key bindings.
+See
+.Va The command-line editor
+and
+.Va Editor commands
+.Pp
+Programmable, interactive word completion and listing.
+See
+.Sx Completion and listing
+and the
+.Va complete
+and
+.Va uncomplete
+builtin commands.
+.Pp
+.Va Spelling correction
+(q.v.) of filenames, commands and variables.
+.Pp
+.Va Editor commands
+(q.v.) which perform other useful functions in the middle of
+typed commands, including documentation lookup
+.Va ( run-help ),
+quick editor restarting
+.Va ( run-fg-editor )
+and
+command resolution
+.Va ( which-command ).
+.Pp
+An enhanced history mechanism.
+Events in the history list are time-stamped.
+See also the
+.Va history
+command and its associated shell variables,
+the previously undocumented
+.Sq #
+event specifier and new modifiers
+under
+.Va History substitution
+,
+the
+.Va *-history
+,
+.Va history-search-*
+,
+.Va i-search-*
+,
+.Va vi-search-*
+and
+.Va toggle-literal-history
+editor commands
+and the
+.Va histlit
+shell variable.
+.Pp
+Enhanced directory parsing and directory stack handling.
+See the
+.Va cd
+,
+.Va pushd
+,
+.Va popd
+and
+.Va dirs
+commands and their associated
+shell variables, the description of
+.Va Directory stack substitution
+,
+the
+.Va dirstack
+,
+.Va owd
+and
+.Va symlinks
+shell variables and
+the
+.Va normalize-command
+and
+.Va normalize-path
+editor commands.
+.Pp
+Negation in glob-patterns.
+See
+.Va Filename substitution
+.Pp
+New
+.Va File inquiry operators
+(q.v.) and a
+.Va filetest
+builtin which uses them.
+.Pp
+A variety of
+.Va Automatic, periodic and timed events
+(q.v.) including
+scheduled events, special aliases, automatic logout and terminal locking,
+command timing and watching for logins and logouts.
+.Pp
+Support for the Native Language System
+(see
+.Va Native Language System support
+),
+OS variant features
+(see
+.Va OS variant support
+and the
+.Va echo_style
+shell variable)
+and system-dependent file locations (see
+.Va FILES
+).
+.Pp
+Extensive terminal-management capabilities.
+See
+.Va Terminal management
+.Pp
+New builtin commands including
+.Va builtins
+,
+.Va hup
+, \fIls\-F\fR,
+.Va newgrp
+,
+.Va printenv
+,
+.Va which
+and
+.Va where
+(q.v.).
+.Pp
+New variables that make useful information easily available to the shell.
+See the
+.Va gid
+,
+.Va loginsh
+,
+.Va oid
+,
+.Va shlvl
+,
+.Va tcsh
+,
+.Va tty
+,
+.Va uid
+and
+.Va version
+shell variables and the
+.Va HOST
+,
+.Va REMOTEHOST
+,
+.Va VENDOR
+,
+.Va OSTYPE
+and
+.Va MACHTYPE
+environment
+variables.
+.Pp
+A new syntax for including useful information in the prompt string
+(see
+.Va prompt
+),
+and special prompts for loops and spelling correction
+(see
+.Va prompt2
+and
+.Va prompt3
+).
+.Pp
+Read-only variables.
+See
+.Va Variable substitution
+.Sh BUGS
+When a suspended command is restarted, the shell prints the directory
+it started in if this is different from the current directory.
+This can
+be misleading (i.e., wrong) as the job may have changed directories internally.
+.Pp
+Shell builtin functions are not stoppable/restartable.
+Command sequences
+of the form
+.Sq a ; b ; c
+are also not handled gracefully when stopping is
+attempted.
+If you suspend
+.Sq b
+, the shell will then immediately execute
+`c'.
+This is especially noticeable if this expansion results from an
+.Va alias
+It suffices to place the sequence of commands in ()'s to force it
+to a subshell, i.e.,
+.Sq ( a ; b ; c )
+.Pp
+Control over tty output after processes are started is primitive; perhaps
+this will inspire someone to work on a good virtual terminal interface.
+In a virtual terminal interface much more interesting things could be
+done with output control.
+.Pp
+Alias substitution is most often used to clumsily simulate shell procedures;
+shell procedures should be provided rather than aliases.
+.Pp
+Control structures should be parsed rather than being recognized as
+built-in commands.
+This would allow control commands to be placed anywhere,
+to be combined with
+.Sq |
+, and to be used with
+.Sq &
+and
+.Sq ;
+metasyntax.
+.Pp
+.Va foreach
+doesn't ignore here documents when looking for its
+.Va end
+.Pp
+It should be possible to use the
+.Sq \&:
+modifiers on the output of command
+substitutions.
+.Pp
+The screen update for lines longer than the screen width is very poor
+if the terminal cannot move the cursor up (i.e., terminal type
+.Sq dumb
+).
+.Pp
+.Va HPATH
+and
+.Va NOREBIND
+don't need to be environment variables.
+.Pp
+Glob-patterns which do not use
+.Sq \&?
+,
+.Sq *
+or
+.Sq []
+or which use
+.Sq {}
+or
+.Sq ~
+are not negated correctly.
+.Pp
+The single-command form of
+.Va if
+does output redirection even if
+the expression is false and the command is not executed.
+.Pp
+\fIls\-F\fR includes file identification characters when sorting filenames
+and does not handle control characters in filenames well.
+It cannot be
+interrupted.
+.Pp
+Command substitution supports multiple commands and conditions, but not
+cycles or backward
+.Va goto
+s.
+.Pp
+Report bugs at http://bugs.gw.com/, preferably with fixes.
+If you want to
+help maintain and test tcsh, send mail to tcsh-request at mx.gw.com with the
+text
+.Sq subscribe tcsh
+on a line by itself in the body.
+.Sh THE T IN TCSH
+In 1964, DEC produced the PDP-6.
+The PDP-10 was a later re-implementation.
+It
+was re-christened the DECsystem-10 in 1970 or so when DEC brought out the
+second model, the KI10.
+.Pp
+TENEX was created at Bolt, Beranek & Newman (a Cambridge, Massachusetts
+think tank) in
+1972 as an experiment in demand-paged virtual memory operating systems.
+They
+built a new pager for the DEC PDP-10 and created the OS to go with it.
+It was
+extremely successful in academia.
+.Pp
+In 1975, DEC brought out a new model of the PDP-10, the KL10; they intended to
+have only a version of TENEX, which they had licensed from BBN, for the new
+box.
+They called their version TOPS-20 (their capitalization is trademarked).
+A lot of TOPS-10 users (`The OPerating System for PDP-10') objected; thus DEC
+found themselves supporting two incompatible systems on the same hardware--but
+then there were 6 on the PDP-11!
+.Pp
+TENEX, and TOPS-20 to version 3, had command completion
+via a user-code-level subroutine library called ULTCMD.
+With version 3, DEC
+moved all that capability and more into the monitor (`kernel' for you Unix
+types), accessed by the COMND% JSYS (`Jump to SYStem' instruction, the
+supervisor call mechanism [are my IBM roots also showing?]).
+.Pp
+The creator of tcsh was impressed by this feature and several others of TENEX
+and TOPS-20, and created a version of csh which mimicked them.
+.Sh LIMITATIONS
+The system limits argument lists to ARG_MAX characters.
+.Pp
+The number of arguments to a command which involves filename expansion is
+limited to 1/6th the number of characters allowed in an argument list.
+.Pp
+Command substitutions may substitute no more characters than are allowed in
+an argument list.
+.Pp
+To detect looping, the shell restricts the number of
+.Va alias
+substitutions on a single line to 20.
+.Sh "SEE ALSO"
+csh(1), emacs(1), ls(1), newgrp(1), sh(1), setpath(1), stty(1), su(1),
+tset(1), vi(1), x(1), access(2), execve(2), fork(2), killpg(2),
+pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
+malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
+termio(7), Introduction to the C Shell
+.Sh VERSION
+This manual documents tcsh 6.20.00 (Astron) 2016-11-24.
+.Sh AUTHORS
+.PD 0
+.TP 2
+William Joy
+Original author of
+.Xr csh 1
+.TP 2
+J.E. Kulp, IIASA, Laxenburg, Austria
+Job control and directory stack features
+.TP 2
+Ken Greer, HP Labs, 1981
+File name completion
+.TP 2
+Mike Ellis, Fairchild, 1983
+Command name recognition/completion
+.TP 2
+Paul Placeway, Ohio State CIS Dept., 1983-1993
+Command line editor, prompt routines, new glob syntax and numerous fixes
+and speedups
+.TP 2
+Karl Kleinpaste, CCI 1983-4
+Special aliases, directory stack extraction stuff, login/logout watch,
+scheduled events, and the idea of the new prompt format
+.TP 2
+Rayan Zachariassen, University of Toronto, 1984
+\fIls\-F\fR and
+.Va which
+builtins and numerous bug fixes, modifications
+and speedups
+.TP 2
+Chris Kingsley, Caltech
+Fast storage allocator routines
+.TP 2
+Chris Grevstad, TRW, 1987
+Incorporated 4.3BSD
+.Xr csh 1
+into
+.Nm
+.TP 2
+Christos S. Zoulas, Cornell U. EE Dept., 1987-94
+Ports to HPUX, SVR2 and SVR3, a SysV version of getwd.c, SHORT_STRINGS support
+and a new version of sh.glob.c
+.TP 2
+James J Dempsey, BBN, and Paul Placeway, OSU, 1988
+A/UX port
+.TP 2
+Daniel Long, NNSC, 1988
+.Va wordchars
+.TP 2
+Patrick Wolfe, Kuck and Associates, Inc., 1988
+.Va vi
+mode cleanup
+.TP 2
+David C Lawrence, Rensselaer Polytechnic Institute, 1989
+.Va autolist
+and ambiguous completion listing
+.TP 2
+Alec Wolman, DEC, 1989
+Newlines in the prompt
+.TP 2
+Matt Landau, BBN, 1989
+.Va ~/.tcshrc
+.TP 2
+Ray Moody, Purdue Physics, 1989
+Magic space bar history expansion
+.TP 2
+Mordechai ????, Intel, 1989
+printprompt() fixes and additions
+.TP 2
+Kazuhiro Honda, Dept. of Computer Science, Keio University, 1989
+Automatic spelling correction and
+.Va prompt3
+.TP 2
+Per Hedeland, Ellemtel, Sweden, 1990-
+Various bugfixes, improvements and manual updates
+.TP 2
+Hans J. Albertsson (Sun Sweden)
+.Va ampm
+,
+.Va settc
+and
+.Va telltc
+.TP 2
+Michael Bloom
+Interrupt handling fixes
+.TP 2
+Michael Fine, Digital Equipment Corp
+Extended key support
+.TP 2
+Eric Schnoebelen, Convex, 1990
+Convex support, lots of
+.Xr csh 1
+bug fixes,
+save and restore of directory stack
+.TP 2
+Ron Flax, Apple, 1990
+A/UX 2.0 (re)port
+.TP 2
+Dan Oscarsson, LTH Sweden, 1990
+NLS support and simulated NLS support for non NLS sites, fixes
+.TP 2
+Johan Widen, SICS Sweden, 1990
+.Va shlvl
+, Mach support,
+.Va correct-line
+, 8-bit printing
+.TP 2
+Matt Day, Sanyo Icon, 1990
+POSIX termio support, SysV limit fixes
+.TP 2
+Jaap Vermeulen, Sequent, 1990-91
+Vi mode fixes, expand-line, window change fixes, Symmetry port
+.TP 2
+Martin Boyer, Institut de recherche d'Hydro-Quebec, 1991
+.Va autolist
+beeping options, modified the history search to search for
+the whole string from the beginning of the line to the cursor.
+.TP 2
+Scott Krotz, Motorola, 1991
+Minix port
+.TP 2
+David Dawes, Sydney U. Australia, Physics Dept., 1991
+SVR4 job control fixes
+.TP 2
+Jose Sousa, Interactive Systems Corp., 1991
+Extended
+.Va vi
+fixes and
+.Va vi
+delete command
+.TP 2
+Marc Horowitz, MIT, 1991
+ANSIfication fixes, new exec hashing code, imake fixes,
+.Va where
+.TP 2
+Bruce Sterling Woodcock, sterling at netcom.com, 1991-1995
+ETA and Pyramid port, Makefile and lint fixes,
+.Va ignoreeof
+=n addition, and
+various other portability changes and bug fixes
+.TP 2
+Jeff Fink, 1992
+.Va complete-word-fwd
+and
+.Va complete-word-back
+.TP 2
+Harry C. Pulley, 1992
+Coherent port
+.TP 2
+Andy Phillips, Mullard Space Science Lab U.K., 1992
+VMS-POSIX port
+.TP 2
+Beto Appleton, IBM Corp., 1992
+Walking process group fixes,
+.Xr csh 1
+bug fixes,
+POSIX file tests, POSIX SIGHUP
+.TP 2
+Scott Bolte, Cray Computer Corp., 1992
+CSOS port
+.TP 2
+Kaveh R. Ghazi, Rutgers University, 1992
+Tek, m88k, Titan and Masscomp ports and fixes.
+Added autoconf support.
+.TP 2
+Mark Linderman, Cornell University, 1992
+OS/2 port
+.TP 2
+Mika Liljeberg, liljeber at kruuna.Helsinki.FI, 1992
+Linux port
+.TP 2
+Tim P. Starrin, NASA Langley Research Center Operations, 1993
+Read-only variables
+.TP 2
+Dave Schweisguth, Yale University, 1993-4
+New man page and tcsh.man2html
+.TP 2
+Larry Schwimmer, Stanford University, 1993
+AFS and HESIOD patches
+.TP 2
+Luke Mewburn, RMIT University, 1994-6
+Enhanced directory printing in prompt,
+added
+.Va ellipsis
+and
+.Va rprompt
+.TP 2
+Edward Hutchins, Silicon Graphics Inc., 1996
+Added implicit cd.
+.TP 2
+Martin Kraemer, 1997
+Ported to Siemens Nixdorf EBCDIC machine
+.TP 2
+Amol Deshpande, Microsoft, 1997
+Ported to WIN32 (Windows/95 and Windows/NT); wrote all the missing library
+and message catalog code to interface to Windows.
+.TP 2
+Taga Nayuta, 1998
+Color ls additions.
+.PD
+.Pp
+.Sh "THANKS TO"
+Bryan Dunlap, Clayton Elwell, Karl Kleinpaste, Bob Manson, Steve Romig,
+Diana Smetters, Bob Sutterfield, Mark Verber, Elizabeth Zwicky and all
+the other people at Ohio State for suggestions and encouragement
+.Pp
+All the people on the net, for putting up with,
+reporting bugs in, and suggesting new additions to each and every version
+.Pp
+Richard M. Alderson III, for writing the
+.Sq T in tcsh
+section

Modified: vendor/tcsh/dist/tw.color.c
===================================================================
--- vendor/tcsh/dist/tw.color.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.color.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.color.c,v 1.1.1.5 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.color.c,v 1.33 2015/05/28 11:53:49 christos Exp $ */
 /*
  * tw.color.c: builtin color ls-F
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.color.c,v 1.27 2010/08/19 05:52:19 christos Exp $")
+RCSID("$tcsh: tw.color.c,v 1.33 2015/05/28 11:53:49 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -91,13 +91,66 @@
     VAR(NOS, "ca", "30;41"),    /* File with capability */
 };
 
+#define nvariables (sizeof(variables)/sizeof(variables[0]))
+
 enum FileType {
     VDir, VSym, VOrph, VPipe, VSock, VDoor, VBlock, VChr, VExe,
-    VFile, VNormal, VMiss, VLeft, VRight, VEnd
+    VFile, VNormal, VMiss, VLeft, VRight, VEnd, VSuid, VSgid, VSticky,
+    VOther, Vstird, VReset, Vhard, Vhard2, VCap
 };
 
-#define nvariables (sizeof(variables)/sizeof(variables[0]))
+/*
+ * Map from LSCOLORS entry index to Variable array index
+ */
+static const uint8_t map[] = {
+    VDir,	/* Directory */
+    VSym,	/* Symbolic Link */
+    VSock,	/* Socket */
+    VPipe,	/* Named Pipe */
+    VExe,	/* Executable */
+    VBlock,	/* Block Special */
+    VChr,	/* Character Special */
+    VSuid,	/* Setuid Executable */
+    VSgid,	/* Setgid Executable */
+    VSticky,	/* Directory writable to others and sticky */
+    VOther,	/* Directory writable to others but not sticky */
+};
 
+
+
+enum ansi {
+    ANSI_RESET_ON = 0,		/* reset colors/styles (white on black) */
+    ANSI_BOLD_ON = 1,		/* bold on */
+    ANSI_ITALICS_ON = 3,	/* italics on */
+    ANSI_UNDERLINE_ON = 4,	/* underline on */
+    ANSI_INVERSE_ON = 7,	/* inverse on */
+    ANSI_STRIKETHROUGH_ON = 9,	/* strikethrough on */
+    ANSI_BOLD_OFF = 21,		/* bold off */
+    ANSI_ITALICS_OFF = 23,	/* italics off */
+    ANSI_UNDERLINE_OFF = 24,	/* underline off */
+    ANSI_INVERSE_OFF = 27,	/* inverse off */
+    ANSI_STRIKETHROUGH_OFF = 29,/* strikethrough off */
+    ANSI_FG_BLACK = 30,		/* fg black */
+    ANSI_FG_RED = 31,		/* fg red */
+    ANSI_FG_GREEN = 32,		/* fg green */
+    ANSI_FG_YELLOW = 33,	/* fg yellow */
+    ANSI_FG_BLUE = 34,		/* fg blue */
+    ANSI_FG_MAGENTA = 35,	/* fg magenta */
+    ANSI_FG_CYAN = 36,		/* fg cyan */
+    ANSI_FG_WHITE = 37,		/* fg white */
+    ANSI_FG_DEFAULT = 39,	/* fg default (white) */
+    ANSI_BG_BLACK = 40,		/* bg black */
+    ANSI_BG_RED = 41,		/* bg red */
+    ANSI_BG_GREEN = 42,		/* bg green */
+    ANSI_BG_YELLOW = 43,	/* bg yellow */
+    ANSI_BG_BLUE = 44,		/* bg blue */
+    ANSI_BG_MAGENTA = 45,	/* bg magenta */
+    ANSI_BG_CYAN = 46,		/* bg cyan */
+    ANSI_BG_WHITE = 47,		/* bg white */
+    ANSI_BG_DEFAULT = 49,	/* bg default (black) */
+};
+#define TCSH_BOLD	0x80
+	
 typedef struct {
     Str	    extension;	/* file extension */
     Str	    color;	/* color string */
@@ -167,7 +220,102 @@
     return *s == (Char)f;
 }
 
+static void
+init(size_t colorlen, size_t extnum)
+{
+    size_t i;
 
+    xfree(extensions);
+    for (i = 0; i < nvariables; i++)
+	variables[i].color = variables[i].defaultcolor;
+    if (colorlen == 0 && extnum == 0) {
+	extensions = NULL;
+	colors = NULL;
+    } else {
+	extensions = xmalloc(colorlen + extnum * sizeof(*extensions));
+	colors = extnum * sizeof(*extensions) + (char *)extensions;
+    }
+    nextensions = 0;
+}
+
+static int
+color(Char x)
+{
+    static const char ccolors[] = "abcdefghx";
+    char *p;
+    if (Isupper(x)) {
+	x = Tolower(x);
+    }
+
+    if (x == '\0' || (p = strchr(ccolors, x)) == NULL)
+	return -1;
+    return 30 + (p - ccolors);
+}
+
+static void
+makecolor(char **c, int fg, int bg, Str *v)
+{
+    int l;
+    if (fg & 0x80)
+	l = xsnprintf(*c, 12, "%.2d;%.2d;%.2d;%.2d", ANSI_BOLD_ON,
+	    fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD, ANSI_BOLD_OFF);
+	l = xsnprintf(*c, 6, "%.2d;%.2d",
+	    fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD);
+
+    v->s = *c;
+    v->len = l;
+    *c += l + 1;
+}
+
+/* parseLSCOLORS():
+ * 	Parse the LSCOLORS environment variable
+ */
+static const Char *xv;	/* setjmp clobbering */
+void
+parseLSCOLORS(const Char *value)
+{
+    size_t i, len, clen;
+    jmp_buf_t osetexit;
+    size_t omark;
+    xv = value;
+
+    if (xv == NULL) {
+	init(0, 0);
+	return;
+    }
+
+    len = Strlen(xv);
+    len >>= 1;
+    clen = len * 12;	/* "??;??;??;??\0" */
+    init(clen, 0);
+
+    /* Prevent from crashing if unknown parameters are given. */
+    omark = cleanup_push_mark();
+    getexit(osetexit);
+
+    /* init pointers */
+
+    if (setexit() == 0) {
+	const Char *v = xv;
+	char *c = colors;
+
+	int fg, bg;
+	for (i = 0; i < len; i++) {
+	    fg = color(*v++);
+	    if (fg == -1)
+		stderror(ERR_BADCOLORVAR, v[-1], '?');
+
+	    bg = color(*v++);
+	    if (bg == -1)
+		stderror(ERR_BADCOLORVAR, '?', v[-1]);
+	    makecolor(&c, fg, bg, &variables[map[i]].color);
+	}
+
+    }
+    cleanup_pop_mark(omark);
+    resexit(osetexit);
+}
+
 /* parseLS_COLORS():
  *	Parse the LS_COLORS environment variable
  */
@@ -183,16 +331,11 @@
 
     (void) &e;
 
-    /* init */
-    xfree(extensions);
-    for (i = 0; i < nvariables; i++)
-	variables[i].color = variables[i].defaultcolor;
-    colors = NULL;
-    extensions = NULL;
-    nextensions = 0;
 
-    if (value == NULL)
+    if (value == NULL) {
+	init(0, 0);
 	return;
+    }
 
     len = Strlen(value);
     /* allocate memory */
@@ -200,14 +343,13 @@
     for (v = value; *v; v++)
 	if ((*v & CHAR) == ':')
 	    i++;
-    extensions = xmalloc(len + i * sizeof(Extension));
-    colors = i * sizeof(Extension) + (char *)extensions;
-    nextensions = 0;
 
+    init(len, i);
+
     /* init pointers */
     v = value;
     c = colors;
-    e = &extensions[0];
+    e = extensions;
 
     /* Prevent from crashing if unknown parameters are given. */
 
@@ -216,44 +358,44 @@
 
     if (setexit() == 0) {
 
-    /* parse */
-    while (*v) {
-	switch (*v & CHAR) {
-	case ':':
-	    v++;
-	    continue;
-
-	case '*':		/* :*ext=color: */
-	    v++;
-	    if (getstring(&c, &v, &e->extension, '=') &&
-		0 < e->extension.len) {
+	/* parse */
+	while (*v) {
+	    switch (*v & CHAR) {
+	    case ':':
 		v++;
-		getstring(&c, &v, &e->color, ':');
-		e++;
 		continue;
-	    }
-	    break;
 
-	default:		/* :vl=color: */
-	    if (v[0] && v[1] && (v[2] & CHAR) == '=') {
-		for (i = 0; i < nvariables; i++)
-		    if ((Char)variables[i].variable[0] == (v[0] & CHAR) &&
-			(Char)variables[i].variable[1] == (v[1] & CHAR))
-			break;
-		if (i < nvariables) {
-		    v += 3;
-		    getstring(&c, &v, &variables[i].color, ':');
+	    case '*':		/* :*ext=color: */
+		v++;
+		if (getstring(&c, &v, &e->extension, '=') &&
+		    0 < e->extension.len) {
+		    v++;
+		    getstring(&c, &v, &e->color, ':');
+		    e++;
 		    continue;
 		}
-		else
-		    stderror(ERR_BADCOLORVAR, v[0], v[1]);
+		break;
+
+	    default:		/* :vl=color: */
+		if (v[0] && v[1] && (v[2] & CHAR) == '=') {
+		    for (i = 0; i < nvariables; i++)
+			if ((Char)variables[i].variable[0] == (v[0] & CHAR) &&
+			    (Char)variables[i].variable[1] == (v[1] & CHAR))
+			    break;
+		    if (i < nvariables) {
+			v += 3;
+			getstring(&c, &v, &variables[i].color, ':');
+			continue;
+		    }
+		    else
+			stderror(ERR_BADCOLORVAR, v[0], v[1]);
+		}
+		break;
 	    }
-	    break;
+	    while (*v && (*v & CHAR) != ':')
+		v++;
 	}
-	while (*v && (*v & CHAR) != ':')
-	    v++;
     }
-    }
 
     cleanup_pop_mark(omark);
     resexit(osetexit);
@@ -264,15 +406,15 @@
 /* put_color():
  */
 static void
-put_color(const Str *color)
+put_color(const Str *colorp)
 {
     size_t  i;
-    const char	 *c = color->s;
+    const char	 *c = colorp->s;
     int	   original_output_raw = output_raw;
 
     output_raw = TRUE;
     cleanup_push(&original_output_raw, output_raw_restore);
-    for (i = color->len; 0 < i; i--)
+    for (i = colorp->len; 0 < i; i--)
 	xputchar(*c++);
     cleanup_until(&original_output_raw);
 }
@@ -286,12 +428,12 @@
     size_t  i;
     char   *filename = short2str(fname);
     char   *last = filename + len;
-    Str	   *color = &variables[VFile].color;
+    Str	   *colorp = &variables[VFile].color;
 
     switch (suffix) {
     case '>':			/* File is a symbolic link pointing to
 				 * a directory */
-	color = &variables[VDir].color;
+	colorp = &variables[VDir].color;
 	break;
     case '+':			/* File is a hidden directory [aix] or
 				 * context dependent [hpux] */
@@ -301,7 +443,7 @@
 	for (i = 0; i < nvariables; i++)
 	    if (variables[i].suffix != NOS &&
 		(Char)variables[i].suffix == suffix) {
-		color = &variables[i].color;
+		colorp = &variables[i].color;
 		break;
 	    }
 	if (i == nvariables) {
@@ -310,7 +452,7 @@
 		    && strncmp(last - extensions[i].extension.len,
 			       extensions[i].extension.s,
 			       extensions[i].extension.len) == 0) {
-		  color = &extensions[i].color;
+		  colorp = &extensions[i].color;
 		break;
 	    }
 	}
@@ -318,7 +460,7 @@
     }
 
     put_color(&variables[VLeft].color);
-    put_color(color);
+    put_color(colorp);
     put_color(&variables[VRight].color);
 }
 

Modified: vendor/tcsh/dist/tw.comp.c
===================================================================
--- vendor/tcsh/dist/tw.comp.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.comp.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.comp.c,v 1.1.1.4 2011-02-02 22:33:56 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.comp.c,v 1.45 2015/09/30 13:28:02 christos Exp $ */
 /*
  * tw.comp.c: File completion builtin
  */
@@ -32,7 +32,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.comp.c,v 1.42 2007/10/01 21:52:00 christos Exp $")
+RCSID("$tcsh: tw.comp.c,v 1.45 2015/09/30 13:28:02 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -46,7 +46,7 @@
 static Char 		 *tw_tok	(Char *);
 static int	 	  tw_pos	(Char *, int);
 static void	  	  tw_pr		(Char **);
-static int	  	  tw_match	(const Char *, const Char *);
+static int	  	  tw_match	(const Char *, const Char *, int);
 static void	 	  tw_prlist	(struct varent *);
 static const Char	 *tw_dollar	(const Char *,Char **, size_t, Char **,
 					 Char, const char *);
@@ -248,14 +248,15 @@
  *	in a prefix of the string.
  */
 static int
-tw_match(const Char *str, const Char *pat)
+tw_match(const Char *str, const Char *pat, int exact)
 {
     const Char *estr;
-    int rv = Gnmatch(str, pat, &estr);
+    int rv = exact ? Gmatch(estr = str, pat) : Gnmatch(str, pat, &estr);
 #ifdef TDEBUG
-    xprintf("Gnmatch(%s, ", short2str(str));
+    xprintf("G%smatch(%s, ", exact ? "" : "n", short2str(str));
     xprintf("%s, ", short2str(pat));
-    xprintf("%s) = %d [%d]\n", short2str(estr), rv, estr - str);
+    xprintf("%s) = %d [%" TCSH_PTRDIFF_T_FMT "d]\n", short2str(estr), rv,
+	estr - str);
 #endif /* TDEBUG */
     return (int) (rv ? estr - str : -1);
 }
@@ -525,6 +526,7 @@
 	     *pos = NULL;	/* scratch pointer 			*/
 	int   cmd, res;
         Char  sep;		/* the command and separator characters */
+	int   exact;
 
 	if (ptr[0] == '\0')
 	    continue;
@@ -599,6 +601,7 @@
 	}
 #endif /* TDEBUG */
 
+	exact = 0;
 	switch (cmd) {
 	case 'p':			/* positional completion */
 #ifdef TDEBUG
@@ -614,12 +617,14 @@
 
 	case 'N':			/* match with the next-next word */
 	case 'n':			/* match with the next word */
+	    exact = 1;
+	    /*FALLTHROUGH*/
 	case 'c':			/* match with the current word */
 	case 'C':
 #ifdef TDEBUG
 	    xprintf("%c: ", cmd);
 #endif /* TDEBUG */
-	    if ((n = tw_match(pos, ran)) < 0) {
+	    if ((n = tw_match(pos, ran, exact)) < 0) {
 		cleanup_until(ran);
 		continue;
 	    }

Modified: vendor/tcsh/dist/tw.decls.h
===================================================================
--- vendor/tcsh/dist/tw.decls.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.decls.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.decls.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.decls.h,v 3.23 2012/06/21 17:40:40 christos Exp $ */
 /*
  * tw.decls.h: Tenex external declarations
  */
@@ -125,6 +125,7 @@
 extern	 void		  set_color_context	(void);
 extern	 void		  print_with_color	(const Char *, size_t, Char);
 extern	 void		  parseLS_COLORS	(const Char *);
+extern	 void		  parseLSCOLORS		(const Char *);
 #endif /* COLOR_LS_F */
 
 #endif /* _h_tw_decls */

Modified: vendor/tcsh/dist/tw.h
===================================================================
--- vendor/tcsh/dist/tw.h	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.h	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.h,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.h,v 3.25 2006/01/12 18:15:25 christos Exp $ */
 /*
  * tw.h: TwENEX functions headers
  */

Modified: vendor/tcsh/dist/tw.help.c
===================================================================
--- vendor/tcsh/dist/tw.help.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.help.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.help.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.help.c,v 3.27 2006/08/24 20:56:31 christos Exp $ */
 /* tw.help.c: actually look up and print documentation on a file.
  *	      Look down the path for an appropriate file, then print it.
  *	      Note that the printing is NOT PAGED.  This is because the

Modified: vendor/tcsh/dist/tw.init.c
===================================================================
--- vendor/tcsh/dist/tw.init.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.init.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.init.c,v 1.1.1.4 2012-07-08 16:12:18 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.init.c,v 3.42 2011/04/17 14:49:30 christos Exp $ */
 /*
  * tw.init.c: Handle lists of things to complete
  */
@@ -125,9 +125,8 @@
 	sl->buff = xrealloc(sl->buff, sl->tbuff * sizeof(Char));
 	/* Re-thread the new pointer list, if changed */
 	if (ptr != NULL && ptr != sl->buff) {
-	    intptr_t offs = sl->buff - ptr;
 	    for (i = 0; i < sl->nlist; i++)
-		sl->list[i] += offs;
+		sl->list[i] = sl->buff + (sl->list[i] - ptr);
 	}
 	disabled_cleanup(&pintr_disabled);
     }

Modified: vendor/tcsh/dist/tw.parse.c
===================================================================
--- vendor/tcsh/dist/tw.parse.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.parse.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.parse.c,v 1.1.1.5 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.parse.c,v 3.139 2015/10/16 14:59:56 christos Exp $ */
 /*
  * tw.parse.c: Everyone has taken a shot in this futile effort to
  *	       lexically analyze a csh line... Well we cannot good
@@ -35,7 +35,7 @@
  */
 #include "sh.h"
 
-RCSID("$tcsh: tw.parse.c,v 3.133 2011/04/14 14:33:05 christos Exp $")
+RCSID("$tcsh: tw.parse.c,v 3.139 2015/10/16 14:59:56 christos Exp $")
 
 #include "tw.h"
 #include "ed.h"
@@ -618,7 +618,11 @@
 	    break;
 
 	wq = w & QUOTE;
-	w &= ~QUOTE;
+#if INVALID_BYTE != 0
+	/* add checking INVALID_BYTE for FIX UTF32 */
+	if ((w & INVALID_BYTE) != INVALID_BYTE)		/* w < INVALID_BYTE */
+#endif
+	    w &= ~QUOTE;
 
 	if (cmap(w, _ESC | _QF))
 	    wq = QUOTE;		/* quotes are always quoted */
@@ -1236,7 +1240,7 @@
 tw_suffix(int looking, struct Strbuf *word, const Char *exp_dir, Char *exp_name)
 {
     Char *ptr;
-    Char *dollar;
+    Char *dol;
     struct varent *vp;
 
     (void) strip(exp_name);
@@ -1258,8 +1262,8 @@
 	else if ((ptr = tgetenv(exp_name)) == NULL || *ptr == '\0')
 	    return ' ';
 
-	if ((dollar = Strrchr(word->s, '$')) != 0 && 
-	    dollar[1] == '{' && Strchr(dollar, '}') == NULL)
+	if ((dol = Strrchr(word->s, '$')) != 0 && 
+	    dol[1] == '{' && Strchr(dol, '}') == NULL)
 	  return '}';
 
 	return isadirectory(exp_dir, ptr) ? '/' : ' ';

Modified: vendor/tcsh/dist/tw.spell.c
===================================================================
--- vendor/tcsh/dist/tw.spell.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/tw.spell.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/tw.spell.c,v 1.1.1.3 2007-04-10 21:07:41 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/tw.spell.c,v 3.21 2006/03/02 18:46:45 christos Exp $ */
 /*
  * tw.spell.c: Spell check words
  */

Modified: vendor/tcsh/dist/vms.termcap.c
===================================================================
--- vendor/tcsh/dist/vms.termcap.c	2018-06-27 00:37:32 UTC (rev 11146)
+++ vendor/tcsh/dist/vms.termcap.c	2018-06-27 00:42:17 UTC (rev 11147)
@@ -1,4 +1,4 @@
-/* $Header: /home/cvs/src/contrib/tcsh/vms.termcap.c,v 1.1.1.4 2012-07-08 16:12:19 laffer1 Exp $ */
+/* $Header: /p/tcsh/cvsroot/tcsh/vms.termcap.c,v 1.12 2011/01/09 16:25:29 christos Exp $ */
 /*
  *	termcap.c	1.1	20/7/87		agc	Joypace Ltd
  *



More information about the Midnightbsd-cvs mailing list