Index: vendor/tcsh/6.21.00-83c5be0/Fixes =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Fixes (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Fixes (revision 353870) @@ -0,0 +1,2174 @@ + 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is + not a tty. + 4. Avoid infinite loops during history loads when merging, print a better + error for errors during history load. + 3. PR/88: Preserve empty arguments in :q + 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) + 1. PR/81: Fix range matching issue where we were comparing with the + range character instead of the start of range. [l-z]* would match foo + 12. V6.21.00 - 20190508 + 11. Abort history loading on words and lines too long + https://bugzilla.redhat.com/show_bug.cgi?id=1598502 + 10. PR/37: Introduce GetCmdChar() to avoid open coding array access. + 9. make closem() not close sockets so as not to affect nss_ldap. + tcsh never creates sockets so that's ok (Miloslav Trmac) + 8. PR/597: Make rmstar work with aliased rm + 7. convert match() from recursive to backtracking. + 6. Handle 8 bit characters in bindkey (Werner Fink) + 5. Look for tgetent in libtinfo as well (Werner Fink) + 4. Don't play pointer tricks that are undefined in modern c (Brooks Davis) + 3. Fix out of bounds read (Brooks Davis) + 2. Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar) + 1. PR/471: Delay arginp parsing + + 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 + 3. cleanup ifdefs in utmp code, and provide default array entries + 2. Ignore #machine entries in host.defs + 1. Detect missing ) in gethost.c (Corinna Vinschen) + +104. V6.18.00 - 20120114 +103. remove unused variables. +102. Make gethost use definitions for x __x__ and __x automatically. +101. More utmp fixes +100. V6.17.10 - 20120105 + 99. Add more FreeBSD/NetBSD machines + 98. Add portability wrapper for gencat + 97. Fix warning for write in SYSMALLOC systems. + 96. V6.17.09 - 20120102 + 95. revert gencat handling to pre-cygwin fixes (without the env settings) + 94. remove stray endutent() + 93. V6.17.08 - 20111230 + 92. Remove - from gencat + 91. Provide support for malloc_usable_size() so that linux works again + without SYSMALLOC + 90. Add support for FreeBSD's utmpx. + 89. V6.17.07 - 20111227 + 88. Fix debian bug #645238: tcsh segfaults when prompt includes %j and + there are more than 10 jobs. + 87. PR/155: Default $anyerror to set for backward compatibility + 86. PR/149: Don't print -1 in %j (Vojtech Vitek) + 85. handle -- on chdir commands as the end of options processing so that + they can process a directory like -x without resorting to ./-x + (Andrew Stevenson) + 84. Handle write(2) returning ENOENT from SoFS, thanks ++HAL (Robert Byrnes) + 83. PR/38: Null check for jobs (Kurt Miller) + 82. Fix spelling correction correcting ./foo -> ../foo2 (jean-luc leger) + 81. PR/120: string0 in filetest does not have enough space. + 80. V6.17.06 - 20110415 + 79. PR/110: Add $anyerror to select behavior. Default to the new one. + 78. Don't try to spell commands that are correct (Rouben Rostamian) + [./tcsh -f; set path=($path 2); mkdir foo2; cd foo2; touch foo; + chmod +x foo; set correct=cmd; ./foo -> ../foo] + 77. Don't push the syntax struct on the cleanup stack, because on foo;bar + if foo fails, we will free bar prematurely (Ben Miller) + 76. Avoid infinite loop while trying to print the pid of a dying process + to a closed file (Bob Arendt) + 75. Handle completion of ${ variables (Anthony Mallet) + 74. Add --disable-nls-catalogs (Corinna Vinschen) + 73. convert message catalogs to UTF-8 (Werner Fink) + 72. check that the NLS path works before setting $NLSPATH. + 71. use SYSMALLOC for GLIBC (Werner Fink) + 70. use mallinfo for SYSMALLOC (Corinna Vinschen) + 69. V6.17.05 - 20110201 + 68. Use mkstemp() if there for here docs (Werner Fink) + 67. Fix handling of errors and exit values in builtins (Werner Fink) + 66. Better pty name detection (Werner Fink) + 65. Enable NLS catalogs on Cygwin (Corinna Vinschen) + 64. NLSPATH handling fixes (Corinna Vinschen) + 63. Avoid infrequent exit when tcsh cd's into a non-existent directory + https://bugzilla.novell.com/show_bug.cgi?id=293395 (Werner Fink) + 62. Don't try to spell check full path binaries that are correct because + they can cause hangs when other nfs partitions are hung. (Werner Fink) + 61. Avoid nested interrupts when exiting causing history writing to fail + https://bugzilla.novell.com/show_bug.cgi?id=331627 (Werner Fink) + 60. Instead of giving an error or ignoring lines with missing eol at eof, + process them. + 59. Avoid leaking fd's in mail check (Werner Fink) + 58. Add cygwin_xcrypt() (Corinna Vinschen) + 57. Recognize i686 (Corinna Vinschen) + 56. Rename cygwin32 to cygwin and bring it up-to-date with modern cygwin + settings (Corinna Vinschen) + 55. Avoid double slashes in cdpath (Corinna Vinschen) + 54. V6.17.04 - 20110118 + 53. Revert PR/110, breaks the test suite. + 52. V6.17.03 - 20110117 + 51. PR/102: Complain on input files with missing trailing \n + 50. PR/104: If atime == mtime we don't have new mail. + 49. PR/113: Don't allow illegal variable names to be set. + 48. PR/112: don't set $REMOTEHOST on the local machine. + 47. PR/110: exit status of the pipeline should be the status of the last + command. + 46. Android support (Corinna Vinschen) + 45. Add AUTOSET_KANJI which works around the Shift-JIS encoding that + translates unshifted 7 bit ASCII (Werner Fink) + 44. Handle mb{r,}towc() returning 0 by setting the return value to NUL + (Jean-Luc Leger) + 43. PR/109: make wait interruptible (Vojtech Vitek) + 42. resource limit fixes: signed vs. unsigned, megabyte issue, doc issues + (Robert Byrnes) + 41. remove .bat and .cmd handling for executables on cygwin (Corinna Vinschen) + 40. Don't echo history while history -L or history -M + 39. Check for EOS before ** from Greg Dionne + 38. Don't fork in backeval from Bryan Mason + 37. Better globstar support from Greg Dionne + 36. Error out when processing the last incomplete line instead of silently + ignoring it (Anders Kaseorg) + 35. Fix SEGV from echo `` + 34. Better fixes for histchars and promptchars (nargs) + 33. Fix win32 issue calling fmalloc/ffree from non-thread-safe context. + (Fabio Fabbri) + 32. V6.17.02 - 20100512 + 31. PR/79: nargs: Better handling for promptchars. + 30. PR/97: Add parseoctal to retain compatibility with previous versions (Jim + Zajkowski) + 29. PR/84: Performance fixes for large history merges (add + hashtable (Ted Anderson) + 28. Revert previous #23; people should use $histlit if they want this + feature. + 27. Don't kill "hup" background jobs when a child of the shell exits. + From Debian. + 26. Ignore \r\n in the command line options for OS's that don't strip + these from #!; from Debian + 25. Fix enhanced missing patch (Greg Dionne) + 24. Callers of rt_mbtowc don't grok -2 as a return. Return -1 for now. + (Corinna Vinschen) + 23. Turn HistLit on while recording history to avoid \!\! losing its \. + From Debian + 22. set autoexpand; set histchars="";\n crash. From Debian + 21. V6.17.01 - 20100506 + 20. unset verbose while we are reading the history file to avoid echoing + to the terminal. (Jeffrey Bastian) + 19. globstar addition, Enhance addition, euid, euser, gid variables + (Greg Dionne) + 18. Make 'e' in vi mode work like 'b' - use wordchars (Alistair Crooks) + 17. Handle UTF-16 surrogates (Corinna Vinschen) + 16. Make tcsh work on systems where sizeof(wchar_t) == 2 (Corinna Vinschen) + 15. Better support for Solaris >= 2.9 (Thomas Uhle) + 14. Change internal expression calculations to long long so that we can + deal with > 32 bit time, inodes, uids, file sizes etc. + 13. Add new linux resource limits. + 12. Don't print 'Exit X' when printexitvalue is set in `` expressions + (Jeff Bastian) + 11. Add more LS_COLORS vars (M.H. Anderson) + 10. Reduce whitespace in Makefile (Don Estabrook) + 9. Manual page fixes (Alan R. S. Bueno) + 8. Remove history in loops bug from the documentation (Holger Weiss) + 7. Add autorehash (Holger Weiss) + 6. Add history.at (Ted Anderson) + 5. Better NLSPATH handling (Norm Jacobs) + 4. Fix hostname building from utmp (Cyrus Rahman) + 3. Handle pending signals before flush so that the the history file does + not get truncated. (Ted Anderson) + 2. Fix AsciiOnly setting that broke 8 bit input. (Juergen Keil) + 1. remember to closedir in mailchk (from Werner Fink, reported by + David Binderman) + + 21. V6.17.00 - 20090710 + 20. Fix dataroot autoconf issue. + 19. Fix directory stuff for unit tests. + 18. Fix small bug in history in loops. + 17. Provide newer config.{guess,sub} + 16. Fix gcc 4 warnings. + 15. Fix memory trashing bug introduced in 10. + 14. V6.16.01 - 20090624 + 13. add missing sigemptyset in goodbye() + 12. add rlimit swapsize from FreeBSD. + 11. restore behavior where a[n-] never prints an error. + 10. always save the whole command, not just the first 80 chars of it. + 9. fix short2str/short2qstr length adjustment in wide chars + (Vitezslav Crhonek) + 8. set histfile=/tmp/history.temp; set savehist=(100 merge); + alias precmd history -S. After that justpr is not restored and commands + don't execute. (Andriy Gapon) + 7. Fix "as" $ modifier from corrupting memory. + set t=demfonsftraftionf; echo $t:as/f// + 6. Make $% work with environment variable (Ron Johnston) + 5. Dragonfly script support (Matthias Schmidt, m65) + 4. Add autoexpand=onlyhistory (Don Estabrook, m66) + 3. Add history in loops (Laurence Darby, m48) + 2. Add missing colorls "rs" variable (Shlomi Fish, m70) + 1. Fix pts detection issue (Ruslan Ermilov) + + 33. V6.16.00 - 20080930 + 32. longjmp clobbered variable fixes. + 31. __GNX__ addition + 30. Windows fork fixes + 28. V6.15.02 - 20080830 + 27. Fix an eval free'ing botch (Per Hedeland) + 26. /bin/echo "`" coredumped because stderror() calls longjmp corrupting + the stack (Mark Davies). We should vet the code for all stderror() + calls that cleanup local stack variables. + 25. foo > ${undef} caused coredumps because of vfork() child corrupting + the state of the parent stack. + 24. $x[A-B] did not complain for A out of range. (Cai Xianchao) + 23. rename setp -> tcsh_setp to avoid conflict with mach (Javier Vasquez) + 22. Fix degree handling by defining __XPG4_CHAR_CLASS__ for solaris + (Mike Sullivan) + 21. Change 'od' to 'od -c' in tests so that they work on big endian machines. + (Martin Kraemer) + 20. Add environment variable COMMAND_LINE to be available in completions + (Marcin Konarski) + 19. V6.15.01 - 20070928 + 18. Evaluate expressions in the proper order (Li Zefan), controlled by + compat_expr. + 17. Don't need to flush() if we are silent. Prevents recursive error issue. + (joshua stein) + 16. Don't execute the jobcmd if the output is not a tty (Charles Ross) + 15. Quote the history in the examples (Johann 'Myrkraverk' Oskarsson) + 14. Mismatch clarification patch (Per Hedeland) + 13. Fix 'repeat n cmd &' abort() (Mike Sullivan) + 12. Fix octal parsing (Li Zefan) + 11. Fix pty detection for autologout setting (Kris Kennaway, Giorgos Keramidas) + 10. kill `foo` got stuck because sigchld was disabled too soon (Mark Peek) + 9. Avoid null pointer dereference in proc cwd (Kurt Miller) + 8. eval "foreach a b c" exits (Anthony Menasse) + 7. Quoting was broken in substitutions (Joe Wells) + 6. QNX patches via pkgsrc + 5. cd - twice from a directory that contained a glob pattern, + expands the glob twice (Mark Santcroos) + 4. MidnightBsd support (Lucas Holt) + 3. Fix history substitution core-dump with no history entries + 2. Merge two character tables that are the same (Martin Kraemer) + 1. On ancient 7 bit locales, punctuation characters are used to + denote special characters such as umlaut, adiaresis, etc. + These characters return true for isalpha/isalnum. Ignore them + because they break parsing (Martin Kraemer) + + 74. V6.15.00 - 20070303 + 73. fix extension eating windows code (christos) + 72. fix loop in %R history expansion (christos) + 71. sched +X source file disables interrupts (Mike Sullivan) + 70. One off copying macro buffers (Jean-Luc Leger) + 69. Avoid infinite loops in :ga modifiers when the LHS is a substring of the + RHS. + 68. Automatically disable WIDE_STRINGS with --disable-nls (Miloslav Trmac) + 67. V6.14.07 - 20060825 + 66. rename set to setv to avoid clashes (christos) + 65. Eliminate sighold/sigrelse (christos) + 64. Compilation cleanups. (Martin Kraemer) + 63. Don't rebuild needlessly when generated files are unchanged + (Martin Kraemer) + 62. Fix confusion between Char and eChar (Martin Kraemer) + 61. V6.14.06 - 20060824 + 60. set PROGRAM_ENVIRONMENT for OSD_POSIX (Martin Kraemer) + 59. EBCDIC patch (Martin Kraemer) + 58. Remove globbing support in history rearches (Ryan Barrett) + 57. Highlighting patch (Ryan Barrett) + 56. Mark-Cursor exchange emacs editing fix (Martin Kraemer) + 55. V6.14.05 - 20060304 + 54. don't limit termcap strings to 1K (Alan Ferrency) + 53. protect against null path. + 52. Be more conservative in wide_read PR#29 + 51. remove HAVE_STRCOLL; not needed anymore (Miloslav Trmac) + 50. remove imake support and make nls configurable by configure + (Miloslav Trmac) + 49. V6.14.04 - 20060214 + 48. Fixes build failure with !SHORT_STRINGS (Miloslav Trmac) + 47. Fixes constness warnings with !SHORT_STRINGS: short2str is "strip()", + which modifies its argument. Rather than verify this is safe in all + callers, I have added caching_strip() to mirror the behavior of other + modes. (Miloslav Trmac) + 46. Fixes some constness warnings with SHORT_STRINGS; this is orthogonal + to both build errors with SHORT_STRINGS in 6.14.03, and + short_strings.patch. (Miloslav Trmac) + 45. config-catalogs.patch: Autodetect catalog support (#14). (Miloslav Trmac) + 44. auth.patch: Handle false positives in getauthid() detection, + IIRC on FreeBSD. (Miloslav Trmac) + 43. crypt.patch: Autodetect whether is available. (Miloslav Trmac) + 42. sigint.patch: Block SIGINT while waiting on children. + This is necessary, but I'll still have to look on the older + releases to find out why it was not necessary before + ("before" = 6.13 on Linux). (Miloslav Trmac) + 41. config-package.patch: Readd package version to configure.in, + the testsuite uses it. + (TODO: a better integration with package.h) (Miloslav Trmac) + 40. item_len.patch: Truncate item.len when truncating the string, + just to be sure. (Miloslav Trmac) + 39. va_list.patch: Add missing va_end(). (Miloslav Trmac) + 38. Use va_copy in xvasprintf(); emulate va_copy as suggested in + Autoconf manual if it is not available. (Miloslav Trmac) + 37. declarations.patch: Replace some #ifdef nests by autodetecting + whether the guarded declaration is necessary. + I'm only guessing this is the intent of the #ifdefs, though. + Declare environ unconditionally, it is a bit hard to detect + and the declaration is correct for Linux, anyway. (Miloslav Trmac) + 36. warning.patch: Fix a const warning. + 35. More color-ls variables (Jean-Luc Leger) + 34. V6.14.03 - 20060212 + 33. Signal related changes (Miloslav Trmac) + 32. Misc cast cleanups and code clarification (Miloslav Trmac) + 31. Use dynamically allocated buffers everywhere (Miloslav Trmac) + 30. Fix reading of invalid byte sequences (Miloslav Trmac) + 29. read should only increment count when it succeeds (Miloslav Trmac) + 28. testsuiteadditions (Miloslav Trmac) + 27. -n fixes (Miloslav Trmac) + 26. signness warnings (Miloslav Trmac) + 25. Prevent infinite recursion in catclose (Gerhard Niklasch) + 24. Add Dragonfly (Joerg Sonnenberger) + 23. Check for wcwidth returning a negative number (TOMITA Yoshinori) + 22. recognize "li" and "co" in echotc (Martin Kraemer) [PR/7] + 21. Don't use T_Cols for wrapping purposes; use TermH consistently + (Martin Kraemer) [PR/8] + 20. Don't display duplicate utmp records (Miloslav Trmac) [PR/17] + 19. Clarify hashing and -f sections of man page (Volker Quetschke) [PR/20] + 18. Dave Yearke: configure did not recognize solaris 10 [PR/18] + 17. CYGWIN: Don't lowercase commands and allow foo.exe on command line. + (Corinna Vinschen) [PR/19] + 16. CYGWIN: cd /foo && cd .. ends up erroneously in // for systems that + HAVE_SLASHSLASH [PR/21] + 15. %j was broken (Peter Kruse) + 14. Extend // handling in pathnames from being apollo specific to also + cygwin (Corinna Vinschen) + 13. Fix uppercase/lowercase transformations (Jean-Luc Leger) + 12. Fix symlink expansion (revert from 6.10.00) (Jean-Luc Leger and Christos) + 11. Fix literal sequence in prompt (Miloslav Trmac) + 10. V6.14.02 - 20050412 + 9. Prototype fixes (Miloslav Trmac and Jean-Luc Leger) + 8. V6.14.01 - 20050411 + 7. Make =- refer to $owd (H.Merijn Brand) + 6. Use prototypes (almost) everywhere (Miloslav Trmac) (issue #5) + 5. Fix doc path in Cygwin installation (Corinna Vinschen) + 4. Fix column size calculation (Martin Kraemer) + 3. Implement newline-and-hold and newline-and-down-history (Per Hedeland) + 2. Messages fixes for the ja (Japanese) locale (NAKAMURA Takeshi) (issue #4) + 1. Enable charset conversion in nls (Miloslav Trmac) (issue #3) + + 76. V6.14.00 - 20050325 + 75. Additional messages for the ja (Japanese) locale (NAKAMURA Takeshi) + 74. V6.13.10 - 20050321 + 73. Implement --help (Tom Warzeka) + 72. Clamp solaris autologout time + 71. Add support for "limit heapsize" (Martin Kraemer) + 70. Improved autoconf for utmp/utmpx (Miloslav Trmac) + 69. V6.13.09 - 20050303 + 68. Autoconf additions (Miloslav Trmac and Jean-Luc Leger) + 67. Fix erroneous sign extension when printing huge numbers (Martin Kraemer) + 66. Handle delay in termcap entries (Martin Kraemer) + 65. EBCDIC and BS2000 fixes (Martin Kraemer) + 64. Avoid the SCCS percent-S-percent sequence differently (Kimmo Suominen) + 63. Mark position update fixes (Martin Kraemer) + 62. Define BSDLIMIT and BSDTIMES for Cygwin (Corinna Vinschen) + 61. Fix NLSFrom prototype (Martin Kraemer) + 60. V6.13.08 - 20050303 + 59. Add test for socklen_t in autoconf + 58. Fix problems with NLSFrom prototype + 57. Deal with AIX's utmpx lossage + 56. V6.13.07 - 20050118 + 55. constifications, XXX: duplicate prototype on setpgrp(). + 54. iconv fixes (Miloslav Trmac) + 53. literal code cleanups (Miloslav Trmac) + 52. move intptr_t definition to sh.h and include both stdint.h and inttypes.h + 51. Fix dup2() issues, and introduce FSAFE as the highest file descriptor + to be left untouched. This is to avoid closing hesiod/nis etc file + descriptors behind their backs. I need to really fix file descriptor + handling one day. + 50. forward<->reverse char conversion verification (Miloslav Trmac) + 49. japanese locale additions (Yoshiyuki Sakakibara) + 48. wide character/utf 8 cleanups (Michael Schroeder) + 47. V6.13.06 - 20050105 + 46. autoconf cleanup (Miloslav Trmac) + 45. Fix literal refresh code (Michael Schroeder) + 44. Fix history printing bug with WIDE_STRINGS + 43. V6.13.05 - 20041121 + 42. deal with not having intptr_t + 41. get rid of bool. + 40. Protect HAVE_ICONV with NLS_CATALOGS + 39. Deal with wchar_t being unsigned. + 38. If we HAVEUTMPX redefine some utmp functions in terms of utmpx ones. + 37. V6.13.04 - 20041120 + 36. Fix display problems with two-column characters when using WIDE_STRINGS. + (Miloslav Trmac) + 35. Change charset declarations for some of the translations. + (Miloslav Trmac) + 34. Set O_LARGEFILE properly (Miloslav Trmac) + 33. Use libc functions to access utmp data (Miloslav Trmac) + 32. t_pmatch() was not really case-insensitive when cs == 8 + (Miloslav Trmac) + 31. Fix escaping of "control" bytes 0x80..0x9F when they are actually + parts of UTF-8 character representation. (Miloslav Trmac) + 30. V6.13.03 - 20041120 + 29. More close_on_exec fixes (Miloslav Trmac) + 28. SUSE dspmbyte fixes (via Harald) + 27. Newline handling in command substitution controlled by csubstnonl + (Miloslav Trmac) + 26. Fix UNC prompt expansion (WIN32) (Yasuhiro Matsumoto) + 25. Fix incorrect xprintf() usage (Miloslav Trmac) + 24. Additional architectures support for $HOSTTYPE and $MACHTYPE + (Miloslav Trmac) + 23. Use nl_langinfo(CODESET) to determine $dspmbyte (Miloslav Trmac) + 22. Complete arguments that contant a # (Steven Grady) + 21. Set close-on-exec in subshells + 20. Compilation fixes (Miloslav Trmac) + 19. V6.13.02 - 20040804 + 18. de-register, de-extern, de-shadow, and const poison. + 17. WIDE_STRINGS support (Miloslav Trmac) + 16. warning cleanups (Miloslav Trmac) + 15. nlsclose() arg passing, exp2 is now a gcc builtin (Mark Peek) + 14. iconv malloc portability fix. + 13. make automatic dspmbyte determination case insensitive + 12. V6.13.01 - 20040724 + 11. bug fix in automatic dspmbyte setting (Miloslav Trmac) + 10. iconv patches (Miloslav Trmac) + 9. cygwin signal fixes; only init 32 signals, don't set bit flag on error; + breaks SIGHUP. (Corinna Vinschen) + 8. Make sure terminal size change takes effect immediately. + 7. Obey $printexitvalue for builtins. + 6. FreeBSD PR/66420: Allow history parsing to be special so that it + can handle inline # characters (Oliver Eikemeier) + 5. new termname builtin from (Andrew Stevenson) + 4. if ($var =~ *[^0-9]*) echo not numeric, fix (Andrew Stevenson) + 3. completion fix to avoid dup hosts from ssh_known_hosts + (Eric D. Hendrickson) + 2. vc++ 7.1 compilation fix (Steve Schockley) + 1. UTF-8 handling for both single and double width characters, but + no combining character support. (Michael Schroeder) + + 36. V6.13.00 - 20040519 + 35. V6.12.03 - 20040322 + 34. turn on kanji and dspmbyte by default; add check for utf8 locales, + and turn parsing of that automatically based on $LANG. + 33. Fix compilation issue under Windows/NT and charset incorrect patch + (Yoshiyuki Sakakibara) + 32. completion additions (Tom Warzeka) + 31. compilation fix (Martin Kraemer) + 30. V6.12.02 - 20040221 + 29. Glob completion listing addition (Tom Warzeka) + 28. BS2000 bs2cmd builtin. (Martin Kraemer) + 27. Fix interrupt resetting code when /etc startup scripts have syntax errors + (Mark A. Grondona) + 26. Clarification of kill-ring commands (Per Hedeland) + 25. Debian completion additions (Martin Godisch) + 24. Japanese character set fixes (Juehiro-san) from debian + 23. NLS charset fixes; disabled since they only work with gnu gencat + (Martin Godisch) + 22. Fix HPUX >= 11 resource (Jack Cummings) + 21. Handle breaksw that jumps out of loops. + 20. Revert #16. It causes worse problems. + 19. Avoid using execl() because the last NULL does not always promoted to + a pointer because the function is variadic (Harti Brandt) + 18. revert ignoreeof to the 6.11.00 behavior and document it (Martin Godisch) + 17. do a case insensitive comparison for the multibyte vars (Martin Godisch) + 16. don't sigsuspend() for an already exited job + 15. glob all arguments in source (Martin Godisch) + 14. various debian fixes (Martin Godisch) + 13. setenv syntax check revert (Satoshi I. Nozawa) + 12. EAGAIN typo (dan harkless) + 11. filec compilation issue on hpux (beebe) + 10. win32 compilation fixes for O_LARGEFILE (amol) + 9. Don't go into an infinite loop when tcgetpgrp() returns an error. + 8. Cygwin fixes (Corinna Vinschen) + 7. NLS catclose() bug avoidance (KAJIMOTO Masato) + 6. V6.12.01 - 20030208 + 5. Misc NT cleanup. No more GPL code (amol) + 4. use strtol() to detect errors in builtin kill (Peter Jeremy) + 3. Recognize linux systems on mips* (Maciej W. Rozycki) + 2. Enable complete=igncase on unix (Stephen Krauth) + 1. Eliminate maxitems (Todd Miller) + + 58. V6.12.00 - 20020732 + 57. misc cleanups. + 56. V6.11.05 - 20020712 + 55. We should have socklen_t in the INET6 case, but we leave int otherwise. + 54. Fixed for Darwin/Rhapsody (Mark Peek) + 53. provide new config.sub and config.guess from ftp://ftp.gnu.org/gnu/config/ + (Nelson Beebe) + 52. V6.11.04 - 20020709 + 51. Dissallow setting of environment variables that do not contain + alphanumeric names (Ton Voon) + 50. Don't expand path components that don't resolve to path names (Jonathan + Chen) + 49. Make $ignoreeof agree with the man page (Matias Moreno Meringer) + 48. Fix argument passing in tc.prompt.c expdollar (Nelson Beebe) + 47. Completion fixes from FreeBSD (Mark Peek) + 46. FreeBSD's sbsize limit (Mark Peek) + 45. Fix repeat 3 repeat 2 echo foo + 44. Fix I/O redirection in scripts (Ian D Allen) + 43. Fix ` \\\n ` evaluation (Jean-Luc Leger) + 42. add --version (Nelson Beebe) + 41. portability fixes for sed (Nelson Beebe) + 40. undef sv_handler for AIX's benefit. (Nelson Beebe) + 39. Add a test for ss_family that disables IPV6 (linux/ppc, osf/1 have + problems) (Nelson Beebe) + 38. Disable ipv6 for Apple (Nelson Beebe) + 37. Fix darwin configure entry (Nelson Beebe) + 36. V6.11.03 - 20020701 + 35. Add Ian D. Allen's bug list. + 34. If we are invoked as csh, default to bsd echo (Matej Vela) + 33. Don't close file descriptors too early because setuid scripts fail. + (Jill Pryse-Davies) + 32. Completion updates (Tom Warzeka) + 31. Fix compilation issue on SunOS4 with _POSIX_VDISABLE (Tom Warzeka) + 30. ukrainian update (Olexander Kunytsa) + 29. DSPMBYTE=utf8 patch (Jean-Luc Leger) + 28. fix ipv4 only compilation, remove extra sigsetmask() call (Takayuki Nakao) + 27. window change can cause free to be re-entered causing abort (Mark Peek) + 26. vp->vec vetting, suggested by Ian Dall. + 25. V6.11.02 - 20020516 + 24. Fix prompt bugs in $var and %c0n (TAKAI Kousuke) + 23. Add Cray SV2 config (Rafal Maszkowski) + 22. Add pdf manual page (Warren Ferguson) + 21. Fix REMOTEHOST lossage in with AF_LOCAL sockets (Tom Mander) + 20. Fix win32 break because of TIOCSTI (Amol) + 19. Fix TIOCSTI for hpux 11 (Igor Schein) + 18. Avoid collapsing paths that refer to non-existent components + (Martin Kraemer) + 17. Make -shell invocations always treated as a login shell. + 16. V6.11.01 - 20020308 + 15. Fixes to polish nls locale (Paweł Niewiadomski) + 14. russian locale fixes (Alexey Dokuchaev) + 13. document door support (Shaen) + 12. tcsh euc handling extensions (Alexey Zelkin) + 11. Make sure that jobcmd does not clobber the current job (Rob McMahon) + 10. Make sure that the output of verbose and echo do not end up in the + command output (Victor I. Pasko) + 9. Add %j in prompt [needs more work; is not right the first time + after proclist changes] (Hr. Peter Kruse) + 8. `` commands with embedded newlines would ignore commands following + the new line (Victor I. Pasko) + 7. Re-initialize nls if NLSPATH is changed (Naoki Wakamatsu) + 6. Fix 64 bit compilation with linux and resource limits. + 5. Avoid double globbing when ls-F needs to fork (Joe Townsend) + 4. put back csh filec compatible support. + 3. add support for quads in xprintf in the presence of gcc. + 2. unlimit should set rlim.rlim_max to rlim.rlim_cur if max < cur. + 1. Make ~user work again when the home directory is '/'. + + 40. V6.11.00 - 20010902 + 39. Completion fixes (Tom Warzeka) + 38. make c_insert not static so that it can be used from win32 (amol) + 37. Fix rmstar not to corrupt memory when we say no. (Mark Peek) + 36. V6.10.02 - 20010806 + 35. polish nls locale (Paweł Niewiadomski)) + 34. Fix a tcsetattr race running background jobs as the last line on an xterm + window (Andrew Brown) + 33. jobcmd alias (Greg Parker) + 32. hpux11 support (Joshua Weage) + 31. Fix SHORT_STRINGS compilation (Daniel Trinkle) + 30. Add kill -s (Mark Peek) + 29. Don't recognize all mips as dec (Bjorn Knutsson) + 28. Fix GLOB_QUOTE problem (noted by Per) I introduced in 6.10.01. + 27. Port to concurrent's powermaxos (Matt Majka) + 26. New builtin srcfile (Amol) + 25. Fix bindkey "\\" cmd (reported by Ismail H. Tuncer) + 24. %0Xc was broken in the prompt if the user's home directory was '/'. + (reported by Edward Glowacki) + 23. V6.10.01 - 20010426 + 22. LARGEFILE support on Linux. + 21. Add big5 multibyte support (Yen-Ming Lee) + 20. Check the return value of setpriority (Dima Dorfman) + 19. Avoid constructing paths with // on DomainOS (Nickolai Zeldovich) + 18. Russian translation (Ilmar S. Habibulin) + 17. Fix hostdefs for alpha support in FreeBSD (Andrey A. Chernov) + 16. Add door support in colorls (Shaen) + 15. Add BSD_STYLE_COLORLS for FreeBSD (Anand) + 14. MAXHOSTNAMELEN needs to be 256 (Kris Kennaway) + 13. Document stty -tabs problems on compaq (Nelson H. F. Beebe) + 12. Fix broken comment, and new versions of config.guess and config.sub + (H.Merijn Brand) + 11. fix redrawing in the recognize case (Andrew Brown) + 10. don't call qsort with 0 items. (Luke Mewburn) + 9. fix echo;echo;echo; not outputing anything (Andrey A. Chernov) + 8. Fix shell word parsing in dabbrev-expand (Per Hedeland) + 7. hpux fixes (Chienting Lin) + 6. Implement kill ring (Per Hedeland) + 5. Avoid core-dumping when a very long $HOME gets passed in (Kris Kennaway) + 4. Add rlimit_vmem for linux based on rlimit_as (N KomaZaki) + 3. back out symlink=expand path check. + 2. Add Estonian translation (Toomas Soome) + 1. Accept empty $savedirs to mean infinity. + + 57. V6.10.00 - 20001119 + 56. Completion fixes (Tom Warzeka) + 55. add missing linux kanji define (Tsuyoshi Kawabe) + 54. More WINNT_NATIVE fixes (amol) + 53. Fix compile error on winnt (Yoshiyuki Sakakibara) + 52. nonstopux configure and makefile fixes (Tom Bates) + 51. V6.09.04 - 20001111 + 50. Order of initialization for multibyte display was wrong + (HyunChul Kim) + 49. Follow the guideline for linux for japanese locale: + http://www.linux.or.jp/JF/JFdocs/Japanese-Locale-Policy.txt + (Tomohiro KUBOTA) + 48. Ukrainian nls map (Olexander Kunytsa) + 47. exit immeditiately if we get an error while we are setting up + (Michael Shalayeff) + 46. (unset path; unsetenv PATH; rehash) -> crash (Kent Vander Velden) + 45. change winnt to winnt_native (Randolph Fritz) + 44. Support home/end in the editor (Andrey A. Chernov) + 43. Typo s/gycwin/cygwin/ in tc.os.h (Andreas Schott) + 42. Alpha ev6 addition (Karen R. McArthur) + 41. DSPMBYTE patch from (Issei Suzuki) + 40. Security fix for here-doc tmp files (proton@ENERGYMECH.NET) + 39. Fix resource limit rounding *again* (Johannes Gross) + 38. Fix $ expansion in prompt (Takashi Sumiyoshi) + 37. V6.09.03 - 20000715 + 36. cygwin port fixes (Arihiro Yoshida) + 35. Add a new "catalog" variable that specifies which NLS catalog + to be used (Issei Suzuki) + 34. cleanup and addition of page up/down (amol) + 33. fix vfork compile problem. + 32. use inet_addr instead of inet_aton for portability. + 31. V6.09.02 - 20000704 + 30. lots more completions (George Cox) + 29. change FILSIZ to BUFSIZE [now that BUFSIZE >> MAXPATHLEN] and + avoid a potential buffer overflow in sh.dir.c (Volker Schmidt) + 28. _MINIX_VMD port (Martijn van Buul) + 27. inet6 handling for remotehost and configure (Hajimu UMEMOTO) + 26. aix-4 does not need gethostname (Darren Reed) + 25. IBM OS/390 Unix Systems Services support (Peter Prymmer) + 24. Fix prompt formatting (Andrey A. Chernov) + 23. Use HostType from Imakefile correctly (Kjetil Torgrim Homme) + 22. Handle long and expanded history lines better (Boleslaw Ciesielski) + 21. With symlinks=expand expand valid paths only (Martin Kraemer) + 20. Make one-byte charsets work with KANJI (Andrey A. Chernov) + 19. NT-specific executable detection moved to NT code (amol) + 18. New "complete module" (Dan Nicolaescu) + 17. Correctly display scaling string in limit error messages (Nathan Ahlstrom) + 16. Don't display "unset watch" message when not appropriate (kim) + 15. V6.09.01 - 20000114 + 14. Circumvent IRIX4D ESTALE bug by exiting. + 13. IRIS4D de-linting. + 12. Finnish nls catalogs (Jukka A. Ukkonen) + 11. Even more multibyte fixes (Taga Nayuta) + 10. Patches to statically link tcsh under solaris-2.6 (John Hawkinson) + 9. Manual page typos (R. Bernstein) + 8. HP/UX-11 (9000/800) HP/UX-10.20 (9000/820) (Haflidi Sigtryggur Magnusson) + 7. Color-ls fixes (Luis Francisco Gonzalez) + 6. Don't re-use time0 to compare to stat's st_mtime, cause it could be + the value returned from times(2) which is the ticks since system + startup (Frank van der Linden) + 5. Time percentage wrap fix (Simon Burge) + 4. EUCKR support (HyunChul Kim) + 3. Grammar and typo fixes for tcsh.man (Steve Kelem) + 2. More multibyte fixes (Rodney Ruddock) + 1. Change 6.08 -> 6.09 where I missed it; update for utlrix 4.5 (Simon Burge) + + 65. V6.09.00 - 19990816 + 64. Add csh emacs mode (Dan Harkless) + 63. Make sure the the glob buffer matches the word buffer size (Brian Biswas) + 62. Fix periodic to work without tperiod set (Kenny McCormack) + 61. V6.08.07 - 19990813 + 60. Fix e_dabbrev_expand (Bjorn Knutsson) + 59. Make \builtin work again (by calling the command not the builtin) + 58. Add NLS_BUGS for OS's that keep file descriptors open for NLS (Ian Dowse) + 57. Make NONLSREBIND work after tcsh starts up. + 56. Fix AIX stupid exit bug. (Dan Harkless) + 55. More irix fixes (Kaveh) + 54. V6.08.06 - 19990701 + 53. module command completion (Dan Nicolaescu) + 52. Man command completion enhancement (Tom) + 51. Fixes for irix configuration (Kaveh) + 50. Support \a and \e in echo command. From (Keith Thompson) + 49. Alpha configure nit from Kaveh + 48. V6.08.05 - 19990511 + 47. In some system, when a builtin fails immediately after we start + tcsh and before we print any messages, NLS messages fail (some + descriptor might be closed) [FreeBSD, HP/UX?]. So we force reading + the NLS catalogs in errinit() (Yoshiyuki Sakakibara) + 46. typos in ja/set1 and ja/set29 (Yoshiyuki Sakakibara) + 45. "dspmbyte autoset trap" support to HP-UX 10.20. (Yoshiyuki Sakakibara) + 44. misnumbered NLS message in tw.help.c (Yoshiyuki Sakakibara) + 43. colorcat variable for NLS color messages (Yoshiyuki Sakakibara) + 42. autoconf fixes from Kaveh (and if it broke, me) + 41. SGI irix fixes from Glenn Coombs. + 40. Don't spin writing the history file when quota is exceeded (Rob McMahon) + 39. V6.08.04 - 19990419 + 38. complete additions (John Gotts) + 37. Port to amiga with geek gadgets (Arto Huusko) + 36. Ignore case in setenv for windows (amol) + 35. Bug fixes for NT unc stuff (amol) + 34. Hash spell check (amol) + 33. V6.08.03 - 19990211 + 32. Helpcommand documentation (Vladimir Alexiev) + 31. small Y2K fix [%y in prompt would be formatted as 10 not 00 at year 2000], + and new Itoa() code (Chris Torek) + 30. OpenBSD m68k patches (Paul DuBois) + 29. Avoid redefinition of getpeername on Solaris-2.7 + 28. fix problems with savedups=erase, savehist=merge (Randy Gobbel) + 27. Don't set $shell to csh, if we were invoked as tcsh (Tomas Persson) + 26. added $_ + 25. added postcmd + 24. V6.08.02 - 19981124 + 23. document continue and continue_args + 22. wrong test in slowexec made NT optimization a noop (Amol) + 21. Rhapsody fixes + separate CFLAGS/CPPFLAGS (Wilfredo Sanchez) + 20. literals in both prompt at rprompt did not work properly (Taga Nayuta) + 19. multibyte deletion fixes (Yoshiyuki.Sakakibara) + 18. clean up key binding stuff for NT by moving the nt dependent code to + the NT source (amol) + 17. dspmbyte fixes for AIX, typos in man page and nls (Yoshiyuki Sakakibara) + 16. Convex fixes (Ron Echeverri) + 15. V6.08.01 - 19981025 + 14. SX4 port; this adds many casts for machines where ptrdiff_t is 64 bits. + (Andreas Schott) + 13. U/Win port; does not work properly with U/Win 1.6, wait for the next + version (Chris Jones) + 12. Sgi does not need gethostname prototype (John Bogan) + 11. Logic in sh.dir.c was wrong for NT (Amol) + 10. HP_CXD_SPP stat64 fixes (Scott Garee) + 9. Documentation spelling fixes (Keith Thompson) + 8. Documentation fix for savedirs (Amol) + 7. Siemens OSD_POSIX fixes (Martin Kraemer) + 6. include for all the BSD's (Trevor Johnson) + 5. Multibyte display fixes for gnu ls (Taga Nayuta) + 4. Configure/Makefile hesiod and bindir fixes (Dan Winship) + 3. Use winnt not win32 in tc.os.h (Amol) + 2. Cygwin32 port (Raj Menon) + 1. Ported Fixes (Tom) + + 95. V6.08.00 - 19981002 + 94. where builtin nt fix (Amol) + 93. V6.07.13 - 19980926 + 96. NT multibyte fixes (Amol) + 95. NeXT needs getcwd. + 94. fix new bug introduced by strncpy'fication in sh.dir.c (Taga Nayuta) + 93. V6.07.12 - 19980918 + 92. add cray in configure script (Tom) + 91. nls fixes + 90. Avoid buffer overflows in directory code (kim) + 89. Add multibyte character display support (Yoshiyuki Sakakibara) + 88. Make tcsh use getcwd instead of getwd and supply a getcwd. + 87. Fix remotehost again (kim) + 86. V6.07.11 - 19980913 + 85. Leave remotehost ip addresses alone (don't try to resolve them) (Kim) + 84. Read vs. force_read fixes (Amol) + 83. Make colorls if color is set before the first LS_COLORS setenv + (Taga Nayuta) + 82. Use _PATH_DEFPATH on BSD4_4 systems. (Jim Bernard) + 81. Cursor bounds checks (Michael Schroeder) + 80. Syntax error nits (Michael Schroeder) + 79. configure fixes (Michael Schroeder) + 78. V6.07.10 - 19980904 + 77. Off by one error in NO_ERRORS... + 76. Japanese NLS messages (Yoshiyuki Sakakibara) + 75. Add ENXIO and EBADF in the test for write failures for Irix Zombies + (Ralf W. Grosse-Kunstleve) + 74. Missed a test for NOSTRCOLL in glob.c (Michael Liepelt) + 73. Another ABSOLUTEP change (Amol) + 72. Italian NLS messages (Massimo Bertozzi) + 71. WIN32 fixes for ntslowexec and color_ls literal printing in prompt (Amol) + 70. a few missed WIN32 merges (Amol) + 69. defined YPBUGS for sgi (Kaveh) + 68. V6.07.09 - 19980707 + 67. Separate the nt builtins (Amol) + 66. completion fixes (Tom) + 65. color ls fixes (Taga Nayuta) + 64. V6.07.08 - 19980629 + 63. add config.h.in (Kaveh) + 62. win32 updates (Amol) + 61. warning and portability cleanups on the new changes (Kaveh) + 60. V6.07.07 - 19980628 + 59. Fast execute by-pass for win32 (Amol Deshpande) + 58. Clean up const usage a bit, and fix gcc 2.8.1 warnings. + 57. Use @bindir@ for DESTBIN in Makefile.in (Edgar Hoch) + 56. Avoid overflow in time builtin computation (Nobue Adachi) + 55. Color ls additions (Taga Nayuta) + 54. unsigned char vs. char warning fixes (Kaveh) + 53. Solaris 64 bit fixes (fix directory offset bug) (Thomas-Martin Kruel) + 52. More win32 patches (Amol) + 51. autoconf lossage from (Kaveh) + 50. V6.07.06 - 04/08/98 + 49. Collation fix for globbing (Andrey A. Chernov) + 48. We might have NLS_CATALOGS and not LC_MESSAGES (Andrey A. Chernov) + 47. 4.4BSD header fixes (Andrey A. Chernov) + 46. Signed char prompt fixes (Andrey A. Chernov) + 45. Pattern match fix for directory searches (Mike Patnode) + 44. Pentium DGUX fixes (Miko Nahum) + 43. Spanish nls message catalogs (Luis Francisco Gonzalez) + 42. Fix trailing whitespace parsing in HASHBANG code (Martin Kraemer) + 41. Remove stray debuggin message from unmatched substitutions. + (from Amol Deshpande) + 40. Fix reversed arguments in Usagae message. (from Amol Deshpande) + 39. Fix bug introduced at tcsh-7.06.03 [expdollar] that affected %.n prompt + format. + 38. Fix typos introduced in last batch of changes. + 37. Fix interrupted script using onintr, exiting parent shell problem. + 36. Cleanup prototypes. + 35. V6.07.05 - 10/28/97 + 34. Integrate Amol Deshpande's WINNT fixes to the tcsh source. Note that + this is not complete yet; we are missing the NT glue code and the message + catalogs. + 33. Fix ^T at the first character in the line (Chuck Silvers) + 32. Eliminate xsprintf and xvsprintf + 31. Qmail patch from (Matthew Zahorik) + 30. Added missing linux signals (Vadim Vygonets) + 29. fixed problem where complete complete 'p/*/t:*.txt/' would not honor + the pattern. + 28. Port to an EBCDIC machine: BS2000 by Siemens Nixdorf that has an + IBM/390 compatible processor (Martin.Kraemer) + 27. Detect when we have errors writing to stdout (Vadim Vygonets) + 26. Ignore quotes in the comparisons for builtins, so that \builtin works + (Amol Deshpande). + 25. HPUX, portability fixes; make sure that we have the right config file + (Jonathan Kamens) + 24. Don't do lookups for x displays and figure out ttys properly + (Leonard N. Zubkoff) + 23. make print_by_columns print in a single column when the output is not a tty + 22. use rlim_t for Solaris2 (Casper Dik) + 21. V6.07.04 - 05/04/97 + 20. set -f -l patch (Michael Veksler) + 19. SGI patches (Tomasz J. Cholewo). Also fix completion code to take into + account aliases that start with a period. + 18. SCO patches (Boyd Lynn Gerber) + 17. Fujitsu patches (Toshiaki Nomura) + 16. autoconf patches (Kaveh Ghazi) + 15. BSDI patches (Paul Vixie) + 14. %Q formatting character addition. + 13. Fix set=#123; echo $i:s/#// (Quoting problem) + 12. V6.07.03 - 02/23/97 + 11. Understand %$variable in the prompt. + 10. Quote directory names properly in .cshdirs + 9. USE_ACCESS and autoconfig patches from (Larry Schwimmer) + 8. Pyramid att config file (Andrew Lister) + 7. $rprompt code (Luke Mewburn) + 6. Kanji patches (Huw Rogers) + 5. Cray T3E port (Jorn Amundsen) + 4. Avoid html redirects in tcsh.man2html (from Kimmo) + 3. HP/UX 10.0 fix for filesize resource limit; don't scale by 512 anymore. + 2. Workaround for TIOCSTAT for NetBSD from lukem@netbsd.org + 1. Return exit status from 0..255 not -128...127, as POSIX mandates. + +V6.07.02, 10/27/96 + 58. More configure fixes from Kaveh. + 57. Fix histdup=erase again: Don't renumber events, or access uninitialized + storage. + 56. 6.07.01 - 10/19/96 + 55. Fix histdup=erase, where after some repetitions, we would get negative + history events (kim@gw.com) + 54. NLS fixes and typo in sh.err.c (Martin.Kraemer@deejai.mch.sni.de) + 53. Output history in raw format in the history file (mveksler@VNET.IBM.COM) + 52. Fix possible core dump when !: in autoexpand mode (rbrown@ERA.COM) + 51. 6.07.00 - 10/11/96 + 50. Avoid stdio.h inclusion problem in SCO (gethost.c). + 49. A bit of housekeeping in host.defs + 48. 6.06.04 - 10/05/96 + 47. Fix tellmewhat() code to return true if found. + 46. Change register foo to register int foo to avoid compiler warnings. + 45. Fix problem with sticky non editing mode from Casper Dik. + 44. history lex fix from Martin Kraemer; history events that ended with 0 + were not properly parsed. + 43. SNI fixes from Martin Kraemer. + 42. SGI fixes from Ralf W. Grosse-Kunstleve. + 41. BSDI2.1 fixes from Paul Vixie. + 40. 6.06.03 - 09/24/96 + 39. undef TIOCGLTC for HP/UX 10.0 from Michael Shroeder + 38. Sinix fixes + 37. 6.06.02 - 06/22/96 + 36. Added implicitcd + 35. Added configure.in and Makefile.in from Kaveh. + 34. unset path, unsetenv PATH, ./foo did not work. + 33. Add VAR_NOGLOB, and use it to avoid globbing directory names when + cd'ing into them. + 32. Fix bug introduced in the new tty parsing code. + 31. Avoid pushing string back to the parsing string in ${ errors. + 30. Patches for the manual page from Dave. + 29. 6.06.01 - 05/24/96 + 28. Use sysconf to get NCARGS if available Robert Daniel Kennedy + + 27. Grab the program name and use that instead of tcsh in error messages. + 26. Fix histdup, so that it does not leave gaps in the event sequence. + 25. HP/UX v10.0 fixes: Don't use bsdtty.h and avoid clobbering memory + since SIGRT??? is defined as -1. + 24. Avoid coredumps when $TERMCAP exceeds 1024 characters + Michael Schroeder + 23. Fix memory clobbering when SHORT_STRINGS is not defined. + Todd J Derr + 22. Only restart stopped editors. Robert Webb + 21. Recognize pts sysv ptys when checking to set autologout Bob Myers + + 20. Magic space incomplete modified core dump fix. Chris Metcalf + , Bradley White + 19. Linux nls fixes Rik Faith + 18. SGI RS8000, Ported notes. Ralf W. Grosse-Kunstleve + + 17. Greek nls messages. Aggelos P. Varvitsiotis + 16. Imakefile linux and libcrypt fixes. Jonathan Kamens + 15. FreeBSD fixes Jukka Ukkonen + 14. Expand the environment space for path Steve Kelem + 13. Don't overwrite the environment randomly Steve Kelem + + 12. Don't turn the editor on when we have dumb or unknown terminals. This + breaks emacs when compiled with terminfo Jonathan Kamens + 11. Fix F- parsing in tc.bind.c (Bob Meyers) + 10. Added -T option in history to force timestamp printing. -h alone does + not print timestamps anymore for compatibility with csh. + 9. Typo in tc.bind.c [with -DOBSOLETE] (misplaced parenthesis) + 8. Recognize convex models properly. + 7. suppress the DING! option using the noding variable. + 6. negative nice values did not work. + 5. Harris CX/UX 7.x support. + 4. ERR_DMMODE was used on the crays but not defined. I changed the error + messages in tc.os.c to use ERR_STRING instead, and fixed a missing error + message in the catalogs. Someone will need to retranslate #30 and #31 + in set23. + 3. Bug setting listflags... Workaround: set listflags=(A /bin/ls) + 2. Typo in Imakefile (# comment instead of c comment) + 1. Typo in ma.setp.c (missing parenthesis) + + +V6.06.00, 05/13/95 + 88. Cleanup off-by-one error ed.defns.c. + 87. 6.05.09 - 05/06/95 + 86. Small memory leak in dosetenv() + 85. Make sure that the number of editing functions defined is correct + and abort otherwise. + 84. Completion Fixes from Tom + 83. Don't add yp stuff in the tilde cache [names that start with + or -] + 82. Don't let children catclose() in xexit(), because the parent will lose + access to the nls catalogs. From Michael. + 81. 6.05.08 - 04/29/95 + 80. Update to the newest csh sh.file.c + 79. More completions from Tom. + 78. Fix the Imakefile to use XCOMM + 77. Update for AIX 3.2. + 76. French catalog from J.M.Vansteene@frcl.bull.fr (fwd Michael Schmidt) + 75. Nls fixes and small typos from Michael + 74. PDP11 BSD type fixes. + 73. More manual page fixes. + 72. 6.05.07 - 04/19/95 + 71. More NLS catalog fixes. + 70. Bruce's jumbo patch. + 69. 6.05.06 - 03/15/95 + 68. make clean does not clobber config.h if Makefile.std is used. + make veryclean does. + 67. New config define NISPLUS. Reportedly fixes vanishing output of ~expansion + on solaris 2.4. + 66. showdots has been removed; use listflags instead. [handles -x too] + 65. more nls catalog fixes. + 64. set histchars=,. did not have any effect in .cshrc + 63. fix "-c command" new core dump. + 62. more completions from Tom + 61. call catclose() before exiting, so that svr4 cleans up the symlinks before + exiting. + 60. Per's fix for insert-last-word + 59. Per's emacs abbreviation mode. + 58. Makefile fixes for catalog stuff. + 57. fixed again complete-word-raw and list-word-raw + 56. 6.05.05 - 03/11/95 + 55. Made %?str work again + 54. IRIX sigalarm problem should be fixed + 53. complete-word-raw and list-word-raw should work + 52. nls catalogs complete reworking. + 51. sh.init.c: Signal complete rewrite. + 50. Signal fixes from Bruce. + 49. Added promptchars, like histchars; affect %# in the prompt. The first + char is for the user and the second is for root. + 48. 6.05.04 - 03/03/95 + 47. Add NODOT config, $command [that holds the command passed with -c] + $GROUP and $group + 46. AFS fixes from Larry Schwimmer + 45. Real NLS catalogs from Michael Schmidt + 44. patch to allow ^? binding. + 43. completion patch from Paul DuBois. + 42. Don't spell check in here docs. + 41. Incorrect normalization of usec in sh.time.c + 40. directory printing and option parsing fixes [from Paul DuBois] + 39. realloc_searchlen should be static to avoid conflicts with OS's that + use the same malloc package. + 38. LOGINFIRST now applies to /etc/csh.login + 37. Fixes in bind compatibility code to bindkey. + 36. 6.05.03 - 01/17/95 + 35. Don't print the whole watchlist on startup. One can use explicitly + the log builtin for that. + 34. Don't display the $watch value in the log command. + 33. Don't delete the unmatched portion if we try to complete a spelling error. + 32. Solaris 2.4 workaround for isprint('\t') lossage (From Casper) + 31. Fixed csh bug: [Reported by Jaap] + set test="one\ + two\ + three" + echo "$test:q" + 30. Fixed the lossage in setting the looking mode in tw.parse.c before + calling t_search; $x/$y will not append the right suffix. + 29. Another attempt at the gethost timeout code. + 28. Cray dmmode and filetests -m -k [need documentation!] + 27. More manual patches. + 26. Don't glob the path; security problem and core-dump. [from beto] + 25. Avoid waiting for jobs that failed to restart, thus hanging the shell. + eg, run job in background, attach to debugger; kill it inside the + debugger. Get out of the debugger and you are stuck if you fg that job. + 24. 6.05.02 - 09/04/94 + 23. remhost code could pass the wrong length to getpeername() + 22. too eager sed'ing broke convex getwarpbyvalue() to getwarpbyvarval() + 21. Fixed new bindings bug. + 20. Fixed bug in newgrp code; execv was called incorrectly. + 19. Take into account programmable completion hints when spell checking. + 18. Unconditionally change stty modes in Rawmode() + 17. Change date in $version to be ISO 8601 per Keith's suggestion + 16. Fixed portability problems in the new counted-strings codes (From Kaveh) + 15. Fixed binding problem with the new counted-strings code [all key bindings + ended up in the extended map] + 14. 6.05.01 - 07/08/94 + 13. Changed key bindings to use counted strings instead of Null terminated + strings, so that binding ^@ works. + 12. Fix parsing bug, where words that contained keywords caused incorrect + word breaks: + switch (iftagd) + case iftagd: + echo It works + breaksw + default: + echo It is broken. + endsw + 11. Fix sh.c for systems with no job control. [the new hup builtin sends + SIGCONT]. + 10. Don't add the suffix character when all completions fail, from michael + 9. Added histdup=erase, that deletes the oldest duplicate instead of + the newest. + 8. Don't call .logout recursively if we receive more than one hup, + and don't process hangups when we execute the .logout. + 7. $logout was set to a static string. + 6. Non printable binding listing was broken. + 5. Recursive sourced scripts would get mangled up because of input buffer + confusion (thanks michael) + 4. M-space should not be counted as a space. Leads to infinite loop in + word splitting. + 3. Pyramid fixes. + 2. Fixed '\' in sysv echo (from Mika) + 1. Missed fix_yp_bugs() when setting REMOTEHOST (From Casper) + + +V6.05.00, 06/19/94 +113. 6.04.17 06/18/94 +112. Realloc debug fix from John. +111. Completion fixes from Bruce. +110. Added -b option to bind. +109. Added tcsh.man2html from Dave. Looks great! +108. 6.04.16 06/06/94 +107. Allow multi word glob in "`foo`" expressions. + > if ("`ls`" == "a b c") then +106. Michaels lex() buffer patch version 2. + the previous version core-dumped with + > sleep | echo +105. Fix seg fault in find_cmd, when path is unset. +104. 6.04.15 05/28/94 +103. the previous =~ fix, was a bit broken. +102. 6.04.14 05/25/94 +101. expression parser fix for !~ and =~. + if (foo =~ *) echo ok + the * was taken for a multiply and parsed as 0 * 0 returning 0. + and asked to match "foo" with "0" +100. Michael's lex() buffer patch. + 99. Bruce's Jumbo cleanup + 98. fixed Imakefile for X11R6 + 97. fixed argument parsing in source command. + 96. added $sched to format scheduled events. + 95. 6.04.13 05/07/94 + 94. added expand-command + 93. Alpha OSF-2.0 fixes + 92. 6.04.12 04/28/94 + 91. Ignoreeof patch from Bruce. + 90. Dan's completion fix. + 89. 6.04.11 04/12/94 + 88. Don't source .logout when killed with -HUP unless we are a login shell. + [ actually $loginsh controls the behavior now ] + 87. ISC-4.0 posix exec() bug workaround + (from Jonathan Broome ) + 86. Dan's patch for complete=enhance + 85. Kaveh's patches for memset, host.defs, _{U,G}ID_T + 84. 6.04.10 03/29/94 + 83. Pathname completion bug fixes... + 82. Completion pathname(p) changes: Completion 'C' -> 'X'. + Replaced 'p' with 'F' and added D,T,C. + 81. Next NLS fixes + (From Paul Nevai ) + 80. make spelling correction obey the current histchars setting. + 79. Fix rounding in limits so that 0 is a true 0. + (From Ken Lalonde ) + 78. 6.04.09 03/12/94 + 77. Alarm race with remotehost. + 76. If you have in your .cshrc + set savehist=(100 merge) + and execute + #!./tcsh + exec ps + you get no output; [fixed] + 75. setenv SHLVL -1; tcsh = Segmentation fault [fixed] + 74. 6.04.08 02/10/94 + 73. new machtype, ostype, vendor + 72. execute .logout on hangup. + 71. more man page fixes. + 70. 6.04.07 02/04/94 + 69. Dynamic hash changes, globbing for which command from Michael. + 68. INBUFSIZE fixes for history. + 67. printenv returns 1 when a variable is not found, like the non builtin one + 66. Add quotes to the mismatch array so that: + > touch foo + > mail "oo bar" + does not get corrected. The right fix would be to do correct parsing + and quote the space... + 65. NULL terminate mismatch[] array in ed.inputl.c, since it is used in + Strchr(). + 64. renamed stat to filetest + 63. Afs and Hesiod patches. + 62. More manual page patches. + 61. 6.04.06 12/19/93 + 60. Alarm for resolver timeouts (untested) + 59. Fixes for Henry Spenser's regex in the Makefiles + 58. Modifiers now work with $< and $< does not do :q by default. + [incompatibility with csh] and $< can be interrupted. + 57. Added $histdup. + 56. source /etc/.login for Solaris 2.x + 55. don't remove trailing spaces in history searches. + 54. dirs -L and dirs -S spurious warning elimination. + 53. man page fixes from David. + 52. Kimmo's patch [makefile, gcc warning, netdb.h include] + 51. 6.04.05 12/12/93 + 50. rewrote srcunit() to use st_save and st_restore. The code was + too messy to be useful before. + 49. recdirs and rechist patches again! + 48. Harris hck port, and ISC imake update + 47. Eliminate the x windows :display.screen before looking for the + hostname in REMOTEHOST + 46. Patch for CDF filetype() recognition (hpux) + 45. 6.04.04 11/12/93 + 44. Made =x obey nonomatch. + 43. Fixed rechist and recdirs not to depend on savehist and savedirs + 42. Removed aliases, bind, linedit builtins [ifdef'ed out as OBSOLETE] + 41. change REMHOST to REMOTEHOST for compatibility with SGI. + 40. $owd was not working correctly. + 39. Debugging printf elimination (from Kimmo) + 38. Typos in the new hup code in sh.c (from Matt) + 37. Imakefile fix for sequent (from Jaap) + 36. 6.04.03, 10/30/93 + 35. New manual page in place. + 34. Fixed Makefile sed RE to work with gnu sed. + 33. Added hup builtin. + 32. Added $REMHOST in config_f.h + 31. Fixed random parsing bug in sh.exp.c in isa(). It checked cp[1] + without checking cp[0] first... (should propagate to 4.4BSD) + 30. More sh.exp.c fixes from Bruce + 29. Always exit when the user types exit. + cat | tcsh -f -s + exit + ls + 28. savedirs fix and readlink() null termination fix from Peter. + 27. Added -p flag (force dirs printing in all directory functions and $owd + variable + 26. Let $dirstack work by default without needing to be set. + 25. Fixed history -h to work with other history flags. + 24. Renamed ed-functions more consistently (dcs) + 23. Added missing filetests (dcs) + 22. Added NEWGRP define in config_f.h (dcs) + 21. More fixes for non blocking io recovery from Bruce + 20. 6.04.02, 10/08/93 + 19. changed default prompt to %# + 18. New group 'g' completion. + 17. removed IIASA defs. + 16. fix for history -SL and dirs -SL to work when savedirs and savehist are + not set. + 15. fix magic-space to understand :p + 14. make :u,:l work for history. + 13. Fixes for non-blocking i/o recovery. trap all non blocking styles under + sunos. + 12. 6.04.01, 08/10/93 + 11. Vi mode word moves [they work like vi and don't obey wordchars anymore]. + 10. New file operators and stat builtin + 9. David's FIONREAD patch for SVR4 + 8. Bruce's ignoreeof=n patch + 7. Dan's complete/correct enhancement + 6. Abort corrections patch. + 5. Print_by_columns, now does not use the rightmost column. + 4. Renamed config/config.$i to $i to avoid once and for all filename length + problems. + 3. bbn butterfly config + 2. Beto's proc fixes + 1. Bruce's bug fix for ed.chared.c, signals + + +V6.04.00, 07/03/93 + 92. Alpha prototypes, for gcc -Wall clean compile. + 91. Fixed alpha hashing. Did not work for directories > 31, Thanks to + Dan Mosedale for all the help! + 90. Added USE(a) for unused parameters, to avoid compiler warnings. + 89. 6.03.10, 06/25/93 + 88. Makefile and lint patches from Bruce. + 87. Posixsig patch from Peter for svr4 + 86. 6.03.09, 06/11/93 + 85. signal handling broke with the last job control patch... + > (does-not-compute;) + would hang. + 84. don't quit after the first modifier fails: + > set i=aabbcc + > echo $i:s/a/A/:s/b/B/ + AaBbcc + > echo $i:s/x/A/:s/b/B/ + aabbcc + 83. Imakefile fixes for sequents from Jaap. + 82. Move past the bottom of input when we hit ^C, so that multi-line + input commands don't get trashed. + 81. Look only at the first word in ${EDITOR,VISUAL} to determine the + editor name. + 80. Last patch broke listmax. + 79. Remove extra sandbagging in exitstat(). Not needed anymore as value() + will never return NULL. + 78. Save $status before calling aliasrun() otherwise: + > alias precmd 'cd .' + > true + > echo $status + 0 + > false + > echo $status + 0 + 77. 6.03.08, 06/07/93 + 76. missing prototypes/unused variables under SYSV4. + 75. savedirs should glob the filename argument. + 74. 6.03.07, 06/05/93 + 73. Changed _Q, _Q1 macros in sh.lex.c, sh.dol.c, sh.char.? to _QF and _QB + because today 4.4BSD defined _Q to be ``Phonetics'' + 72. listmaxrows variable. + 71. set -r would not make existing variables readonly. + 70. print usernames with ~user where possible in dirs and job cwd's + 69. Mika's fixes (missing args in sh.c set(), linux Makefile, SIGCHLD) + 68. FIONREAD argument is int everywhere except on SunOS where it is long. + Tcsh used to think that it was long, and so it broke on the alpha where + sizeof(int) != sizeof(long) + 67. 6.03.06 05/16/93 + 66. Pipeline fixes. This should get rid of the dreaded Stopped tty output + message. + 65. Michael's fix for history buffer cleanup: + > alias foo 'echo \!:1:h' + > foo a/b + a + > ^P [nothing happens] + 64. Unsigned long rlimit type for 64 bit machines (alpha) + 63. Fixed Imakefile for alpha + 62. tilde expansion now obeys $nonomatch + 61. readonly veriables. 'set -r x=3' will set x to a very sticky 3... + 60. Fixed bug in the new tab'ed completion that interfered with old listing. + 59. Fixed entry -> item in tw.parse.c + 58. Added -f option to unlimit + 57. Define __STDC__ in Imakefile for Irix + 56. Static redeclarations in tw.parse.c + 55. 6.03.05 04/26/93 + 54. Don't echo history expansion in loops: + > alias junk 'foreach i (\!:2*) \ + foreach? echo \!:1 $i; \ + foreach? end' + > junk a b c d + echo a $i ; + a b + echo a $i ; + a c + echo a $i ; + a d + 53. Added complete-word-fwd and complete-word-back that scroll through + the list of possible completions... Neat addition from + jfink@csugrad.cs.vt.edu (Jeff "$DOTDIR" Fink) + 52. Workaround hpux9.01 broken optimizer in sh.glob.c where 'ls *' breaks. + 51. Michael's editor fix. With "magic margins" and 80 char width, try: + > set prompt= + 20aa76bac + 50. Reverted fix that does not glob the expanded back-quote text again. + 49. > cd /., echo $cwd + /. + Eliminate the . in this case... + 48. Matt's optimization in glob.c [retracted] + 47. Fixed bug with -S + 46. Renamed Makefile Makefile.std, and fixed the readme file + 45. 6.03.04 04/07/93 + 44. Changed -s == !-z and -S == socket + 43. Fixed typo in sh.c, in phup [shpgrp != pr->pgrp] + 42. Multi-line aliases are not entered into the history when executed. + 41. Changed f_seek to a union to avoid gcc warnings on 4.4BSD + 40. Fixed 'unset home; dirs' bug + 39. fixed $HOME->$home memory problem. + 38. $?0 returns false now on interactive shells for csh compatibility. + 37. Default watch inteval was 10 hours not 10 minutes as advertized in the + manual! + 36. Fixed clobbered veriable warning from gcc-1.39 in tw.parse.c + 35. Fixed typo with INVPTR in sh.lex.c + 34. 6.03.03 03/04/93 + 33. Eliminate 'Reset tty pgrp error message'. It is normal for the + walking process group stuff. Check about the killpg() above? + 32. More portability for 64 bit machines. + 31. Improved completion error messages. + 30. Fix bug with double globbing expansion on mirrored variables: + > setenv TERM '?vt100' + 29. Avoid hanging when writing to pipes etc. (From Paul Close) + 28. Typo in the $HOME->$home mirroring. + 27. %p %P 'p'recise time formats that include seconds for prompt strings. + 26. Signal list fixes from Paul Close. nsig is now a variable. + 25. 6.03.02 02/12/93 + 24. NEC SX3 "entry" is a reserved word!, changed entry to item... + [this is as bad as cray typedefining "word" to int. Next thing I know, + I'll have to prefix all the variables with tcsh_!] + 23. xxx + 22. Protected all include files to avoid warnings from lcc. + 21. Finally resolved the job control problems with linux and ISC (from Beto) + 20. More HUP,XFSZ,XCPU fixes. (with Beto) + 19. Dcanon would not canonicalize correctly in case where dnormalize() + failed to find a directory, but the directory existed when not + crossing the symbolic link. + 18. sh.init.c fixes; give 65 signals for all POSIX machines. + 17. AMS mail fixes and cmu wm handling. + 16. Setenv would not ignore trim quoted names... + > alias foo 'setenv "\!:1" bar' + > setenv FOO 123 + > foo FOO + > printenv + ... + FOO=123 + FOO=bar + ... + 15. 6.03.01 08/01/93 + 14. #undef SHORT_STRINGS gcc warning fixes... + 13. csh bug fix in foreach [quoteing problem] + > foreach i ("*") + > echo $i:q + > end + Should print * + 12. ls-F obeys showdots... + 11. After scheduled commands get executed, the editor could stay disabled + until the first enter. + 10. sigset() bug in ed.init.c; ^C could get disabled sometimes. + 9. Don't glob in dowhich(); otherwise \pat does not work if pat is aliased. + 8. When completion patterns are used $ and ~ expansion did not work right. + 7. Printenv builtin and long backquote expansion fix from Harald. + 6. $:-1, $:-0 enhancement from Paul and Michael. + 5. Lynx/OS patches + 4. Apollo bugs [Setenv -> tsetenv, typedef in pid_t] + 3. ^@ did not work correctly in bindkey. + 2. Fix vms/posix ifdefs in tc.alloc.c + 1. Elide gcc-2.3.1 warnings + + +V6.03.00, 11/20/92 +102. Solaris2 patches, renamed sunosX to sosX to fit in 14 character filenames. +101. 6.02.12 11/12/92 +100. Decreased BUFSIZE to 1K... +99. Don't use sbrk() in tc.alloc.c on VMS +98. EINTR error handling from Michael +97. Overwrite mode takes effect immediately, not delayed by a command. +96. Emx fixes. +95. SIGHUP gain... +94. Coherent times()/ fixes. +93. 6.02.11 10/27/92 +92. Mach setpath fixes. +91. Which now globs its arguments +90. Again POSIX SIGHUP fixes... Maybe we got it right this time... +89. Increased BUFSIZE to 4K. Smaller machines may want to decrease this. + [ Now one can edit up to 4K of buffer! ]. From Harald. +88. : is now a true builtin that does nothing, instead of being treated like + the last character of a label. This is so it can take args. From Harald. +87. More fixes for hpux limits from Harald. +86. Login shell if ppid == 1 and argc == 1 for VMS. +85. Typo in sh.exec.c from Harry. +84. Per's editor fixes. +83. 6.02.10 10/17/92 +82. Don't free STRNULL in freelex(). Update linked list in copylex() to + do the same insert as in lex(). +81. Fixed spurious tilde printing in %c prompt. +80. Fixed dumb wild free in AddXKey... + (thanks Harald for the complex bindings! :-) + > bindkey "\e10z" expand-line # Any editor command will do + > bindkey -[cs] "\e10z" "foo" # Any string or command will do + Free(%x) .... +79. coherent additions. +78. fixes for hpux8 resource limits [Thanks Harald] +77. 6.02.09 10/10/92 +76. More vms cleanups. +75. Removed #include CONFIGH from sh.h. There was no way to make it work + under VMS/POSIX +74. Added t completion (Gray Watson) +73. Memory leaks in sh.dir.c and sh.glob.c [thanks purify :-)] +72. IRIX 5.0 patches (from Paul Close) +71. BSD resource limits for hpux8.0 (From Andreas Stolcke) +70. NGROUPS_MAX fixes (from Matt Day) +69. 6.02.08 10/04/92 +68. VMS port additions. +67. Added $%var, which == strlen(var) +66. Added ^X^I and ^X^D to override programmable listing+completion +65. Added case insensitive globbing for OS/2 +64. FIOCLEX and FIONCLEX are only used if we don't have FD_CLOEXEC. +63. Added emx termio support, and emx pathsep support; emx compiles and runs: + needs job-debugging and finishing touches. +62. Horrible bug with the lex linked list; from Loic Grenie, grenie@ens.fr + > echo a !# + echoed 'echo a echo a echo'! +61. Shell -w,-x were incompatible with the same for test [POSIX] (beto) +60. builtin newgrp did not accept the - argument. +59. FIOCLEX for the masses (POSIX FD_CLOEXEC addition) +58. Old style csh completion bug fix [not used] (beto) +57. A background process waiting for input from tty + blocks when being foregrounded doesn't read its input and + doesn't get and signals. + It can only be killed from another session. (beto) + > cat > foo + #!/bin/csh -f + echo ">>>>>>" + set x = $< + echo $x + ^D + > chmod +x foo + > foo & + > fg + ^Z,^C # Nothing happens +56. history > 1000 fix (beto) +55. 6.02.07 9/18/92 +54. Added e_stuff_char() to put back a character in cooked mode in + the input stream... Useful for status (^T) +53. $? == $status and $# == $#argv like in the bourne shell. +52. Added $dirstack. Problems: off by one since =0 == $cwd, but + $dirstack[1] == $cwd... Suggestions welcome. +51. Leading spaces would confuse the run-help function. +50. Don't expand imported environment variables: + > setenv HOME \* + > tcsh + > echo "$home" + > echo "$HOME" +49. %C0n displays the number of directories omitted as /usr/local/bin /<2>bin/ +48. Added POSIXSIGS as a configuration option. +47. Per's fixes for history format and arrow key binding. +46. Expand-variables expands array variables too +45. 6.02.06 8/14/92 +44. Separated limit stuff from BSDTIMES and added BSDLIMIT +43. History searching inconsistent with HistLit: + > echo foo + foo + > ^foo^bar + bar + > ec[M-p] + echo foo +42. 6.02.05 8/8/92 +41. sourcing a script that contains 'onintr -; onintr' would disable + interrupts on the command line +40. cd ../... with symlinks=ignore would work !@#!@ +39. No more BACKPIPE for POSIX machines... +38. SUNOS NLS bug workarounds... +37. New HASHBANG define for #! emulation... even 386BSD does not have it + yet... +36. Added new -b -c file operators from SGI csh. +35. 6.02.04 7/23/92 +34. Walking process group fixes. +33. $0 contains now argv[0] when we are not executing a shell script. +32. New Getwd() was broken. +31. 6.02.03 7/17/92 +30. We kill our last foreground process group on HUP, for POSIX systems. +29. Walking process group fix. +28. $shlvl gets reset to 1 for login shells. +27. Macros can now involve multiple commands, i.e. + bindkey -s "^[OP" "ls\n^P" +26. 6.02.02 7/6/92 +25. nostat accepts now a list shell patterns. +24. Avoid print_exit_value in if ( { foo } ) +23. Symbolic key names for bindkey [arrow keys]. +22. Smarter getwd() that avoids some of the NFS hangs... +21. Use memmove() where possible. +20. 6.02.01 6/16/92 +19. Fix automatic correction to work with the new completion. +18. Globbing bug with brace expansion, when arguments need to be realloced... + e.g. echo 134{6,7}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9} +17. shift and left operators update variables correcly ('shift path' did not + work) +16. apollo fixes for cd. +15. STRNULL <-> NULL bug fixes. +14. %S in xprintf for short strings. +13. history -LSc, dirs -LSc additions, builtins builtin [oxymoron] +12. history formatting string, who formatting string, prompt formatting + all use tprintf() now. +11. $history accepts a second formatting argument.. +10. History timestamps preserved in .history +9. Backquotes were broken: echo hi | cat > `echo foo` +8. SGI -t operator problem. +7. Dnix fixes. +6. Fix history file writing bug when autologout. +5. Change from TCSETA to TCSETAW, since we affect the output. +4. Per's fixes for display margin bugs. +3. Linux fixes. +2. Collapse adjacent stars in glob.c to avoid exponential behavior. +1. Fixed parseescape to put ^ literally if not followed by alpha. + + +V6.02.00, 5/15/92 +94. Default echo_style was not being set correctly. +93. $< did not work correctly with NLS chars. +92. 6.01.15 (5/11/92) +91. Minor cleanups in refresh code. +90. 6.01.14 (5/8/92) +89. Print \n in the right margin always to be consistent. +88. Linux patches. +87. 6.01.13 (5/2/92) +86. Fixes in listing and completion of non-unique commands. +85. Fix =stack entries > 9... from Bill Petro +84. Fix for last character at margin. [on terminals that have am & xm move + the cursor manually to the next line] +83. Fix for complete completions +82. small typo in tc.alloc.c from Mark Moraes. +81. small typo in tw.parse.c from Richard. +80. Man page fixes from Per. +79. 6.01.12 (4/24/92) [release version for 6.02] +78. Autosuffix was not getting reset all the time. +77. Don't limit completion patterns to 1K. +76. Naming changes in ed.screen.c from Justin. +75. 6.01.11 (4/10/92) +74. Fixed magic-space ! expand bug: + > echo a b123 45.{6,7} + > echo !:2!:3[magic-space] +73. Work-around for apollo optimizer in tc.bind.c +72. Problem with setjmp in tw.parse.c +71. symlinks=expand from Yumin. +70. tenematch() fixes from Michael; +69. 6.01.10 (4/3/92) +68. Fixed Gnmatch. +67. Removed ignore_symlinks and chase_symlinks. Replaced by symlinks variable. +66. Backquote from completion was broken for machines with no dup2() +65. No $printexitvalue for `` jobs. +64. Added ultrix stuff for PW_AUTH [from Mike Potter mpotter@lampf.lanl.gov] +63. Fixed bug in Gnmatch(), added 'N' command 'x' completion. +62. Fixed fg_proc_entry() so autologout gets disabled when a process + is foregrounded. +61. 6.01.09 (3/26/92) +60. source builtin takes arguments now that are passed in the script e.g.: + > ./tcsh -i a b c + > cat test + echo $argv + > echo $argv + a b c + > source test 1 2 3 + 1 2 3 + > echo $argv + a b c +59. Eliminate $margin_bug, add more intelligent margin code [from Justin] +58. expand_symlinks variable Urgh... +57. SGI CONTROL() fixes... +56. new dnormalize(), expand_symlinks flag. +55. interrupting completion restores the current line. [from Marc] +54. 6.01.08 (3/20/92) +53. inputmode affects the first line too. +52. Searches in vi do not destroy the current line. +51. -drwX test enhancement. +50. Generalized completion syntax and added more completion builtins. +49. Don't print '\n' on the right margin if we can avoid it. +48. 6.01.07 (3/9/92) +47. New completion style. [[[ ]],=] +46. 6.01.06 (3/7/92) +45. complete styles are ignored after shell metachars eg. + > complete mail =u + > mail christos < [tab] + completes filenames. +44. $echo_style is initialized to the default style of the machine. +43. SGI 4.0 CTRL() macro is busted. So we ignore it. +42. Fixed bug with the new margin code (thanks justin) +41. Fixed mirroring of variables. Now set and setenv affect + HOME, TERM, PATH, SHLVL, USER and their csh counterparts. Unset affects + affects only the csh copies of the variables, and unsetenv only the + environment variables. +40. Fixed gcc-2.0 warnings in sh.sem.c (needed for vfork() -O2 optimization) +39. 6.01.05 (2/21/92) +38. signal masking for BSD machines was still wrong in tw.init.c +37. Added $margin_bug, and now the editor outputs on the rightmost + column by default. This should fix the xterm cut-n-paste problem. +36. AU/X 2.0 and SGI compiles with POSIX as a default now. +35. sysv_echo is gone too. Now we have a variable called echo_style + which can be set to "none", "bsd", "sysv", "both" that defines + the builtin echo_style. The default is "bsd" for systems with + SYSVREL == 0, "sysv" otherwise. This can be overriden in config.h + by defining ECHO_STYLE ro be BSD_ECHO, SYSV_ECHO, BOTH_ECHO, + or NONE_ECHO. +34. asynchronous notification in run-fg-editor would try to change the + tty settings and print an extra prompt. + > set notify + > sleep 10 & + > vi^Z + > ^[^Z +33. alias x /bin/true + x? + reported .//bin/true instead of /bin/true +32. 6.01.04 (2/12/92) +31. fixed vi_substitute_line +30. binding completion addition. +29. showdots=-A addition +28. sysv_echo addition; deleted bsd_echo which is now the default. +27. dunique could crash. +26. Don't clear lines after an asynchronous notification, because it + might erase the message. +25. 6.01.03 (1/29/92) +24. `` were not working correctly when tcsh is started with 0,1,2 closed. +23. Correction was picking up the wrong thing in cases like .rhosts hosts +22. Correction with names with quoted spaces was broken. +21. Added sysv_echo and bsd_echo. +20. Added and documented the complete builtin. +19. Added dunique and cd -. +18. Per's fix for alarm functions. Things would break if time went backwards. +17. Realloc bug fix (copy min of old and new size) +16. Fix for csh compatible braces. +15. Brace globbing and negation globbing for Gmatch. +14. 6.01.02 (1/16/92) +13. Completion builtin, new tw* files. +12. 6.01.01 (1/6/92) +11. Changed w_ fields in tc.who.c to who_ to avoid redefinitions in + in some os's. +10. Setting savehist to an empty string makes savehist use the value + in $history. +9. echotc did not use the internal termcap descriptions. +8. echotc did not work right for single argument termcap strings. +7. DGUX needs SAVESIGVEC, updated type protection, and disabled CSWTCH. +6. Changed SVID to SYSVREL, since there is no SVID == 4 (yet). +5. Typo in tc.sig.h: UNRELSIGS was not getting defined. +4. Globbing bug fix. tglob() should ignore globbing characters inside + backquotes otherwise things get expanded twice: + % echo 'bar?' > 'foo?' + % echo `cat foo\?` + echo: No match. +3. Mach setpath fix. +2. Alliant process group fix. +1. Xenix fixes for broken vi and help path with no suffixes. + + +V6.01.00, 12/19/91 [for comp.sources.unix] +22. Restore the original prompt in automatic correction when the user + asks to re-edit the command. +21. Better error for unreadable files in tw.parse.c +20. Sequent patches. +19. (V6.00.08 beta 12/14/91) +18. Filenames containing # were spelled/expanded incorrectly. +17. Stellar/stellix port. +16. Hpux 8.0 has SIGWINDOW but we cannot get the window size. Protect + against window changes updating $LINES and $COLUMNS. +15. Mach setpath did not work right. +14. Mach does not need setenv in lib; in fact that does not work right. +13. shell level gets decremented when we exec. +12. restart_fg_editor picked the wrong editor if arg contained a slash. + e.g vi ~/.cshrc +11. (V6.00.07 beta 12/08/91) +10. Allow use of vfork() on systems that do not have job control. +9. Avoid NUMCC from being defined twice. +8. (V6.00.06 beta 12/05/91) +7. SunOS3's FIOCLEX dups... +6. Yet another globbing bug fix from Michael (echo .[^.]) +5. Ultrix now wants __ before cpp symbols. +4. Workaround sun's header files inconsistency so tcsh can be compiled + with #undef POSIX +3. Fixed limit stuff so that large values don't cause errors. +2. Fixed =1 and ~user error messages (Per) +1. (beta-5 6.00.04 == 6.00.05) + +$#* +$#* New numbering scheme (The last 2 digits are reserved for beta releases +$#* from now on. So we start at 6.00.06 which is 6.00.04 beta 6, and we are +$#* going to release 6.01.00... +$#* + +V6.00.04, (never released) +34. (beta-5 11/25/91) +33. Simplify code in BindArrowKeys() +32. Get rid of the PNULL's +31. Support for shadow password in locking code. (From Kimmo) +30. Normalize-path editor function. +29. (beta-4 11/21/91) +28. minix additions +27. bindkey fixes (-c addition, casting cleanups) +26. (beta-3 11/16/91) +25. Prompt length checking. +24. Michael's fixes for the watching code. Tcsh could core dump when using + a corrupted utmp. +23. overwrite mode flag, and autologout locking code. +22. overwrite mode would still insert digits! +21. Get the value of _POSIX_VDISABLE from pathconf... +20. Hpux 8.0 fixes. Sigstack botches with shared libraries. Ansi mode + static initialization of structures with prototyped function pointers + gives spurious warnings... +19. Onintr in /etc rc files is disabled. +18. (beta-2 11/03/91) +17. Multi-line aliases with `` bug fix. +16. Sticky emacs overwrite mode. +15. Autolist option. +14. Fix for redirection with wildcard filanames. +13. No error correction for multi-line commands. +12. Esix-4 re-defines p_pid. Argh... +11. (beta-1 10/28/91) +10. Foreach loops were broken again. +9. SUNOS localtime() bug does not only happen on the 8th byte. [Michael] +8. sh.dir.c, memory corruption in dinit(). Thanks Michael. +7. uts broken work-around, and has a wait3() +6. SGI (-t filename) extension, returns true when filename is a tty. +5. 'default:' addition in all switch() statements. +4. oflag was not being updated correctly in Rawmode() +3. missing 'break;' in prompt code '%y'. +2. infinite loop in :a code. +1. hashstat was not reporting hits+misses + + +V6.00.03, 10/21/91 +31. watch code now accepts shell patterns. +30. new hashing code portability fixes. +29. $foo:gs/:/ / fix and 'a' modifier addition. +28. Added $! (the pid of the last background job forked) +27. exec does not kill the shell when it fails. +26. Irix4.0 decls. +25. SVR4 uthost fixes from Kimmo Suominen +24. Imake addition from marc +23. New i-search from Per. +22. ibmesa fixes +21. convex fixes. +20. t command for vi. +19. SVR4 fixes (reverse pipeline and sigaction()) from David Dawes. +18. New hashing from Marc +17. Added : to the ~name separators so ~foo:~bar works. +16. New ed.init.c. Added ed.term.c +15. Still can't get the history exactly csh-like... !-2$ was broken... +14. vi character searches. +13. -Dvar=name command line option for the apollos. +12. Prompt format changes for date/directory. +11. Vi searches. +10. Emacs i-search. [currently not bound] +9. Vi additions ([dc]-{w,$,f},Undo) +8. tcsh -n parses now builtin structures. +7. seek to the end on errors in loops. +6. echotc -s was broken +5. Better !event parsing. !foo;!bar was broken. +4. foreach loops and if statements in aliases. +3. .cshdirs would corrupt the heap if some directories were not there. +2. System V echo was broken with \ +1. Fixed echo '!-1', history would eat the quote. + +V6.00.02, 08/05/91 [For comp.sources.unix] +8. tcsh will always set $LOGNAME and $USER if not already set in the + environment. +7. added $histfile. +6. echo `echo` * and echo ~ {} were broken +5. setty builtin addition +4. Multiple : modifiers [experimental, disabled with -DCOMPAT] +3. 7 bit fixes, and hp9000s500. +2. #undef DEBUG in tc.alloc.c, so we continue if we get a bad free() +1. getn() is now protected against NULL strings. + +V6.00.01, 07/16/91 +17. added beepcmd, and fixed small tenematch bugs. +16. Renamed DUP2 flag to HAVEDUP2 cause AIXPS2 defines DUP2 already. +15. More ANSI fixes, and mit additions (load-average) +14. don't clear ECHOE, background programs might need it. +13. Refresh bug fix... +12. getpwent() should not be interrupted (yellow pages), cause it might + leave dangling pointers, that endpwent() will trash. +11. ChangeSize is now responsible to set the screen size to something + sane, but it should not affect the environment if the information + it received is not valid +10. Find out if we are running under emacs using $TERM. It is more + reliable. +9. tcsh was broken if SHORT_STRINGS was not defined (glob() problem) +8. If GetSize() fails it should always return reasonable screen sizes. +7. globbing should not fail if one or more patterns match. +6. increased the number of aliases in the loop detection code. +5. DGUX has size_t and pid_t defined now... +4. ESIX does not have EWOULDBLOCK or EAGAIN & POSIX... That was not handled + correctly. +3. rs6000 needs BSDWAIT. +2. Hpux susp key could not be changed. +1. Apollo fixes. + +V6.00.00, 07/04/91 +45. Fixed quoting of VSTART/VSTOP on termios +44. Memory leak every time you pipe in or out. +43. echo {foo bar.[ch]}. Did not check for end of word. +42. ANSI prototypes +41. dmove() would leave the source descriptor open when using dup2() + e.g. + while (1) + echo foo >>! bar + end + runs out of file descriptors +40. recursive `` expanded via aliases would abort. +39. set home=../relative-path-name was broken. + e.g. + set home=../..; cd ..; + +38. Incorrect error when changing to directory: + e.g. + mkdir not-in-cd-path; chmod -x not-in-cd-path; cd not-in-cd-path; + echoed: + not-in-cd-path: No such file or directory. + it should have said + not-in-cd-path: Permission denied. +37. if ( \! =~ [\!] ) echo ok, did not echo ok. Quoting inside [] pattern. +36. More than 127 jobs caused job # to go negative +35. unsetenv ... Added support for more than one pattern. +34. More background process status report fixes. +33. Apollo builtin support. +32. Glob fix. echo '*' * was not handled properly. +31. Glob fix. setenv FOO `sleep 1` would either cause a segmentation fault. + or print ambiguous. +30. Glob fix. Quoted characters inside [] were not handled properly. +29. Removed TELL and VMUNIX defines. I think we cannot compile on V6 anyway +28. Overflow check for expansions. +27. Added matchbeep, shell pattern history searching. +26. Added code to handle /dev/std{in,out,err} +25. Fixed POSIX speed handling in raw mode. +24. Fixed a flushing bug in the filec code in sh.file.c +23. Compiled and added hp9000s700 to the list of hosts. +22. Fixed horrible bug in gmatch() + switch (4) + case [a-z]: + echo bug; + breaksw; + case 4: + echo ok; + breaksw; + endsw +21. Fixes for _SEQUENT_ ut_host. +20. FLUSHO added +19. mkdir foo\`bar; cd foo\`bar; was broken +18. EWOULDBLOCK == EAGAIN on RENO check for that too. +17. Dword() simplified and removed the gotos. +16. Hpux now compiles with POSIX. Moved the local chars modes in ed.init.c + after the tty modes. +15. Process group fixes for POSIX +14. We need on the suns for FIOCLEX!!! We did not close + our file descriptors before... +13. A/UX fixes. +12. History events that start with a number are not necessarily numeric: + > !3d + 3d: Event not fount +11. History loop detection added. + > alias a \!# + > b; a +10. Alias loop detection code was ineffective on eager optimizers. + 9. All errors should now go through our table. Next step we should + add nls error messages. + 8. Unsetenv now globs its arguments! Before it did not... + 7. Added tilde cache and -l flag. + 6. Added autocorrect + 5. Fixed for so that background jobs in scripts get process groups + 4. Fixed amazing memory leak in setenv()... + 3. Added short2qstr() so that we can form quoted strings to be used with glob() + 2. str2short and short2str allocate space dynamically. + 1. Fixed bug related to the is*() routines called with shorts. + [only if NLS and SHORT_STRINGS are defined]. + (The _ctype_ was getting indexed with shorts...) + 0. Complete overhaul. Brought in the 4.4 csh stuff. Separated most + tcsh and csh code except where I would have to add more global + variables. Compiled correctly with both lint and gcc -Wall on + a sparc running 4.1 + +V5.20.03, 03/20/91. - Never released +25. Kanji, SXA additions. +24. (exec foo) should not fail if they are suspended jobs. +23. Support kernel paging stuff on aix 370. +22. Now we handle correctly the environment variables LINES, COLUMNS, + TERMCAP for window size changes... +21. Tcsh 5.18c+ had broken NULL chars on scripts. + > cat > foo + #!/usr/local/bin/tcsh -f + echo "foo" + echo "^V^@" + echo "bar" + ^D + > chmod +x foo; foo + foo +20. Posix has EAGAIN and not EWOULDBLOCK +19. Don't set ECHOK; makes kill ^U ugly. +18. $shell is SHELLPATH and not $SHELL any more. +17. Added -n flag to cd, pushd, popd and dirs. Documented -l and -v + flags. +16. Documented and fixed chase_symlinks and ignore_symlinks. +15. Call endpwent() when you get interrupted... + cd ~chri^C + cd ~christos/ + +14. Exec when you have suspended jobs asks for verification. +13. Variable length fixes: + >set abcdefghijklmnopqrstuvwxyz=1 + >echo $abcdefghijklmnopqrstuvwxyz + abcdefghijklmnopqrs: Undefined variable + Now we have better messages too... +12. Icon fixes... +11. Quote expanded glob and history chars too. +10. If someone sets SHIN to O_NDELAY we died... Now we set it back... + 9. unset path; unsetenv PATH; ls-F; (poof) fixed... + 8. Patches for masscomp, and ${var123} lexical analysis fix... + 7. Patch for sunview bug: A partially covered suntool sends SIGWINCH every + time the text is scrolled, causing annoying redraw effects. Now tcsh + checks if the size really changed before doing anything. + 6. Interrupt in the middle of cwdcmd, and periodic does not remove the + aliases. + 5. prompt2 and prompt3 fixes: + Prompt2 now prints the status of the parser by default. + Prompt3 can now have the standard prompt escape sequences. + 4. eval file descriptor re-direction fix. + >set p='w | tail +3' + >eval $p + (originally | tail +3 was ignored) + 3. $edit != emacs anymore; it was misleading, 'set edit' enables editing + 'unset edit' disables it. + 2. PERROR define fix. + 1. irix3.3.1 line discipline fix. + +V5.20.02, 12/15/90. +32. /etc/Logout added and merged with /etc/Login flag. +31. Fixed tty chars in ed.init.c. Some of them were not handled correctly. +30. Command execution does not leak memory any more, and doing + ~ four times does not core-dump. +29. Fixed the notorious csh 'if(' bug (part of the convex fixes) +28. Intelligent getwd() on startup, and canonicalization. +27. Intelligent directory stack. Gets updated when $HOME changes. +26. Directory stack/save-restore additions +25. Convex Fixes. +24. Fixed onlret, and echonl getting stuck on svid. +23. Shouldn't leave tty in raw mode at auto-logout (e.g. when su'ing from a + csh, this is annoying). +22. Some users had environment EMACS set to something, and with my bad fix + at pl 1 found that they didn't have echo... (of course, even before my + "fix", they didn't have editing...). Anyway, refined the check to be + for EMACS=t, which is what emacs sets when running a subshell. +21. kill -CONT %job, would not update the status of the job, but it would + just restart it. +20. Sequent fixes. +19. AIX370 signal and TCF fixes. +18. fixed ls-F -l, SIGINT problem. +17. aix on the ps2 does not have strcoll() either. +16. Bind [A - [D and OA to OD in vi mode to the arrow key functions + so that they work from insert mode. +15. %~ was not working correctly for /home/news and /home/newsbin... +14. Removed Rcs Log +13. ISC unix fixes. +12. sunos3.x wants not +11. Remove precmd's, cwdcmd's and periodic cmds that had errors. +10. Compile sunos4.1 using termio. + 9. Rs6000 line discipline fixes. + 8. T_Tabs was wrong for termio machines. + 7. Don't bind single keystroke arrow keys, when they are already bound! + 6. Test for newline and tab before deciding not to send shell scripts + to the bourne shell. + 5. Added LITERAL prompt stuff. + 4. Fixed gethostname() in sh.rest.c to return the nodename. + 3. Do not quote spell checked stuff. This is not very intelligent but + works better than before. + 2. Fixes for relative path components. (paths that start with a .) + 1. Fixed so that Rawmode() is not called when we are not editing + (breaks running under emacs) + +V5.20.01, 11/15/90. +12. Recognize environment variables too. +11. Always start in Rawmode() +10. don't try to execute binary files using the bourne shell. + 9. Vi change to end of line updates correctly now. + 8. Prompt in continuation lines. + 7. Prompt in if statements fix. + 6. System V ^C works right now. + 5. ^Z works correctly in bindings + 4. Better error messages for variables. + 3. dinit() now is more robust. + 2. Added aux2.0 patches. + 1. Fixed bug with arrow key bindings in ed.screen.c. All the keys + were bound to up-history! + +V5.20.00, 11/10/90. +26. Fixed system V and POSIX time reporting. +25. Fixed ed.screen.c so that it does not use malloc(). +24. Fixed SIGWINCH on the iris +23. Fixed ed.screen.c, so that settc works correcly. It used to set + the termcap with a string that was allocated from the stack! +22. Fixed listing of commands, where the last command was not checked. +21. Fixed which command. It did not work for + \, if command was aliased. +20. Eliminated CSH4.3 define. You've had enough time to upgrade from 4.2 +19. Fixed GotTermCaps to be called only once. +18. Added bindkey -r +17. Attributes were not getting reset correctly. +16. history -t does not print the time-stamp. +15. AddXkey, works now for single character xkeys. +14. filetype() knows better about symlinks. +13. ls-F works with filenames that have metachars +12. Completion/spelling works with quoted things. +11. Fixed refresh bug. Repeat by: + On an intelligent terminal that has insert and delete chars (xterm) + > orphan + > vi orphan.c + > ^P^P +10. Fixed so that if we don't have a tty on stdin editing is disabled. + 9. Check for nested process forking, to avoid loops such as: + > alias foo 'set bar=`foo`' + > foo + 8. Fix setting of AsciiOnly (Per) + 7. tw.spell.c, defined F_OK for systems that don't have it. + 6. ourwait.h had typo in ifdef. + 5. BSD compilers need a cast to int for enums used in + switches (Matthew Day) + 4. Found the cause for the core-dump in long backquote + expansions (Mark Davies) + 3. Some externs in ed.h needed to be truly externs... + reported by Mark Davies, bug appeared only on hp9000s800. + 2. Changed $tcsh, and $version strings. + 1. Added internal sprintf function, renamed putchar to CSHputchar, + printf to CSHprintf, sprintf to CSHsprintf. + +V5.19.02, 10/23/90. +36. Added /etc/cshrc for the SGI irises. +35. Added expand-variables function. +34. Documented $time in tcsh.man +33. Shell variables are now 'recognized' when expanding/listing things. +32. ls-F does not eat the last slash on the / directory! +31. Strings bound to keys are printed inside double quotes. +30. History now remembers the exact line, not just an unparsed version of + the tokens. +29. Renamed itoa to Itoa(), so things in libc that use itoa() don't break. +28. Ported to IBM aix/ps2. +27. Fixed eval so that it forks when the output is piped + Repeat by: + > who | grep $user + > eval who | grep $user +26. Fixed so that 'nice ' does not + nice or fork. + Consider doing: + nice cd /tmp && rm *.c (don't try it!!!) + [what actually happens is that nice has to fork, then the child executes + chdir, and the parent stays where it was] +25. Added Dan's patches (nls, builtin bindkey, fixes to the editor). +24. Added aix370, migrate, getspath, getspath, getxvers, setxvers +23. Added builtin echotc, removed sl and el. +22. Ported to 4.4 BSD. This involved changing the way lots of flags worked, + cleanup of the SVID stuff, and addition of more compilation flags. + Now POSIX can work whed BSD is defined... +21. Fixed so that el, sl work. Actually they are to be removed soon and + be replaced with echotc. +20. Avoid the Quoted Space hack for alias when printing jobs! + [aliases to the same name avoid further alias expansion, by + inserting a quoted space in front of the command. In SHORT_STRINGS + QUOTE is the 15th bit so print ignores it thinking it is the + end of the string. So we just skip the Quoted Space....] + Repeat by: + > set notify + > alias ls ls -F + > (ls) & + Prints Exit 0 ( + Should print: Exit 0 ( ls -F ) +19. Fixed so that "", '', ``, all produce ': Command not found', + and not the spurious messages. + Repeat by: + > set path = (/bin /usr/bin .... .) + > "" + /some/path/name/: Command not found +18. Enable the use of macros if they exist and NLS is defined. + NLS code is not ready yet. +17. Fixed rmstar and continue_jobs code, so that they are not compile + options, but shell variables. Now you need to 'set rmstar' to get + enable rmstar. +16. Fixed SIGWINCH, SIGWINDOW, and setting of li, co, that broke + suntools, and others. + Repeat by: + Start a shelltool of size other than 80x34 + > telltc + > stty -a + do not report the same number of lines and columns. +15. More fixes to tw.parse.c, and tw.spell.c. +14. More fixes to sh.char.c. +13. Fixed coredump caused by ``. +12. Fixed spell-line code.. +11. Trapped SIGCHLD in sh.sem.c, while forking. Still there is a small + race, but the probability of happening is smaller! +10. Fixed sh.char.c to be ISO compliant. + 9. Added expand-glob + 8. Fixed ourwait.h for little endians. + 7. Fixed that foreach i (^D expands correctly. + 6. Fixed so that listmax is ignored in ls-F. + 5. Fixed spelling correction so that single letter words and words that + contain globbing chars do not get spell checked. + 4. Changed NeXT HOSTTYPE to next, since all HOSTTYPE's are lower case. + 3. Fixed symmetry, and changed symmetry HOSTTYPE from sequent to symmetry. + 2. Added boldfacing, underlining chars. + 1. Added IRIX3.3.1 support. + +V5.19.01, 9/26/90. + 7. Brought the README file up-to-date, and changed the bug report + address to point to me. + 6. sh.lex.c. In addla(), overflow computation was wrong. + 5. Fixed SHELLPATH, to be set correctly when $SHELL is not set. + 4. Fixed print statement in sh.proc.c that contained \215. + 3. Fixed the Makefile and MAKEDIFFS so that a tahoe diff can be made. + 2. RS6000: hacked around execv bug, and ed.init.c warning. + 1. Editor should not be enabled when we don't have a tty. Index: vendor/tcsh/6.21.00-83c5be0/README.md =================================================================== --- vendor/tcsh/6.21.00-83c5be0/README.md (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/README.md (revision 353870) @@ -0,0 +1,26 @@ +# TCSH + +*C shell with file name completion and command line editing* + +The Tcsh source code is available on GitHub as a read-only repo +mirror at: + +> http://github.com/tcsh-org/tcsh + +Instructions for compiling Tcsh can be found in [BUILDING]. + +PLEASE file any bug reports, fixes, and code for new features at: + +> https://bugs.astron.com/ + +Comments, questions, etc. (even flames) are welcome via email to +the tcsh mailing list: + +> tcsh@astron.com +> https://mailman.astron.com/mailman/listinfo/tcsh + +[![Build Status][status]][travis] + +[BUILDING]: BUILDING +[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master +[travis]: https://travis-ci.org/tcsh-org/tcsh Property changes on: vendor/tcsh/6.21.00-83c5be0/README.md ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: vendor/tcsh/6.21.00-83c5be0/glob.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/glob.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/glob.c (revision 353870) @@ -0,0 +1,799 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Guido van Rossum. + * + * 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; 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. + */ +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)glob.c 5.12 (Berkeley) 6/24/91"; +#endif /* LIBC_SCCS and not lint */ +/* + * Glob: the interface is a superset of the one defined in POSIX 1003.2, + * draft 9. + * + * The [!...] convention to negate a range is supported (SysV, Posix, ksh). + * + * Optional extra services, controlled by flags not defined by POSIX: + * + * GLOB_QUOTE: + * Escaping convention: \ inhibits any special meaning the following + * character might have (except \ at end of string is retained). + * GLOB_MAGCHAR: + * Set in gl_flags if pattern contained a globbing character. + * GLOB_ALTNOT: + * Use ^ instead of ! for "not". + * gl_matchc: + * Number of matches in the current invocation of glob. + */ + +#ifdef WINNT_NATIVE + #pragma warning(disable:4244) +#endif /* WINNT_NATIVE */ + +#define Char __Char +#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 +#undef META +#undef ismeta +#undef Strchr + +#ifndef S_ISDIR +#define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR) +#endif + +#if !defined(S_ISLNK) && defined(S_IFLNK) +#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK) +#endif + +#if !defined(S_ISLNK) && !defined(lstat) +#define lstat stat +#endif + +typedef unsigned short Char; + +static int glob1 (Char *, glob_t *, int); +static int glob2 (struct strbuf *, const Char *, glob_t *, int); +static int glob3 (struct strbuf *, const Char *, const Char *, + const Char *, glob_t *, int); +static void globextend (const char *, glob_t *); +static int match (const char *, const Char *, const Char *, + int); +static int compare (const void *, const void *); +static DIR *Opendir (const char *); +#ifdef S_IFLNK +static int Lstat (const char *, struct stat *); +#endif +static int Stat (const char *, struct stat *sb); +static Char *Strchr (Char *, int); +#ifdef DEBUG +static void qprintf (const char *, const Char *); +#endif + +#define DOLLAR '$' +#define DOT '.' +#define EOS '\0' +#define LBRACKET '[' +#define NOT '!' +#define ALTNOT '^' +#define QUESTION '?' +#define QUOTE '\\' +#define RANGE '-' +#define RBRACKET ']' +#define SEP '/' +#define STAR '*' +#define TILDE '~' +#define UNDERSCORE '_' + +#define M_META 0x8000 +#define M_PROTECT 0x4000 +#define M_MASK 0xffff +#define M_ASCII 0x00ff + +#define LCHAR(c) ((c)&M_ASCII) +#define META(c) ((c)|M_META) +#define M_ALL META('*') +#define M_END META(']') +#define M_NOT META('!') +#define M_ALTNOT META('^') +#define M_ONE META('?') +#define M_RNG META('-') +#define M_SET META('[') +#define ismeta(c) (((c)&M_META) != 0) + +int +globcharcoll(__Char c1, __Char c2, int cs) +{ +#if defined(NLS) && defined(LC_COLLATE) && defined(HAVE_STRCOLL) +# if defined(WIDE_STRINGS) + wchar_t s1[2], s2[2]; + + if (c1 == c2) + return (0); + if (cs) { + c1 = towlower(c1); + c2 = towlower(c2); + } else { + /* This should not be here, but I'll rather leave it in than engage in + a LC_COLLATE flamewar about a shell I don't use... */ + if (iswlower(c1) && iswupper(c2)) + return (1); + if (iswupper(c1) && iswlower(c2)) + return (-1); + } + s1[0] = c1; + s2[0] = c2; + s1[1] = s2[1] = '\0'; + return wcscoll(s1, s2); +# else /* not WIDE_STRINGS */ + char s1[2], s2[2]; + + if (c1 == c2) + return (0); + /* + * From kevin lyda : + * strcoll does not guarantee case sorting, so we pre-process now: + */ + if (cs) { + c1 = islower(c1) ? c1 : tolower(c1); + c2 = islower(c2) ? c2 : tolower(c2); + } else { + if (islower(c1) && isupper(c2)) + return (1); + if (isupper(c1) && islower(c2)) + return (-1); + } + s1[0] = c1; + s2[0] = c2; + s1[1] = s2[1] = '\0'; + return strcoll(s1, s2); +# endif +#else + return (c1 - c2); +#endif +} + +/* + * Need to dodge two kernel bugs: + * opendir("") != opendir(".") + * NAMEI_BUG: on plain files trailing slashes are ignored in some kernels. + * POSIX specifies that they should be ignored in directories. + */ + +static DIR * +Opendir(const char *str) +{ +#if defined(hpux) || defined(__hpux) + struct stat st; +#endif + + if (!*str) + return (opendir(".")); +#if defined(hpux) || defined(__hpux) + /* + * Opendir on some device files hangs, so avoid it + */ + if (stat(str, &st) == -1 || !S_ISDIR(st.st_mode)) + return NULL; +#endif + return opendir(str); +} + +#ifdef S_IFLNK +static int +Lstat(const char *fn, struct stat *sb) +{ + int st; + + st = lstat(fn, sb); +# ifdef NAMEI_BUG + if (*fn != 0 && strend(fn)[-1] == '/' && !S_ISDIR(sb->st_mode)) + st = -1; +# endif /* NAMEI_BUG */ + return st; +} +#else +#define Lstat Stat +#endif /* S_IFLNK */ + +static int +Stat(const char *fn, struct stat *sb) +{ + int st; + + st = stat(fn, sb); +#ifdef NAMEI_BUG + if (*fn != 0 && strend(fn)[-1] == '/' && !S_ISDIR(sb->st_mode)) + st = -1; +#endif /* NAMEI_BUG */ + return st; +} + +static Char * +Strchr(Char *str, int ch) +{ + do + if (*str == ch) + return (str); + while (*str++); + return (NULL); +} + +#ifdef DEBUG +static void +qprintf(const char *pre, const Char *s) +{ + const Char *p; + + xprintf("%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & 0xff); + xprintf("\n%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & M_PROTECT ? '"' : ' '); + xprintf("\n%s", pre); + for (p = s; *p; p++) + xprintf("%c", *p & M_META ? '_' : ' '); + xprintf("\n"); +} +#endif /* DEBUG */ + +static int +compare(const void *p, const void *q) +{ +#if defined(NLS) && defined(HAVE_STRCOLL) + return (strcoll(*(char *const *) p, *(char *const *) q)); +#else + return (strcmp(*(char *const *) p, *(char *const *) q)); +#endif /* NLS && HAVE_STRCOLL */ +} + +/* + * The main glob() routine: compiles the pattern (optionally processing + * quotes), calls glob1() to do the real pattern matching, and finally + * sorts the list (unless unsorted operation is requested). Returns 0 + * if things went well, nonzero if errors occurred. It is not an error + * to find no matches. + */ +int +glob(const char *pattern, int flags, int (*errfunc) (const char *, int), + glob_t *pglob) +{ + int err, oldpathc; + Char *bufnext, m_not; + const unsigned char *patnext; + int c, not; + Char *qpatnext, *patbuf; + int no_match; + + patnext = (const unsigned char *) pattern; + if (!(flags & GLOB_APPEND)) { + pglob->gl_pathc = 0; + pglob->gl_pathv = NULL; + if (!(flags & GLOB_DOOFFS)) + pglob->gl_offs = 0; + } + pglob->gl_flags = flags & ~GLOB_MAGCHAR; + pglob->gl_errfunc = errfunc; + oldpathc = pglob->gl_pathc; + pglob->gl_matchc = 0; + + if (pglob->gl_flags & GLOB_ALTNOT) { + not = ALTNOT; + m_not = M_ALTNOT; + } + else { + not = NOT; + m_not = M_NOT; + } + + patbuf = xmalloc((strlen(pattern) + 1) * sizeof(*patbuf)); + bufnext = patbuf; + + no_match = *patnext == not; + if (no_match) + patnext++; + + if (flags & GLOB_QUOTE) { + /* Protect the quoted characters */ + while ((c = *patnext++) != EOS) { +#ifdef WIDE_STRINGS + int len; + + len = mblen((const char *)(patnext - 1), MB_LEN_MAX); + if (len == -1) + TCSH_IGNORE(mblen(NULL, 0)); + else if (len > 1) { + *bufnext++ = (Char) c; + while (--len != 0) + *bufnext++ = (Char) (*patnext++ | M_PROTECT); + } else +#endif /* WIDE_STRINGS */ + if (c == QUOTE) { + if ((c = *patnext++) == EOS) { + c = QUOTE; + --patnext; + } + *bufnext++ = (Char) (c | M_PROTECT); + } + else + *bufnext++ = (Char) c; + } + } + else + while ((c = *patnext++) != EOS) + *bufnext++ = (Char) c; + *bufnext = EOS; + + bufnext = patbuf; + qpatnext = patbuf; + while ((c = *qpatnext++) != EOS) { + switch (c) { + case LBRACKET: + c = *qpatnext; + if (c == not) + ++qpatnext; + if (*qpatnext == EOS || + Strchr(qpatnext + 1, RBRACKET) == NULL) { + *bufnext++ = LBRACKET; + if (c == not) + --qpatnext; + break; + } + pglob->gl_flags |= GLOB_MAGCHAR; + *bufnext++ = M_SET; + if (c == not) + *bufnext++ = m_not; + c = *qpatnext++; + do { + *bufnext++ = LCHAR(c); + if (*qpatnext == RANGE && + (c = qpatnext[1]) != RBRACKET) { + *bufnext++ = M_RNG; + *bufnext++ = LCHAR(c); + qpatnext += 2; + } + } while ((c = *qpatnext++) != RBRACKET); + *bufnext++ = M_END; + break; + case QUESTION: + pglob->gl_flags |= GLOB_MAGCHAR; + *bufnext++ = M_ONE; + break; + case STAR: + pglob->gl_flags |= GLOB_MAGCHAR; + /* collapse adjacent stars to one [or three if globstar], + * to avoid exponential behavior + */ + if (bufnext == patbuf || bufnext[-1] != M_ALL || + ((flags & GLOB_STAR) != 0 && + (bufnext - 1 == patbuf || bufnext[-2] != M_ALL || + bufnext - 2 == patbuf || bufnext[-3] != M_ALL))) + *bufnext++ = M_ALL; + break; + default: + *bufnext++ = LCHAR(c); + break; + } + } + *bufnext = EOS; +#ifdef DEBUG + qprintf("patbuf=", patbuf); +#endif + + if ((err = glob1(patbuf, pglob, no_match)) != 0) { + xfree(patbuf); + return (err); + } + + /* + * If there was no match we are going to append the pattern + * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified + * and the pattern did not contain any magic characters + * GLOB_NOMAGIC is there just for compatibility with csh. + */ + if (pglob->gl_pathc == oldpathc && + ((flags & GLOB_NOCHECK) || + ((flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) { + if (!(flags & GLOB_QUOTE)) + globextend(pattern, pglob); + else { + char *copy, *dest; + const char *src; + + /* copy pattern, interpreting quotes */ + copy = xmalloc(strlen(pattern) + 1); + 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; + } + *dest++ = *src++; + } + *dest = EOS; + globextend(copy, pglob); + xfree(copy); + } + xfree(patbuf); + return 0; + } + else if (!(flags & GLOB_NOSORT) && (pglob->gl_pathc != oldpathc)) + qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, + pglob->gl_pathc - oldpathc, sizeof(char *), compare); + xfree(patbuf); + return (0); +} + +static int +glob1(Char *pattern, glob_t *pglob, int no_match) +{ + struct strbuf pathbuf = strbuf_INIT; + int err; + + /* + * a null pathname is invalid -- POSIX 1003.1 sect. 2.4. + */ + if (*pattern == EOS) + return (0); + err = glob2(&pathbuf, pattern, pglob, no_match); + xfree(pathbuf.s); + return err; +} + +/* + * functions glob2 and glob3 are mutually recursive; there is one level + * of recursion for each segment in the pattern that contains one or + * more meta characters. + */ +static int +glob2(struct strbuf *pathbuf, const Char *pattern, glob_t *pglob, int no_match) +{ + struct stat sbuf; + int anymeta; + const Char *p; + size_t orig_len; + + /* + * loop over pattern segments until end of pattern or until segment with + * meta character found. + */ + anymeta = 0; + for (;;) { + if (*pattern == EOS) { /* end of pattern? */ + strbuf_terminate(pathbuf); + + if (Lstat(pathbuf->s, &sbuf)) + return (0); + + if (((pglob->gl_flags & GLOB_MARK) && + pathbuf->s[pathbuf->len - 1] != SEP) && + (S_ISDIR(sbuf.st_mode) +#ifdef S_IFLNK + || (S_ISLNK(sbuf.st_mode) && + (Stat(pathbuf->s, &sbuf) == 0) && + S_ISDIR(sbuf.st_mode)) +#endif + )) { + strbuf_append1(pathbuf, SEP); + strbuf_terminate(pathbuf); + } + ++pglob->gl_matchc; + globextend(pathbuf->s, pglob); + return 0; + } + + /* find end of next segment, tentatively copy to pathbuf */ + p = pattern; + orig_len = pathbuf->len; + while (*p != EOS && *p != SEP) { + if (ismeta(*p)) + anymeta = 1; + strbuf_append1(pathbuf, *p++); + } + + if (!anymeta) { /* no expansion, do next segment */ + pattern = p; + while (*pattern == SEP) + strbuf_append1(pathbuf, *pattern++); + } + else { /* need expansion, recurse */ + pathbuf->len = orig_len; + return (glob3(pathbuf, pattern, p, pattern, pglob, no_match)); + } + } + /* NOTREACHED */ +} + +static size_t +One_Char_mbtowc(__Char *pwc, const Char *s, size_t n) +{ +#ifdef WIDE_STRINGS + char buf[MB_LEN_MAX], *p; + + if (n > MB_LEN_MAX) + n = MB_LEN_MAX; + p = buf; + while (p < buf + n && (*p++ = LCHAR(*s++)) != 0) + ; + return one_mbtowc(pwc, buf, n); +#else + *pwc = *s & CHAR; + return 1; +#endif +} + +static int +glob3(struct strbuf *pathbuf, const Char *pattern, const Char *restpattern, + const Char *pglobstar, glob_t *pglob, int no_match) +{ + DIR *dirp; + struct dirent *dp; + struct stat sbuf; + int err; + Char m_not = (pglob->gl_flags & GLOB_ALTNOT) ? M_ALTNOT : M_NOT; + size_t orig_len; + int globstar = 0; + int chase_symlinks = 0; + const Char *termstar = NULL; + + strbuf_terminate(pathbuf); + orig_len = pathbuf->len; + errno = err = 0; + + while (pglobstar < restpattern) { + __Char wc; + size_t width = One_Char_mbtowc(&wc, pglobstar, MB_LEN_MAX); + if ((pglobstar[0] & M_MASK) == M_ALL && + (pglobstar[width] & M_MASK) == M_ALL) { + globstar = 1; + chase_symlinks = (pglobstar[2 * width] & M_MASK) == M_ALL; + termstar = pglobstar + (2 + chase_symlinks) * width; + break; + } + pglobstar += width; + } + + if (globstar) { + err = pglobstar==pattern && termstar==restpattern ? + *restpattern == EOS ? + glob2(pathbuf, restpattern - 1, pglob, no_match) : + glob2(pathbuf, restpattern + 1, pglob, no_match) : + glob3(pathbuf, pattern, restpattern, termstar, pglob, no_match); + if (err) + return err; + pathbuf->len = orig_len; + strbuf_terminate(pathbuf); + } + + if (*pathbuf->s && (Lstat(pathbuf->s, &sbuf) || !S_ISDIR(sbuf.st_mode) +#ifdef S_IFLINK + && ((globstar && !chase_symlinks) || !S_ISLNK(sbuf.st_mode)) +#endif + )) + return 0; + + if (!(dirp = Opendir(pathbuf->s))) { + /* todo: don't call for ENOENT or ENOTDIR? */ + if ((pglob->gl_errfunc && (*pglob->gl_errfunc) (pathbuf->s, errno)) || + (pglob->gl_flags & GLOB_ERR)) + return (GLOB_ABEND); + else + return (0); + } + + /* search directory for matching names */ + while ((dp = readdir(dirp)) != NULL) { + /* initial DOT must be matched literally */ + if (dp->d_name[0] == DOT && *pattern != DOT) + if (!(pglob->gl_flags & GLOB_DOT) || !dp->d_name[1] || + (dp->d_name[1] == DOT && !dp->d_name[2])) + continue; /*unless globdot and not . or .. */ + pathbuf->len = orig_len; + strbuf_append(pathbuf, dp->d_name); + strbuf_terminate(pathbuf); + + if (globstar) { +#ifdef S_IFLNK + if (!chase_symlinks && + (Lstat(pathbuf->s, &sbuf) || S_ISLNK(sbuf.st_mode))) + continue; +#endif + if (match(pathbuf->s + orig_len, pattern, termstar, + (int)m_not) == no_match) + continue; + strbuf_append1(pathbuf, SEP); + strbuf_terminate(pathbuf); + if ((err = glob2(pathbuf, pglobstar, pglob, no_match)) != 0) + break; + } else { + if (match(pathbuf->s + orig_len, pattern, restpattern, + (int) m_not) == no_match) + continue; + if ((err = glob2(pathbuf, restpattern, pglob, no_match)) != 0) + break; + } + } + /* todo: check error from readdir? */ + closedir(dirp); + return (err); +} + + +/* + * Extend the gl_pathv member of a glob_t structure to accomodate a new item, + * add the new item, and update gl_pathc. + * + * This assumes the BSD realloc, which only copies the block when its size + * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic + * behavior. + * + * Return 0 if new item added, error code if memory couldn't be allocated. + * + * Invariant of the glob_t structure: + * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and + * gl_pathv points to (gl_offs + gl_pathc + 1) items. + */ +static void +globextend(const char *path, glob_t *pglob) +{ + char **pathv; + int i; + size_t newsize; + + newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); + pathv = xrealloc(pglob->gl_pathv, newsize); + + if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) { + /* first time around -- clear initial gl_offs items */ + pathv += pglob->gl_offs; + for (i = pglob->gl_offs; --i >= 0;) + *--pathv = NULL; + } + pglob->gl_pathv = pathv; + + pathv[pglob->gl_offs + pglob->gl_pathc++] = strsave(path); + pathv[pglob->gl_offs + pglob->gl_pathc] = NULL; +} + +/* + * pattern matching function for filenames. + */ +static int +match(const char *name, const Char *pat, const Char *patend, int m_not) +{ + int ok, negate_range; + const Char *patNext; + const char *nameNext, *nameStart, *nameEnd; + Char c; + + patNext = pat; + nameStart = nameNext = name; + nameEnd = NULL; + + while (pat < patend || *name) { + size_t lwk, pwk; + __Char wc, wk, wc1; + + c = *pat; /* Only for M_MASK bits */ + if (*name == EOS) + nameEnd = name; + + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + lwk = one_mbtowc(&wk, name, MB_LEN_MAX); + switch (c & M_MASK) { + case M_ALL: + while ((*(pat + pwk) & M_MASK) == M_ALL) { + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + patNext = pat; + nameNext = name + lwk; + pat += pwk; + continue; + case M_ONE: + if (*name == EOS) + break; + name += lwk; + pat += pwk; + continue; + case M_SET: + ok = 0; + if (*name == EOS) + break; + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + name += lwk; + if ((negate_range = ((*pat & M_MASK) == m_not)) != 0) { + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + wc1 = wc; + while ((*pat & M_MASK) != M_END) { + if ((*pat & M_MASK) == M_RNG) { + __Char wc2; + + pat += pwk; + pwk = One_Char_mbtowc(&wc2, pat, MB_LEN_MAX); + if (globcharcoll(wc1, wk, 0) <= 0 && + globcharcoll(wk, wc2, 0) <= 0) + ok = 1; + } else if (wc == wk) + ok = 1; + pat += pwk; + wc1 = wc; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + } + pat += pwk; + pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); + if (ok == negate_range) + break; + continue; + default: + if (*name == EOS || samecase(wk) != samecase(wc)) + break; + name += lwk; + pat += pwk; + continue; + } + if (nameNext != nameStart + && (nameEnd == NULL || nameNext <= nameEnd)) { + pat = patNext; + name = nameNext; + continue; + } + return 0; + } + return 1; +} + +/* free allocated data belonging to a glob_t structure */ +void +globfree(glob_t *pglob) +{ + int i; + char **pp; + + if (pglob->gl_pathv != NULL) { + pp = pglob->gl_pathv + pglob->gl_offs; + for (i = pglob->gl_pathc; i--; ++pp) + if (*pp) + xfree(*pp), *pp = NULL; + xfree(pglob->gl_pathv), pglob->gl_pathv = NULL; + } +} Index: vendor/tcsh/6.21.00-83c5be0/host.defs =================================================================== --- vendor/tcsh/6.21.00-83c5be0/host.defs (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/host.defs (revision 353870) @@ -0,0 +1,1281 @@ +newcode : +/* + * host.defs: Hosttype/Machtype etc. + */ +/*- + * Copyright (c) 1980, 1991 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; 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" + +endcode : + +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) +newcode : +static char * +isamultimax(int flag) +{ + if (access("/Umax.image", F_OK) == 0) + return "multimax"; + else + return flag ? "mach" : "ns32000"; +} +endcode : +enddef : + + +newdef : defined(cray) +newcode : +/* + * On crays, find the current machine type via the target() syscall + * We need ctype.h to convert the name returned to lower case + */ +# include +# include +# include + +/* From: hpa@hook.eecs.nwu.edu (H. Peter Anvin) */ +static char * +getcray(void) +{ +# ifdef MC_GET_SYSTEM /* If we have target() */ + struct target data; + + if (target(MC_GET_SYSTEM, &data) != -1) { + static char hosttype_buf[sizeof(data.mc_pmt)+1]; + unsigned char *p = (unsigned char *) &(data.mc_pmt); + char *q = hosttype_buf; + int n; + + /* + * Copy to buffer and convert to lower case + * String may not be null-terminated, so keep a counter + */ + for (n = 0; *p && n < sizeof(data.mc_pmt); n++) + *q++ = tolower(p[n]); + + *q = '\0'; + + /* replace dashes with underscores if present */ + while ((q = strchr(hosttype_buf, '-')) != NULL) + *q = '_'; + return hosttype_buf; /* Return in static buffer */ + } + else +# endif /* MC_GET_SYSTEM */ + return "cray"; /* target() failed */ +} +endcode : +enddef : + + +newdef : defined(convex) +newcode : +/* + * On convex, find the current machine type via the getsysinfo() syscall + */ +#include + +/* From: fox@convex.com (David DeSimone) */ +static char * +getconvex(void) +{ + struct system_information sysinfo; + static char result[8]; + + if (getsysinfo(SYSINFO_SIZE, &sysinfo) == -1) + return "convex"; + + switch(sysinfo.cpu_type) { +#ifdef SI_CPUTYPE_C1 + case SI_CPUTYPE_C1: + return "c1"; +#endif + +#ifdef SI_CPUTYPE_C2 + case SI_CPUTYPE_C2: + return "c2"; +#endif + +#ifdef SI_CPUTYPE_C2MP + case SI_CPUTYPE_C2MP: + (void) strcpy(result, "c2X0"); + result[2] = sysinfo.cpu_count + '0'; + return result; +#endif + +#ifdef SI_CPUTYPE_C34 + case SI_CPUTYPE_C34: + (void) strcpy(result, "c34X0"); + result[3] = sysinfo.cpu_count + '0'; + return result; +#endif + +#ifdef SI_CPUTYPE_C38 + case SI_CPUTYPE_C38: + (void) strcpy(result, "c38X0"); + result[3] = sysinfo.cpu_count + '0'; + return result; +#endif + +#ifdef SI_CPUTYPE_C46 + case SI_CPUTYPE_C46: + (void) strcpy(result, "c46X0"); + result[3] = sysinfo.cpu_count + '0'; + return result; +#endif + + default: + return "convex"; + } +} +endcode : +enddef : + +newdef : defined(linux) || defined(CYGWIN) || defined(GNU) || defined(GLIBC) +newcode : +# include "tw.h" +#include +static char mach[256]; +static char host[256]; +static char ostype[32]; +static void populate(void) +{ + struct utsname uts; + int e = uname(&uts); + const char *p = short2str(tgetenv(STROSTYPE)); + if (p == NULL) { +#if defined(__ANDROID__) + p = "android"; +#elif defined(__CYGWIN__) + p = "cygwin"; +#else + p = "linux"; +#endif + } + xsnprintf(ostype, sizeof(ostype), "%s", p); + xsnprintf(mach, sizeof(mach), "%s", e != -1 ? uts.machine : "unknown"); + xsnprintf(host, sizeof(host), "%s-%s", + e != -1 ? uts.machine : "unknown", ostype); +} + +static char * +getmach(void) +{ + if (!mach[0]) + populate(); + return mach; +} + +static char * +gethost(void) +{ + if (!host[0]) + populate(); + return host; +} + +static char * +getostype(void) +{ + if (!ostype[0]) + populate(); + return ostype; +} + +endcode : +enddef : + +newcode : +void +getmachine(void) +{ + const char *hosttype; + const char *ostype; + const char *vendor; + const char *machtype; + +endcode : + + +newdef : defined(HOSTTYPE) +hosttype: : HOSTTYPE +enddef : + + +newdef : defined(PARAGON) +comment : Intel Paragon running OSF/1 +vendor : : "intel" +hosttype: : "paragon" +ostype : : "osf1" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(AMIX) +comment : Amiga running Amix 2.02 +vendor : : "commodore" +hosttype: : "amiga" +ostype : : "Amix" +machtype: : "m68k" +enddef : + + +newdef : defined(accel) +comment : celerity Accel +vendor : : "celerity" +hosttype: : "celerityACCEL" +ostype : : "unix" +machtype: : "accel" +enddef : + + +newdef : defined(_VMS_POSIX) +comment : digital vax or alpha running vms posix +vendor : : "dec" +hosttype: : "VMS-POSIX" +ostype : : "vms" +machtype: defined(alpha) : "alpha" +machtype: defined(vax) : "vax" +enddef : + + +newdef : defined(hp_osf) +comment : Hewlett Packard running OSF/1 +vendor : : "hp" +hosttype: defined(pa_risc) : "hp9000s700-osf1" +hosttype: : "hp-osf1" +ostype : : "osf1" +machtype: defined(pa_risc) : "pa_risc" +enddef : + + +newdef : defined(hp9000) +comment : Hewlett Packard running MORE/bsd +vendor : : "hp" +hosttype: defined(hp300) : "hp300" +hosttype: defined(hp800) : "hp800" +hosttype: : "hp9000" +ostype : defined(BSD4_4) : "bsd44" +ostype : : "mtXinu" +machtype: defined(hp300) : "m68k" +machtype: defined(hp800) : "pa_risc" +enddef : + + +newdef : defined(hpux) +comment : Hewlett Packard running HP/UX +vendor : : "hp" +hosttype: defined(hp9000s800) : "hp9000s800" +hosttype: defined(hp9000s700) : "hp9000s700" +hosttype: defined(hp9000s500) : "hp9000s500" +hosttype: defined(hp9000s300) : "hp9000s300" +hosttype: : "hp" +ostype : : "hpux" +machtype: defined(hp9000s800) : "pa_risc" +machtype: defined(hp9000s700) : "pa_risc" +machtype: defined(hp9000s500) : "m68k" +machtype: defined(hp9000s300) : "m68k" +enddef : + + +newdef : defined(apollo) +comment : Hewlett Packard apollo running Domain/OS +vendor : : "hp" +hosttype: : "apollo" +ostype : : "DomainOS" +machtype: : "m68k" +enddef : + + +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_amd64) : "i86pc" +hosttype: defined(mc68010) : "sun2" +hosttype: defined(mc68020) : "sun3" +hosttype: defined(sparc) : "sun4" +hosttype: : "sun" +ostype : defined(SUNOS3) : "sunos3" +ostype : defined(SUNOS4) : "sunos4" +ostype : defined(SOLARIS2) : "solaris" +machtype: defined(mc68010) : "m68k" +machtype: defined(mc68020) : "m68k" +machtype: defined(sparcv9) : "sparcv9" +machtype: defined(sparc) : "sparc" +machtype: defined(M_i386) : "i386" +machtype: defined(M_amd64) : "amd64" +enddef : + + +newdef : defined(pyr) +comment : Pyramid Technology +vendor : : "pyramid" +hosttype: : "pyramid" +machtype: : "pyramid" +enddef : + + +newdef : defined(hcx) || defined(_CX_UX) +comment : Harris Tahoe running CX/UX +vendor : : "harris" +hosttype: : "hcx" +ostype : : "hcx" +machtype: : "tahoe" +enddef : + + +newdef : defined(tahoe) +comment : Harris Tahoe +vendor : : "harris" +hosttype: : "tahoe" +machtype: : "tahoe" +enddef : + + +newdef : defined(ibm032) +comment : RT running IBM AOS4.3 or MACH +vendor : : "ibm" +hosttype: : "rt" +ostype : defined(MACH) : "mach" +ostype : : "aos" +machtype: : "ibm032" +enddef : + + +newdef : defined(aiws) +comment : RT running IBM aix2.x +vendor : : "ibm" +hosttype: : "rtpc" +ostype : : "aix" +machtype: : "ibm032" +enddef : + + +newdef : defined(_AIX370) +comment : IBM/370 running aix +vendor : : "ibm" +hosttype: : "aix370" +ostype : : "aix" +machtype: : "ibm370" +enddef : + + +newdef : defined(_IBMESA) +comment : IBM/ESA running aix +vendor : : "ibm" +hosttype: : "aixESA" +ostype : : "aix" +machtype: : "esa" +enddef : + + +newdef : defined(_IBMR2) +comment : IBM/RS6000 running aix +vendor : : "ibm" +hosttype: : "rs6000" +ostype : : "aix" +machtype: : "rs6000" +enddef : + + +newdef : defined(_AIXPS2) +comment : IBM/PS2 running aix +vendor : : "ibm" +hosttype: : "ps2" +ostype : : "aix" +machtype: : "i386" +enddef : + + +newdef : defined(OREO) +comment : Macintosh running AU/X +vendor : : "apple" +hosttype: : "mac2" +ostype : : "aux" +machtype: defined(mc68020) : "m68k" +enddef : + + +newdef : defined(u3b20d) +comment : AT&T 3B/20 series running SVR2/3 +vendor : : "att" +hosttype: : "att3b20" +machtype: : "u3b20" +enddef : + + +newdef : defined(u3b15) +comment : AT&T 3B/15 series running SVR2/3 +vendor : : "att" +hosttype: : "att3b15" +machtype: : "u3b15" +enddef : + + +newdef : defined(u3b5) +comment : AT&T 3B/5 series running SVR2/3 +vendor : : "att" +hosttype: : "att3b5" +machtype: : "u3b5" +enddef : + + +newdef : defined(u3b2) +comment : AT&T 3B/2 series running SVR2/3 +vendor : : "att" +hosttype: : "att3b2" +machtype: : "u3b2" +enddef : + + +newdef : defined(UNIXPC) +comment : AT&T UnixPC att3b1/att7300 +vendor : : "att" +hosttype: : "unixpc" +machtype: defined(u3b1) : "u3b1" +machtype: defined(att7300) : "att7300" +enddef : + + +newdef : defined(_MINIX) +comment : Andy Tanenbaum's minix +vendor : defined(M_i386) : "intel" +hosttype: defined(M_i386) : "minix386" +hosttype: : "minix" +ostype : : "minix" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(gnu_hurd) +comment : GNU/HURD +vendor : defined(M_intel) : "intel" +hosttype: defined(M_i686) : "i686" +hosttype: defined(M_i586) : "i586" +hosttype: defined(M_i486) : "i486" +hosttype: defined(M_i386) : "i386" +ostype : : "gnu" +machtype: defined(M_i686) : "i686-pc-gnu" +machtype: defined(M_i586) : "i586-pc-gnu" +machtype: defined(M_i486) : "i486-pc-gnu" +machtype: defined(M_i386) : "i386-pc-gnu" +enddef : + + +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(alpha) : "dec" +vendor : defined(PPC) : "apple" +enddef : + + +newdef : defined(EMX) +comment : OS/2 EMX [unix emulation under OS/2] +vendor : defined(M_intel) : "intel" +hosttype: defined(M_i386) : "i386-emx" +ostype : : "os2" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(NetBSD) +comment : NetBSD +vendor : defined(algor) : "algoritmics" +vendor : defined(arm32) || defined(arm) : "acorn" +vendor : defined(alpha) : "digital" +vendor : defined(amiga) : "commodore" +vendor : defined(atari) : "atari" +vendor : defined(hp300) : "hp" +vendor : defined(M_intel) : "intel" +vendor : defined(m68k) : "motorola" +vendor : defined(mac68k) : "apple" +vendor : defined(pc532) : "national-semi" +vendor : defined(pmax) : "dec" +vendor : defined(powerpc) : "motorola" +vendor : defined(mips) : "mips" +vendor : defined(sparc) : "sun" +vendor : defined(sparc64) : "sun" +vendor : defined(sun3) : "sun" +vendor : defined(vax) : "digital" +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(arm) : "arm" +machtype: defined(sparc) : "sparc" +machtype: defined(sparc64) : "sparc64" +machtype: defined(mc68020) : "m68k" +machtype: defined(M_i386) : "i386" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +machtype: defined(mips) : "mips" +machtype: defined(pc532) : "pc532" +machtype: defined(powerpc) : "powerpc" +machtype: defined(vax) : "vax" +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) +comment : FreeBSD +vendor : defined(alpha) : "digital" +vendor : defined(arm32) || defined(arm) : "acorn" +vendor : defined(M_intel) : "intel" +vendor : defined(ia64) : "intel" +vendor : defined(mips) : "mips" +vendor : defined(powerpc) : "motorola" +vendor : defined(sparc) : "sun" +vendor : defined(sparc64) : "sun" +vendor : defined(M_amd64) : "amd" +hosttype: : "FreeBSD" +ostype : : "FreeBSD" +machtype: defined(alpha) : "alpha" +machtype: defined(arm32) || defined(APCS_32) : "arm32" +machtype: defined(arm) : "arm" +machtype: defined(ia64) : "ia64" +machtype: defined(M_i386) : "i386" +machtype: defined(mips) : "mips" +machtype: defined(powerpc) : "powerpc" +machtype: defined(sparc) : "sparc" +machtype: defined(sparc64) : "sparc64" +machtype: defined(M_amd64) : "x86_64" +enddef : + + +newdef : defined(MidnightBSD) +comment : MidnightBSD +vendor : defined(M_intel) : "intel" +hosttype: : "MidnightBSD" +ostype : : "MidnightBSD" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(__386BSD__) +comment : Bill Jolitz's 386BSD +vendor : defined(M_intel) : "intel" +hosttype: : "386BSD" +ostype : : "386BSD" +machtype: : "i386" +enddef : + + +newdef : defined(bsdi) +comment : BSDI's unix +vendor : defined(M_intel) : "intel" +vendor : defined(sparc) : "sun" +vendor : defined(powerpc) : "motorola" +hosttype: defined(M_intel) : "bsd386" +hosttype: defined(sparc) : "bsd-sparc" +hosttype: defined(powerpc) : "bsd-powerpc" +ostype : : "bsdi" +machtype: defined(M_i386) : "i386" +machtype: defined(sparc) : "sparc" +machtype: defined(powerpc) : "powerpc" +enddef : + + +newdef : defined(COHERENT) +comment : COHERENT's unix +vendor : defined(_I386) : "intel" +hosttype: : "coh386" +hosttype: : "coherent" +ostype : : "coherent" +machtype: defined(_I386) : "i386" +enddef : + +newdef : defined(concurrent) +comment : Concurrent PowerHawk +vendor : : "concurrent" +hosttype: : "powerhawk" +ostype : : "powermax_os" +machtype: : "powerhawk" +enddef : + +newdef : defined(SCO) +comment : SCO UNIX System V/386 Release 3.2 +vendor : : "sco" +hosttype: : "sco386" +ostype : : "sco_unix" +machtype: : "i386" +enddef : + +newdef : defined(M_XENIX) && !defined(M_UNIX) +comment : SCO XENIX +vendor : : "sco" +hosttype: : "sco_xenix" +ostype : : "sco_xenix" +machtype: defined(M_I386) : "i386" +machtype: defined(M_I286) : "i286" +enddef : + + +newdef : defined(ISC) || defined(ISC202) +comment : Interactive Unix +vendor : : "isc" +hosttype: : "isc386" +ostype : defined(POSIX) : "POSIX" +ostype : : "SVR3" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(INTEL) +comment : Intel Unix +vendor : : "intel" +hosttype: : "intel386" +ostype : : "intel_unix" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(MACH) +comment : cmu's mach +vendor : : "cmu" +hosttype: defined(M_i386) : "i386-mach" +ostype : : "mach" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(alliant) +comment : Alliants FSX +vendor : : "alliant" +hosttype: defined(mc68000) : "alliant-fx80" +hosttype: defined(i860) : "alliant-fx2800" +hosttype: : "alliant" +ostype : : "fsx" +machtype: defined(mc68000) : "mc68000" +machtype: defined(i860) : "i860" +enddef : + + +newdef : defined(_FTX) +comment : Stratus Computer, Inc FTX2 (i860 based) +comment : Stratus Computer, Inc FTX3 (HPPA based) +vendor : : "stratus" +hosttype: defined(i860) && defined(_FTX) : "atlantic" +hosttype: defined(hppa) && defined(_FTX) : "continuum" +ostype : defined(i860) && defined(_FTX) : "ftx2" +ostype : defined(hppa) && defined(_FTX) : "ftx3" +machtype: defined(i860) : "i860" +machtype: defined(hppa) : "hppa" +enddef : + + +newdef : defined(sequent) || defined(_SEQUENT_) +comment : Sequent Balance (32000 based) +comment : Sequent Symmetry running DYNIX/ptx (386/486 based) +comment : Sequent Symmetry running DYNIX 3 (386/486 based) +vendor : : "sequent" +hosttype: defined(M_i386) && defined(sequent) : "symmetry" +hosttype: defined(M_i386) : "ptx" +hosttype: : "balance" +ostype : defined(M_i386) && !defined(sequent) : "ptx" +ostype : : "dynix3" +machtype: defined(M_i386) : "i386" +machtype: defined(ns32000) : "ns32000" +enddef : + + +newdef : defined(ns32000) +comment : Encore Computer Corp. Multimax (32000 based) +vendor : : "encore" +hosttype: defined(CMUCS) : "multimax" +hosttype: : isamultimax(0) +ostype : defined(CMUCS) : "mach" +ostype : : isamultimax(1) +machtype: : "ns32000" +enddef : + + +newdef : defined(iconuxv) +comment : Icon 88k running Unix +vendor : : "icon" +hosttype: : "icon" +ostype : : "iconuxv" +machtype: defined(m88k) : "m88k" +enddef : + + +newdef : defined(_CRAY) && defined(_CRAYCOM) +comment : Cray Computer Corp. running CSOS +vendor : : "ccc" +hosttype: defined(_CRAY2) : "cray" +hosttype: defined(_CRAY3) : "cray" +hosttype: defined(_CRAY4) : "cray" +ostype : : "CSOS" +machtype: defined(_CRAY2) : "cray2" +machtype: defined(_CRAY3) : "cray3" +machtype: defined(_CRAY4) : "cray4" +enddef : + + +newdef : defined(cray) && !defined(_CRAYMPP) +comment : Cray Research Inc. PVP running UNICOS +vendor : : "cri" +hosttype: : getcray() +ostype : : "unicos" +machtype: : getcray() +enddef : + + +newdef : defined(cray) && defined(_CRAYT3D) +comment : Cray Research Inc. running UNICOS MAX +vendor : : "cri" +hosttype: : getcray() +ostype : : "unicosmax" +machtype: : getcray() +enddef : + + +newdef : defined(cray) && defined(_CRAYT3E) +comment : Cray Research Inc. running UNICOS/mk +vendor : : "cri" +hosttype: : getcray() +ostype : : "unicosmk" +machtype: : getcray() +enddef : + + +newdef : defined(convex) +comment : Convex +vendor : : "convex" +hosttype: : "convex" +ostype : : "convexos" +machtype: : getconvex() +enddef : + + +newdef : defined(butterfly) +comment : BBN Butterfly 1000 +vendor : : "bbn" +hosttype: : "butterfly" +machtype: defined(mc68020) : "m68k" +enddef : + + +newdef : defined(NeXT) +comment : NeXTStep +vendor : : "next" +hosttype: defined(mc68020) : "next" +hosttype: defined(M_i386) : "intel-pc" +hosttype: defined(hppa) : "hp" +hosttype: defined(sparc) : "sun" +ostype : : "nextstep" +machtype: defined(mc68020) : "m68k" +machtype: defined(M_i386) : "i386" +machtype: defined(hppa) : "hppa" +machtype: defined(sparc) : "sparc" +enddef : + + +newdef : defined(APPLE) && defined(MACH) +comment : OS X +vendor : : "apple" +hosttype: defined(i386) : "intel-mac" +hosttype: defined(ppc) : "powermac" +hosttype: defined(M_amd64) : "intel-mac" +ostype : : "darwin" +machtype: defined(i386) : "i386" +machtype: defined(M_amd64) : "x86_64" +machtype: defined(ppc) : "powerpc" +enddef : + + +newdef : defined(sony_news) +comment : Sony NEWS 800 or 1700 workstation +vendor : : "sony" +hosttype: defined(mips) : "news_mips" +hosttype: defined(mc68020) : "news_m68k" +ostype : : "News" +machtype: defined(mc68020) : "m68k" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +enddef : + + +newdef : defined(sgi) +comment : Silicon Graphics +vendor : : "sgi" +hosttype: defined(M_mipsel) : "iris4d" +hosttype: defined(M_mipseb) : "iris4d" +hosttype: defined(mc68000) : "iris3d" +ostype : : "irix" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +machtype: defined(mc68000) : "mc68000" +enddef : + + +newdef : defined(ultrix) +comment : Digital's Ultrix +vendor : : "dec" +hosttype: defined(M_mipsel) : "decstation" +hosttype: defined(M_mipseb) : "decmips" +hosttype: defined(vax) : "vax" +ostype : : "ultrix" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +machtype: defined(vax) : "vax" +enddef : + + +newdef : defined(MIPS) +comment : Mips OS +vendor : : "mips" +hosttype: defined(M_mipsel) : "mips" +hosttype: defined(M_mipseb) : "mips" +ostype : : "mips" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +enddef : + + +newdef : defined(DECOSF1) +comment : Digital's alpha running osf1 +vendor : : "dec" +ostype : : "osf1" +hosttype: defined(alpha) : "alpha" +machtype: defined(alpha) : "alpha" +enddef : + + +newdef : defined(Lynx) +comment : Lynx OS 2.1 +vendor : : "Lynx" +hosttype: defined(M_mipsel) : "lynxos-mips" +hosttype: defined(M_mipseb) : "lynxos-mips" +hosttype: defined(M_i386) : "lynxos-i386" +hosttype: defined(i860) : "lynxos-i860" +hosttype: defined(m68k) : "lynxos-m68k" +hosttype: defined(m88k) : "lynxos-m88k" +hosttype: defined(sparc) : "lynxos-sparc" +hosttype: : "lynxos-unknown" +ostype : : "LynxOS" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +machtype: defined(M_i386) : "i386" +machtype: defined(i860) : "i860" +machtype: defined(m68k) : "m68k" +machtype: defined(m88k) : "m88k" +machtype: defined(sparc) : "sparc" +enddef : + + +newdef : defined(masscomp) +comment : Masscomp +vendor : : "masscomp" +hosttype: : "masscomp" +ostype : : "masscomp" +enddef : + +newdef : defined(MACHTEN) +comment : Machintosh +vendor : : "Tenon" +hosttype: : "Macintosh" +ostype : : "MachTen" +machtype: : "Macintosh" +enddef : + + + +newdef : defined(GOULD_NP1) +comment : Gould +vendor : : "gould" +hosttype: : "gould_np1" +machtype: : "gould" +enddef : + + +newdef : defined(MULTIFLOW) +comment : Multiflow running 4.3BSD +vendor : : "multiflow" +hosttype: : "multiflow" +machtype: : "multiflow" +ostype : : "bsd43" +enddef : + + +newdef : defined(SXA) +comment : PFU/Fujitsu A-xx computer +vendor : : "sxa" +hosttype: : "pfa50" +ostype : defined(_BSDX_) : "e60-bsdx" +ostype : : "e60" +machtype: : "pfa50" +enddef : + + +newdef : defined(titan) +comment : (St)Ardent Titan +vendor : : "ardent" +hosttype: : "titan" +enddef : + + +newdef : defined(stellar) +comment : Stellar +vendor : : "stellar" +hosttype: : "stellar" +ostype : : "stellix" +enddef : + + +newdef : defined(atari) +comment : Atari TT running SVR4. This machine was never +comment : commercially available. +vendor : : "atari" +hosttype: : "atari" +ostype : : "asv" +enddef : + + +newdef : defined(OPUS) +comment : ??? +vendor : : "opus" +hosttype: : "opus" +enddef : + + +newdef : defined(eta10) +comment : ETA running SVR3 +vendor : : "eta" +hosttype: : "eta10" +enddef : + + +newdef : defined(hk68) +comment : Heurikon HK68 running Uniplus+ 5.0 +vendor : : "heurikon" +hosttype: : "hk68" +ostype : : "uniplus" +enddef : + + +newdef : defined(NDIX) +comment : Norsk Data ND 500/5000 running Ndix +vendor : : "norsk" +hosttype: : "nd500" +ostype : : "ndix" +enddef : + + +newdef : defined(AMIGA) +comment : Amiga running AmigaOS+GG +vendor : : "commodore" +hosttype: : "amiga" +ostype : : "AmigaOS" +machtype: : "m68k" +enddef : + + +newdef : defined(uts) +comment : Amdahl running uts 2.1 +vendor : : "amdahl" +hosttype: : "amdahl" +ostype : : "uts" +machtype: : "amdahl" +enddef : + + +newdef : defined(UTek) +comment : Tektronix 4300 running UTek (BSD 4.2 / 68020 based) +vendor : : "tektronix" +hosttype: : "tek4300" +enddef : + + +newdef : defined(UTekV) +comment : Tektronix XD88/10 running UTekV 3.2e (SVR3/88100 based) +vendor : : "tektronix" +hosttype: : "tekXD88" +enddef : + + +newdef : defined(DGUX) +comment : Data-General AViiON running DGUX +hosttype: : "aviion" +ostype : : "dgux" +vendor : : "dg" +machtype: defined(m88k) : "m88k" +machtype: defined(i386) : "pentium" +enddef : + + +newdef : defined(sysV68) +comment : Motorola MPC running System V/68 R32V2 (SVR3/68020 based) +vendor : : "motorola" +hosttype: : "sysV68" +machtype: : "m68k" +enddef : + + +newdef : defined(supermax) +comment : DDE Supermax running System V/68 R3 (SVR3/68020 based) +vendor : : "supermax" +hosttype: : "supermax" +machtype: : "m68k" +enddef : + + +newdef : defined(sysV88) +comment : Motorola MPC running System V/88 R32V2 (SVR3/88100 based) +vendor : : "motorola" +hosttype: : "sysV88" +machtype: : "m88k" +enddef : + + +newdef : defined(clipper) +comment : Clipper Chipset (Intergraph) +vendor : : "intergraph" +hosttype: : "clipper" +machtype: : "clipper" +enddef : + +newdef : defined(QNX) +ostype : : "qnx" +enddef : + +newdef : (defined(SNI) || defined(sinix)) && !defined(_OSD_POSIX) +comment : Fujitsu Siemens Computers (former "Siemens Nixdorf Informationssysteme"): SINIX aka. ReliantUNIX, a SVR4 derivative +vendor : : "fsc" +hosttype: defined(M_intel) : "wx200i" +hosttype: defined(MIPSEB) : "rm400" +ostype : defined(sinix) : "sinix" +machtype: defined(M_i586) : "i586" +machtype: defined(M_i486) : "i486" +machtype: defined(M_i386) : "i386" +machtype: defined(M_mipsel) : "mipsel" +machtype: defined(M_mipseb) : "mipseb" +machtype: : "mips" +enddef : + +newdef : defined(_OSD_POSIX) +comment : Fujitsu Siemens Computers (former "Siemens Nixdorf Informationssysteme"): BS2000 POSIX (mainframe, EBCDIC) +vendor : : "fsc" +hosttype: : "bs2000" +ostype : : "osdposix" +machtype: #machine(7500) : "s390" +machtype: #machine(mips) : "mips" +machtype: #machine(sparc) : "sparc" +machtype: : "bs2000" +enddef : + +newdef : defined(MVS) +comment : ibm uss s/390 (mainframe, EBCDIC) +vendor : : "ibm" +hosttype: : "s390" +ostype : : "os390" +machtype: : "s390" +enddef : + +newdef : defined(_SX) +comment : NEC Corporation (SX-4) +vendor : : "nec" +ostype : : "superux" +hosttype: : "sx4" +machtype: : "sx4" +enddef : + +newdef : !defined(SOLARIS2) && (SYSVREL == 4) +comment : Unix System V Release 4.0 +vendor : defined(DELL) : "dell" +hosttype: defined(M_i386) : "i386" +ostype : : "svr4" +machtype: defined(M_i386) : "i386" +enddef : + +newdef : defined(uxp) || defined(uxps) +comment : FUJITSU DS/90 7000 +vendor : : "fujitsu" +hosttype: : "ds90" +ostype : : "sysv4" +machtype: : "sparc" +enddef : + +newdef : defined(CYGWIN) +comment : Cygwin +vendor : defined(M_intel) : "intel" +hosttype: : gethost() +ostype : : getostype() +machtype: : getmach() +enddef : + +newdef : defined(_UWIN) +comment : AT&T Research Unix for Windows +vendor : : "att" +hosttype: : "win32.i386" +machtype: : "i386" +enddef : + + +newdef : defined(mc68000) || defined(mc68k32) || defined(m68k) || defined(mc68010) || defined(mc68020) +hosttype: : "m68k" +vendor : defined(m68k) : "motorola" +machtype: : "m68k" +enddef : + + +newdef : defined(m88k) +hosttype: : "m88k" +machtype: : "m88k" +enddef : + + +newdef : defined(M_intel) +hosttype: defined(M_i586) : "i586" +hosttype: defined(M_i486) : "i486" +hosttype: defined(M_i386) : "i386" +vendor : : "intel" +machtype: defined(M_i586) : "i586" +machtype: defined(M_i486) : "i486" +machtype: defined(M_i386) : "i386" +enddef : + + +newdef : defined(sparc) +hosttype: : "sparc" +machtype: : "sparc" +enddef : + + +newdef : defined(i860) +hosttype: : "i860" +machtype: : "i860" +enddef : + + +newdef : defined(osf1) +ostype : : "osf1" +enddef : + + +newdef : SYSVREL == 0 +ostype : defined(BSD4_4) : "bsd44" +ostype : defined(BSD) : "bsd" +ostype : defined(POSIX) : "posix" +enddef : + + +newdef : SYSVREL == 1 +ostype : : "svr1" +enddef : + + +newdef : SYSVREL == 2 +ostype : : "svr2" +enddef : + + +newdef : SYSVREL == 3 +ostype : : "svr3" +enddef : + + +newdef : SYSVREL == 4 +ostype : : "svr4" +enddef : + + +newcode : +#ifndef _hosttype_ + hosttype = "unknown"; +#endif +#ifndef _ostype_ + ostype = "unknown"; +#endif +#ifndef _vendor_ + vendor = "unknown"; +#endif +#ifndef _machtype_ + machtype = "unknown"; +#endif + tsetenv(STRHOSTTYPE, str2short(hosttype)); + tsetenv(STRVENDOR, str2short(vendor)); + tsetenv(STROSTYPE, str2short(ostype)); + tsetenv(STRMACHTYPE, str2short(machtype)); +} /* end setmachine */ +endcode : Index: vendor/tcsh/6.21.00-83c5be0/sh.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/sh.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/sh.c (revision 353870) @@ -0,0 +1,2549 @@ +/* + * sh.c: Main shell routines + */ +/*- + * Copyright (c) 1980, 1991 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; 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. + */ +#define EXTERN /* Intern */ +#include "sh.h" + +#ifndef lint +char copyright[] = +"@(#) Copyright (c) 1991 The Regents of the University of California.\n\ + All rights reserved.\n"; +#endif /* not lint */ + +#include "tc.h" +#include "ed.h" +#include "tw.h" + +extern int MapsAreInited; +extern int NLSMapsAreInited; + +/* + * C Shell + * + * Bill Joy, UC Berkeley, California, USA + * October 1978, May 1980 + * + * Jim Kulp, IIASA, Laxenburg, Austria + * April 1980 + * + * Filename recognition added: + * Ken Greer, Ind. Consultant, Palo Alto CA + * October 1983. + * + * Karl Kleinpaste, Computer Consoles, Inc. + * Added precmd, periodic/tperiod, prompt changes, + * directory stack hack, and login watch. + * Sometime March 1983 - Feb 1984. + * + * Added scheduled commands, including the "sched" command, + * plus the call to sched_run near the precmd et al + * routines. + * Upgraded scheduled events for running events while + * sitting idle at command input. + * + * Paul Placeway, Ohio State + * added stuff for running with twenex/inputl 9 Oct 1984. + * + * ported to Apple Unix (TM) (OREO) 26 -- 29 Jun 1987 + */ + +jmp_buf_t reslab IZERO_STRUCT; +struct wordent paraml IZERO_STRUCT; + +static const char tcshstr[] = "tcsh"; + +struct sigaction parintr; /* Parents interrupt catch */ +struct sigaction parterm; /* Parents terminate catch */ + +#ifdef TESLA +int do_logout = 0; +#endif /* TESLA */ + + +int use_fork = 0; /* use fork() instead of vfork()? */ + +/* + * Magic pointer values. Used to specify other invalid conditions aside + * from null. + */ +static Char INVCHAR; +Char *INVPTR = &INVCHAR; +Char **INVPPTR = &INVPTR; + +static int fast = 0; +static int mflag = 0; +static int prompt = 1; +int enterhist = 0; +int tellwhat = 0; +time_t t_period; +Char *ffile = NULL; +int dolzero = 0; +int insource = 0; +int exitset = 0; +static time_t chktim; /* Time mail last checked */ +char *progname; +int tcsh; + +/* + * This preserves the input state of the shell. It is used by + * st_save and st_restore to manupulate shell state. + */ +struct saved_state { + int insource; + int OLDSTD; + int SHIN; + int SHOUT; + int SHDIAG; + int intty; + struct whyle *whyles; + Char *gointr; + Char *arginp; + Char *evalp; + Char **evalvec; + Char *alvecp; + Char **alvec; + int onelflg; + int enterhist; + Char **argv; + Char **av; + Char HIST; + int cantell; + struct Bin B; + int justpr; +}; + +static int srccat (Char *, Char *); +#ifndef WINNT_NATIVE +static int srcfile (const char *, int, int, Char **); +#else +int srcfile (const char *, int, int, Char **); +#endif /*WINNT_NATIVE*/ +static void srcunit (int, int, int, Char **); +static void mailchk (void); +#ifndef _PATH_DEFPATH +static Char **defaultpath (void); +#endif +static void record (void); +static void st_save (struct saved_state *, int, int, + Char **, Char **); +static void st_restore (void *); + + int main (int, char **); + +#ifndef LOCALEDIR +#define LOCALEDIR "/usr/share/locale" +#endif + +#ifdef NLS_CATALOGS +static void +add_localedir_to_nlspath(const char *path) +{ + static const char msgs_LOC[] = "/%L/LC_MESSAGES/%N.cat"; + static const char msgs_lang[] = "/%l/LC_MESSAGES/%N.cat"; + char *old; + char *new, *new_p; + size_t len; + int add_LOC = 1; + int add_lang = 1; + char trypath[MAXPATHLEN]; + struct stat st; + + if (path == NULL) + return; + + (void) xsnprintf(trypath, sizeof(trypath), "%s/en/LC_MESSAGES/tcsh.cat", + path); + if (stat(trypath, &st) == -1) + return; + + if ((old = getenv("NLSPATH")) != NULL) + len = strlen(old) + 1; /* don't forget the colon. */ + else + len = 0; + + len += 2 * strlen(path) + + sizeof(msgs_LOC) + sizeof(msgs_lang); /* includes the extra colon */ + + new = new_p = xcalloc(len, 1); + + if (old != NULL) { + size_t pathlen = strlen(path); + char *old_p; + + (void) xsnprintf(new_p, len, "%s", old); + new_p += strlen(new_p); + len -= new_p - new; + + /* Check if the paths we try to add are already present in NLSPATH. + If so, note it by setting the appropriate flag to 0. */ + for (old_p = old; old_p; old_p = strchr(old_p, ':'), + old_p = old_p ? old_p + 1 : NULL) { + if (strncmp(old_p, path, pathlen) != 0) + continue; + if (strncmp(old_p + pathlen, msgs_LOC, sizeof(msgs_LOC) - 1) == 0) + add_LOC = 0; + else if (strncmp(old_p + pathlen, msgs_lang, + sizeof(msgs_lang) - 1) == 0) + add_lang = 0; + } + } + + /* Add the message catalog paths not already present to NLSPATH. */ + if (add_LOC || add_lang) + (void) xsnprintf(new_p, len, "%s%s%s%s%s%s", + old ? ":" : "", + add_LOC ? path : "", add_LOC ? msgs_LOC : "", + add_LOC && add_lang ? ":" : "", + add_lang ? path : "", add_lang ? msgs_lang : ""); + + tsetenv(STRNLSPATH, str2short(new)); + free(new); +} +#endif + +int +main(int argc, char **argv) +{ + int batch = 0; + volatile int nexececho = 0; + int nofile = 0; + volatile int nverbose = 0; + volatile int rdirs = 0; + volatile int exitcode = 0; + int quitit = 0; + Char *cp; +#ifdef AUTOLOGOUT + Char *cp2; +#endif + char *tcp, *ttyn; + int f, reenter; + char **tempv; + static const char *targinp = NULL; + int osetintr; + struct sigaction oparintr; + +#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 */ + +#ifdef NLS +# ifdef LC_CTYPE + (void) setlocale(LC_CTYPE, ""); /* for iscntrl */ +# endif /* LC_CTYPE */ +#endif /* NLS */ + + STR_environ = blk2short(environ); + environ = short2blk(STR_environ); /* So that we can free it */ + +#ifdef NLS_CATALOGS + add_localedir_to_nlspath(LOCALEDIR); +#endif + + nlsinit(); + initlex(¶ml); + +#ifdef MALLOC_TRACE + mal_setstatsfile(fdopen(dmove(xopen("/tmp/tcsh.trace", + O_WRONLY|O_CREAT|O_LARGEFILE, 0666), 25), "w")); + mal_trace(1); +#endif /* MALLOC_TRACE */ + +#if !(defined(BSDTIMES) || defined(_SEQUENT_)) && defined(POSIX) +# ifdef _SC_CLK_TCK + clk_tck = (clock_t) sysconf(_SC_CLK_TCK); +# else /* ! _SC_CLK_TCK */ +# ifdef CLK_TCK + clk_tck = CLK_TCK; +# else /* !CLK_TCK */ + clk_tck = HZ; +# endif /* CLK_TCK */ +# endif /* _SC_CLK_TCK */ +#endif /* !BSDTIMES && POSIX */ + + settimes(); /* Immed. estab. timing base */ +#ifdef TESLA + do_logout = 0; +#endif /* TESLA */ + + /* + * Make sure we have 0, 1, 2 open + * Otherwise `` jobs will not work... (From knaff@poly.polytechnique.fr) + */ + { + do + if ((f = xopen(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE)) == -1 && + (f = xopen("/", O_RDONLY|O_LARGEFILE)) == -1) + exit(1); + while (f < 3); + xclose(f); + } + + osinit(); /* Os dependent initialization */ + + + { + char *t; + + t = strrchr(argv[0], '/'); +#ifdef WINNT_NATIVE + { + char *s = strrchr(argv[0], '\\'); + if (s) + t = s; + } +#endif /* WINNT_NATIVE */ + t = t ? t + 1 : argv[0]; + if (*t == '-') t++; + progname = strsave((t && *t) ? t : tcshstr); /* never want a null */ + tcsh = strncmp(progname, tcshstr, sizeof(tcshstr) - 1) == 0; + } + + /* + * Initialize non constant strings + */ +#ifdef _PATH_BSHELL + STR_BSHELL = SAVE(_PATH_BSHELL); +#endif +#ifdef _PATH_TCSHELL + STR_SHELLPATH = SAVE(_PATH_TCSHELL); +#else +# ifdef _PATH_CSHELL + STR_SHELLPATH = SAVE(_PATH_CSHELL); +# endif +#endif + STR_WORD_CHARS = SAVE(WORD_CHARS); + STR_WORD_CHARS_VI = SAVE(WORD_CHARS_VI); + + HIST = '!'; + HISTSUB = '^'; + PRCH = tcsh ? '>' : '%'; /* to replace %# in $prompt for normal users */ + PRCHROOT = '#'; /* likewise for root */ + word_chars = STR_WORD_CHARS; + bslash_quote = 0; /* PWP: do tcsh-style backslash quoting? */ + anyerror = 1; /* for compatibility */ + setcopy(STRanyerror, STRNULL, VAR_READWRITE); + + /* Default history size to 100 */ + setcopy(STRhistory, str2short("100"), VAR_READWRITE); + sethistory(100); + + tempv = argv; + ffile = SAVE(tempv[0]); + dolzero = 0; + if (eq(ffile, STRaout)) /* A.out's are quittable */ + quitit = 1; + uid = getuid(); + gid = getgid(); + euid = geteuid(); + egid = getegid(); + /* + * We are a login shell if: 1. we were invoked as - with + * optional arguments 2. or we were invoked only with the -l flag + */ + loginsh = (**tempv == '-') || (argc == 2 && + tempv[1][0] == '-' && tempv[1][1] == 'l' && + tempv[1][2] == '\0'); +#ifdef _VMS_POSIX + /* No better way to find if we are a login shell */ + if (!loginsh) { + loginsh = (argc == 1 && getppid() == 1); + **tempv = '-'; /* Avoid giving VMS an acidic stomach */ + } +#endif /* _VMS_POSIX */ + + if (loginsh && **tempv != '-') { + char *argv0; + + /* + * Mangle the argv space + */ + tempv[1][0] = '\0'; + tempv[1][1] = '\0'; + tempv[1] = NULL; + argv0 = strspl("-", *tempv); + *tempv = argv0; + argc--; + } + if (loginsh) { + (void) time(&chktim); + setNS(STRloginsh); + } + + NoNLSRebind = getenv("NOREBIND") != NULL; +#ifdef NLS +# ifdef SETLOCALEBUG + dont_free = 1; +# endif /* SETLOCALEBUG */ + (void) setlocale(LC_ALL, ""); +# ifdef LC_COLLATE + (void) setlocale(LC_COLLATE, ""); +# endif +# ifdef SETLOCALEBUG + dont_free = 0; +# endif /* SETLOCALEBUG */ +# ifdef STRCOLLBUG + fix_strcoll_bug(); +# endif /* STRCOLLBUG */ + + /* + * On solaris ISO8859-1 contains no printable characters in the upper half + * so we need to test only for MB_CUR_MAX == 1, otherwise for multi-byte + * locales we are always AsciiOnly == 0. + */ + if (MB_CUR_MAX == 1) { + int k; + + for (k = 0200; k <= 0377 && !isprint(CTL_ESC(k)); k++) + continue; + AsciiOnly = k > 0377; + } else + AsciiOnly = 0; +#else + AsciiOnly = getenv("LANG") == NULL && getenv("LC_CTYPE") == NULL; +#endif /* NLS */ + if (MapsAreInited && !NLSMapsAreInited) + ed_InitNLSMaps(); + ResetArrowKeys(); + + /* + * Initialize for periodic command intervals. Also, initialize the dummy + * tty list for login-watch. + */ + (void) time(&t_period); +#ifndef HAVENOUTMP + initwatch(); +#endif /* !HAVENOUTMP */ + +#if defined(alliant) + /* + * From: Jim Pace + * tcsh does not work properly on the alliants through an rlogin session. + * The shell generally hangs. Also, reference to the controlling terminal + * does not work ( ie: echo foo > /dev/tty ). + * + * A security feature was added to rlogind affecting FX/80's Concentrix + * from revision 5.5.xx upwards (through 5.7 where this fix was implemented) + * This security change also affects the FX/2800 series. + * The security change to rlogind requires the process group of an rlogin + * session become disassociated with the tty in rlogind. + * + * The changes needed are: + * 1. set the process group + * 2. reenable the control terminal + */ + if (loginsh && isatty(SHIN)) { + ttyn = ttyname(SHIN); + xclose(SHIN); + SHIN = xopen(ttyn, O_RDWR|O_LARGEFILE); + shpgrp = getpid(); + (void) ioctl (SHIN, TIOCSPGRP, (ioctl_t) &shpgrp); + (void) setpgid(0, shpgrp); + } +#endif /* alliant */ + + /* + * Move the descriptors to safe places. The variable didfds is 0 while we + * have only FSH* to work with. When didfds is true, we have 0,1,2 and + * prefer to use these. + */ + initdesc(); + + cdtohome = 1; + setv(STRcdtohome, SAVE(""), VAR_READWRITE); + + /* + * Get and set the tty now + */ + if ((ttyn = ttyname(SHIN)) != NULL) { + /* + * Could use rindex to get rid of other possible path components, but + * hpux preserves the subdirectory /pty/ when storing the tty name in + * utmp, so we keep it too. + */ + if (strncmp(ttyn, "/dev/", 5) == 0) + setv(STRtty, cp = SAVE(ttyn + 5), VAR_READWRITE); + else + setv(STRtty, cp = SAVE(ttyn), VAR_READWRITE); + } + 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 + * forking/waiting + */ + + /* + * 7-10-87 Paul Placeway autologout should be set ONLY on login shells and + * on shells running as root. Out of these, autologout should NOT be set + * for any psudo-terminals (this catches most window systems) and not for + * any terminal running X windows. + * + * At Ohio State, we have had problems with a user having his X session + * drop out from under him (on a Sun) because the shell in his master + * xterm timed out and exited. + * + * Really, this should be done with a program external to the shell, that + * watches for no activity (and NO running programs, such as dump) on a + * terminal for a long peroid of time, and then SIGHUPS the shell on that + * terminal. + * + * bugfix by Rich Salz : For root rsh things + * allways first check to see if loginsh or really root, then do things + * with ttyname() + * + * Also by Jean-Francois Lamy : check the + * value of cp before using it! ("root can rsh too") + * + * PWP: keep the nested ifs; the order of the tests matters and a good + * (smart) C compiler might re-arange things wrong. + */ +#ifdef AUTOLOGOUT +# ifdef convex + if (uid == 0) + /* root always has a 15 minute autologout */ + setcopy(STRautologout, STRrootdefautologout, VAR_READWRITE); + else + if (loginsh) + /* users get autologout set to 0 */ + setcopy(STRautologout, STR0, VAR_READWRITE); +# else /* convex */ + if (loginsh || (uid == 0)) { + if (*cp) { + /* only for login shells or root and we must have a tty */ + if (((cp2 = Strrchr(cp, (Char) '/')) != NULL) && + (Strncmp(cp, STRptssl, 3) != 0)) { + cp2 = cp2 + 1; + } + else + cp2 = cp; + if (!(((Strncmp(cp2, STRtty, 3) == 0) && Isalpha(cp2[3])) || + Strstr(cp, STRptssl) != NULL)) { + if (getenv("DISPLAY") == NULL) { + /* NOT on X window shells */ + setcopy(STRautologout, STRdefautologout, VAR_READWRITE); + } + } + } + } +# endif /* convex */ +#endif /* AUTOLOGOUT */ + + sigset_interrupting(SIGALRM, queue_alrmcatch); + + setcopy(STRstatus, STR0, VAR_READWRITE); + + /* + * get and set machine specific environment variables + */ + getmachine(); + + + /* + * Publish the selected echo style + */ +#if ECHO_STYLE != BSD_ECHO + if (tcsh) { +# if ECHO_STYLE == NONE_ECHO + setcopy(STRecho_style, STRnone, VAR_READWRITE); +# endif /* ECHO_STYLE == NONE_ECHO */ +# if ECHO_STYLE == SYSV_ECHO + setcopy(STRecho_style, STRsysv, VAR_READWRITE); +# endif /* ECHO_STYLE == SYSV_ECHO */ +# if ECHO_STYLE == BOTH_ECHO + setcopy(STRecho_style, STRboth, VAR_READWRITE); +# endif /* ECHO_STYLE == BOTH_ECHO */ + } else +#endif /* ECHO_STYLE != BSD_ECHO */ + setcopy(STRecho_style, STRbsd, VAR_READWRITE); + + /* + * increment the shell level. + */ + shlvl(1); + +#ifdef __ANDROID__ + /* 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 + cp = quote(SAVE("/sdcard")); + tsetenv(STRKHOME, cp); +#else + if ((tcp = getenv("HOME")) != NULL) + cp = quote(SAVE(tcp)); + else + cp = NULL; +#endif + + if (cp == NULL) + fast = 1; /* No home -> can't read scripts */ + else + setv(STRhome, cp, VAR_READWRITE); + + dinit(cp); /* dinit thinks that HOME == cwd in a login + * shell */ + /* + * Grab other useful things from the environment. Should we grab + * everything?? + */ + { + char *cln, *cus, *cgr; + struct passwd *pw; + struct group *gr; + + +#ifdef apollo + int oid = getoid(); + + setv(STRoid, Itoa(oid, 0, 0), VAR_READWRITE); +#endif /* apollo */ + + setv(STReuid, Itoa(euid, 0, 0), VAR_READWRITE); + if ((pw = xgetpwuid(euid)) == NULL) + setcopy(STReuser, STRunknown, VAR_READWRITE); + else + setcopy(STReuser, str2short(pw->pw_name), VAR_READWRITE); + + setv(STRuid, Itoa(uid, 0, 0), VAR_READWRITE); + + setv(STRgid, Itoa(gid, 0, 0), VAR_READWRITE); + + cln = getenv("LOGNAME"); + cus = getenv("USER"); + if (cus != NULL) + setv(STRuser, quote(SAVE(cus)), VAR_READWRITE); + else if (cln != NULL) + setv(STRuser, quote(SAVE(cln)), VAR_READWRITE); + else if ((pw = xgetpwuid(uid)) == NULL) + setcopy(STRuser, STRunknown, VAR_READWRITE); + else + setcopy(STRuser, str2short(pw->pw_name), VAR_READWRITE); + if (cln == NULL) + tsetenv(STRLOGNAME, varval(STRuser)); + if (cus == NULL) + tsetenv(STRKUSER, varval(STRuser)); + + cgr = getenv("GROUP"); + if (cgr != NULL) + setv(STRgroup, quote(SAVE(cgr)), VAR_READWRITE); + else if ((gr = xgetgrgid(gid)) == NULL) + setcopy(STRgroup, STRunknown, VAR_READWRITE); + else + setcopy(STRgroup, str2short(gr->gr_name), VAR_READWRITE); + if (cgr == NULL) + tsetenv(STRKGROUP, varval(STRgroup)); + } + + /* + * HOST may be wrong, since rexd transports the entire environment on sun + * 3.x Just set it again + */ + { + char cbuff[MAXHOSTNAMELEN]; + + if (gethostname(cbuff, sizeof(cbuff)) >= 0) { + cbuff[sizeof(cbuff) - 1] = '\0'; /* just in case */ + tsetenv(STRHOST, str2short(cbuff)); + } + else + tsetenv(STRHOST, STRunknown); + } + + +#ifdef REMOTEHOST + /* + * Try to determine the remote host we were logged in from. + */ + remotehost(); +#endif /* REMOTEHOST */ + +#ifdef apollo + if ((tcp = getenv("SYSTYPE")) == NULL) + tcp = "bsd4.3"; + tsetenv(STRSYSTYPE, quote(str2short(tcp))); +#endif /* apollo */ + + /* + * set editing on by default, unless running under Emacs as an inferior + * shell. + * We try to do this intelligently. If $TERM is available, then it + * should determine if we should edit or not. $TERM is preserved + * across rlogin sessions, so we will not get confused if we rlogin + * under an emacs shell. Another advantage is that if we run an + * xterm under an emacs shell, then the $TERM will be set to + * xterm, so we are going to want to edit. Unfortunately emacs + * does not restore all the tty modes, so xterm is not very well + * set up. But this is not the shell's fault. + * Also don't edit if $TERM == wm, for when we're running under an ATK app. + * Finally, emacs compiled under terminfo, sets the terminal to dumb, + * so disable editing for that too. + * + * Unfortunately, in some cases the initial $TERM setting is "unknown", + * "dumb", or "network" which is then changed in the user's startup files. + * We fix this by setting noediting here if $TERM is unknown/dumb and + * if noediting is set, we switch on editing if $TERM is changed. + */ + if ((tcp = getenv("TERM")) != NULL) { + setv(STRterm, quote(SAVE(tcp)), VAR_READWRITE); + noediting = strcmp(tcp, "unknown") == 0 || strcmp(tcp, "dumb") == 0 || + strcmp(tcp, "network") == 0; + editing = strcmp(tcp, "emacs") != 0 && strcmp(tcp, "wm") != 0 && + !noediting; + } + else { + noediting = 0; + editing = ((tcp = getenv("EMACS")) == NULL || strcmp(tcp, "t") != 0); + } + + /* + * The 'edit' variable is either set or unset. It doesn't + * need a value. Making it 'emacs' might be confusing. + */ + if (editing) + setNS(STRedit); + + + /* + * still more mutability: make the complete routine automatically add the + * suffix of file names... + */ + setNS(STRaddsuffix); + + /* + * Compatibility with tcsh >= 6.12 by default + */ + setNS(STRcsubstnonl); + + /* + * Random default kill ring size + */ + setcopy(STRkillring, str2short("30"), VAR_READWRITE); + + /* + * Re-initialize path if set in environment + */ + if ((tcp = getenv("PATH")) == NULL) +#ifdef _PATH_DEFPATH + importpath(str2short(_PATH_DEFPATH)); +#else /* !_PATH_DEFPATH */ + setq(STRpath, defaultpath(), &shvhed, VAR_READWRITE); +#endif /* _PATH_DEFPATH */ + else + /* Importpath() allocates memory for the path, and the + * returned pointer from SAVE() was discarded, so + * this was a memory leak.. (sg) + * + * importpath(SAVE(tcp)); + */ + importpath(str2short(tcp)); + + + { + /* If the SHELL environment variable ends with "tcsh", set + * STRshell to the same path. This is to facilitate using + * the executable in environments where the compiled-in + * default isn't appropriate (sg). + */ + + size_t sh_len = 0; + + if ((tcp = getenv("SHELL")) != NULL) { + sh_len = strlen(tcp); + if ((sh_len >= 5 && strcmp(tcp + (sh_len - 5), "/tcsh") == 0) || + (!tcsh && sh_len >= 4 && strcmp(tcp + (sh_len - 4), "/csh") == 0)) + setv(STRshell, quote(SAVE(tcp)), VAR_READWRITE); + else + sh_len = 0; + } + if (sh_len == 0) + setcopy(STRshell, STR_SHELLPATH, VAR_READWRITE); + } + +#ifdef _OSD_POSIX /* BS2000 needs this variable set to "SHELL" */ + if ((tcp = getenv("PROGRAM_ENVIRONMENT")) == NULL) + tcp = "SHELL"; + tsetenv(STRPROGRAM_ENVIRONMENT, quote(str2short(tcp))); +#endif /* _OSD_POSIX */ + +#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 */ + + mainpid = getpid(); + doldol = putn((tcsh_number_t)mainpid); /* For $$ */ +#ifdef WINNT_NATIVE + { + char *tmp; + Char *tmp2; + if ((tmp = getenv("TMP")) != NULL) { + tmp = xasprintf("%s/%s", tmp, "sh"); + tmp2 = SAVE(tmp); + xfree(tmp); + } + else { + tmp2 = SAVE(""); + } + shtemp = Strspl(tmp2, doldol); /* For << */ + xfree(tmp2); + } +#else /* !WINNT_NATIVE */ +#ifdef HAVE_MKSTEMP + { + const char *tmpdir = getenv ("TMPDIR"); + if (!tmpdir) + tmpdir = "/tmp"; + shtemp = Strspl(SAVE(tmpdir), SAVE("/sh" TMP_TEMPLATE)); /* For << */ + } +#else /* !HAVE_MKSTEMP */ + shtemp = Strspl(STRtmpsh, doldol); /* For << */ +#endif /* HAVE_MKSTEMP */ +#endif /* WINNT_NATIVE */ + + /* + * Record the interrupt states from the parent process. If the parent is + * non-interruptible our hand must be forced or we (and our children) won't + * be either. Our children inherit termination from our parent. We catch it + * only if we are the login shell. + */ + sigaction(SIGINT, NULL, &parintr); + sigaction(SIGTERM, NULL, &parterm); + + +#ifdef TCF + /* Enable process migration on ourselves and our progeny */ + (void) signal(SIGMIGRATE, SIG_DFL); +#endif /* TCF */ + + /* + * dspkanji/dspmbyte autosetting + */ + /* PATCH IDEA FROM Issei.Suzuki VERY THANKS */ +#if defined(DSPMBYTE) +#if defined(NLS) && defined(LC_CTYPE) + if (((tcp = setlocale(LC_CTYPE, NULL)) != NULL || (tcp = getenv("LANG")) != NULL) && !adrof(CHECK_MBYTEVAR)) +#else + if ((tcp = getenv("LANG")) != NULL && !adrof(CHECK_MBYTEVAR)) +#endif + { + autoset_dspmbyte(str2short(tcp)); + } +#if defined(WINNT_NATIVE) + else if (!adrof(CHECK_MBYTEVAR)) + nt_autoset_dspmbyte(); +#endif /* WINNT_NATIVE */ +#endif +#if defined(AUTOSET_KANJI) +# if defined(NLS) && defined(LC_CTYPE) + if (setlocale(LC_CTYPE, NULL) != NULL || getenv("LANG") != NULL) +# else + if (getenv("LANG") != NULL) +# endif + autoset_kanji(); +#endif /* AUTOSET_KANJI */ + fix_version(); /* publish the shell version */ + + if (argc > 1 && strcmp(argv[1], "--version") == 0) { + xprintf("%S\n", varval(STRversion)); + xexit(0); + } + if (argc > 1 && strcmp(argv[1], "--help") == 0) { + xprintf("%S\n\n", varval(STRversion)); + xprintf("%s", CGETS(11, 8, HELP_STRING)); + xexit(0); + } + /* + * Process the arguments. + * + * Note that processing of -v/-x is actually delayed till after script + * processing. + * + * We set the first character of our name to be '-' if we are a shell + * running interruptible commands. Many programs which examine ps'es + * use this to filter such shells out. + */ + argc--, tempv++; + while (argc > 0 && (tcp = tempv[0])[0] == '-' && + *++tcp != '\0' && !batch) { + do + switch (*tcp++) { + + case 0: /* - Interruptible, no prompt */ + prompt = 0; + setintr = 1; + nofile = 1; + break; + + case 'b': /* -b Next arg is input file */ + batch = 1; + break; + + case 'c': /* -c Command input from arg */ + if (argc == 1) + xexit(0); + argc--, tempv++; +#ifdef M_XENIX + /* Xenix Vi bug: + it relies on a 7 bit environment (/bin/sh), so it + pass ascii arguments with the 8th bit set */ + if (!strcmp(argv[0], "sh")) + { + char *p; + + for (p = tempv[0]; *p; ++p) + *p &= ASCII; + } +#endif + targinp = tempv[0]; + prompt = 0; + nofile = 1; + break; + case 'd': /* -d Load directory stack from file */ + rdirs = 1; + break; + +#ifdef apollo + case 'D': /* -D Define environment variable */ + { + Char *dp; + + cp = str2short(tcp); + if (dp = Strchr(cp, '=')) { + *dp++ = '\0'; + tsetenv(cp, dp); + } + else + tsetenv(cp, STRNULL); + } + *tcp = '\0'; /* done with this argument */ + break; +#endif /* apollo */ + + case 'e': /* -e Exit on any error */ + exiterr = 1; + break; + + case 'f': /* -f Fast start */ + fast = 1; + break; + + case 'i': /* -i Interactive, even if !intty */ + intact = 1; + nofile = 1; + break; + + case 'm': /* -m read .cshrc (from su) */ + mflag = 1; + break; + + case 'n': /* -n Don't execute */ + noexec = 1; + break; + + case 'q': /* -q (Undoc'd) ... die on quit */ + quitit = 1; + break; + + case 's': /* -s Read from std input */ + nofile = 1; + break; + + case 't': /* -t Read one line from input */ + onelflg = 2; + prompt = 0; + nofile = 1; + break; + + case 'v': /* -v Echo hist expanded input */ + nverbose = 1; /* ... later */ + break; + + case 'x': /* -x Echo just before execution */ + nexececho = 1; /* ... later */ + break; + + case 'V': /* -V Echo hist expanded input */ + setNS(STRverbose); /* NOW! */ + break; + + case 'X': /* -X Echo just before execution */ + setNS(STRecho); /* NOW! */ + break; + + case 'F': + /* + * This will cause children to be created using fork instead of + * vfork. + */ + use_fork = 1; + break; + + case ' ': + case '\t': + case '\r': + case '\n': + /* + * for O/S's that don't do the argument parsing right in + * "#!/foo -f " scripts + */ + break; + + default: /* Unknown command option */ + exiterr = 1; + stderror(ERR_TCSHUSAGE, tcp-1, progname); + break; + + } while (*tcp); + tempv++, argc--; + } + + if (quitit) /* With all due haste, for debugging */ + (void) signal(SIGQUIT, SIG_DFL); + + /* + * Unless prevented by -, -c, -i, -s, or -t, if there are remaining + * arguments the first of them is the name of a shell file from which to + * read commands. + */ + if (nofile == 0 && argc > 0) { + nofile = xopen(tempv[0], O_RDONLY|O_LARGEFILE); + if (nofile < 0) { + child = 1; /* So this ... */ + /* ... doesn't return */ + stderror(ERR_SYSTEM, tempv[0], strerror(errno)); + } + xfree(ffile); + dolzero = 1; + ffile = SAVE(tempv[0]); + /* + * Replace FSHIN. Handle /dev/std{in,out,err} specially + * since once they are closed we cannot open them again. + * In that case we use our own saved descriptors + */ + if ((SHIN = dmove(nofile, FSHIN)) < 0) + switch(nofile) { + case 0: + SHIN = FSHIN; + break; + case 1: + SHIN = FSHOUT; + break; + case 2: + SHIN = FSHDIAG; + break; + default: + stderror(ERR_SYSTEM, tempv[0], strerror(errno)); + break; + } + (void) close_on_exec(SHIN, 1); + prompt = 0; + /* argc not used any more */ tempv++; + } + + /* + * Call to closem() used to be part of initdesc(). Now called below where + * the script name argument has become stdin. Kernel may have used a file + * descriptor to hold the name of the script (setuid case) and this name + * mustn't be lost by closing the fd too soon. + */ + closem(); + + /* + * Consider input a tty if it really is or we are interactive. but not for + * editing (christos) + */ + if (!(intty = isatty(SHIN))) { + if (adrof(STRedit)) + unsetv(STRedit); + editing = 0; + } + intty |= intact; +#ifndef convex + if (intty || (intact && isatty(SHOUT))) { + if (!batch && (uid != euid || gid != egid)) { + errno = EACCES; + child = 1; /* So this ... */ + /* ... doesn't return */ + stderror(ERR_SYSTEM, progname, strerror(errno)); + } + } +#endif /* convex */ + isoutatty = isatty(SHOUT); + isdiagatty = isatty(SHDIAG); + /* + * Decide whether we should play with signals or not. If we are explicitly + * told (via -i, or -) or we are a login shell (arg0 starts with -) or the + * input and output are both the ttys("csh", or "csh/dev/ttyx") + * Note that in only the login shell is it likely that parent may have set + * signals to be ignored + */ + if (loginsh || intact || (intty && isatty(SHOUT))) + setintr = 1; + settell(); + /* + * Save the remaining arguments in argv. + */ + setq(STRargv, blk2short(tempv), &shvhed, VAR_READWRITE); + + /* + * Set up the prompt. + */ + if (prompt) { + setcopy(STRprompt, STRdefprompt, VAR_READWRITE); + /* that's a meta-questionmark */ + setcopy(STRprompt2, STRmquestion, VAR_READWRITE); + setcopy(STRprompt3, STRKCORRECT, VAR_READWRITE); + } + + /* + * If we are an interactive shell, then start fiddling with the signals; + * this is a tricky game. + */ + shpgrp = mygetpgrp(); + opgrp = tpgrp = -1; + if (setintr) { + struct sigaction osig; + + **argv = '-'; + if (!quitit) /* Wary! */ + (void) signal(SIGQUIT, SIG_IGN); + pintr_disabled = 1; + sigset_interrupting(SIGINT, queue_pintr); + (void) signal(SIGTERM, SIG_IGN); + + /* + * No reason I can see not to save history on all these events.. + * Most usual occurrence is in a window system, where we're not a login + * shell, but might as well be... (sg) + * But there might be races when lots of shells exit together... + * [this is also incompatible]. + * We have to be mre careful here. If the parent wants to + * ignore the signals then we leave them untouched... + * We also only setup the handlers for shells that are trully + * interactive. + */ + sigaction(SIGHUP, NULL, &osig); + if (loginsh || osig.sa_handler != SIG_IGN) + /* exit processing on HUP */ + sigset_interrupting(SIGHUP, queue_phup); +#ifdef SIGXCPU + sigaction(SIGXCPU, NULL, &osig); + if (loginsh || osig.sa_handler != SIG_IGN) + /* exit processing on XCPU */ + sigset_interrupting(SIGXCPU, queue_phup); +#endif +#ifdef SIGXFSZ + sigaction(SIGXFSZ, NULL, &osig); + if (loginsh || osig.sa_handler != SIG_IGN) + /* exit processing on XFSZ */ + sigset_interrupting(SIGXFSZ, queue_phup); +#endif + + if (quitit == 0 && targinp == 0) { +#ifdef SIGTSTP + (void) signal(SIGTSTP, SIG_IGN); +#endif +#ifdef SIGTTIN + (void) signal(SIGTTIN, SIG_IGN); +#endif +#ifdef SIGTTOU + (void) signal(SIGTTOU, SIG_IGN); +#endif + /* + * Wait till in foreground, in case someone stupidly runs csh & + * dont want to try to grab away the tty. + */ + if (isatty(FSHDIAG)) + f = FSHDIAG; + else if (isatty(FSHOUT)) + f = FSHOUT; + else if (isatty(OLDSTD)) + f = OLDSTD; + else + f = -1; + +#ifdef NeXT + /* NeXT 2.0 /usr/etc/rlogind, does not set our process group! */ + if (f != -1 && shpgrp == 0) { + shpgrp = getpid(); + (void) setpgid(0, shpgrp); + (void) tcsetpgrp(f, shpgrp); + } +#endif /* NeXT */ +#ifdef BSDJOBS /* if we have tty job control */ + if (f != -1 && grabpgrp(f, shpgrp) != -1) { + /* + * Thanks to Matt Day for the POSIX references, and to + * Paul Close for the SGI clarification. + */ + if (setdisc(f) != -1) { + opgrp = shpgrp; + shpgrp = getpid(); + tpgrp = shpgrp; + if (tcsetpgrp(f, shpgrp) == -1) { + /* + * On hpux 7.03 this fails with EPERM. This happens on + * the 800 when opgrp != shpgrp at this point. (we were + * forked from a non job control shell) + * POSIX 7.2.4, says we failed because the process + * group specified did not belong to a process + * in the same session with the tty. So we set our + * process group and try again. + */ + if (setpgid(0, shpgrp) == -1) { + xprintf("setpgid:"); + goto notty; + } + if (tcsetpgrp(f, shpgrp) == -1) { + xprintf("tcsetpgrp:"); + goto notty; + } + } + /* + * We check the process group now. If it is the same, then + * we don't need to set it again. On hpux 7.0 on the 300's + * if we set it again it fails with EPERM. This is the + * correct behavior according to POSIX 4.3.3 if the process + * was a session leader . + */ + else if (shpgrp != mygetpgrp()) { + if(setpgid(0, shpgrp) == -1) { + xprintf("setpgid:"); + goto notty; + } + } +#ifdef IRIS4D + /* + * But on irix 3.3 we need to set it again, even if it is + * the same. We do that to tell the system that we + * need BSD process group compatibility. + */ + else + (void) setpgid(0, shpgrp); +#endif + (void) close_on_exec(dcopy(f, FSHTTY), 1); + } + else + tpgrp = -1; + } + if (tpgrp == -1) { + notty: + xprintf(CGETS(11, 1, "Warning: no access to tty (%s).\n"), + strerror(errno)); + xprintf("%s", + CGETS(11, 2, "Thus no job control in this shell.\n")); + /* + * Fix from:Sakari Jalovaara if we don't + * have access to tty, disable editing too + */ + if (adrof(STRedit)) + unsetv(STRedit); + editing = 0; + } +#else /* BSDJOBS */ /* don't have job control, so frotz it */ + tpgrp = -1; +#endif /* BSDJOBS */ + } + } + if (setintr == 0 && parintr.sa_handler == SIG_DFL) + setintr = 1; + +/* + * SVR4 doesn't send a SIGCHLD when a child is stopped or continued if the + * handler is installed with signal(2) or sigset(2). sigaction(2) must + * be used instead. + * + * David Dawes (dawes@physics.su.oz.au) Sept 1991 + */ + sigset_interrupting(SIGCHLD, queue_pchild); + + if (intty && !targinp) + (void) ed_Setup(editing);/* Get the tty state, and set defaults */ + /* Only alter the tty state if editing */ + + /* + * Set an exit here in case of an interrupt or error reading the shell + * start-up scripts. + */ + osetintr = setintr; + oparintr = parintr; + (void)cleanup_push_mark(); /* There is no outer handler */ + if (setexit() != 0) /* PWP */ + reenter = 1; + else + reenter = 0; + exitset++; + haderr = 0; /* In case second time through */ + if (!fast && reenter == 0) { + /* Will have varval(STRhome) here because set fast if don't */ + { + pintr_disabled++; + cleanup_push(&pintr_disabled, disabled_cleanup); + setintr = 0;/*FIXRESET:cleanup*/ + /* onintr in /etc/ files has no effect */ + parintr.sa_handler = SIG_IGN;/*FIXRESET: cleanup*/ +#ifdef LOGINFIRST +#ifdef _PATH_DOTLOGIN + if (loginsh) + (void) srcfile(_PATH_DOTLOGIN, 0, 0, NULL); +#endif +#endif + +#ifdef _PATH_DOTCSHRC + (void) srcfile(_PATH_DOTCSHRC, 0, 0, NULL); +#endif + if (!targinp && !onelflg && !havhash) + dohash(NULL,NULL); +#ifndef LOGINFIRST +#ifdef _PATH_DOTLOGIN + if (loginsh) + (void) srcfile(_PATH_DOTLOGIN, 0, 0, NULL); +#endif +#endif + cleanup_until(&pintr_disabled); + setintr = osetintr; + parintr = oparintr; + } +#ifdef LOGINFIRST + if (loginsh) + (void) srccat(varval(STRhome), STRsldotlogin); +#endif + /* upward compat. */ + if (!srccat(varval(STRhome), STRsldottcshrc)) + (void) srccat(varval(STRhome), STRsldotcshrc); + + if (!targinp && !onelflg && !havhash) + dohash(NULL,NULL); + + /* + * Source history before .login so that it is available in .login + */ + loadhist(NULL, 0); +#ifndef LOGINFIRST + if (loginsh) + (void) srccat(varval(STRhome), STRsldotlogin); +#endif + if (loginsh || rdirs) + loaddirs(NULL); + } + /* Reset interrupt flag */ + setintr = osetintr; + parintr = oparintr; + exitset--; + + /* Initing AFTER .cshrc is the Right Way */ + if (intty && !targinp) { /* PWP setup stuff */ + ed_Init(); /* init the new line editor */ +#ifdef SIG_WINDOW + check_window_size(1); /* mung environment */ +#endif /* SIG_WINDOW */ + } + + /* + * Now are ready for the -v and -x flags + */ + if (nverbose) + setNS(STRverbose); + if (nexececho) + setNS(STRecho); + + + if (targinp) { + /* If this -c command caused an error before, skip processing */ + if (reenter && arginp) { + exitcode = 1; + goto done; + } + + 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 + * interactive shell our call here will never return by being blown past on + * an error. + */ + process(setintr); + +done: + /* + * Mop-up. + */ + /* Take care of these (especially HUP) here instead of inside flush. */ + handle_pending_signals(); + if (intty) { + if (loginsh) { + xprintf("logout\n"); + xclose(SHIN); + child = 1; +#ifdef TESLA + do_logout = 1; +#endif /* TESLA */ + goodbye(NULL, NULL); + } + else { + xprintf("exit\n"); + } + } + record(); + exitstat(); + return exitcode; +} + +void +untty(void) +{ +#ifdef BSDJOBS + if (tpgrp > 0 && opgrp != shpgrp) { + (void) setpgid(0, opgrp); + (void) tcsetpgrp(FSHTTY, opgrp); + (void) resetdisc(FSHTTY); + } +#endif /* BSDJOBS */ +} + +void +importpath(Char *cp) +{ + size_t i = 0; + Char *dp; + Char **pv; + int c; + + for (dp = cp; *dp; dp++) + if (*dp == PATHSEP) + i++; + /* + * i+2 where i is the number of colons in the path. There are i+1 + * directories in the path plus we need room for a zero terminator. + */ + pv = xcalloc(i + 2, sizeof(Char *)); + dp = cp; + i = 0; + if (*dp) + for (;;) { + if ((c = *dp) == PATHSEP || c == 0) { + *dp = 0; + pv[i++] = Strsave(*cp ? cp : STRdot); + if (c) { + cp = dp + 1; + *dp = PATHSEP; + } + else + break; + } +#ifdef WINNT_NATIVE + else if (*dp == '\\') + *dp = '/'; +#endif /* WINNT_NATIVE */ + dp++; + } + pv[i] = 0; + cleanup_push(pv, blk_cleanup); + setq(STRpath, pv, &shvhed, VAR_READWRITE); + cleanup_ignore(pv); + cleanup_until(pv); +} + +/* + * Source to the file which is the catenation of the argument names. + */ +static int +srccat(Char *cp, Char *dp) +{ + if (cp[0] == '/' && cp[1] == '\0') + return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL); + else { + Char *ep; + char *ptr; + int rv; + +#ifdef WINNT_NATIVE + ep = Strend(cp); + if (ep != cp && ep[-1] == '/' && dp[0] == '/') /* silly win95 */ + dp++; +#endif /* WINNT_NATIVE */ + + ep = Strspl(cp, dp); + cleanup_push(ep, xfree); + ptr = short2str(ep); + + rv = srcfile(ptr, (mflag ? 0 : 1), 0, NULL); + cleanup_until(ep); + return rv; + } +} + +/* + * Source to a file putting the file descriptor in a safe place (> 2). + */ +#ifndef WINNT_NATIVE +static int +#else +int +#endif /*WINNT_NATIVE*/ +srcfile(const char *f, int onlyown, int flag, Char **av) +{ + int unit; + + if ((unit = xopen(f, O_RDONLY|O_LARGEFILE)) == -1) + return 0; + cleanup_push(&unit, open_cleanup); + unit = dmove(unit, -1); + cleanup_ignore(&unit); + cleanup_until(&unit); + + (void) close_on_exec(unit, 1); + srcunit(unit, onlyown, flag, av); + return 1; +} + + +/* + * Save the shell state, and establish new argument vector, and new input + * fd. + */ +static void +st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av) +{ + st->insource = insource; + st->SHIN = SHIN; + /* Want to preserve the meaning of "source file >output". + * Save old descriptors, move new 0,1,2 to safe places and assign + * them to SH* and let process() redo 0,1,2 from them. + * + * The macro returns true if d1 and d2 are good and they point to + * different things. If you don't avoid saving duplicate + * descriptors, you really limit the depth of "source" recursion + * you can do because of all the open file descriptors. -IAN! + */ +#define NEED_SAVE_FD(d1,d2) \ + (fstat(d1, &s1) != -1 && fstat(d2, &s2) != -1 \ + && (s1.st_ino != s2.st_ino || s1.st_dev != s2.st_dev) ) + + st->OLDSTD = st->SHOUT = st->SHDIAG = -1;/* test later to restore these */ + if (didfds) { + struct stat s1, s2; + if (NEED_SAVE_FD(0,OLDSTD)) { + st->OLDSTD = OLDSTD; + OLDSTD = dmove(0, -1); + (void)close_on_exec(OLDSTD, 1); + } + if (NEED_SAVE_FD(1,SHOUT)) { + st->SHOUT = SHOUT; + SHOUT = dmove(1, -1); + (void)close_on_exec(SHOUT, 1); + } + if (NEED_SAVE_FD(2,SHDIAG)) { + st->SHDIAG = SHDIAG; + SHDIAG = dmove(2, -1); + (void)close_on_exec(SHDIAG, 1); + } + donefds(); + } + + st->intty = intty; + st->whyles = whyles; + st->gointr = gointr; + st->arginp = arginp; + st->evalp = evalp; + st->evalvec = evalvec; + st->alvecp = alvecp; + st->alvec = alvec; + st->onelflg = onelflg; + st->enterhist = enterhist; + st->justpr = justpr; + if (hflg) + st->HIST = HIST; + else + st->HIST = '\0'; + st->cantell = cantell; + cpybin(st->B, B); + + /* + * we can now pass arguments to source. + * For compatibility we do that only if arguments were really + * passed, otherwise we keep the old, global $argv like before. + */ + if (av != NULL && *av != NULL) { + struct varent *vp; + if ((vp = adrof(STRargv)) != NULL && vp->vec != NULL) + st->argv = saveblk(vp->vec); + else + st->argv = NULL; + setq(STRargv, saveblk(av), &shvhed, VAR_READWRITE); + } + else + st->argv = NULL; + st->av = av; + + SHIN = unit; /* Do this first */ + + /* Establish new input arena */ + { + fbuf = NULL; + fseekp = feobp = fblocks = 0; + settell(); + } + + arginp = 0; + onelflg = 0; + intty = isatty(SHIN); + whyles = 0; + gointr = 0; + evalvec = 0; + evalp = 0; + alvec = al; + alvecp = 0; + enterhist = hflg; + if (enterhist) + HIST = '\0'; + insource = 1; +} + + +/* + * Restore the shell to a saved state + */ +static void +st_restore(void *xst) +{ + struct saved_state *st; + + st = xst; + if (st->SHIN == -1) + return; + + /* Reset input arena */ + { + int i; + Char** nfbuf = fbuf; + int nfblocks = fblocks; + + fblocks = 0; + fbuf = NULL; + for (i = 0; i < nfblocks; i++) + xfree(nfbuf[i]); + xfree(nfbuf); + } + cpybin(B, st->B); + + xclose(SHIN); + + insource = st->insource; + SHIN = st->SHIN; + if (st->OLDSTD != -1) + xclose(OLDSTD), OLDSTD = st->OLDSTD; + if (st->SHOUT != -1) + xclose(SHOUT), SHOUT = st->SHOUT; + if (st->SHDIAG != -1) + xclose(SHDIAG), SHDIAG = st->SHDIAG; + arginp = st->arginp; + onelflg = st->onelflg; + evalp = st->evalp; + evalvec = st->evalvec; + alvecp = st->alvecp; + alvec = st->alvec; + intty = st->intty; + whyles = st->whyles; + gointr = st->gointr; + if (st->HIST != '\0') + HIST = st->HIST; + enterhist = st->enterhist; + cantell = st->cantell; + justpr = st->justpr; + + if (st->argv != NULL) + setq(STRargv, st->argv, &shvhed, VAR_READWRITE); + else if (st->av != NULL && *st->av != NULL && adrof(STRargv) != NULL) + unsetv(STRargv); +} + +/* + * Source to a unit. If onlyown it must be our file or our group or + * we don't chance it. This occurs on ".cshrc"s and the like. + */ +static void +srcunit(int unit, int onlyown, int hflg, Char **av) +{ + struct saved_state st; + + st.SHIN = -1; /* st_restore checks this */ + + if (unit < 0) + return; + + if (onlyown) { + struct stat stb; + + if (fstat(unit, &stb) < 0) { + xclose(unit); + return; + } + } + + /* Does nothing before st_save() because st.SHIN == -1 */ + cleanup_push(&st, st_restore); + if (setintr) { + pintr_disabled++; + cleanup_push(&pintr_disabled, disabled_cleanup); + } + + /* Save the current state and move us to a new state */ + st_save(&st, unit, hflg, NULL, av); + + /* + * Now if we are allowing commands to be interrupted, we let ourselves be + * interrupted. + */ + if (setintr) { + cleanup_until(&pintr_disabled); + pintr_disabled++; + cleanup_push(&pintr_disabled, disabled_cleanup); + } + + process(0); /* 0 -> blow away on errors */ + + /* Restore the old state */ + cleanup_until(&st); +} + + +/*ARGSUSED*/ +void +goodbye(Char **v, struct command *c) +{ + USE(v); + USE(c); + record(); + + if (loginsh) { + size_t omark; + sigset_t set; + + sigemptyset(&set); + signal(SIGQUIT, SIG_IGN); + sigaddset(&set, SIGQUIT); + sigprocmask(SIG_UNBLOCK, &set, NULL); + signal(SIGINT, SIG_IGN); + sigaddset(&set, SIGINT); + signal(SIGTERM, SIG_IGN); + sigaddset(&set, SIGTERM); + signal(SIGHUP, SIG_IGN); + sigaddset(&set, SIGHUP); + sigprocmask(SIG_UNBLOCK, &set, NULL); + phup_disabled = 1; + setintr = 0; /* No interrupts after "logout" */ + /* Trap errors inside .logout */ + omark = cleanup_push_mark(); + if (setexit() == 0) { + if (!(adrof(STRlogout))) + setcopy(STRlogout, STRnormal, VAR_READWRITE); +#ifdef _PATH_DOTLOGOUT + (void) srcfile(_PATH_DOTLOGOUT, 0, 0, NULL); +#endif + if (adrof(STRhome)) + (void) srccat(varval(STRhome), STRsldtlogout); +#ifdef TESLA + do_logout = 1; +#endif /* TESLA */ + } + cleanup_pop_mark(omark); + } + exitstat(); +} + +void +exitstat(void) +{ +#ifdef PROF + _mcleanup(); +#endif + /* + * Note that if STATUS is corrupted (i.e. getn bombs) then error will exit + * directly because we poke child here. Otherwise we might continue + * unwarrantedly (sic). + */ + child = 1; + + xexit(getn(varval(STRstatus))); +} + +/* + * in the event of a HUP we want to save the history + */ +void +phup(void) +{ + if (loginsh) { + setcopy(STRlogout, STRhangup, VAR_READWRITE); +#ifdef _PATH_DOTLOGOUT + (void) srcfile(_PATH_DOTLOGOUT, 0, 0, NULL); +#endif + if (adrof(STRhome)) + (void) srccat(varval(STRhome), STRsldtlogout); + } + + record(); + +#ifdef POSIXJOBS + /* + * We kill the last foreground process group. It then becomes + * responsible to propagate the SIGHUP to its progeny. + */ + { + struct process *pp, *np; + + for (pp = proclist.p_next; pp; pp = pp->p_next) { + np = pp; + /* + * Find if this job is in the foreground. It could be that + * the process leader has exited and the foreground flag + * is cleared for it. + */ + do + /* + * If a process is in the foreground we try to kill + * it's process group. If we succeed, then the + * whole job is gone. Otherwise we keep going... + * But avoid sending HUP to the shell again. + */ + if (((np->p_flags & PFOREGND) != 0) && np->p_jobid != shpgrp) { + np->p_flags &= ~PHUP; + if (killpg(np->p_jobid, SIGHUP) != -1) { + /* In case the job was suspended... */ +#ifdef SIGCONT + (void) killpg(np->p_jobid, SIGCONT); +#endif + break; + } + } + while ((np = np->p_friends) != pp); + } + } +#endif /* POSIXJOBS */ + + xexit(SIGHUP); +} + +static Char *jobargv[2] = {STRjobs, 0}; + +/* + * Catch an interrupt, e.g. during lexical input. + * If we are an interactive shell, we reset the interrupt catch + * immediately. In any case we drain the shell output, + * and finally go through the normal error mechanism, which + * gets a chance to make the shell go away. + */ +int just_signaled; /* bugfix by Michael Bloom (mg@ttidca.TTI.COM) */ + +void +pintr(void) +{ + just_signaled = 1; + pintr1(1); +} + +void +pintr1(int wantnl) +{ + if (setintr) { + if (pjobs) { + pjobs = 0; + xputchar('\n'); + dojobs(jobargv, NULL); + stderror(ERR_NAME | ERR_INTR); + } + } + /* MH - handle interrupted completions specially */ + { + if (InsideCompletion) + stderror(ERR_SILENT); + } + /* JV - Make sure we shut off inputl */ + { + (void) Cookedmode(); + GettingInput = 0; + if (evalvec) + doneinp = 1; + } + drainoline(); +#ifdef HAVE_GETPWENT + (void) endpwent(); +#endif + + /* + * If we have an active "onintr" then we search for the label. Note that if + * one does "onintr -" then we shan't be interruptible so we needn't worry + * about that here. + */ + if (gointr) { + gotolab(gointr); + reset(); + } + else if (intty && wantnl) { + if (editing) { + /* + * If we are editing a multi-line input command, and move to + * the beginning of the line, we don't want to trash it when + * we hit ^C + */ + PastBottom(); + ClearLines(); + ClearDisp(); + } + else { + /* xputchar('\n'); *//* Some like this, others don't */ + (void) putraw('\r'); + (void) putraw('\n'); + } + } + stderror(ERR_SILENT); +} + +/* + * Process is the main driving routine for the shell. + * It runs all command processing, except for those within { ... } + * in expressions (which is run by a routine evalav in sh.exp.c which + * is a stripped down process), and `...` evaluation which is run + * also by a subset of this code in sh.glob.c in the routine backeval. + * + * The code here is a little strange because part of it is interruptible + * and hence freeing of structures appears to occur when none is necessary + * if this is ignored. + * + * Note that if catch is not set then we will unwind on any error. + * If an end-of-file occurs, we return. + */ +void +process(int catch) +{ + jmp_buf_t osetexit; + /* PWP: This might get nuked by longjmp so don't make it a register var */ + size_t omark; + volatile int didexitset = 0; + + getexit(osetexit); + omark = cleanup_push_mark(); + for (;;) { + struct command *t; + int hadhist, old_pintr_disabled; + + (void)setexit(); + if (didexitset == 0) { + exitset++; + didexitset++; + } + pendjob(); + + justpr = enterhist; /* execute if not entering history */ + + if (haderr) { + if (!catch) { + /* unwind */ + doneinp = 0; + cleanup_pop_mark(omark); + resexit(osetexit); + reset(); + } + haderr = 0; + /* + * Every error is eventually caught here or the shell dies. It is + * at this point that we clean up any left-over open files, by + * closing all but a fixed number of pre-defined files. Thus + * routines don't have to worry about leaving files open due to + * deeper errors... they will get closed here. + */ + closem(); + continue; + } + if (doneinp) { + doneinp = 0; + break; + } + if (chkstop) + chkstop--; + if (neednote) + pnote(); + if (intty && prompt && evalvec == 0) { + just_signaled = 0; + mailchk(); + /* + * Watch for logins/logouts. Next is scheduled commands stored + * previously using "sched." Then execute periodic commands. + * Following that, the prompt precmd is run. + */ +#ifndef HAVENOUTMP + watch_login(0); +#endif /* !HAVENOUTMP */ + sched_run(); + period_cmd(); + precmd(); + /* + * If we are at the end of the input buffer then we are going to + * read fresh stuff. Otherwise, we are rereading input and don't + * need or want to prompt. + */ + if (fseekp == feobp && aret == TCSH_F_SEEK) + printprompt(0, NULL); + flush(); + setalarm(1); + } + if (seterr) { + xfree(seterr); + seterr = NULL; + } + + /* + * Interruptible during interactive reads + */ + if (setintr) + pintr_push_enable(&old_pintr_disabled); + freelex(¶ml); + hadhist = lex(¶ml); + if (setintr) + cleanup_until(&old_pintr_disabled); + cleanup_push(¶ml, lex_cleanup); + + /* + * Echo not only on VERBOSE, but also with history expansion. If there + * is a lexical error then we forego history echo. + * Do not echo if we're only entering history (source -h). + */ + if ((hadhist && !seterr && intty && !tellwhat && !Expand && !whyles) || + (!enterhist && adrof(STRverbose))) + { + int odidfds = didfds; + haderr = 1; + didfds = 0; + prlex(¶ml); + flush(); + haderr = 0; + didfds = odidfds; + } + (void) alarm(0); /* Autologout OFF */ + alrmcatch_disabled = 1; + + /* + * Save input text on the history list if reading in old history, or it + * is from the terminal at the top level and not in a loop. + * + * PWP: entry of items in the history list while in a while loop is done + * elsewhere... + */ + if (enterhist || (catch && intty && !whyles && !tellwhat && !arun)) + savehist(¶ml, enterhist > 1); + + if (Expand && seterr) + Expand = 0; + + /* + * Print lexical error messages, except when sourcing history lists. + */ + if (!enterhist && seterr) + stderror(ERR_OLD); + + /* + * If had a history command :p modifier then this is as far as we + * should go + */ + if (justpr) + goto cmd_done; + + /* + * If had a tellwhat from twenex() then do + */ + if (tellwhat) { + (void) tellmewhat(¶ml, NULL); + goto cmd_done; + } + + alias(¶ml); + +#ifdef BSDJOBS + /* + * If we are interactive, try to continue jobs that we have stopped + */ + if (prompt) + continue_jobs(¶ml); +#endif /* BSDJOBS */ + + /* + * Check to see if the user typed "rm * .o" or something + */ + if (prompt) + rmstar(¶ml); + /* + * Parse the words of the input into a parse tree. + */ + t = syntax(paraml.next, ¶ml, 0); + /* + * We cannot cleanup push here, because cd /blah; echo foo + * would rewind t on the chdir error, and free the rest of the command + */ + if (seterr) { + freesyn(t); + stderror(ERR_OLD); + } + + postcmd(); + /* + * Execute the parse tree From: Michael Schroeder + * was execute(t, tpgrp); + */ + execute(t, (tpgrp > 0 ? tpgrp : -1), NULL, NULL, TRUE); + freesyn(t); + + /* + * Made it! + */ +#ifdef SIG_WINDOW + if (windowchg || (catch && intty && !whyles && !tellwhat)) { + (void) check_window_size(0); /* for window systems */ + } +#endif /* SIG_WINDOW */ + setcopy(STR_, InputBuf, VAR_READWRITE | VAR_NOGLOB); + cmd_done: + if (cleanup_reset()) + cleanup_until(¶ml); + else + haderr = 1; + } + cleanup_pop_mark(omark); + resexit(osetexit); + exitset--; + handle_pending_signals(); +} + +/*ARGSUSED*/ +void +dosource(Char **t, struct command *c) +{ + Char *f; + int hflg = 0; + char *file; + + USE(c); + t++; + if (*t && eq(*t, STRmh)) { + if (*++t == NULL) + stderror(ERR_NAME | ERR_HFLAG); + hflg++; + } + else if (*t && eq(*t, STRmm)) { + if (*++t == NULL) + stderror(ERR_NAME | ERR_MFLAG); + hflg = 2; + } + + f = globone(*t++, G_ERROR); + file = strsave(short2str(f)); + 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); +} + +/* + * Check for mail. + * If we are a login shell, then we don't want to tell + * about any mail file unless its been modified + * after the time we started. + * This prevents us from telling the user things he already + * knows, since the login program insists on saying + * "You have mail." + */ + +/* + * The AMS version. + * This version checks if the file is a directory, and if so, + * tells you the number of files in it, otherwise do the old thang. + * The magic "+1" in the time calculation is to compensate for + * an AFS bug where directory mtimes are set to 1 second in + * the future. + */ + +static void +mailchk(void) +{ + struct varent *v; + Char **vp; + time_t t; + int intvl, cnt; + struct stat stb; + int new; + + v = adrof(STRmail); + if (v == NULL || v->vec == NULL) + return; + (void) time(&t); + vp = v->vec; + cnt = blklen(vp); + intvl = (cnt && number(*vp)) ? (--cnt, getn(*vp++)) : MAILINTVL; + if (intvl < 1) + intvl = 1; + if (chktim + intvl > t) + return; + for (; *vp; vp++) { + char *filename = short2str(*vp); + char *mboxdir = filename; + + if (stat(filename, &stb) < 0) + continue; +#if defined(BSDTIMES) || defined(_SEQUENT_) + new = stb.st_mtime > time0.tv_sec; +#else + new = stb.st_mtime > seconds0; +#endif + if (S_ISDIR(stb.st_mode)) { + DIR *mailbox; + int mailcount = 0; + char *tempfilename; + struct stat stc; + + tempfilename = xasprintf("%s/new", filename); + + if (stat(tempfilename, &stc) != -1 && S_ISDIR(stc.st_mode)) { + /* + * "filename/new" exists and is a directory; you are + * using Qmail. + */ + stb = stc; +#if defined(BSDTIMES) || defined(_SEQUENT_) + new = stb.st_mtime > time0.tv_sec; +#else + new = stb.st_mtime > seconds0; +#endif + mboxdir = tempfilename; + } + + if (stb.st_mtime <= chktim + 1 || (loginsh && !new)) { + xfree(tempfilename); + continue; + } + + mailbox = opendir(mboxdir); + xfree(tempfilename); + if (mailbox == NULL) + continue; + + /* skip . and .. */ + if (!readdir(mailbox) || !readdir(mailbox)) { + (void)closedir(mailbox); + continue; + } + + while (readdir(mailbox)) + mailcount++; + + (void)closedir(mailbox); + if (mailcount == 0) + continue; + + if (cnt == 1) + xprintf(CGETS(11, 3, "You have %d mail messages.\n"), + mailcount); + else + xprintf(CGETS(11, 4, "You have %d mail messages in %s.\n"), + mailcount, filename); + } + else { + char *type; + + if (stb.st_size == 0 || stb.st_atime >= stb.st_mtime || + (stb.st_atime <= chktim && stb.st_mtime <= chktim) || + (loginsh && !new)) + continue; + type = strsave(new ? CGETS(11, 6, "new ") : ""); + cleanup_push(type, xfree); + if (cnt == 1) + xprintf(CGETS(11, 5, "You have %smail.\n"), type); + else + xprintf(CGETS(11, 7, "You have %smail in %s.\n"), type, filename); + cleanup_until(type); + } + } + chktim = t; +} + +/* + * Extract a home directory from the password file + * The argument points to a buffer where the name of the + * user whose home directory is sought is currently. + * We return home directory of the user, or NULL. + */ +Char * +gethdir(const Char *home) +{ + Char *h; + + /* + * Is it us? + */ + if (*home == '\0') { + if ((h = varval(STRhome)) != STRNULL) + return Strsave(h); + else + return NULL; + } + + /* + * Look in the cache + */ + if ((h = gettilde(home)) == NULL) + return NULL; + else + return Strsave(h); +} + +/* + * Move the initial descriptors to their eventual + * resting places, closing all other units. + */ +void +initdesc(void) +{ +#ifdef NLS_BUGS +#ifdef NLS_CATALOGS + nlsclose(); +#endif /* NLS_CATALOGS */ +#endif /* NLS_BUGS */ + + + didfds = 0; /* 0, 1, 2 aren't set up */ + (void) close_on_exec(SHIN = dcopy(0, FSHIN), 1); + (void) close_on_exec(SHOUT = dcopy(1, FSHOUT), 1); + (void) close_on_exec(SHDIAG = dcopy(2, FSHDIAG), 1); + (void) close_on_exec(OLDSTD = dcopy(SHIN, FOLDSTD), 1); +#ifndef CLOSE_ON_EXEC + didcch = 0; /* Havent closed for child */ +#endif /* CLOSE_ON_EXEC */ + if (SHDIAG >= 0) + isdiagatty = isatty(SHDIAG); + else + isdiagatty = 0; + if (SHDIAG >= 0) + isoutatty = isatty(SHOUT); + else + isoutatty = 0; +#ifdef NLS_BUGS +#ifdef NLS_CATALOGS + nlsinit(); +#endif /* NLS_CATALOGS */ +#endif /* NLS_BUGS */ +} + + +void +#ifdef PROF +done(int i) +#else +xexit(int i) +#endif +{ +#ifdef TESLA + if (loginsh && do_logout) { + /* this is to send hangup signal to the develcon */ + /* we toggle DTR. clear dtr - sleep 1 - set dtr */ + /* ioctl will return ENOTTY for pty's but we ignore it */ + /* exitstat will run after disconnect */ + /* we sleep for 2 seconds to let things happen in */ + /* .logout and rechist() */ +#ifdef TIOCCDTR + (void) sleep(2); + (void) ioctl(FSHTTY, TIOCCDTR, NULL); + (void) sleep(1); + (void) ioctl(FSHTTY, TIOCSDTR, NULL); +#endif /* TIOCCDTR */ + } +#endif /* TESLA */ + + { + struct process *pp, *np; + pid_t mypid = getpid(); + /* Kill all processes marked for hup'ing */ + for (pp = proclist.p_next; pp; pp = pp->p_next) { + np = pp; + do + if ((np->p_flags & PHUP) && np->p_jobid != shpgrp && + np->p_parentid == mypid) { + if (killpg(np->p_jobid, SIGHUP) != -1) { + /* In case the job was suspended... */ +#ifdef SIGCONT + (void) killpg(np->p_jobid, SIGCONT); +#endif + break; + } + } + while ((np = np->p_friends) != pp); + } + } + untty(); +#ifdef NLS_CATALOGS + /* + * We need to call catclose, because SVR4 leaves symlinks behind otherwise + * in the catalog directories. We cannot close on a vforked() child, + * because messages will stop working on the parent too. + */ + if (child == 0) + nlsclose(); +#endif /* NLS_CATALOGS */ +#ifdef WINNT_NATIVE + nt_cleanup(); +#endif /* WINNT_NATIVE */ + _exit(i); +} + +#ifndef _PATH_DEFPATH +static Char ** +defaultpath(void) +{ + char *ptr; + Char **blk, **blkp; + struct stat stb; + + blkp = blk = xmalloc(sizeof(Char *) * 10); + +#ifndef NODOT +# ifndef DOTLAST + *blkp++ = Strsave(STRdot); +# endif +#endif + +#define DIRAPPEND(a) \ + if (stat(ptr = a, &stb) == 0 && S_ISDIR(stb.st_mode)) \ + *blkp++ = SAVE(ptr) + +#ifdef _PATH_LOCAL + DIRAPPEND(_PATH_LOCAL); +#endif + +#ifdef _PATH_USRUCB + DIRAPPEND(_PATH_USRUCB); +#endif + +#ifdef _PATH_USRBSD + DIRAPPEND(_PATH_USRBSD); +#endif + +#ifdef _PATH_BIN + DIRAPPEND(_PATH_BIN); +#endif + +#ifdef _PATH_USRBIN + DIRAPPEND(_PATH_USRBIN); +#endif + +#undef DIRAPPEND + +#ifndef NODOT +# ifdef DOTLAST + *blkp++ = Strsave(STRdot); +# endif +#endif + *blkp = NULL; + return (blk); +} +#endif + +static void +record(void) +{ + if (!fast) { + recdirs(NULL, adrof(STRsavedirs) != NULL); + rechist(NULL, adrof(STRsavehist) != NULL); + } + displayHistStats("Exiting"); /* no-op unless DEBUG_HIST */ +} + +/* + * Grab the tty repeatedly, and give up if we are not in the correct + * tty process group. + */ +int +grabpgrp(int fd, pid_t desired) +{ + struct sigaction old; + pid_t pgrp; + size_t i; + + for (i = 0; i < 100; i++) { + if ((pgrp = tcgetpgrp(fd)) == -1) + return -1; + if (pgrp == desired) + return 0; + (void)sigaction(SIGTTIN, NULL, &old); + (void)signal(SIGTTIN, SIG_DFL); + (void)kill(0, SIGTTIN); + (void)sigaction(SIGTTIN, &old, NULL); + } + errno = EPERM; + return -1; +} Index: vendor/tcsh/6.21.00-83c5be0/sh.err.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/sh.err.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/sh.err.c (revision 353870) @@ -0,0 +1,656 @@ +/* + * sh.err.c: Error printing routines. + */ +/*- + * Copyright (c) 1980, 1991 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; 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. + */ +#define _h_sh_err /* Don't redefine the errors */ +#include "sh.h" +#include + +/* + * C Shell + */ + +#ifdef lint +#undef va_arg +#define va_arg(a, b) (a ? (b) 0 : (b) 0) +#endif + +char *seterr = NULL; /* Holds last error if there was one */ +extern int enterhist; + +#define ERR_FLAGS 0xf0000000 +#define ERR_NAME 0x10000000 +#define ERR_SILENT 0x20000000 +#define ERR_OLD 0x40000000 +#define ERR_INTERRUPT 0x80000000 + +#define ERR_SYNTAX 0 +#define ERR_NOTALLOWED 1 +#define ERR_WTOOLONG 2 +#define ERR_LTOOLONG 3 +#define ERR_DOLZERO 4 +#define ERR_INCBR 5 +#define ERR_EXPORD 6 +#define ERR_BADMOD 7 +#define ERR_SUBSCRIPT 8 +#define ERR_BADNUM 9 +#define ERR_NOMORE 10 +#define ERR_FILENAME 11 +#define ERR_GLOB 12 +#define ERR_COMMAND 13 +#define ERR_TOOFEW 14 +#define ERR_TOOMANY 15 +#define ERR_DANGER 16 +#define ERR_EMPTYIF 17 +#define ERR_IMPRTHEN 18 +#define ERR_NOPAREN 19 +#define ERR_NOTFOUND 20 +#define ERR_MASK 21 +#define ERR_LIMIT 22 +#define ERR_TOOLARGE 23 +#define ERR_SCALEF 24 +#define ERR_UNDVAR 25 +#define ERR_DEEP 26 +#define ERR_BADSIG 27 +#define ERR_UNKSIG 28 +#define ERR_VARBEGIN 29 +#define ERR_VARTOOLONG 30 +#define ERR_VARALNUM 31 +#define ERR_JOBCONTROL 32 +#define ERR_EXPRESSION 33 +#define ERR_NOHOMEDIR 34 +#define ERR_CANTCHANGE 35 +#define ERR_NULLCOM 36 +#define ERR_ASSIGN 37 +#define ERR_UNKNOWNOP 38 +#define ERR_AMBIG 39 +#define ERR_EXISTS 40 +#define ERR_ARGC 41 +#define ERR_INTR 42 +#define ERR_RANGE 43 +#define ERR_OVERFLOW 44 +#define ERR_NOSUCHJOB 45 +#define ERR_TERMINAL 46 +#define ERR_NOTWHILE 47 +#define ERR_NOPROC 48 +#define ERR_NOMATCH 49 +#define ERR_MISSING 50 +#define ERR_UNMATCHED 51 +#define ERR_NOMEM 52 +#define ERR_PIPE 53 +#define ERR_SYSTEM 54 +#define ERR_STRING 55 +#define ERR_JOBS 56 +#define ERR_JOBARGS 57 +#define ERR_JOBCUR 58 +#define ERR_JOBPREV 59 +#define ERR_JOBPAT 60 +#define ERR_NESTING 61 +#define ERR_JOBCTRLSUB 62 +#define ERR_SYNC 63 +#define ERR_STOPPED 64 +#define ERR_NODIR 65 +#define ERR_EMPTY 66 +#define ERR_BADDIR 67 +#define ERR_DIRUS 68 +#define ERR_HFLAG 69 +#define ERR_NOTLOGIN 70 +#define ERR_DIV0 71 +#define ERR_MOD0 72 +#define ERR_BADSCALE 73 +#define ERR_SUSPLOG 74 +#define ERR_UNKUSER 75 +#define ERR_NOHOME 76 +#define ERR_HISTUS 77 +#define ERR_SPDOLLT 78 +#define ERR_NEWLINE 79 +#define ERR_SPSTAR 80 +#define ERR_DIGIT 81 +#define ERR_VARILL 82 +#define ERR_NLINDEX 83 +#define ERR_EXPOVFL 84 +#define ERR_VARSYN 85 +#define ERR_BADBANG 86 +#define ERR_NOSUBST 87 +#define ERR_BADSUBST 88 +#define ERR_LHS 89 +#define ERR_RHSLONG 90 +#define ERR_BADBANGMOD 91 +#define ERR_MODFAIL 92 +#define ERR_SUBOVFL 93 +#define ERR_BADBANGARG 94 +#define ERR_NOSEARCH 95 +#define ERR_NOEVENT 96 +#define ERR_TOOMANYRP 97 +#define ERR_TOOMANYLP 98 +#define ERR_BADPLP 99 +#define ERR_MISRED 100 +#define ERR_OUTRED 101 +#define ERR_REDPAR 102 +#define ERR_INRED 103 +#define ERR_BADPLPS 104 +#define ERR_ALIASLOOP 105 +#define ERR_NOWATCH 106 +#define ERR_NOSCHED 107 +#define ERR_SCHEDUSAGE 108 +#define ERR_SCHEDEV 109 +#define ERR_SCHEDCOM 110 +#define ERR_SCHEDTIME 111 +#define ERR_SCHEDREL 112 +#define ERR_TCNOSTR 113 +#define ERR_SETTCUS 114 +#define ERR_TCCAP 115 +#define ERR_TCPARM 116 +#define ERR_TCARGS 117 +#define ERR_TCNARGS 118 +#define ERR_TCUSAGE 119 +#define ERR_ARCH 120 +#define ERR_HISTLOOP 121 +#define ERR_FILEINQ 122 +#define ERR_SELOVFL 123 +#define ERR_TCSHUSAGE 124 +#define ERR_COMPCOM 125 +#define ERR_COMPINV 126 +#define ERR_COMPMIS 127 +#define ERR_COMPINC 128 +#define ERR_MFLAG 129 +#define ERR_ULIMUS 130 +#define ERR_READONLY 131 +#define ERR_BADJOB 132 +#define ERR_INVALID 133 +#define ERR_BADCOLORVAR 134 +#define ERR_EOF 135 +#define NO_ERRORS 136 + +static const char *elst[NO_ERRORS] INIT_ZERO_STRUCT; + +/* + * Init the elst depending on the locale + */ +void +errinit(void) +{ +#ifdef NLS_CATALOGS + size_t i; + + for (i = 0; i < NO_ERRORS; i++) + xfree((char *)(intptr_t)elst[i]); +# if defined(__FreeBSD__) || defined(hpux) || defined(__MidnightBSD__) +# define NLS_MAXSET 30 + for (i = 1; i <= NLS_MAXSET; i++) + CGETS(i, 1, "" ); +# endif +#endif + + elst[ERR_SYNTAX] = CSAVS(1, 1, "Syntax Error"); + elst[ERR_NOTALLOWED] = CSAVS(1, 2, "%s is not allowed"); + elst[ERR_WTOOLONG] = CSAVS(1, 3, "Word too long"); + elst[ERR_LTOOLONG] = CSAVS(1, 4, "$< line too long"); + 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_SUBSCRIPT] = CSAVS(1, 9, "Subscript error"); + elst[ERR_BADNUM] = CSAVS(1, 10, "Badly formed number"); + elst[ERR_NOMORE] = CSAVS(1, 11, "No more words"); + elst[ERR_FILENAME] = CSAVS(1, 12, "Missing file name"); + elst[ERR_GLOB] = CSAVS(1, 13, "Internal glob error"); + elst[ERR_COMMAND] = CSAVS(1, 14, "Command not found"); + elst[ERR_TOOFEW] = CSAVS(1, 15, "Too few arguments"); + elst[ERR_TOOMANY] = CSAVS(1, 16, "Too many arguments"); + elst[ERR_DANGER] = CSAVS(1, 17, "Too dangerous to alias that"); + elst[ERR_EMPTYIF] = CSAVS(1, 18, "Empty if"); + elst[ERR_IMPRTHEN] = CSAVS(1, 19, "Improper then"); + elst[ERR_NOPAREN] = CSAVS(1, 20, "Words not parenthesized"); + elst[ERR_NOTFOUND] = CSAVS(1, 21, "%s not found"); + elst[ERR_MASK] = CSAVS(1, 22, "Improper mask"); + elst[ERR_LIMIT] = CSAVS(1, 23, "No such limit"); + elst[ERR_TOOLARGE] = CSAVS(1, 24, "Argument too large"); + elst[ERR_SCALEF] = CSAVS(1, 25, "Improper or unknown scale factor"); + elst[ERR_UNDVAR] = CSAVS(1, 26, "Undefined variable"); + elst[ERR_DEEP] = CSAVS(1, 27, "Directory stack not that deep"); + elst[ERR_BADSIG] = CSAVS(1, 28, "Bad signal number"); + elst[ERR_UNKSIG] = CSAVS(1, 29, "Unknown signal; kill -l lists signals"); + elst[ERR_VARBEGIN] = CSAVS(1, 30, "Variable name must begin with a letter"); + elst[ERR_VARTOOLONG] = CSAVS(1, 31, "Variable name too long"); + elst[ERR_VARALNUM] = CSAVS(1, 32, + "Variable name must contain alphanumeric characters"); + elst[ERR_JOBCONTROL] = CSAVS(1, 33, "No job control in this shell"); + elst[ERR_EXPRESSION] = CSAVS(1, 34, "Expression Syntax"); + elst[ERR_NOHOMEDIR] = CSAVS(1, 35, "No home directory"); + elst[ERR_CANTCHANGE] = CSAVS(1, 36, "Can't change to home directory"); + elst[ERR_NULLCOM] = CSAVS(1, 37, "Invalid null command"); + elst[ERR_ASSIGN] = CSAVS(1, 38, "Assignment missing expression"); + elst[ERR_UNKNOWNOP] = CSAVS(1, 39, "Unknown operator"); + elst[ERR_AMBIG] = CSAVS(1, 40, "Ambiguous"); + elst[ERR_EXISTS] = CSAVS(1, 41, "%s: File exists"); + elst[ERR_ARGC] = CSAVS(1, 42, "Argument for -c ends in backslash"); + elst[ERR_INTR] = CSAVS(1, 43, "Interrupted"); + elst[ERR_RANGE] = CSAVS(1, 44, "Subscript out of range"); + elst[ERR_OVERFLOW] = CSAVS(1, 45, "Line overflow"); + elst[ERR_NOSUCHJOB] = CSAVS(1, 46, "No such job"); + elst[ERR_TERMINAL] = CSAVS(1, 47, "Can't from terminal"); + 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_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"); + elst[ERR_STRING] = CSAVS(1, 56, "%s"); + elst[ERR_JOBS] = CSAVS(1, 57, "Usage: jobs [ -l ]"); + elst[ERR_JOBARGS] = CSAVS(1, 58, "Arguments should be jobs or process id's"); + elst[ERR_JOBCUR] = CSAVS(1, 59, "No current job"); + elst[ERR_JOBPREV] = CSAVS(1, 60, "No previous job"); + elst[ERR_JOBPAT] = CSAVS(1, 61, "No job matches pattern"); + elst[ERR_NESTING] = CSAVS(1, 62, "Fork nesting > %d; maybe `...` loop"); + elst[ERR_JOBCTRLSUB] = CSAVS(1, 63, "No job control in subshells"); + elst[ERR_SYNC] = CSAVS(1, 64, "Sync fault: Process %d not found"); + elst[ERR_STOPPED] = +#ifdef SUSPENDED + CSAVS(1, 65, "%sThere are suspended jobs"); +#else + CSAVS(1, 66, "%sThere are stopped jobs"); +#endif /* SUSPENDED */ + elst[ERR_NODIR] = CSAVS(1, 67, "No other directory"); + elst[ERR_EMPTY] = CSAVS(1, 68, "Directory stack empty"); + elst[ERR_BADDIR] = CSAVS(1, 69, "Bad directory"); + elst[ERR_DIRUS] = CSAVS(1, 70, "Usage: %s [-%s]%s"); + elst[ERR_HFLAG] = CSAVS(1, 71, "No operand for -h flag"); + elst[ERR_NOTLOGIN] = CSAVS(1, 72, "Not a login shell"); + elst[ERR_DIV0] = CSAVS(1, 73, "Division by 0"); + elst[ERR_MOD0] = CSAVS(1, 74, "Mod by 0"); + elst[ERR_BADSCALE] = CSAVS(1, 75, "Bad scaling; did you mean \"%s\"?"); + elst[ERR_SUSPLOG] = CSAVS(1, 76, "Can't suspend a login shell (yet)"); + elst[ERR_UNKUSER] = CSAVS(1, 77, "Unknown user: %s"); + elst[ERR_NOHOME] = CSAVS(1, 78, "No $home variable set"); + elst[ERR_HISTUS] = CSAVS(1, 79, + "Usage: history [-%s] [# number of events]"); + elst[ERR_SPDOLLT] = CSAVS(1, 80, "$, ! or < not allowed with $# or $?"); + elst[ERR_NEWLINE] = CSAVS(1, 81, "Newline in variable name"); + elst[ERR_SPSTAR] = CSAVS(1, 82, "* not allowed with $# or $?"); + elst[ERR_DIGIT] = CSAVS(1, 83, "$? or $# not allowed"); + elst[ERR_VARILL] = CSAVS(1, 84, "Illegal variable name"); + elst[ERR_NLINDEX] = CSAVS(1, 85, "Newline in variable index"); + elst[ERR_EXPOVFL] = CSAVS(1, 86, "Expansion buffer overflow"); + elst[ERR_VARSYN] = CSAVS(1, 87, "Variable syntax"); + elst[ERR_BADBANG] = CSAVS(1, 88, "Bad ! form"); + elst[ERR_NOSUBST] = CSAVS(1, 89, "No previous substitute"); + 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_MODFAIL] = CSAVS(1, 94, "Modifier failed"); + elst[ERR_SUBOVFL] = CSAVS(1, 95, "Substitution buffer overflow"); + elst[ERR_BADBANGARG] = CSAVS(1, 96, "Bad ! arg selector"); + elst[ERR_NOSEARCH] = CSAVS(1, 97, "No prev search"); + elst[ERR_NOEVENT] = CSAVS(1, 98, "%s: Event not found"); + elst[ERR_TOOMANYRP] = CSAVS(1, 99, "Too many )'s"); + elst[ERR_TOOMANYLP] = CSAVS(1, 100, "Too many ('s"); + elst[ERR_BADPLP] = CSAVS(1, 101, "Badly placed ("); + elst[ERR_MISRED] = CSAVS(1, 102, "Missing name for redirect"); + elst[ERR_OUTRED] = CSAVS(1, 103, "Ambiguous output redirect"); + elst[ERR_REDPAR] = CSAVS(1, 104, "Can't << within ()'s"); + elst[ERR_INRED] = CSAVS(1, 105, "Ambiguous input redirect"); + elst[ERR_BADPLPS] = CSAVS(1, 106, "Badly placed ()'s"); + elst[ERR_ALIASLOOP] = CSAVS(1, 107, "Alias loop"); + elst[ERR_NOWATCH] = CSAVS(1, 108, "No $watch variable set"); + elst[ERR_NOSCHED] = CSAVS(1, 109, "No scheduled events"); + elst[ERR_SCHEDUSAGE] = CSAVS(1, 110, + "Usage: sched -.\nUsage: sched [+]hh:mm "); + elst[ERR_SCHEDEV] = CSAVS(1, 111, "Not that many scheduled events"); + elst[ERR_SCHEDCOM] = CSAVS(1, 112, "No command to run"); + elst[ERR_SCHEDTIME] = CSAVS(1, 113, "Invalid time for event"); + elst[ERR_SCHEDREL] = CSAVS(1, 114, "Relative time inconsistent with am/pm"); + 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_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, + "Usage: echotc [-v|-s] [ []]"); + elst[ERR_ARCH] = CSAVS(1, 122, "%s: %s. Binary file not executable"); + elst[ERR_HISTLOOP] = CSAVS(1, 123, "!# History loop"); + elst[ERR_FILEINQ] = CSAVS(1, 124, "Malformed file inquiry"); + elst[ERR_SELOVFL] = CSAVS(1, 125, "Selector overflow"); +#ifdef apollo + elst[ERR_TCSHUSAGE] = CSAVS(1, 126, +"Unknown option: `-%s'\nUsage: %s [ -bcdefilmnqstvVxX -Dname[=value] ] [ argument ... ]"); +#else /* !apollo */ +# ifdef convex + elst[ERR_TCSHUSAGE] = CSAVS(1, 127, +"Unknown option: `-%s'\nUsage: %s [ -bcdefFilmnqstvVxX ] [ argument ... ]"); +# else /* rest */ + elst[ERR_TCSHUSAGE] = CSAVS(1, 128, +"Unknown option: `-%s'\nUsage: %s [ -bcdefilmnqstvVxX ] [ argument ... ]"); +# endif /* convex */ +#endif /* apollo */ + elst[ERR_COMPCOM] = CSAVS(1, 129, "\nInvalid completion: \"%s\""); + elst[ERR_COMPINV] = CSAVS(1, 130, "\nInvalid %s: '%c'"); + elst[ERR_COMPMIS] = CSAVS(1, 131, + "\nMissing separator '%c' after %s \"%s\""); + elst[ERR_COMPINC] = CSAVS(1, 132, "\nIncomplete %s: \"%s\""); + elst[ERR_MFLAG] = CSAVS(1, 133, "No operand for -m flag"); + 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_EOF] = CSAVS(1, 138, "Unexpected end of file"); +} + +/* Cleanup data. */ +struct cleanup_entry +{ + void *var; + void (*fn) (void *); +#ifdef CLEANUP_DEBUG + const char *file; + size_t line; +#endif +}; + +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. */ +void +cleanup_push_internal(void *var, void (*fn) (void *) +#ifdef CLEANUP_DEBUG + , const char *file, size_t line +#endif +) +{ + struct cleanup_entry *ce; + + if (cleanup_sp == cleanup_stack_size) { + if (cleanup_stack_size == 0) + cleanup_stack_size = 64; /* Arbitrary */ + else + cleanup_stack_size *= 2; + cleanup_stack = xrealloc(cleanup_stack, + cleanup_stack_size * sizeof (*cleanup_stack)); + } + ce = cleanup_stack + cleanup_sp; + ce->var = var; + ce->fn = fn; +#ifdef CLEANUP_DEBUG + ce->file = file; + ce->line = line; +#endif + cleanup_sp++; +} + +static void +cleanup_ignore_fn(void *dummy) +{ + USE(dummy); +} + +void +cleanup_ignore(void *var) +{ + struct cleanup_entry *ce; + + ce = cleanup_stack + cleanup_sp; + while (ce != cleanup_stack) { + ce--; + if (ce->var == var) { + ce->fn = cleanup_ignore_fn; + return; + } + } + abort(); +} + +void +cleanup_until(void *last_var) +{ + while (cleanup_sp != 0) { + struct cleanup_entry ce; + + cleanup_sp--; + ce = cleanup_stack[cleanup_sp]; + ce.fn(ce.var); + if (ce.var == last_var) + return; + } + abort(); +} + +int +cleanup_reset(void) +{ + return cleanup_sp > cleanup_mark; +} + +void +cleanup_until_mark(void) +{ + while (cleanup_sp > cleanup_mark) { + struct cleanup_entry ce; + + cleanup_sp--; + ce = cleanup_stack[cleanup_sp]; + ce.fn(ce.var); + } +} + +size_t +cleanup_push_mark(void) +{ + size_t old_mark; + + old_mark = cleanup_mark; + cleanup_mark = cleanup_sp; + return old_mark; +} + +void +cleanup_pop_mark(size_t mark) +{ + assert (mark <= cleanup_sp); + cleanup_mark = mark; +} + +void +sigint_cleanup(void *xsa) +{ + const struct sigaction *sa; + + sa = xsa; + sigaction(SIGINT, sa, NULL); +} + +void +sigprocmask_cleanup(void *xmask) +{ + sigset_t *mask; + + mask = xmask; + sigprocmask(SIG_SETMASK, mask, NULL); +} + +void +open_cleanup(void *xptr) +{ + int *ptr; + + ptr = xptr; + xclose(*ptr); +} + +void +opendir_cleanup(void *xdir) +{ + DIR *dir; + + dir = xdir; + xclosedir(dir); +} + +void +xfree_indirect(void *xptr) +{ + void **ptr; /* This is actually type punning :( */ + + ptr = xptr; + xfree(*ptr); +} + +void +reset(void) +{ + cleanup_until_mark(); + _reset(); + abort(); +} + +/* + * The parser and scanner set up errors for later by calling seterr, + * which sets the variable err as a side effect; later to be tested, + * e.g. in process. + */ +void +/*VARARGS1*/ +seterror(unsigned int id, ...) +{ + if (seterr == 0) { + va_list va; + + va_start(va, id); + if (id >= sizeof(elst) / sizeof(elst[0])) + id = ERR_INVALID; + seterr = xvasprintf(elst[id], va); + va_end(va); + } +} + +void +fixerror(void) +{ + didfds = 0; /* Forget about 0,1,2 */ + /* + * Go away if -e or we are a child shell + */ + if (!exitset || exiterr || child) + xexit(1); + + /* + * Reset the state of the input. This buffered seek to end of file will + * also clear the while/foreach stack. + */ + btoeof(); + + setcopy(STRstatus, STR1, VAR_READWRITE);/*FIXRESET*/ +#ifdef BSDJOBS + if (tpgrp > 0) + (void) tcsetpgrp(FSHTTY, tpgrp); +#endif +} + +/* + * Print the error with the given id. + * + * Special ids: + * ERR_SILENT: Print nothing. + * ERR_OLD: Print the previously set error + * ERR_NAME: If this bit is set, print the name of the function + * in bname + * + * This routine always resets or exits. The flag haderr + * is set so the routine who catches the unwind can propogate + * it if they want. + * + * Note that any open files at the point of error will eventually + * be closed in the routine process in sh.c which is the only + * place error unwinds are ever caught. + */ +void +/*VARARGS*/ +stderror(unsigned int id, ...) +{ + va_list va; + int flags; + + va_start(va, id); + + /* + * Reset don't free flag for buggy os's + */ + dont_free = 0; + + flags = (int) id & ERR_FLAGS; + id &= ~ERR_FLAGS; + + /* Pyramid's OS/x has a subtle bug in which prevents calling + * va_end more than once in the same function. -- sterling@netcom.com + */ + assert(!((flags & ERR_OLD) && seterr == NULL)); + + if (id >= sizeof(elst) / sizeof(elst[0])) + id = ERR_INVALID; + + if (!(flags & ERR_SILENT)) { + /* + * Must flush before we print as we wish output before the error + * to go on (some form of) standard output, while output after + * goes on (some form of) diagnostic output. If didfds then output + * will go to 1/2 else to FSHOUT/FSHDIAG. See flush in sh.print.c. + */ + flush();/*FIXRESET*/ + haderr = 1; /* Now to diagnostic output */ + if (enterhist) + xprintf("Can't load history: ");/*FIXRESET*/ + if (flags & ERR_NAME) + xprintf("%s: ", bname);/*FIXRESET*/ + if ((flags & ERR_OLD)) { + /* Old error. */ + xprintf("%s.\n", seterr);/*FIXRESET*/ + } else { + xvprintf(elst[id], va);/*FIXRESET*/ + xprintf(".\n");/*FIXRESET*/ + } + } + va_end(va); + + if (seterr) { + xfree(seterr); + seterr = NULL; + } + + fixerror(); + + reset(); /* Unwind */ +} Index: vendor/tcsh/6.21.00-83c5be0/sh.h =================================================================== --- vendor/tcsh/6.21.00-83c5be0/sh.h (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/sh.h (revision 353870) @@ -0,0 +1,1301 @@ +/* + * sh.h: Catch it all globals and includes file! + */ +/*- + * Copyright (c) 1980, 1991 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; 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 _h_sh +#define _h_sh + +#include "config.h" + +#include +#include + +#ifdef HAVE_ICONV +# include +#endif + +#ifdef HAVE_STDINT_H +# include +#endif + +#ifdef HAVE_INTTYPES_H +# include +#endif + +#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && !defined(WINNT_NATIVE) +typedef unsigned long intptr_t; +#endif + +#ifndef EXTERN +# define EXTERN extern +#else /* !EXTERN */ +# ifdef WINNT_NATIVE +# define IZERO = 0 +# define IZERO_STRUCT = {0} +# endif /* WINNT_NATIVE */ +#endif /* EXTERN */ + +#ifndef IZERO +# define IZERO +#endif /* IZERO */ +#ifndef IZERO_STRUCT +# define IZERO_STRUCT +#endif /* IZERO_STRUCT */ + +#ifndef WINNT_NATIVE +# define INIT_ZERO +# define INIT_ZERO_STRUCT +# define force_read xread +#endif /*!WINNT_NATIVE */ + +#if defined(KANJI) && defined(WIDE_STRINGS) && defined(HAVE_NL_LANGINFO) && defined(CODESET) +#define AUTOSET_KANJI +#endif +/* + * Sanity + */ +#if defined(_POSIX_SOURCE) && !defined(POSIX) +# define POSIX +#endif + +#if defined(POSIXJOBS) && !defined(BSDJOBS) +# define BSDJOBS +#endif + +#define TMP_TEMPLATE ".XXXXXX" + +#ifdef SHORT_STRINGS +# ifdef WIDE_STRINGS +#include +# ifdef UTF16_STRINGS +typedef wint_t Char; +# else +typedef wchar_t Char; +#endif +typedef unsigned long uChar; +typedef wint_t eChar; /* Can contain any Char value or CHAR_ERR */ +#define CHAR_ERR WEOF /* Pretty please, use bit 31... */ +#define normal_mbtowc(PWC, S, N) rt_mbtowc(PWC, S, N) +#define reset_mbtowc() TCSH_IGNORE(mbtowc(NULL, NULL, 0)) +# else +typedef short Char; +typedef unsigned short uChar; +typedef int eChar; +#define CHAR_ERR (-1) +#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1) +#define reset_mbtowc() ((void)0) +# endif +# define SAVE(a) (Strsave(str2short(a))) +#else +typedef char Char; +typedef unsigned char uChar; +typedef int eChar; +#define CHAR_ERR (-1) +#define normal_mbtowc(PWC, S, N) ((void)(N), *(PWC) = (unsigned char)*(S), 1) +#define reset_mbtowc() ((void)0) +# define SAVE(a) (strsave(a)) +#endif + +#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) +static __inline void tcsh_ignore(intptr_t a) +{ + USE(a); +} + +/* + * Return true if the path is absolute + */ +#if defined(WINNT_NATIVE) +# define ABSOLUTEP(p) ((p)[0] == '/' || \ + (Isalpha((p)[0]) && (p)[1] == ':')) +#elif defined(__CYGWIN__) +# define ABSOLUTEP(p) ((p)[0] == '/' || \ + (Isalpha((p)[0]) && (p)[1] == ':' && \ + ((p)[2] == '\0' || (p)[2] == '/'))) +#else /* !WINNT_NATIVE && !__CYGWIN__ */ +# define ABSOLUTEP(p) (*(p) == '/') +#endif /* WINNT_NATIVE || __CYGWIN__ */ + +/* + * Fundamental definitions which may vary from system to system. + * + * BUFSIZE The i/o buffering size; also limits word size + * MAILINTVL How often to mailcheck; more often is more expensive + */ +#ifdef BUFSIZE +# if BUFSIZE < 4096 +# undef BUFSIZE +# define BUFSIZE 4096 /* buffer size should be no less than this */ +# endif +#else +# define BUFSIZE 4096 +#endif /* BUFSIZE */ + +#define FORKSLEEP 10 /* delay loop on non-interactive fork failure */ +#define MAILINTVL 600 /* 10 minutes */ + +#ifndef INBUFSIZE +# define INBUFSIZE 2*BUFSIZE /* Num input characters on the command line */ +#endif /* INBUFSIZE */ + + +/* + * What our builtin echo looks like + */ +#define NONE_ECHO 0 +#define BSD_ECHO 1 +#define SYSV_ECHO 2 +#define BOTH_ECHO (BSD_ECHO|SYSV_ECHO) + +#ifndef ECHO_STYLE +# if SYSVREL > 0 +# define ECHO_STYLE SYSV_ECHO +# else /* SYSVREL == 0 */ +# define ECHO_STYLE BSD_ECHO +# 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 + * commands. + */ +#define FSAFE 5 /* We keep the first 5 descriptors untouched */ +#define FSHTTY 15 /* /dev/tty when manip pgrps */ +#define FSHIN 16 /* Preferred desc for shell input */ +#define FSHOUT 17 /* ... shell output */ +#define FSHDIAG 18 /* ... shell diagnostics */ +#define FOLDSTD 19 /* ... old std input */ + +#ifdef PROF +#define xexit(n) done(n) +#endif + +#ifdef cray +# define word word_t /* sys/types.h defines word.. bad move! */ +#endif + +#include + +#ifdef cray +# undef word +#endif + +/* + * Path separator in environment variables + */ +#ifndef PATHSEP +# if defined(__EMX__) || defined(WINNT_NATIVE) +# define PATHSEP ';' +# else /* unix */ +# define PATHSEP ':' +# endif /* __EMX__ || WINNT_NATIVE */ +#endif /* !PATHSEP */ + +#if defined(__HP_CXD_SPP) && !defined(__hpux) +# include +# define stat stat64 +# define fstat fstat64 +# define lstat lstat64 +#endif /* __HP_CXD_SPP && !__hpux */ + +#ifdef HAVE_LONG_LONG +typedef long long tcsh_number_t; +#else +typedef long tcsh_number_t; +#endif +/* + * This macro compares the st_dev field of struct stat. On aix on ibmESA + * st_dev is a structure, so comparison does not work. + */ +#ifndef DEV_DEV_COMPARE +# define DEV_DEV_COMPARE(x,y) ((x) == (y)) +#endif /* DEV_DEV_COMPARE */ + +#ifdef _SEQUENT_ +# include +#endif /* _SEQUENT_ */ +#if (defined(POSIX) || SYSVREL > 0) && !defined(WINNT_NATIVE) +# include +#endif /* (POSIX || SYSVREL > 0) && !WINNT_NATIVE */ + +#ifdef NLS +# include +#endif /* NLS */ + +#if !defined(_MINIX) && !defined(_VMS_POSIX) && !defined(WINNT_NATIVE) && !defined(__MVS__) +# include +#endif /* !_MINIX && !_VMS_POSIX && !WINNT_NATIVE && !__MVS__ */ +#include + +#if defined(BSDTIMES) || defined(BSDLIMIT) +# include +# if SYSVREL>3 && !defined(SCO) && !defined(sgi) && !defined(SNI) && !defined(sun) && !(defined(__alpha) && defined(__osf__)) && !defined(_SX) && !defined(__MVS__) +# include "/usr/ucbinclude/sys/resource.h" +# else +# ifdef convex +# define sysrusage cvxrusage +# include +# else +# define sysrusage rusage +# include +# endif /* convex */ +# endif /* SYSVREL>3 */ +#endif /* BSDTIMES */ + +#ifndef WINNT_NATIVE +# ifndef POSIX +# ifdef TERMIO +# include +# else /* SGTTY */ +# include +# endif /* TERMIO */ +# else /* POSIX */ +# ifndef _UWIN +# include +# else +# include +# endif /* _UWIN */ +# if SYSVREL > 3 || defined(__linux__) +# undef TIOCGLTC /* we don't need those, since POSIX has them */ +# undef TIOCSLTC +# undef CSWTCH +# define CSWTCH _POSIX_VDISABLE /* So job control works */ +# endif /* SYSVREL > 3 */ +# endif /* POSIX */ +#endif /* WINNT_NATIVE */ + +#ifdef sonyrisc +# include +#endif /* sonyrisc */ + +#if defined(POSIX) && !defined(WINNT_NATIVE) +# include + +/* + * the gcc+protoize version of + * redefines malloc(), so we define the following + * to avoid it. + */ +# if defined(SYSMALLOC) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) || defined(sgi) || defined(_OSD_POSIX) +# define NO_FIX_MALLOC +# include +# else /* glibc */ +# define _GNU_STDLIB_H +# define malloc __malloc +# define free __free +# define calloc __calloc +# define realloc __realloc +# include +# undef malloc +# undef free +# undef calloc +# undef realloc +# endif /* glibc || sgi */ +#endif /* POSIX && !WINNT_NATIVE */ +#include + +#if SYSVREL > 0 || defined(_IBMR2) || defined(_MINIX) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +# if !defined(pyr) && !defined(stellar) +# include +# ifdef _MINIX +# define HZ CLOCKS_PER_SEC +# endif /* _MINIX */ +# endif /* !pyr && !stellar */ +#endif /* SYSVREL > 0 || _IBMR2 */ + +/* In the following ifdef the DECOSF1 has been commented so that later + * versions of DECOSF1 will get TIOCGWINSZ. This might break older versions... + */ +#if !((defined(SUNOS4) || defined(_MINIX) /* || defined(DECOSF1) */) && defined(TERMIO)) +# if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE) +# include +# if SYSVREL > 3 || defined(__linux__) +# undef TIOCGLTC /* we don't need those, since POSIX has them */ +# undef TIOCSLTC +# undef CSWTCH +# define CSWTCH _POSIX_VDISABLE /* So job control works */ +# endif /* SYSVREL > 3 */ +# endif +#endif + +#if (defined(__DGUX__) && defined(POSIX)) || defined(DGUX) +#undef CSWTCH +#define CSWTCH _POSIX_VDISABLE +#endif + +#if (!defined(FIOCLEX) && defined(SUNOS4)) || ((SYSVREL == 4) && !defined(_SEQUENT_) && !defined(SCO) && !defined(_SX)) && !defined(__MVS__) +# include +#endif /* (!FIOCLEX && SUNOS4) || (SYSVREL == 4 && !_SEQUENT_ && !SCO && !_SX ) */ + +#if !defined(_MINIX) && !defined(supermax) && !defined(WINNT_NATIVE) && !defined(IRIS4D) +# include +#endif /* !_MINIX && !supermax && !WINNT_NATIVE && !defined(IRIS4D) */ + +#if !defined(O_RDONLY) || !defined(O_NDELAY) +# include +#endif + +#include + +#include + +#include + +#ifdef HAVE_DIRENT_H +# include +#else +# ifdef HAVE_NDIR_H +# include +# else +# include +# endif +# define dirent direct +#endif /* HAVE_DIRENT_H */ +#ifndef HAVE_STRUCT_DIRENT_D_INO +# define d_ino d_fileno +#endif +#if defined(hpux) || defined(sgi) || defined(OREO) +# include /* So the fgetpwent() prototypes work */ +#endif /* hpux || sgi || OREO */ +#ifndef WINNT_NATIVE +#include +#include +#endif /* WINNT_NATIVE */ +#ifdef HAVE_SHADOW_H +# include +#endif /* HAVE_SHADOW_H */ +#ifdef HAVE_AUTH_H +# include +#endif /* HAVE_AUTH_H */ +#if defined(BSD) && !defined(POSIX) +# include +# define strchr(a, b) index(a, b) +# define strrchr(a, b) rindex(a, b) +#else +# include +#endif /* BSD */ + +/* + * IRIX-5.0 has , but most system include files do not + * include it yet, so we include it here + */ +#if defined(sgi) && SYSVREL > 3 +# include +#endif /* sgi && SYSVREL > 3 */ + +#ifdef REMOTEHOST +# ifdef ISC +# undef MAXHOSTNAMELEN /* Busted headers? */ +# endif + +# include +# include +# include +# 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) +# define INET6 +# endif /* sgi */ +# endif /* __APPLE__ */ +# endif +# include /* For struct iovec */ +#endif /* REMOTEHOST */ + +#ifdef PURIFY +/* exit normally, allowing purify to trace leaks */ +# define _exit exit +#endif /* !PURIFY */ + +/* + * ASCII vs. EBCDIC + */ +#if 'Z' - 'A' == 25 +# ifndef IS_ASCII +# define IS_ASCII +# endif +#endif + +#include "sh.types.h" + +#if !HAVE_DECL_GETPGRP +# ifndef GETPGRP_VOID +extern pid_t getpgrp (int); +# else +extern pid_t getpgrp (void); +# endif +#endif + +#ifndef lint +typedef ptr_t memalign_t; +#else +typedef union { + char am_char, *am_char_p; + short am_short, *am_short_p; + int am_int, *am_int_p; + long am_long, *am_long_p; + float am_float, *am_float_p; + double am_double, *am_double_p; +} *memalign_t; + +# define malloc lint_malloc +# define free lint_free +# define realloc lint_realloc +# define calloc lint_calloc +#endif + +#ifdef SYSMALLOC +# define xmalloc(i) smalloc(i) +# define xrealloc(p, i) srealloc(p, i) +# define xcalloc(n, s) scalloc(n, s) +# define xfree sfree +#else +# define xmalloc(i) malloc(i) +# define xrealloc(p, i) realloc(p, i) +# define xcalloc(n, s) calloc(n, s) +# define xfree free +#endif /* SYSMALLOC */ +#include "sh.char.h" +#include "sh.err.h" +#include "sh.dir.h" +#include "sh.proc.h" + +#include "pathnames.h" + + +/* + * C shell + * + * Bill Joy, UC Berkeley + * October, 1978; May 1980 + * + * Jim Kulp, IIASA, Laxenburg Austria + * April, 1980 + */ + +#ifdef HESIOD +# include +#endif /* HESIOD */ + +#ifdef REMOTEHOST +# include +#endif /* REMOTEHOST */ + +#ifndef MAXHOSTNAMELEN +# ifdef HOST_NAME_MAX +# define MAXHOSTNAMELEN (HOST_NAME_MAX + 1) +# elif defined(SCO) && (SYSVREL > 3) +# include +# else +# define MAXHOSTNAMELEN 256 +# endif +#endif /* MAXHOSTNAMELEN */ + + + +#define eq(a, b) (Strcmp(a, b) == 0) + +/* globone() flags */ +#define G_ERROR 0 /* default action: error if multiple words */ +#define G_IGNORE 1 /* ignore the rest of the words */ +#define G_APPEND 2 /* make a sentence by cat'ing the words */ + +/* + * Global flags + */ +EXTERN int chkstop IZERO; /* Warned of stopped jobs... allow exit */ + +#if (defined(FIOCLEX) && defined(FIONCLEX)) || defined(F_SETFD) +# define CLOSE_ON_EXEC +#else +EXTERN int didcch IZERO; /* Have closed unused fd's for child */ +#endif /* (FIOCLEX && FIONCLEX) || F_SETFD */ + +EXTERN int didfds IZERO; /* Have setup i/o fd's for child */ +EXTERN int doneinp IZERO; /* EOF indicator after reset from readc */ +EXTERN int exiterr IZERO; /* Exit if error or non-zero exit status */ +EXTERN int child IZERO; /* Child shell ... errors cause exit */ +EXTERN int haderr IZERO; /* Reset was because of an error */ +EXTERN int intty IZERO; /* Input is a tty */ +EXTERN int intact IZERO; /* We are interactive... therefore prompt */ +EXTERN int justpr IZERO; /* Just print because of :p hist mod */ +EXTERN int loginsh IZERO; /* We are a loginsh -> .login/.logout */ +EXTERN int neednote IZERO; /* Need to pnotify() */ +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_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 */ +EXTERN int bslash_quote IZERO;/* PWP: tcsh-style quoting? (in sh.c) */ +EXTERN int anyerror IZERO; /* propagate errors from pipelines/backq */ +EXTERN int compat_expr IZERO;/* csh-style expressions? */ +EXTERN int isoutatty IZERO; /* is SHOUT a tty */ +EXTERN int isdiagatty IZERO;/* is SHDIAG a tty */ +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 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) +EXTERN int dspmbyte_ls; +#endif + +/* + * Global i/o info + */ +EXTERN Char *arginp IZERO; /* Argument input for sh -c and internal `xx` */ +EXTERN int onelflg IZERO; /* 2 -> need line for -t, 1 -> exit on read */ +extern Char *ffile; /* Name of shell file for $0 */ +extern int dolzero; /* if $?0 should return true... */ + +extern char *seterr; /* Error message from scanner/parser */ +#ifndef errno +extern int errno; /* Error from C library routines */ +#endif +extern int exitset; +/* Temp name for << shell files in /tmp, for xfree() */ +EXTERN Char *shtemp IZERO; + +#ifdef BSDTIMES +EXTERN struct timeval time0; /* Time at which the shell started */ +EXTERN struct sysrusage ru0; +#else +# ifdef _SEQUENT_ +EXTERN timeval_t time0; /* time at which shell started */ +EXTERN struct process_stats ru0; +# else /* _SEQUENT_ */ +# ifndef POSIX +EXTERN time_t time0; /* time at which shell started */ +# else /* POSIX */ +EXTERN clock_t time0; /* time at which shell started */ +EXTERN clock_t clk_tck; +# endif /* POSIX */ +EXTERN struct tms shtimes; /* shell and child times for process timing */ +# endif /* _SEQUENT_ */ +EXTERN time_t seconds0; +#endif /* BSDTIMES */ + +#ifndef HZ +# define HZ 100 /* for division into seconds */ +#endif + +/* + * 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 + * uid_t and gid_t are not defined in all the systems so I would have to + * make special cases for them. In the future... + */ +EXTERN uid_t uid, euid; /* Invokers real and effective */ +EXTERN gid_t gid, egid; /* User and group ids */ +EXTERN pid_t opgrp, /* Initial pgrp and tty pgrp */ + shpgrp, /* Pgrp of shell */ + tpgrp; /* Terminal process group */ + /* If tpgrp is -1, leave tty alone! */ + +EXTERN Char *Prompt; /* The actual printed prompt or NULL */ +EXTERN Char *RPrompt; /* Right-hand side prompt or NULL */ + +/* + * To be able to redirect i/o for builtins easily, the shell moves the i/o + * descriptors it uses away from 0,1,2. + * Ideally these should be in units which are closed across exec's + * (this saves work) but for version 6, this is not usually possible. + * The desired initial values for these descriptors are defined in + * sh.local.h. + */ +EXTERN int SHIN IZERO; /* Current shell input (script) */ +EXTERN int SHOUT IZERO; /* Shell output */ +EXTERN int SHDIAG IZERO; /* Diagnostic output... shell errs go here */ +EXTERN int OLDSTD IZERO; /* Old standard input (def for cmds) */ + + +#if (SYSVREL == 4 && defined(_UTS)) || defined(__linux__) +/* + * From: fadden@uts.amdahl.com (Andy McFadden) + * we need sigsetjmp for UTS4, but not UTS2.1 + */ +# define SIGSETJMP +#endif + +/* + * Error control + * + * Errors in scanning and parsing set up an error message to be printed + * at the end and complete. Other errors always cause a reset. + * Because of source commands and .cshrc we need nested error catches. + */ + +#ifdef SIGSETJMP + typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() sigsetjmp(reslab.j, 1) +# define tcsh_longjmp() siglongjmp(reslab.j, 1) +# define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + sigsetjmp(reslab.j, 1)) +# define _reset() siglongjmp(reslab.j, 1) +#else + typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() setjmp(reslab.j) +# define tcsh_longjmp() longjmp(reslab.j, 1) +#endif + +#define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + tcsh_setjmp()) +#ifdef SETJMP_DEBUG +# define _reset() xprintf("reset %s %zu\n", reslab.f, reslab.l), \ + flush(), tcsh_longjmp() +#else +# define _reset() tcsh_longjmp() +#endif + +#define getexit(a) (void) ((a) = reslab) +#define resexit(a) (void) (reslab = (a)) + +#define cpybin(a, b) (void) ((a) = (b)) + +extern jmp_buf_t reslab; + +EXTERN Char *gointr; /* Label for an onintr transfer */ + +extern struct sigaction parintr; /* Parents interrupt catch */ +extern struct sigaction parterm; /* Parents terminate catch */ + +/* + * Lexical definitions. + * + * All lexical space is allocated dynamically. + * The eighth/sixteenth bit of characters is used to prevent recognition, + * and eventually stripped. + */ +#define META 0200 +#define ASCII 0177 +#ifdef WIDE_STRINGS /* Implies SHORT_STRINGS */ +/* 31st char bit used for 'ing (not 32nd, we want all values nonnegative) */ +/* + * 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 0xF0000000 /* Invalid character on input */ +# ifdef SOLARIS2 +# define CHAR 0x30FFFFFF /* Mask to mask out the character */ +# else +# define CHAR 0x00FFFFFF /* Mask to mask out the character */ +# endif +#elif defined (SHORT_STRINGS) +# define QUOTE ((Char) 0100000)/* 16nth char bit used for 'ing */ +# define TRIM 0073777 /* Mask to strip quote/lit bit */ +# define UNDER 0040000 /* Underline flag */ +# define BOLD 0020000 /* Bold flag */ +# define STANDOUT 0010000 /* Standout flag */ +# define LITERAL 0004000 /* Literal character flag */ +# define ATTRIBUTES 0074000 /* The bits used for attributes */ +# define INVALID_BYTE 0 +# define CHAR 0000377 /* Mask to mask out the character */ +#else +# define QUOTE ((Char) 0200) /* Eighth char bit used for 'ing */ +# define TRIM 0177 /* Mask to strip quote bit */ +# define UNDER 0000000 /* No extra bits to do both */ +# define BOLD 0000000 /* Bold flag */ +# define STANDOUT META /* Standout flag */ +# define LITERAL 0000000 /* Literal character flag */ +# define ATTRIBUTES 0200 /* The bits used for attributes */ +# define INVALID_BYTE 0 +# define CHAR 0000177 /* Mask to mask out the character */ +#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 */ + +/* + * Each level of input has a buffered input structure. + * There are one or more blocks of buffered input for each level, + * exactly one if the input is seekable and tell is available. + * In other cases, the shell buffers enough blocks to keep all loops + * in the buffer. + * + * If (WIDE_STRINGS && cantell), fbobp is always a byte offset, but + * (fseekp - fbobp) and (feobp - fbobp) are character offsets (usable for + * fbuf indexing). + * + * If (!cantell), all offsets are character offsets; if (!WIDE_STRINGS), there + * is no difference between byte and character offsets. + */ +EXTERN struct Bin { + off_t Bfseekp; /* Seek pointer, generally != lseek() value */ + off_t Bfbobp; /* Seekp of beginning of buffers */ + off_t Bfeobp; /* Seekp of end of buffers */ + int Bfblocks; /* Number of buffer blocks */ + Char **Bfbuf; /* The array of buffer blocks */ +#ifdef WIDE_STRINGS + /* Number of bytes in each character if (cantell) */ + unsigned char Bfclens[BUFSIZE + 1]; +#endif +} B; + +/* + * This structure allows us to seek inside aliases + */ +struct Ain { + int type; +#define TCSH_I_SEEK 0 /* Invalid seek */ +#define TCSH_A_SEEK 1 /* Alias seek */ +#define TCSH_F_SEEK 2 /* File seek */ +#define TCSH_E_SEEK 3 /* Eval seek */ + union { + off_t _f_seek; /* A byte offset if (cantell) */ + Char* _c_seek; + } fc; +#define f_seek fc._f_seek +#define c_seek fc._c_seek + Char **a_seek; +} ; + +extern int aret; /* Type of last char returned */ +#define SEEKEQ(a, b) ((a)->type == (b)->type && \ + (a)->f_seek == (b)->f_seek && \ + (a)->a_seek == (b)->a_seek) + +#define fseekp B.Bfseekp +#define fbobp B.Bfbobp +#define feobp B.Bfeobp +#define fblocks B.Bfblocks +#define fbuf B.Bfbuf +#define fclens B.Bfclens + +/* + * The shell finds commands in loops by reseeking the input + * For whiles, in particular, it reseeks to the beginning of the + * line the while was on; hence the while placement restrictions. + */ +EXTERN struct Ain lineloc; + +EXTERN int cantell; /* Is current source tellable ? */ + +/* + * Input lines are parsed into doubly linked circular + * lists of words of the following form. + */ +struct wordent { + Char *word; + struct wordent *prev; + struct wordent *next; +}; + +/* + * During word building, both in the initial lexical phase and + * when expanding $ variable substitutions, expansion by `!' and `$' + * must be inhibited when reading ahead in routines which are themselves + * processing `!' and `$' expansion or after characters such as `\' or in + * quotations. The following flags are passed to the getC routines + * telling them which of these substitutions are appropriate for the + * next character to be returned. + */ +#define DODOL 1 +#define DOEXCL 2 +#define DOALL DODOL|DOEXCL + +/* + * Labuf implements a general buffer for lookahead during lexical operations. + * Text which is to be placed in the input stream can be stuck here. + * We stick parsed ahead $ constructs during initial input, + * process id's from `$$', and modified variable values (from qualifiers + * during expansion in sh.dol.c) here. + */ +extern struct Strbuf labuf; +EXTERN size_t lap; /* N/A if == labuf.len, index into labuf.s otherwise */ + +/* + * Parser structure + * + * Each command is parsed to a tree of command structures and + * flags are set bottom up during this process, to be propagated down + * as needed during the semantics/exeuction pass (sh.sem.c). + */ +struct command { + unsigned char t_dtyp; /* Type of node */ +#define NODE_COMMAND 1 /* t_dcom t_drit */ +#define NODE_PAREN 2 /* ( t_dspr ) t_drit */ +#define NODE_PIPE 3 /* t_dlef | t_drit */ +#define NODE_LIST 4 /* t_dlef ; t_drit */ +#define NODE_OR 5 /* t_dlef || t_drit */ +#define NODE_AND 6 /* t_dlef && t_drit */ + unsigned char t_nice; /* Nice value */ +#ifdef apollo + unsigned char t_systype; /* System environment */ +#endif + unsigned long t_dflg; /* Flags, e.g. F_AMPERSAND|... */ +/* save these when re-doing */ +#ifndef apollo +#define F_SAVE (F_NICE|F_TIME|F_NOHUP|F_HUP) +#else +#define F_SAVE (F_NICE|F_TIME|F_NOHUP||F_HUP|F_VER) +#endif +#define F_AMPERSAND (1<<0) /* executes in background */ +#define F_APPEND (1<<1) /* output is redirected >> */ +#define F_PIPEIN (1<<2) /* input is a pipe */ +#define F_PIPEOUT (1<<3) /* output is a pipe */ +#define F_NOFORK (1<<4) /* don't fork, last ()ized cmd */ +#define F_NOINTERRUPT (1<<5) /* should be immune from intr's */ +/* spare */ +#define F_STDERR (1<<7) /* redirect unit 2 with unit 1 */ +#define F_OVERWRITE (1<<8) /* output was ! */ +#define F_READ (1<<9) /* input redirection is << */ +#define F_REPEAT (1<<10) /* reexec aft if, repeat,... */ +#define F_NICE (1<<11) /* t_nice is meaningful */ +#define F_NOHUP (1<<12) /* nohup this command */ +#define F_TIME (1<<13) /* time this command */ +#define F_BACKQ (1<<14) /* command is in `` */ +#define F_HUP (1<<15) /* hup this command */ +#ifdef apollo +#define F_VER (1<<16) /* execute command under SYSTYPE */ +#endif + union { + Char *T_dlef; /* Input redirect word */ + struct command *T_dcar; /* Left part of list/pipe */ + } L; + union { + Char *T_drit; /* Output redirect word */ + struct command *T_dcdr; /* Right part of list/pipe */ + } R; +#define t_dlef L.T_dlef +#define t_dcar L.T_dcar +#define t_drit R.T_drit +#define t_dcdr R.T_dcdr + Char **t_dcom; /* Command/argument vector */ + struct command *t_dspr; /* Pointer to ()'d subtree */ +}; + + +/* + * The keywords for the parser + */ +#define TC_BREAK 0 +#define TC_BRKSW 1 +#define TC_CASE 2 +#define TC_DEFAULT 3 +#define TC_ELSE 4 +#define TC_END 5 +#define TC_ENDIF 6 +#define TC_ENDSW 7 +#define TC_EXIT 8 +#define TC_FOREACH 9 +#define TC_GOTO 10 +#define TC_IF 11 +#define TC_LABEL 12 +#define TC_LET 13 +#define TC_SET 14 +#define TC_SWITCH 15 +#define TC_TEST 16 +#define TC_THEN 17 +#define TC_WHILE 18 + +/* + * These are declared here because they want to be + * initialized in sh.init.c (to allow them to be made readonly) + */ + +#if defined(hpux) && defined(__STDC__) && !defined(__GNUC__) + /* Avoid hpux ansi mode spurious warnings */ +typedef void (*bfunc_t) (); +#else +typedef void (*bfunc_t) (Char **, struct command *); +#endif /* hpux && __STDC__ && !__GNUC__ */ + +extern const struct biltins { + const char *bname; + bfunc_t bfunct; + int minargs, maxargs; +} bfunc[]; +extern int nbfunc; +#ifdef WINNT_NATIVE +extern struct biltins nt_bfunc[]; +extern int nt_nbfunc; +#endif /* WINNT_NATIVE*/ +extern int bequiet; + +extern struct srch { + const char *s_name; + int s_value; +} srchn[]; +extern int nsrchn; + +/* + * Structure defining the existing while/foreach loops at this + * source level. Loops are implemented by seeking back in the + * input. For foreach (fe), the word list is attached here. + */ +EXTERN struct whyle { + struct Ain w_start; /* Point to restart loop */ + struct Ain w_end; /* End of loop (0 if unknown) */ + Char **w_fe, **w_fe0; /* Current/initial wordlist for fe */ + Char *w_fename; /* Name for fe */ + struct whyle *w_next; /* Next (more outer) loop */ +} *whyles; + +/* + * Variable structure + * + * Aliases and variables are stored in AVL balanced binary trees. + */ +EXTERN struct varent { + Char **vec; /* Array of words which is the value */ + Char *v_name; /* Name of variable/alias */ + int v_flags; /* Flags */ +#define VAR_ALL -1 +#define VAR_READONLY 1 +#define VAR_READWRITE 2 +#define VAR_NOGLOB 4 +#define VAR_FIRST 32 +#define VAR_LAST 64 + struct varent *v_link[3]; /* The links, see below */ + int v_bal; /* Balance factor */ +} shvhed IZERO_STRUCT, aliases IZERO_STRUCT; + +#define v_left v_link[0] +#define v_right v_link[1] +#define v_parent v_link[2] + +#define adrof(v) adrof1(v, &shvhed) +#define varval(v) value1(v, &shvhed) + +/* + * The following are for interfacing redo substitution in + * aliases to the lexical routines. + */ +EXTERN struct wordent *alhistp IZERO_STRUCT;/* Argument list (first) */ +EXTERN struct wordent *alhistt IZERO_STRUCT;/* Node after last in arg list */ +EXTERN Char **alvec IZERO_STRUCT, + *alvecp IZERO_STRUCT;/* The (remnants of) alias vector */ + +/* + * Filename/command name expansion variables + */ + +#ifndef MAXPATHLEN +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN 2048 +# endif +#endif /* MAXPATHLEN */ + +#ifndef HAVENOLIMIT +/* + * resource limits + */ +extern struct limits { + int limconst; + const char *limname; + int limdiv; + const char *limscale; +} limits[]; +#endif /* !HAVENOLIMIT */ + +/* + * History list + * + * Each history list entry contains an embedded wordlist + * from the scanner, a number for the event, and a reference count + * to aid in discarding old entries. + * + * Essentially "invisible" entries are put on the history list + * when history substitution includes modifiers, and thrown away + * at the next discarding since their event numbers are very negative. + */ +EXTERN struct Hist { + struct wordent Hlex; + int Hnum; /* eventno when inserted into history list */ + int Href; + time_t Htime; + Char *histline; + struct Hist *Hnext, *Hprev; /* doubly linked list */ + unsigned Hhash; /* hash value of command line */ +} Histlist IZERO_STRUCT; + +extern struct wordent paraml; /* Current lexical word list */ +EXTERN int eventno; /* Next events number */ +EXTERN int lastev; /* Last event reference (default) */ + +EXTERN Char HIST; /* history invocation character */ +EXTERN Char HISTSUB; /* auto-substitute character */ +EXTERN Char PRCH; /* Prompt symbol for regular users */ +EXTERN Char PRCHROOT; /* Prompt symbol for root */ + +/* + * For operating systems with single case filenames (OS/2) + */ +#ifdef CASE_INSENSITIVE +# ifdef WIDE_STRINGS +# define samecase(x) (towlower(x)) +# else +# define samecase(x) (isupper((unsigned char)(x)) ? \ + tolower((unsigned char)(x)) : (x)) +# endif +#else +# define samecase(x) (x) +#endif /* CASE_INSENSITIVE */ + +/* + * strings.h: + */ +#ifndef SHORT_STRINGS +#define Strchr(a, b) strchr(a, b) +#define Strrchr(a, b) strrchr(a, b) +#define Strcat(a, b) strcat(a, b) +#define Strncat(a, b, c) strncat(a, b, c) +#define Strcpy(a, b) strcpy(a, b) +#define Strncpy(a, b, c) strncpy(a, b, c) +#define Strlen(a) strlen(a) +#define Strcmp(a, b) strcmp(a, b) +#define Strncmp(a, b, c) strncmp(a, b, c) +#define Strcasecmp(a, b) strcasecmp(a, b) + +#define Strspl(a, b) strspl(a, b) +#define Strnsave(a, b) strnsave(a, b) +#define Strsave(a) strsave(a) +#define Strend(a) strend(a) +#define Strstr(a, b) strstr(a, b) + +#define str2short(a) (a) +#define blk2short(a) saveblk(a) +#define short2blk(a) saveblk(a) +#define short2str(a) caching_strip(a) +#else +#if defined(WIDE_STRINGS) && !defined(UTF16_STRINGS) +#define Strchr(a, b) wcschr(a, b) +#define Strrchr(a, b) wcsrchr(a, b) +#define Strcat(a, b) wcscat(a, b) +#define Strncat(a, b, c) wcsncat(a, b, c) +#define Strcpy(a, b) wcscpy(a, b) +#define Strncpy(a, b, c) wcsncpy(a, b, c) +#define Strlen(a) wcslen(a) +#define Strcmp(a, b) wcscmp(a, b) +#define Strncmp(a, b, c) wcsncmp(a, b, c) +#else +#define Strchr(a, b) s_strchr(a, b) +#define Strrchr(a, b) s_strrchr(a, b) +#define Strcat(a, b) s_strcat(a, b) +#define Strncat(a, b, c) s_strncat(a, b, c) +#define Strcpy(a, b) s_strcpy(a, b) +#define Strncpy(a, b, c) s_strncpy(a, b, c) +#define Strlen(a) s_strlen(a) +#define Strcmp(a, b) s_strcmp(a, b) +#define Strncmp(a, b, c) s_strncmp(a, b, c) +#endif +#define Strcasecmp(a, b) s_strcasecmp(a, b) + +#define Strspl(a, b) s_strspl(a, b) +#define Strnsave(a, b) s_strnsave(a, b) +#define Strsave(a) s_strsave(a) +#define Strend(a) s_strend(a) +#define Strstr(a, b) s_strstr(a, b) +#endif + +/* + * setname is a macro to save space (see sh.err.c) + */ +EXTERN const char *bname; + +#define setname(a) (bname = (a)) + +#ifdef VFORK +EXTERN Char *Vsav; +EXTERN Char *Vdp; +EXTERN Char *Vexpath; +EXTERN char **Vt; +#endif /* VFORK */ + +EXTERN Char **evalvec; +EXTERN Char *evalp; + +extern struct mesg { + const char *iname; /* name from /usr/include */ + const char *pname; /* print name */ +} mesg[]; + +/* 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; + +#ifdef _PATH_BSHELL +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 */ + +extern Char *INVPTR; +extern Char **INVPPTR; + +extern char *progname; +extern int tcsh; +extern int xlate_cr; +extern int output_raw; +extern int lbuffed; +extern time_t Htime; +extern int numeof; +extern int insource; +extern char linbuf[]; +extern char *linp; +extern int nsig; +#ifdef VFORK +extern int use_fork; +#endif +extern int tellwhat; +extern int NoNLSRebind; +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif + +#include "tc.h" + +#ifndef WINNT_NATIVE +# ifdef NLS_CATALOGS +# ifdef HAVE_FEATURES_H +# include +# endif +# ifdef HAVE_NL_LANGINFO +# include +# endif +# ifdef __uxps__ +# define gettxt gettxt_ds +# endif +# include +# ifdef __uxps__ +# undef gettxt +# endif +EXTERN nl_catd catd; +# if defined(HAVE_ICONV) && defined(HAVE_NL_LANGINFO) +# define CGETS(b, c, d) iconv_catgets(catd, b, c, d) +# else +# define CGETS(b, c, d) xcatgets(catd, b, c, d) +# endif +# define CSAVS(b, c, d) strsave(CGETS(b, c, d)) +# else +# define CGETS(b, c, d) d +# define CSAVS(b, c, d) d +# endif +#else /* WINNT_NATIVE */ +# define CGETS(b, c, d) nt_cgets( b, c, d) +# define CSAVS(b, c, d) strsave(CGETS(b, c, d)) +#endif /* WINNT_NATIVE */ + +#if defined(FILEC) +extern int filec; +#endif /* FILEC */ + +#include "sh.decls.h" +/* + * Since on some machines characters are unsigned, and the signed + * keyword is not universally implemented, we treat all characters + * as unsigned and sign extend them where we need. + */ +#define SIGN_EXTEND_CHAR(a) (((a) & 0x80) ? ((a) | ~0x7f) : (a)) + +/* + * explanation for use by the "--help" option + */ +#define HELP_STRING "\ +-b file batch mode, read and execute commands from `file' \n\ +-c command run `command' from next argument \n\ +-d load directory stack from `~/.cshdirs' \n\ +-Dname[=value] define environment variable `name' to `value' (DomainOS only) \n\ +-e exit on any error \n\ +-f start faster by ignoring the start-up file \n\ +-F use fork() instead of vfork() when spawning (ConvexOS only) \n\ +-i interactive, even when input is not from a terminal \n\ +-l act as a login shell, must be the only option specified \n\ +-m load the start-up file, whether or not owned by effective user \n\ +-n file no execute mode, just check syntax of the following `file' \n\ +-q accept SIGQUIT for running under a debugger \n\ +-s read commands from standard input \n\ +-t read one line from standard input \n\ +-v echo commands after history substitution \n\ +-V like -v but including commands read from the start-up file \n\ +-x echo commands immediately before execution \n\ +-X like -x but including commands read from the start-up file \n\ +--help print this message and exit \n\ +--version print the version shell variable and exit \n\ +\nSee the tcsh(1) manual page for detailed information.\n" + +#include "tc.nls.h" + +#endif /* _h_sh */ Index: vendor/tcsh/6.21.00-83c5be0/sh.hist.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/sh.hist.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/sh.hist.c (revision 353870) @@ -0,0 +1,1367 @@ +/* + * sh.hist.c: Shell history expansions and substitutions + */ +/*- + * Copyright (c) 1980, 1991 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; 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" +#include /* for rename(2), grr. */ +#include +#include "tc.h" +#include "dotlock.h" + +extern int histvalid; +extern struct Strbuf histline; +Char HistLit = 0; + +static int heq (const struct wordent *, const struct wordent *); +static void hfree (struct Hist *); + +#define HIST_ONLY 0x01 +#define HIST_SAVE 0x02 +#define HIST_LOAD 0x04 +#define HIST_REV 0x08 +#define HIST_CLEAR 0x10 +#define HIST_MERGE 0x20 +#define HIST_TIME 0x40 + +/* + * C shell + */ + +/* Static functions don't show up in gprof summaries. So eliminate "static" + * modifier from some frequently called functions. */ +#ifdef PROF +#define PG_STATIC +#else +#define PG_STATIC static +#endif + +/* #define DEBUG_HIST 1 */ + +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) +{ + struct Hist *fp = pp->Hnext; /* following element, if any */ + hp->Hnext = fp, hp->Hprev = pp; + pp->Hnext = hp; + if (fp) + fp->Hprev = hp; + else + histTail = hp; /* meaning hp->Hnext == NULL */ + histCount++; +} + +/* Remove the entry from the history list. */ +static void +hremove(struct Hist *hp) +{ + struct Hist *pp = hp->Hprev; + assert(pp); /* elements always have a previous */ + pp->Hnext = hp->Hnext; + if (hp->Hnext) + hp->Hnext->Hprev = pp; + else + histTail = pp; /* we must have been last */ + if (hp == histMerg) /* deleting this hint from list */ + histMerg = NULL; + assert(histCount > 0); + histCount--; +} + +/* Prune length of history list to specified size by history variable. */ +PG_STATIC void +discardExcess(int hlen) +{ + struct Hist *hp, *np; + if (histTail == NULL) { + assert(histCount == 0); + return; /* no entries on history list */ + } + /* 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)hlen && (np = Histlist.Hnext)) { + if (eventno - np->Href >= hlen || hlen == 0) + hremove(np), hfree(np); + else + break; + } + while (histCount > (unsigned)hlen && (np = histTail) != &Histlist) { + if (eventno - np->Href >= hlen || hlen == 0) + hremove(np), hfree(np); + else + break; + } + if (histCount - (hlen >> 4) <= (unsigned)hlen) + return; /* don't bother doing the full scan */ + for (hp = &Histlist; histCount > (unsigned)hlen && + (np = hp->Hnext) != NULL;) + if (eventno - np->Href >= hlen || hlen == 0) + hremove(np), hfree(np); + else + hp = np; +} + +/* Add the command "sp" to the history list. */ +void +savehist( + struct wordent *sp, + int mflg) /* true if -m (merge) specified */ +{ + /* throw away null lines */ + if (sp && sp->next->word[0] == '\n') + return; + if (sp) + (void) enthist(++eventno, sp, 1, mflg, histlen); + discardExcess(histlen); +} + +#define USE_JENKINS_HASH 1 +/* #define USE_ONE_AT_A_TIME 1 */ +#undef PRIME_LENGTH /* no need for good HTL */ + +#ifdef USE_JENKINS_HASH +#define hashFcnName "lookup3" +/* From: + lookup3.c, by Bob Jenkins, May 2006, Public Domain. + "... You can use this free for any purpose. It's in + the public domain. It has no warranty." + http://burtleburtle.net/bob/hash/index.html + */ + +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c, 4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +struct hashValue /* State used to hash a wordend word list. */ +{ + uint32_t a, b, c; +}; + +/* Set up the internal state */ +static void +initializeHash(struct hashValue *h) +{ + h->a = h->b = h->c = 0xdeadbeef; +} + +/* This does a partial hash of the Chars in a single word. For efficiency we + * include 3 versions of the code to pack Chars into 32-bit words for the + * mixing function. */ +static void +addWordToHash(struct hashValue *h, const Char *word) +{ + uint32_t a = h->a, b = h->b, c = h->c; +#ifdef SHORT_STRINGS +#ifdef WIDE_STRINGS + assert(sizeof(Char) >= 4); + while (1) { + unsigned k; + if ((k = (uChar)*word++) == 0) break; a += k; + if ((k = (uChar)*word++) == 0) break; b += k; + if ((k = (uChar)*word++) == 0) break; c += k; + mix(a, b, c); + } +#else + assert(sizeof(Char) == 2); + while (1) { + unsigned k; + if ((k = (uChar)*word++) == 0) break; a += k; + if ((k = (uChar)*word++) == 0) break; a += k << 16; + if ((k = (uChar)*word++) == 0) break; b += k; + if ((k = (uChar)*word++) == 0) break; b += k << 16; + if ((k = (uChar)*word++) == 0) break; c += k; + if ((k = (uChar)*word++) == 0) break; c += k << 16; + mix(a, b, c); + } +#endif +#else + assert(sizeof(Char) == 1); + while (1) { + unsigned k; + if ((k = *word++) == 0) break; a += k; + if ((k = *word++) == 0) break; a += k << 8; + if ((k = *word++) == 0) break; a += k << 16; + if ((k = *word++) == 0) break; a += k << 24; + if ((k = *word++) == 0) break; b += k; + if ((k = *word++) == 0) break; b += k << 8; + if ((k = *word++) == 0) break; b += k << 16; + if ((k = *word++) == 0) break; b += k << 24; + if ((k = *word++) == 0) break; c += k; + if ((k = *word++) == 0) break; c += k << 8; + if ((k = *word++) == 0) break; c += k << 16; + if ((k = *word++) == 0) break; c += k << 24; + mix(a, b, c); + } +#endif + h->a = a, h->b = b, h->c = c; +} + +static void +addCharToHash(struct hashValue *h, Char ch) +{ + /* The compiler (gcc -O2) seems to do a good job optimizing this without + * explicitly extracting into local variables. */ + h->a += (uChar)ch; + mix(h->a, h->b, h->c); +} + +static uint32_t +finalizeHash(struct hashValue *h) +{ + uint32_t a = h->a, b = h->b, c = h->c; + final(a, b, c); + return c; +} + +#elif USE_ONE_AT_A_TIME +#define hashFcnName "one-at-a-time" +/* This one is also from Bob Jenkins, but is slower but simpler than lookup3. + "... The code given here are all public domain." + http://burtleburtle.net/bob/hash/doobs.html */ + +#if 0 +ub4 +one_at_a_time(char *key, ub4 len) +{ + ub4 hash, i; + for (hash=0, i=0; i> 6); + } + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + return (hash & mask); +} +#endif + +struct hashValue { uint32_t h; }; +static void +initializeHash(struct hashValue *h) +{ + h->h = 0; +} + +static void +addWordToHash(struct hashValue *h, const Char *word) +{ + unsigned k; + uint32_t hash = h->h; + while (k = (uChar)*word++) + hash += k, hash += hash << 10, hash ^= hash >> 6; + h->h = hash; +} + +static void +addCharToHash(struct hashValue *h, Char c) +{ + Char b[2] = { c, 0 }; + addWordToHash(h, b); +} + +static uint32_t +finalizeHash(struct hashValue *h) +{ + unsigned hash = h->h; + hash += (hash << 3); + hash ^= (hash >> 11); + hash += (hash << 15); + return hash; +} + +#else +#define hashFcnName "add-mul" +/* Simple multipy and add hash. */ +#define PRIME_LENGTH 1 /* need "good" HTL */ +struct hashValue { uint32_t h; }; +static void +initializeHash(struct hashValue *h) +{ + h->h = 0xe13e2345; +} + +static void +addWordToHash(struct hashValue *h, const Char *word) +{ + unsigned k; + uint32_t hash = h->h; + while (k = (uChar)*word++) + hash = hash * 0x9e4167b9 + k; + h->h = hash; +} + +static void +addCharToHash(struct hashValue *h, Char c) +{ + h->h = h->h * 0x9e4167b9 + (uChar)c; +} + +static uint32_t +finalizeHash(struct hashValue *h) +{ + return h->h; +} +#endif + +static unsigned +hashhist(struct wordent *h0) +{ + struct hashValue s; + struct wordent *firstWord = h0->next; + struct wordent *h = firstWord; + unsigned hash = 0; + + initializeHash(&s); + for (; h != h0; h = h->next) { + if (h->word[0] == '\n') + break; /* don't hash newline */ + if (h != firstWord) + addCharToHash(&s, ' '); /* space between words */ + addWordToHash(&s, h->word); + } + hash = finalizeHash(&s); + /* Zero means no hash value, so never return zero as a hash value. */ + return hash ? hash : 0x7fffffff; /* prime! */ +} + +#if 0 +unsigned +hashStr(Char *str) +{ + struct hashValue s; + initializeHash(&s); + addWordToHash(&s, str); + return finalizeHash(&s); +} +#endif + +#ifdef PRIME_LENGTH /* need good HTL */ +#define hash2tableIndex(hash, len) ((hash) % len) +#else +#define hash2tableIndex(hash, len) ((hash) & (len-1)) +#endif + +/* This code can be enabled to test the above hash functions for speed and + * collision avoidance. The testing is enabled by "occasional" calls to + * displayHistStats(), see which. */ +#ifdef DEBUG_HIST + +#ifdef BSDTIMES +static double +doTiming(int start) { + static struct timeval beginTime; + if (start) { + gettimeofday(&beginTime, NULL); + return 0.0; + } else { + struct timeval now; + gettimeofday(&now, NULL); + return (now.tv_sec-beginTime.tv_sec) + + (now.tv_usec-beginTime.tv_usec)/1e6; + } +} +#else +static double +doTiming(int start) { + USE(start); + return 0.0; +} +#endif + +static void +generateHashes(int nChars, unsigned nWords, unsigned samples, unsigned *hashes, + unsigned length) +{ + if (nChars < 1) + return; + nWords = (nWords < 1) ? 1 : (nWords > 4) ? 4 : nWords; + Char *number = xmalloc((nChars+nWords)*sizeof(Char)); + struct wordent word[4]; + struct wordent base = { NULL, &word[0], &word[0] }; + word[0].word = number, word[0].next = &base, word[0].prev = &base; + unsigned w = 0; /* word number */ + /* Generate multiple words of length 2, 3, 5, then all the rest. */ + unsigned wBoundaries[4] = { 2-1, 2+3-1, 2+3+5-1, 0 }; + /* Ensure the last word has at least 4 Chars in it. */ + while (nWords >= 2 && nChars < (wBoundaries[nWords-2]+1) + 4) + nWords--; + wBoundaries[nWords-1] = 0xffffffff; /* don't end word past this point */ + unsigned i; + for (i = 0; i 10) + break; + } + } + if (i >= samples) + sec = doTiming(0); + else + samples = i; /* number we actually did */ + if (sec > 0.01) { + xprintf("Hash %d (%d Char %u words) with %s: %d nsec/hash, %d mcps\n", + samples, nChars, w+1, hashFcnName, (int)((sec/samples)*1e9), + (int)((double)samples*nChars/sec/1e6)); + } +} +#endif /* DEBUG_HIST */ + +#ifdef DEBUG_HIST +static void +testHash(void) +{ + static const Char STRtestHashTimings[] = + { 't','e','s','t','H','a','s','h','T','i','m','i','n','g','s', 0 }; + struct varent *vp = adrof(STRtestHashTimings); + if (vp && vp->vec) { + unsigned hashes[4]; /* dummy place to put hashes */ + Char **vals = vp->vec; + while (*vals) { + int length = getn(*vals); + unsigned words = + (length < 5) ? 1 : (length < 25) ? 2 : (length < 75) ? 3 : 4; + if (length > 0) + generateHashes(length, words, 0, hashes, 4); + vals++; + } + } + unsigned length = 1024; +#ifdef PRIME_LENGTH /* need good HTL */ + length = 1021; +#endif + unsigned *hashes = xmalloc(length*sizeof(unsigned)); + memset(hashes, 0, length*sizeof(unsigned)); + /* Compute collision statistics for half full hashes modulo "length". */ + generateHashes(4, 1, length/2, hashes, length); + /* Evaluate collisions by comparing occupancy rates (mean value 0.5). + * One bin for each number of hits. */ + unsigned bins[155]; + memset(bins, 0, sizeof(bins)); + unsigned highest = 0; + unsigned i; + for (i = 0; i= sizeof(bins)/sizeof(bins[0])) /* clip */ + hits = highest = sizeof(bins)/sizeof(bins[0]) - 1; + if (hits > highest) + highest = hits; + bins[hits]++; + } + xprintf("Occupancy of %d buckets by %d hashes %d Chars %d word with %s\n", + length, length/2, 4, 1, hashFcnName); + for (i = 0; i <= highest; i++) { + xprintf(" %d buckets (%d%%) with %d hits\n", + bins[i], bins[i]*100/length, i); + } + /* Count run lengths to evaluate linear rehashing effectiveness. Estimate + * a little corrupted by edge effects. */ + memset(bins, 0, sizeof(bins)); + highest = 0; + for (i = 0; hashes[i] == 0; i++); /* find first occupied bucket */ + unsigned run = 0; + unsigned rehashed = 0; + for (; i 0) + hits = 1 && rehashed--; + else if (hits > 1) + rehashed += hits-1; + if (hits) + run++; + else { + /* a real free slot, count it */ + if (run >= sizeof(bins)/sizeof(bins[0])) /* clip */ + run = highest = sizeof(bins)/sizeof(bins[0]) - 1; + if (run > highest) + highest = run; + bins[run]++; + run = 0; + } + } + /* Ignore the partial run at end as we ignored the beginning. */ + double merit = 0.0, entries = 0; + for (i = 0; i <= highest; i++) { + entries += bins[i]*i; /* total hashed objects */ + merit += bins[i]*i*i; + } + xprintf("Rehash collision figure of merit %u (ideal=100), run lengths:\n", + (int)(100.0*merit/entries)); + for (i = 0; i <= highest; i++) { + if (bins[i] != 0) + xprintf(" %d runs of length %d buckets\n", bins[i], i); + } + xfree(hashes); +} +#endif /* DEBUG_HIST */ + +/* Compares two word lists for equality. */ +static int +heq(const struct wordent *a0, const struct wordent *b0) +{ + const struct wordent *a = a0->next, *b = b0->next; + + for (;;) { + if (Strcmp(a->word, b->word) != 0) + return 0; + a = a->next; + b = b->next; + if (a == a0) + return (b == b0) ? 1 : 0; + if (b == b0) + return 0; + } +} + +/* Renumber entries following p, which we will be deleting. */ +PG_STATIC void +renumberHist(struct Hist *p) +{ + int n = p->Href; + while ((p = p->Hnext)) + p->Href = n--; +} + +/* The hash table is implemented as an array of pointers to Hist entries. Each + * entry is located in the table using hash2tableIndex() and checking the + * following entries in case of a collision (linear rehash). Free entries in + * the table are zero (0, NULL, emptyHTE). Deleted entries that cannot yet be + * freed are set to one (deletedHTE). The Hist.Hhash member is non-zero iff + * the entry is in the hash table. When the hash table get too full, it is + * reallocated to be approximately twice the history length (see + * getHashTableSize). */ +static struct Hist **histHashTable = NULL; +static unsigned histHashTableLength = 0; /* number of Hist pointers in table */ + +static struct Hist * const emptyHTE = NULL; +static struct Hist * const deletedHTE = (struct Hist *)1; + +static struct { + unsigned insertCount; + unsigned removeCount; + unsigned rehashes; + int deleted; +} hashStats; + +#ifdef DEBUG_HIST +void +checkHistHashTable(int print) +{ + unsigned occupied = 0; + unsigned deleted = 0; + unsigned i; + for (i = 0; i= hashStats.removeCount); + checkHistHashTable(1); + memset(&hashStats, 0, sizeof(hashStats)); + if (!doneTest) { + testHash(); + doneTest = 1; + } +} +#else +void +displayHistStats(const char *reason) +{ + USE(reason); +} +#endif + +static void +discardHistHashTable(void) +{ + if (histHashTable == NULL) + return; + displayHistStats("Discarding"); + xfree(histHashTable); + histHashTable = NULL; +} + +/* Computes a new hash table size, when the current one is too small. */ +static unsigned +getHashTableSize(int hlen) +{ + unsigned target = hlen * 2; + unsigned e = 5; + unsigned size; + while ((size = 1< (int)histCount ? hlen : (int)histCount); + histHashTable = xmalloc(histHashTableLength * sizeof(struct Hist *)); + memset(histHashTable, 0, histHashTableLength * sizeof(struct Hist *)); + assert(histHashTable[0] == emptyHTE); + + /* Now insert all the entries on the history list into the hash table. */ + { + struct Hist *hp; + for (hp = &Histlist; (hp = hp->Hnext) != NULL;) { + unsigned lpHash = hashhist(&hp->Hlex); + assert(!hp->Hhash || hp->Hhash == lpHash); + hp->Hhash = 0; /* force insert to new hash table */ + insertHistHashTable(hp, lpHash); + } + } +} + +/* Insert np into the hash table. We assume that np is already on the + * Histlist. The specified hashval matches the new Hist entry but has not yet + * been assigned to Hhash (or the element is already on the hash table). */ +static void +insertHistHashTable(struct Hist *np, unsigned hashval) +{ + unsigned rehashes = 0; + unsigned hi = 0; + if (!histHashTable) + return; + if (np->Hhash != 0) { + /* already in hash table */ + assert(hashval == np->Hhash); + return; + } + assert(np != deletedHTE); + /* Find a free (empty or deleted) slot, using linear rehash. */ + assert(histHashTable); + for (rehashes = 0; + ((hi = hash2tableIndex(hashval + rehashes, histHashTableLength)), + histHashTable[hi] != emptyHTE && histHashTable[hi] != deletedHTE); + rehashes++) { + assert(np != histHashTable[hi]); + if (rehashes >= histHashTableLength / 10) { + /* Hash table is full, so grow it. We assume the create function + * will roughly double the size we give it. Create initializes the + * new table with everything on the Histlist, so we are done when + * it returns. */ +#ifdef DEBUG_HIST + xprintf("Growing history hash table from %d ...", + histHashTableLength); + flush(); +#endif + discardHistHashTable(); + createHistHashTable(histHashTableLength); +#ifdef DEBUG_HIST + xprintf("to %d.\n", histHashTableLength); +#endif + return; + } + } + /* Might be sensible to grow hash table if rehashes is "too big" here. */ + if (histHashTable[hi] == deletedHTE) + hashStats.deleted--; + histHashTable[hi] = np; + np->Hhash = hashval; + hashStats.insertCount++; + hashStats.rehashes += rehashes; +} + +/* Remove the 'np' entry from the hash table. */ +static void +removeHistHashTable(struct Hist *np) +{ + unsigned hi = np->Hhash; + if (!histHashTable || !hi) + return; /* no hash table or not on it */ + /* find desired entry */ + while ((hi = hash2tableIndex(hi, histHashTableLength)), + histHashTable[hi] != emptyHTE) { + if (np == histHashTable[hi]) { + unsigned i; + unsigned deletes = 0; + histHashTable[hi] = deletedHTE; /* dummy, but non-zero entry */ + /* now peek ahead to see if the dummies are really necessary. */ + i = 1; + while (histHashTable[hash2tableIndex(hi+i, histHashTableLength)] == + deletedHTE) + i++; + if (histHashTable[hash2tableIndex(hi+i, histHashTableLength)] == + emptyHTE) { + /* dummies are no longer necessary placeholders. */ + deletes = i; + while (i-- > 0) { + histHashTable[hash2tableIndex(hi+i, histHashTableLength)] = + emptyHTE; + } + } + hashStats.deleted += 1 - deletes; /* delta deleted entries */ + hashStats.removeCount++; + return; + } + hi++; /* linear rehash */ + } + assert(!"Hist entry not found in hash table"); +} + +/* Search the history hash table for a command matching lp, using hashval as + * its hash value. */ +static struct Hist * +findHistHashTable(struct wordent *lp, unsigned hashval) +{ + unsigned deleted = 0; /* number of deleted entries skipped */ + unsigned hi = hashval; + struct Hist *hp; + if (!histHashTable) + return NULL; + while ((hi = hash2tableIndex(hi, histHashTableLength)), + (hp = histHashTable[hi]) != emptyHTE) { + if (hp == deletedHTE) + deleted++; + else if (hp->Hhash == hashval && heq(lp, &(hp->Hlex))) + return hp; + if (deleted > (histHashTableLength>>4)) { + /* lots of deletes, so we need a sparser table. */ + discardHistHashTable(); + createHistHashTable(histHashTableLength); + return findHistHashTable(lp, hashval); + } + hi++; /* linear rehash */ + } + return NULL; +} + +/* When merge semantics are in use, find the approximate predecessor for the + * new entry, so that the Htime entries are decreasing. Return the entry just + * before the first entry with equal times, so the caller can check for + * duplicates. When pTime is not NULL, use it as a starting point for search, + * otherwise search from beginning (largest time value) of history list. */ +PG_STATIC struct Hist * +mergeInsertionPoint( + struct Hist *np, /* new entry to be inserted */ + struct Hist *pTime) /* hint about where to insert */ +{ + struct Hist *pp, *p; + if (histTail && histTail->Htime >= np->Htime) + pTime = histTail; /* new entry goes at the end */ + if (histMerg && histMerg != &Histlist && histMerg != Histlist.Hnext) { + /* Check above and below previous insertion point, in case we're adding + * sequential times in the middle of the list (e.g. history -M). */ + if (histMerg->Htime >= np->Htime) + pTime = histMerg; + else if (histMerg->Hprev->Htime >= np->Htime) + pTime = histMerg->Hprev; + } + if (pTime) { + /* With hint, search up the list until Htime is greater. We skip past + * the equal ones, too, so our caller can elide duplicates. */ + pp = pTime; + while (pp != &Histlist && pp->Htime <= np->Htime) + pp = pp->Hprev; + } else + pp = &Histlist; + /* Search down the list while current entry's time is too large. */ + while ((p = pp->Hnext) && (p->Htime > np->Htime)) + pp = p; /* advance insertion point */ + /* Remember recent position as hint for next time */ + histMerg = pp; + return pp; +} + +/* Bubble Hnum & Href in new entry down to pp through earlier part of list. */ +PG_STATIC void bubbleHnumHrefDown(struct Hist *np, struct Hist *pp) +{ + struct Hist *p; + for (p = Histlist.Hnext; p != pp->Hnext; p = p->Hnext) { + /* swap Hnum & Href values of p and np. */ + int n = p->Hnum, r = p->Href; + p->Hnum = np->Hnum; p->Href = np->Href; + np->Hnum = n; np->Href = r; + } +} + +/* Enter new command into the history list according to current settings. */ +struct Hist * +enthist( + int event, /* newly incremented global eventno */ + struct wordent *lp, + int docopy, + int mflg, /* true if merge requested */ + int hlen) /* -1 if unknown */ +{ + struct Hist *p = NULL, *pp = &Histlist, *pTime = NULL; + struct Hist *np; + const Char *dp; + unsigned lpHash = 0; /* non-zero if hashing entries */ + + if ((dp = varval(STRhistdup)) != STRNULL) { + if (eq(dp, STRerase)) { + /* masaoki@akebono.tky.hp.com (Kobayashi Masaoki) */ + createHistHashTable(hlen); + lpHash = hashhist(lp); + assert(lpHash != 0); + p = findHistHashTable(lp, lpHash); + if (p) { + if (Htime != 0 && p->Htime > Htime) + Htime = p->Htime; + /* If we are merging, and the old entry is at the place we want + * to insert the new entry, then remember the place. */ + if (mflg && Htime != 0 && p->Hprev->Htime >= Htime) + pTime = p->Hprev; + if (!fastMergeErase) + renumberHist(p); /* Reset Href of subsequent entries */ + hremove(p); + hfree(p); + p = NULL; /* so new entry is allocated below */ + } + } + else if (eq(dp, STRall)) { + createHistHashTable(hlen); + lpHash = hashhist(lp); + assert(lpHash != 0); + p = findHistHashTable(lp, lpHash); + if (p) /* p!=NULL, only update this entry's Htime below */ + eventno--; /* not adding a new event */ + } + else if (eq(dp, STRprev)) { + if (pp->Hnext && heq(lp, &(pp->Hnext->Hlex))) { + p = pp->Hnext; + eventno--; + } + } + } + + np = p ? p : xmalloc(sizeof(*np)); + + /* Pick up timestamp set by lex() in Htime if reading saved history */ + if (Htime != 0) { + np->Htime = Htime; + Htime = 0; + } + else + (void) time(&(np->Htime)); + + if (p == np) + return np; /* reused existing entry */ + + /* Initialize the new entry. */ + np->Hnum = np->Href = event; + if (docopy) { + copylex(&np->Hlex, lp); + if (histvalid) + np->histline = Strsave(histline.s); + else + np->histline = NULL; + } + else { + np->Hlex.next = lp->next; + lp->next->prev = &np->Hlex; + np->Hlex.prev = lp->prev; + lp->prev->next = &np->Hlex; + np->histline = NULL; + } + np->Hhash = 0; + + /* The head of history list is the default insertion point. + If merging, advance insertion point, in pp, according to Htime. */ + /* XXX -- In histdup=all, Htime values can be non-monotonic. */ + if (mflg) { /* merge according to np->Htime */ + pp = mergeInsertionPoint(np, pTime); + for (p = pp->Hnext; p && p->Htime == np->Htime; pp = p, p = p->Hnext) { + if (heq(&p->Hlex, &np->Hlex)) { + eventno--; /* duplicate, so don't add new event */ + hfree(np); + return (p); + } + } + /* pp is now the last entry with time >= to np. */ + if (!fastMergeErase) { /* renumber at end of loadhist */ + /* Before inserting np after pp, bubble its Hnum & Href values down + * through the earlier part of list. */ + bubbleHnumHrefDown(np, pp); + } + } + else + pp = &Histlist; /* insert at beginning of history */ + hinsert(np, pp); + if (lpHash && hlen != 0) /* erase & all modes use hash table */ + insertHistHashTable(np, lpHash); + else + discardHistHashTable(); + return (np); +} + +static void +hfree(struct Hist *hp) +{ + assert(hp != histMerg); + if (hp->Hhash) + removeHistHashTable(hp); + freelex(&hp->Hlex); + if (hp->histline) + xfree(hp->histline); + xfree(hp); +} + +PG_STATIC void +phist(struct Hist *hp, int hflg) +{ + if (hp->Href < 0) + return; + if (hflg & HIST_ONLY) { + int old_output_raw; + + /* + * Control characters have to be written as is (output_raw). + * This way one can preserve special characters (like tab) in + * the history file. + * From: mveksler@vnet.ibm.com (Veksler Michael) + */ + old_output_raw = output_raw; + output_raw = 1; + cleanup_push(&old_output_raw, output_raw_restore); + if (hflg & HIST_TIME) + /* + * Make file entry with history time in format: + * "+NNNNNNNNNN" (10 digits, left padded with ascii '0') + */ + + xprintf("#+%010lu\n", (unsigned long)hp->Htime); + + if (HistLit && hp->histline) + xprintf("%S\n", hp->histline); + else + prlex(&hp->Hlex); + cleanup_until(&old_output_raw); + } + else { + Char *cp = str2short("%h\t%T\t%R\n"); + Char *p; + struct varent *vp = adrof(STRhistory); + + if (vp && vp->vec != NULL && vp->vec[0] && vp->vec[1]) + cp = vp->vec[1]; + + p = tprintf(FMT_HISTORY, cp, NULL, hp->Htime, hp); + cleanup_push(p, xfree); + for (cp = p; *cp;) + xputwchar(*cp++); + cleanup_until(p); + } +} + +PG_STATIC void +dophist(int n, int hflg) +{ + struct Hist *hp; + if (setintr) { + int old_pintr_disabled; + + pintr_push_enable(&old_pintr_disabled); + cleanup_until(&old_pintr_disabled); + } + if ((hflg & HIST_REV) == 0) { + /* Since the history list is stored most recent first, non-reversing + * print needs to print (backwards) up the list. */ + if ((unsigned)n >= histCount) + hp = histTail; + else { + for (hp = Histlist.Hnext; + --n > 0 && hp->Hnext != NULL; + hp = hp->Hnext) + ; + } + if (hp == NULL) + return; /* nothing to print */ + for (; hp != &Histlist; hp = hp->Hprev) + phist(hp, hflg); + } else { + for (hp = Histlist.Hnext; n-- > 0 && hp != NULL; hp = hp->Hnext) + phist(hp, hflg); + } +} + +/*ARGSUSED*/ +void +dohist(Char **vp, struct command *c) +{ + int n, hflg = 0; + + USE(c); + if (getn(varval(STRhistory)) == 0) + return; + while (*++vp && **vp == '-') { + Char *vp2 = *vp; + + while (*++vp2) + switch (*vp2) { + case 'c': + hflg |= HIST_CLEAR; + break; + case 'h': + hflg |= HIST_ONLY; + break; + case 'r': + hflg |= HIST_REV; + break; + case 'S': + hflg |= HIST_SAVE; + break; + case 'L': + hflg |= HIST_LOAD; + break; + case 'M': + hflg |= HIST_MERGE; + break; + case 'T': + hflg |= HIST_TIME; + break; + default: + stderror(ERR_HISTUS, "chrSLMT"); + break; + } + } + if (hflg & HIST_CLEAR) { + struct Hist *np, *hp; + for (hp = &Histlist; (np = hp->Hnext) != NULL;) + hremove(np), hfree(np); + } + + if (hflg & (HIST_LOAD | HIST_MERGE)) + loadhist(*vp, (hflg & HIST_MERGE) ? 1 : 0); + else if (hflg & HIST_SAVE) + rechist(*vp, 1); + else { + if (*vp) + n = getn(*vp); + else { + n = getn(varval(STRhistory)); + } + dophist(n, hflg); + } +} + + +char * +fmthist(int fmt, ptr_t ptr) +{ + struct Hist *hp = ptr; + char *buf; + + switch (fmt) { + case 'h': + return xasprintf("%6d", hp->Hnum); + case 'R': + if (HistLit && hp->histline) + return xasprintf("%S", hp->histline); + else { + Char *istr, *ip; + char *p; + + istr = sprlex(&hp->Hlex); + buf = xmalloc(Strlen(istr) * MB_LEN_MAX + 1); + + for (p = buf, ip = istr; *ip != '\0'; ip++) + p += one_wctomb(p, *ip); + + *p = '\0'; + xfree(istr); + return buf; + } + default: + buf = xmalloc(1); + buf[0] = '\0'; + return buf; + } +} + +static void +dotlock_cleanup(void* lockpath) +{ + dot_unlock((char*)lockpath); +} + +/* Save history before exiting the shell. */ +void +rechist(Char *fname, int ref) +{ + 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) + return; + /* + * If $savehist is just set, we use the value of $history + * else we use the value in $savehist + */ + if (((snum = varval(STRsavehist)) == STRNULL) && + ((snum = varval(STRhistory)) == STRNULL)) + snum = STRmaxint; + + + if (fname == NULL) { + if ((fname = varval(STRhistfile)) == STRNULL) + fname = Strspl(varval(STRhome), &STRtildothist[1]); + else + fname = Strsave(fname); + } + else + fname = globone(fname, G_ERROR); + cleanup_push(fname, xfree); + + /* + * The 'savehist merge' feature is intended for an environment + * 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. + * 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 which is given + * by optional lock parameter to savehist. + * + * jw. + */ + /* + * We need the didfds stuff before loadhist otherwise + * exec in a script will fail to print if merge is set. + * From: mveksler@iil.intel.com (Veksler Michael) + */ + oldidfds = didfds; + didfds = 0; + 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) { + jmp_buf_t osetexit; + 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 + } + getexit(osetexit); + if (setexit()) + loadhist(fname, 1); + resexit(osetexit); + } + } + rs = randsuf(); + xsnprintf(path, sizeof(path), "%S.%S", fname, rs); + xfree(rs); + + 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; + dohist(dumphist, NULL); + xclose(fp); + SHOUT = ftmp; + didfds = oldidfds; +#ifndef WINNT_NATIVE + (void)rename(path, short2str(fname)); +#else + (void)ReplaceFile( short2str(fname),path,NULL,0,NULL,NULL); +#endif + cleanup_until(fname); +} + + +/* This is the entry point for loading history data from a file. */ +void +loadhist(Char *fname, int mflg) +{ + static Char *loadhist_cmd[] = {STRsource, NULL, NULL, NULL}; + loadhist_cmd[1] = mflg ? STRmm : STRmh; + + if (fname != NULL) + loadhist_cmd[2] = fname; + else if ((fname = varval(STRhistfile)) != STRNULL) + loadhist_cmd[2] = fname; + else + loadhist_cmd[2] = STRtildothist; + + dosource(loadhist_cmd, NULL); + + /* During history merging (enthist sees mflg set), we disable management of + * Hnum and Href (because fastMergeErase is true). So now reset all the + * values based on the final ordering of the history list. */ + if (mflg) { + int n = eventno; + struct Hist *hp = &Histlist; + while ((hp = hp->Hnext)) + hp->Hnum = hp->Href = n--; + } +} + +void +sethistory(int n) +{ + histlen = n; + discardExcess(histlen); +} Index: vendor/tcsh/6.21.00-83c5be0/sh.lex.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/sh.lex.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/sh.lex.c (revision 353870) @@ -0,0 +1,1857 @@ +/* + * sh.lex.c: Lexical analysis into tokens + */ +/*- + * Copyright (c) 1980, 1991 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; 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" +#include "ed.h" + +#include +/* #define DEBUG_INP */ +/* #define DEBUG_SEEK */ + +/* + * C shell + */ + +#define FLAG_G 1 +#define FLAG_A 2 +/* + * These lexical routines read input and form lists of words. + * There is some involved processing here, because of the complications + * of input buffering, and especially because of history substitution. + */ +static Char *word (int); +static eChar getC1 (int); +static void getdol (void); +static void getexcl (Char); +static struct Hist *findev (Char *, int); +static void setexclp (Char *); +static eChar bgetc (void); +static void balloc (int); +static void bfree (void); +static struct wordent *gethent (Char); +static int matchs (const Char *, const Char *); +static int getsel (int *, int *, int); +static struct wordent *getsub (struct wordent *); +static Char *subword (Char *, Char, int *, size_t *); +static struct wordent *dosub (Char, struct wordent *, int); + +/* + * Peekc is a peek character for getC, peekread for readc. + * There is a subtlety here in many places... history routines + * will read ahead and then insert stuff into the input stream. + * If they push back a character then they must push it behind + * the text substituted by the history substitution. On the other + * hand in several places we need 2 peek characters. To make this + * all work, the history routines read with getC, and make use both + * of ungetC and unreadc. The key observation is that the state + * of getC at the call of a history reference is such that calls + * to getC from the history routines will always yield calls of + * readc, unless this peeking is involved. That is to say that during + * getexcl the variables lap, exclp, and exclnxt are all zero. + * + * Getdol invokes history substitution, hence the extra peek, peekd, + * which it can ungetD to be before history substitutions. + */ +static Char peekc = 0, peekd = 0; +static Char peekread = 0; + +/* (Tail of) current word from ! subst */ +static Char *exclp = NULL; + +/* The rest of the ! subst words */ +static struct wordent *exclnxt = NULL; + +/* Count of remaining words in ! subst */ +static int exclc = 0; + +/* "Globp" for alias resubstitution */ +int aret = TCSH_F_SEEK; + +/* + * Labuf implements a general buffer for lookahead during lexical operations. + * Text which is to be placed in the input stream can be stuck here. + * We stick parsed ahead $ constructs during initial input, + * process id's from `$$', and modified variable values (from qualifiers + * during expansion in sh.dol.c) here. + */ +struct Strbuf labuf; /* = Strbuf_INIT; */ + +/* + * Lex returns to its caller not only a wordlist (as a "var" parameter) + * but also whether a history substitution occurred. This is used in + * the main (process) routine to determine whether to echo, and also + * when called by the alias routine to determine whether to keep the + * argument list. + */ +static int hadhist = 0; + +/* + * Avoid alias expansion recursion via \!# + */ +int hleft; + +struct Strbuf histline; /* = Strbuf_INIT; last line input */ + +int histvalid = 0; /* is histline valid */ + +static Char getCtmp; + +#define getC(f) (((getCtmp = peekc) != '\0') ? (peekc = 0, (eChar)getCtmp) : getC1(f)) +#define ungetC(c) peekc = (Char) c +#define ungetD(c) peekd = (Char) c + +/* Use Htime to store timestamps picked up from history file for enthist() + * if reading saved history (sg) + */ +time_t Htime = (time_t)0; +static time_t a2time_t (Char *); + +/* + * special parsing rules apply for source -h + */ +extern int enterhist; +extern int postcmd_active; + +int +lex(struct wordent *hp) +{ + struct wordent *wdp; + eChar c; + int parsehtime = enterhist; + int toolong = 0; + + histvalid = 0; + histline.len = 0; + + if (!postcmd_active) + btell(&lineloc); + hp->next = hp->prev = hp; + hp->word = STRNULL; + hadhist = 0; + do + c = readc(0); + while (c == ' ' || c == '\t'); + if (c == (eChar)HISTSUB && intty) + /* ^lef^rit from tty is short !:s^lef^rit */ + getexcl(c); + else + unreadc(c); + cleanup_push(hp, lex_cleanup); + wdp = hp; + /* + * The following loop is written so that the links needed by freelex will + * be ready and rarin to go even if it is interrupted. + */ + do { + struct wordent *new; + + new = xmalloc(sizeof(*new)); + new->word = NULL; + new->prev = wdp; + new->next = hp; + wdp->next = new; + hp->prev = new; + wdp = new; + wdp->word = word(parsehtime); + parsehtime = 0; + if (enterhist && toolong++ > 10 * 1024) + stderror(ERR_LTOOLONG); + } while (wdp->word[0] != '\n'); + cleanup_ignore(hp); + cleanup_until(hp); + Strbuf_terminate(&histline); + if (histline.len != 0 && histline.s[histline.len - 1] == '\n') + histline.s[histline.len - 1] = '\0'; + histvalid = 1; + + return (hadhist); +} + +static time_t +a2time_t(Char *wordx) +{ + /* Attempt to distinguish timestamps from other possible entries. + * Format: "+NNNNNNNNNN" (10 digits, left padded with ascii '0') */ + + time_t ret; + Char *s; + int ct; + + if (!wordx || *(s = wordx) != '+') + return (time_t)0; + + for (++s, ret = 0, ct = 0; *s; ++s, ++ct) { + if (!isdigit((unsigned char)*s)) + return (time_t)0; + ret = ret * 10 + (time_t)((unsigned char)*s - '0'); + } + + if (ct != 10) + return (time_t)0; + + return ret; +} + +void +prlex(struct wordent *sp0) +{ + struct wordent *sp = sp0->next; + + for (;;) { + xprintf("%S", sp->word); + sp = sp->next; + if (sp == sp0) + break; + if (sp->word[0] != '\n') + xputchar(' '); + } +} + +void +copylex(struct wordent *hp, struct wordent *fp) +{ + struct wordent *wdp; + + wdp = hp; + fp = fp->next; + do { + struct wordent *new; + + new = xmalloc(sizeof(*new)); + new->word = NULL; + new->prev = wdp; + new->next = hp; + wdp->next = new; + hp->prev = new; + wdp = new; + wdp->word = Strsave(fp->word); + fp = fp->next; + } while (wdp->word[0] != '\n'); +} + +void +initlex(struct wordent *vp) +{ + vp->word = STRNULL; + vp->prev = vp; + vp->next = vp; +} + +void +freelex(struct wordent *vp) +{ + struct wordent *fp; + + while (vp->next != vp) { + fp = vp->next; + vp->next = fp->next; + xfree(fp->word); + xfree(fp); + } + vp->prev = vp; +} + +void +lex_cleanup(void *xvp) +{ + struct wordent *vp; + + vp = xvp; + freelex(vp); +} + +static Char * +word(int parsehtime) +{ + eChar c, c1; + struct Strbuf wbuf = Strbuf_INIT; + Char hbuf[12]; + int h; + int dolflg; + int toolong = 0; + + cleanup_push(&wbuf, Strbuf_cleanup); +loop: + if (enterhist && toolong++ > 256 * 1024) + seterror(ERR_WTOOLONG); + while ((c = getC(DOALL)) == ' ' || c == '\t') + continue; + if (cmap(c, _META | _ESC)) + switch (c) { + case '&': + case '|': + case '<': + case '>': + Strbuf_append1(&wbuf, c); + c1 = getC(DOALL); + if (c1 == c) + Strbuf_append1(&wbuf, c1); + else + ungetC(c1); + goto ret; + + case '#': + if (intty || (enterhist && !parsehtime)) + break; + c = 0; + h = 0; + do { + c1 = c; + c = getC(0); + if (h < 11 && parsehtime) + hbuf[h++] = c; + } while (c != '\n'); + if (parsehtime) { + hbuf[11] = '\0'; + Htime = a2time_t(hbuf); + } + if (c1 == '\\') + goto loop; + /*FALLTHROUGH*/ + + case ';': + case '(': + case ')': + case '\n': + Strbuf_append1(&wbuf, c); + goto ret; + + case '\\': + c = getC(0); + if (c == '\n') { + if (onelflg == 1) + onelflg = 2; + goto loop; + } + if (c != (eChar)HIST) + Strbuf_append1(&wbuf, '\\'); + c |= QUOTE; + default: + break; + } + c1 = 0; + dolflg = DOALL; + for (;;) { + if (enterhist && toolong++ > 256 * 1024) + seterror(ERR_WTOOLONG); + if (c1) { + if (c == c1) { + c1 = 0; + dolflg = DOALL; + } + else if (c == '\\') { + c = getC(0); +/* + * PWP: this is dumb, but how all of the other shells work. If \ quotes + * a character OUTSIDE of a set of ''s, why shouldn't it quote EVERY + * following character INSIDE a set of ''s. + * + * Actually, all I really want to be able to say is 'foo\'bar' --> foo'bar + */ + if (c == (eChar)HIST) + c |= QUOTE; + else { + if (bslash_quote && + ((c == '\'') || (c == '"') || + (c == '\\') || (c == '$'))) { + c |= QUOTE; + } + else { + if (c == '\n') + /* + * if (c1 == '`') c = ' '; else + */ + c |= QUOTE; + ungetC(c); + c = '\\' | QUOTE; + } + } + } + else if (c == '\n') { + seterror(ERR_UNMATCHED, c1); + ungetC(c); + break; + } + } + else if (cmap(c, _META | _QF | _QB | _ESC)) { + if (c == '\\') { + c = getC(0); + if (c == '\n') { + if (onelflg == 1) + onelflg = 2; + break; + } + if (c != (eChar)HIST) + Strbuf_append1(&wbuf, '\\'); + c |= QUOTE; + } + else if (cmap(c, _QF | _QB)) { /* '"` */ + c1 = c; + dolflg = c == '"' ? DOALL : DOEXCL; + } + else if (c != '#' || (!intty && !enterhist)) { + ungetC(c); + break; + } + } + Strbuf_append1(&wbuf, c); + c = getC(dolflg); + } +ret: + cleanup_ignore(&wbuf); + cleanup_until(&wbuf); + return Strbuf_finish(&wbuf); +} + +static eChar +getC1(int flag) +{ + eChar c; + + for (;;) { + if ((c = peekc) != 0) { + peekc = 0; + return (c); + } + if (lap < labuf.len) { + c = labuf.s[lap++]; + if (cmap(c, _META | _QF | _QB)) + c |= QUOTE; + return (c); + } + if ((c = peekd) != 0) { + peekd = 0; + return (c); + } + if (exclp) { + if ((c = *exclp++) != 0) + return (c); + if (exclnxt && --exclc >= 0) { + exclnxt = exclnxt->next; + setexclp(exclnxt->word); + return (' '); + } + exclp = 0; + exclnxt = 0; + /* this will throw away the dummy history entries */ + savehist(NULL, 0); + + } + if (exclnxt) { + exclnxt = exclnxt->next; + if (--exclc < 0) + exclnxt = 0; + else + setexclp(exclnxt->word); + continue; + } + c = readc(1); + + /* Catch EOF in the middle of a line. (An EOF at the beginning of + * a line would have been processed by the readc(0) in lex().) */ + if (c == CHAR_ERR) + c = '\n'; + + if (c == '$' && (flag & DODOL)) { + getdol(); + continue; + } + if (c == (eChar)HIST && (flag & DOEXCL)) { + getexcl(0); + continue; + } + break; + } + return (c); +} + +static void +getdol(void) +{ + struct Strbuf name = Strbuf_INIT; + eChar c; + eChar sc; + int special = 0; + + c = sc = getC(DOEXCL); + if (any("\t \n", c)) { + ungetD(c); + ungetC('$' | QUOTE); + return; + } + cleanup_push(&name, Strbuf_cleanup); + Strbuf_append1(&name, '$'); + if (c == '{') + Strbuf_append1(&name, c), c = getC(DOEXCL); + if (c == '#' || c == '?' || c == '%') + special++, Strbuf_append1(&name, c), c = getC(DOEXCL); + Strbuf_append1(&name, c); + switch (c) { + + case '<': + case '$': + case '!': + if (special) + seterror(ERR_SPDOLLT); + goto end; + + case '\n': + ungetD(c); + name.len--; + if (!special) + seterror(ERR_NEWLINE); + goto end; + + case '*': + if (special) + seterror(ERR_SPSTAR); + goto end; + + default: + if (Isdigit(c)) { +#ifdef notdef + /* let $?0 pass for now */ + if (special) { + seterror(ERR_DIGIT); + goto end; + } +#endif + while ((c = getC(DOEXCL)) != 0) { + if (!Isdigit(c)) + break; + Strbuf_append1(&name, c); + } + } + else if (letter(c)) { + while ((c = getC(DOEXCL)) != 0) { + /* Bugfix for ${v123x} from Chris Torek, DAS DEC-90. */ + if (!letter(c) && !Isdigit(c)) + break; + Strbuf_append1(&name, c); + } + } + else { + if (!special) + seterror(ERR_VARILL); + else { + ungetD(c); + name.len--; + } + goto end; + } + break; + } + if (c == '[') { + Strbuf_append1(&name, c); + do { + /* + * Michael Greim: Allow $ expansion to take place in selector + * expressions. (limits the number of characters returned) + */ + c = getC(DOEXCL | DODOL); + if (c == '\n') { + ungetD(c); + name.len--; + seterror(ERR_NLINDEX); + goto end; + } + Strbuf_append1(&name, c); + } while (c != ']'); + c = getC(DOEXCL); + } + if (c == ':') { + /* + * if the :g modifier is followed by a newline, then error right away! + * -strike + */ + + int gmodflag = 0, amodflag = 0; + + do { + Strbuf_append1(&name, c), c = getC(DOEXCL); + if (c == 'g' || c == 'a') { + if (c == 'g') + gmodflag++; + else + amodflag++; + Strbuf_append1(&name, c); c = getC(DOEXCL); + } + if ((c == 'g' && !gmodflag) || (c == 'a' && !amodflag)) { + if (c == 'g') + gmodflag++; + else + amodflag++; + Strbuf_append1(&name, c); c = getC(DOEXCL); + } + Strbuf_append1(&name, c); + /* scan s// [eichin:19910926.0512EST] */ + if (c == 's') { + int delimcnt = 2; + eChar delim = getC(0); + + Strbuf_append1(&name, delim); + if (!delim || letter(delim) + || Isdigit(delim) || any(" \t\n", delim)) { + seterror(ERR_BADSUBST); + break; + } + while ((c = getC(0)) != CHAR_ERR) { + Strbuf_append1(&name, c); + if(c == delim) delimcnt--; + if(!delimcnt) break; + } + if(delimcnt) { + seterror(ERR_BADSUBST); + break; + } + c = 's'; + } + if (!any("htrqxesul", c)) { + if ((amodflag || gmodflag) && c == '\n') + stderror(ERR_VARSYN); /* strike */ + seterror(ERR_BADMOD, c); + goto end; + } + } + while ((c = getC(DOEXCL)) == ':'); + ungetD(c); + } + else + ungetD(c); + if (sc == '{') { + c = getC(DOEXCL); + if (c != '}') { + ungetD(c); + seterror(ERR_MISSING, '}'); + goto end; + } + Strbuf_append1(&name, c); + } + end: + cleanup_ignore(&name); + cleanup_until(&name); + addla(Strbuf_finish(&name)); +} + +/* xfree()'s its argument */ +void +addla(Char *cp) +{ + static struct Strbuf buf; /* = Strbuf_INIT; */ + + buf.len = 0; + Strbuf_appendn(&buf, labuf.s + lap, labuf.len - lap); + labuf.len = 0; + Strbuf_append(&labuf, cp); + Strbuf_terminate(&labuf); + Strbuf_appendn(&labuf, buf.s, buf.len); + xfree(cp); + lap = 0; +} + +/* left-hand side of last :s or search string of last ?event? */ +static struct Strbuf lhsb; /* = Strbuf_INIT; */ +static struct Strbuf slhs; /* = Strbuf_INIT; left-hand side of last :s */ +static struct Strbuf rhsb; /* = Strbuf_INIT; right-hand side of last :s */ +static int quesarg; + +static void +getexcl(Char sc) +{ + struct wordent *hp, *ip; + int left, right, dol; + eChar c; + + if (sc == 0) { + c = getC(0); + if (c == '{') + sc = (Char) c; + else + ungetC(c); + } + quesarg = -1; + + lastev = eventno; + hp = gethent(sc); + if (hp == 0) + return; + hadhist = 1; + dol = 0; + if (hp == alhistp) + for (ip = hp->next->next; ip != alhistt; ip = ip->next) + dol++; + else + for (ip = hp->next->next; ip != hp->prev; ip = ip->next) + dol++; + left = 0, right = dol; + if (sc == HISTSUB && HISTSUB != '\0') { + ungetC('s'), unreadc(HISTSUB), c = ':'; + goto subst; + } + c = getC(0); + if (!any(":^$*-%", c)) + goto subst; + left = right = -1; + if (c == ':') { + c = getC(0); + unreadc(c); + if (letter(c) || c == '&') { + c = ':'; + left = 0, right = dol; + goto subst; + } + } + else + ungetC(c); + if (!getsel(&left, &right, dol)) + return; + c = getC(0); + if (c == '*') + ungetC(c), c = '-'; + if (c == '-') { + if (!getsel(&left, &right, dol)) + return; + c = getC(0); + } +subst: + exclc = right - left + 1; + while (--left >= 0) + hp = hp->next; + if ((sc == HISTSUB && HISTSUB != '\0') || c == ':') { + do { + hp = getsub(hp); + c = getC(0); + } while (c == ':'); + } + unreadc(c); + if (sc == '{') { + c = getC(0); + if (c != '}') + seterror(ERR_BADBANG); + } + exclnxt = hp; +} + +static struct wordent * +getsub(struct wordent *en) +{ + eChar delim; + eChar c; + eChar sc; + int global; + + do { + exclnxt = 0; + global = 0; + sc = c = getC(0); + while (c == 'g' || c == 'a') { + global |= (c == 'g') ? FLAG_G : FLAG_A; + sc = c = getC(0); + } + + switch (c) { + case 'p': + justpr++; + return (en); + + case 'x': + case 'q': + global |= FLAG_G; + /*FALLTHROUGH*/ + + case 'h': + case 'r': + case 't': + case 'e': + case 'u': + case 'l': + break; + + case '&': + if (slhs.len == 0) { + seterror(ERR_NOSUBST); + return (en); + } + lhsb.len = 0; + Strbuf_append(&lhsb, slhs.s); + Strbuf_terminate(&lhsb); + break; + +#ifdef notdef + case '~': + if (lhsb.len == 0) + goto badlhs; + break; +#endif + + case 's': + delim = getC(0); + if (letter(delim) || Isdigit(delim) || any(" \t\n", delim)) { + unreadc(delim); + lhsb.len = 0; + seterror(ERR_BADSUBST); + return (en); + } + Strbuf_terminate(&lhsb); + lhsb.len = 0; + for (;;) { + c = getC(0); + if (c == '\n') { + unreadc(c); + break; + } + if (c == delim) + break; + if (c == '\\') { + c = getC(0); + if (c != delim && c != '\\') + Strbuf_append1(&lhsb, '\\'); + } + Strbuf_append1(&lhsb, c); + } + if (lhsb.len != 0) + Strbuf_terminate(&lhsb); + else if (lhsb.s[0] == 0) { + seterror(ERR_LHS); + return (en); + } else + lhsb.len = Strlen(lhsb.s); /* lhsb.s wasn't changed */ + rhsb.len = 0; + for (;;) { + c = getC(0); + if (c == '\n') { + unreadc(c); + break; + } + if (c == delim) + break; + if (c == '\\') { + c = getC(0); + if (c != delim /* && c != '~' */ ) + Strbuf_append1(&rhsb, '\\'); + } + Strbuf_append1(&rhsb, c); + } + Strbuf_terminate(&rhsb); + break; + + default: + if (c == '\n') + unreadc(c); + seterror(ERR_BADBANGMOD, (int)c); + return (en); + } + slhs.len = 0; + if (lhsb.s != NULL && lhsb.len != 0) + Strbuf_append(&slhs, lhsb.s); + Strbuf_terminate(&slhs); + if (exclc) + en = dosub(sc, en, global); + } + while ((c = getC(0)) == ':'); + unreadc(c); + return (en); +} + +/* + * + * From Beto Appleton (beto@aixwiz.austin.ibm.com) + * + * when using history substitution, and the variable + * 'history' is set to a value higher than 1000, + * the shell might either freeze (hang) or core-dump. + * We raise the limit to 50000000 + */ + +#define HIST_PURGE -50000000 +static struct wordent * +dosub(Char sc, struct wordent *en, int global) +{ + struct wordent lexi; + int didsub = 0, didone = 0; + struct wordent *hp = &lexi; + struct wordent *wdp; + int i = exclc; + struct Hist *hst; + + wdp = hp; + while (--i >= 0) { + struct wordent *new = xcalloc(1, sizeof *wdp); + + new->word = 0; + new->prev = wdp; + new->next = hp; + wdp->next = new; + wdp = new; + en = en->next; + if (en->word) { + Char *tword, *otword; + + if ((global & FLAG_G) || didsub == 0) { + size_t pos; + + pos = 0; + tword = subword(en->word, sc, &didone, &pos); + if (didone) + didsub = 1; + if (global & FLAG_A) { + while (didone && tword != STRNULL) { + otword = tword; + tword = subword(otword, sc, &didone, &pos); + if (Strcmp(tword, otword) == 0) { + xfree(otword); + break; + } + else + xfree(otword); + } + } + } + else + tword = Strsave(en->word); + wdp->word = tword; + } + } + if (didsub == 0) + seterror(ERR_MODFAIL); + hp->prev = wdp; + /* + * ANSI mode HP/UX compiler chokes on + * return &enthist(HIST_PURGE, &lexi, 0)->Hlex; + */ + hst = enthist(HIST_PURGE, &lexi, 0, 0, -1); + return &(hst->Hlex); +} + +/* Return a newly allocated result of one modification of CP using the + operation TYPE. Set ADID to 1 if a modification was performed. + If TYPE == 's', perform substitutions only from *START_POS on and set + *START_POS to the position of next substitution attempt. */ +static Char * +subword(Char *cp, Char type, int *adid, size_t *start_pos) +{ + Char *wp; + const Char *mp, *np; + + switch (type) { + + case 'r': + case 'e': + case 'h': + case 't': + case 'q': + case 'x': + case 'u': + case 'l': + wp = domod(cp, type); + if (wp == 0) { + *adid = 0; + return (Strsave(cp)); + } + *adid = 1; + return (wp); + + default: + for (mp = cp + *start_pos; *mp; mp++) { + if (matchs(mp, lhsb.s)) { + struct Strbuf wbuf = Strbuf_INIT; + + Strbuf_appendn(&wbuf, cp, mp - cp); + for (np = rhsb.s; *np; np++) + switch (*np) { + + case '\\': + if (np[1] == '&') + np++; + /* fall into ... */ + + default: + Strbuf_append1(&wbuf, *np); + continue; + + case '&': + Strbuf_append(&wbuf, lhsb.s); + continue; + } + *start_pos = wbuf.len; + Strbuf_append(&wbuf, mp + lhsb.len); + *adid = 1; + return Strbuf_finish(&wbuf); + } + } + *adid = 0; + return (Strsave(cp)); + } +} + +Char * +domod(Char *cp, Char type) +{ + Char *wp, *xp; + int c; + + switch (type) { + + case 'q': + case 'x': + if (*cp == '\0') + return Strsave(STRQNULL); + wp = Strsave(cp); + for (xp = wp; (c = *xp) != 0; xp++) + if ((c != ' ' && c != '\t') || type == 'q') + *xp |= QUOTE; + return (wp); + + case 'l': + wp = NLSChangeCase(cp, 1); + return wp ? wp : Strsave(cp); + + case 'u': + wp = NLSChangeCase(cp, 0); + return wp ? wp : Strsave(cp); + + case 'h': + case 't': + if (!any(short2str(cp), '/')) + return (type == 't' ? Strsave(cp) : 0); + wp = Strrchr(cp, '/'); + if (type == 'h') + xp = Strnsave(cp, wp - cp); + else + xp = Strsave(wp + 1); + return (xp); + + case 'e': + case 'r': + wp = Strend(cp); + for (wp--; wp >= cp && *wp != '/'; wp--) + if (*wp == '.') { + if (type == 'e') + xp = Strsave(wp + 1); + else + xp = Strnsave(cp, wp - cp); + return (xp); + } + return (Strsave(type == 'e' ? STRNULL : cp)); + default: + break; + } + return (0); +} + +static int +matchs(const Char *str, const Char *pat) +{ + while (*str && *pat && *str == *pat) + str++, pat++; + return (*pat == 0); +} + +static int +getsel(int *al, int *ar, int dol) +{ + eChar c = getC(0); + int i; + int first = *al < 0; + + switch (c) { + + case '%': + if (quesarg == -1) { + seterror(ERR_BADBANGARG); + return (0); + } + if (*al < 0) + *al = quesarg; + *ar = quesarg; + break; + + case '-': + if (*al < 0) { + *al = 0; + *ar = dol - 1; + unreadc(c); + } + return (1); + + case '^': + if (*al < 0) + *al = 1; + *ar = 1; + break; + + case '$': + if (*al < 0) + *al = dol; + *ar = dol; + break; + + case '*': + if (*al < 0) + *al = 1; + *ar = dol; + if (*ar < *al) { + *ar = 0; + *al = 1; + return (1); + } + break; + + default: + if (Isdigit(c)) { + i = 0; + while (Isdigit(c)) { + i = i * 10 + c - '0'; + c = getC(0); + } + if (i < 0) + i = dol + 1; + if (*al < 0) + *al = i; + *ar = i; + } + else if (*al < 0) + *al = 0, *ar = dol; + else + *ar = dol - 1; + unreadc(c); + break; + } + if (first) { + c = getC(0); + unreadc(c); + if (any("-$*", c)) + return (1); + } + if (*al > *ar || *ar > dol) { + seterror(ERR_BADBANGARG); + return (0); + } + return (1); + +} + +static struct wordent * +gethent(Char sc) +{ + struct Hist *hp; + Char *np; + eChar c; + int event; + int back = 0; + + c = (sc == HISTSUB && HISTSUB != '\0') ? (eChar)HIST : getC(0); + if (c == (eChar)HIST) { + if (alhistp) + return (alhistp); + event = eventno; + } + else + switch (c) { + + case ':': + case '^': + case '$': + case '*': + case '%': + ungetC(c); + if (lastev == eventno && alhistp) + return (alhistp); + event = lastev; + break; + + case '#': /* !# is command being typed in (mrh) */ + if (--hleft == 0) { + seterror(ERR_HISTLOOP); + return (0); + } + else + return (¶ml); + /* NOTREACHED */ + + case '-': + back = 1; + c = getC(0); + /* FALLSTHROUGH */ + + default: + if (any("(=~", c)) { + unreadc(c); + ungetC(HIST); + return (0); + } + Strbuf_terminate(&lhsb); + lhsb.len = 0; + event = 0; + while (!cmap(c, _ESC | _META | _QF | _QB) && !any("^*-%${}:#", c)) { + if (event != -1 && Isdigit(c)) + event = event * 10 + c - '0'; + else + event = -1; + Strbuf_append1(&lhsb, c); + c = getC(0); + } + unreadc(c); + if (lhsb.len == 0) { + lhsb.len = Strlen(lhsb.s); /* lhsb.s wasn't changed */ + ungetC(HIST); + return (0); + } + Strbuf_terminate(&lhsb); + if (event != -1) { + /* + * History had only digits + */ + if (back) + event = eventno + (alhistp == 0) - event; + break; + } + if (back) { + Strbuf_append1(&lhsb, '\0'); /* Allocate space */ + Strbuf_terminate(&lhsb); + memmove(lhsb.s + 1, lhsb.s, (lhsb.len - 1) * sizeof (*lhsb.s)); + lhsb.s[0] = '-'; + } + hp = findev(lhsb.s, 0); + if (hp) + lastev = hp->Hnum; + return (&hp->Hlex); + + case '?': + Strbuf_terminate(&lhsb); + lhsb.len = 0; + for (;;) { + c = getC(0); + if (c == '\n') { + unreadc(c); + break; + } + if (c == '?') + break; + Strbuf_append1(&lhsb, c); + } + if (lhsb.len == 0) { + lhsb.len = Strlen(lhsb.s); /* lhsb.s wasn't changed */ + if (lhsb.len == 0) { + seterror(ERR_NOSEARCH); + return (0); + } + } + else + Strbuf_terminate(&lhsb); + hp = findev(lhsb.s, 1); + if (hp) + lastev = hp->Hnum; + return (&hp->Hlex); + } + + for (hp = Histlist.Hnext; hp; hp = hp->Hnext) + if (hp->Hnum == event) { + hp->Href = eventno; + lastev = hp->Hnum; + return (&hp->Hlex); + } + np = putn((tcsh_number_t)event); + seterror(ERR_NOEVENT, short2str(np)); + xfree(np); + return (0); +} + +static struct Hist * +findev(Char *cp, int anyarg) +{ + struct Hist *hp; + + for (hp = Histlist.Hnext; hp; hp = hp->Hnext) { + Char *dp; + Char *p, *q; + struct wordent *lp = hp->Hlex.next; + int argno = 0; + + /* + * The entries added by alias substitution don't have a newline but do + * have a negative event number. Savehist() trims off these entries, + * but it happens before alias expansion, too early to delete those + * from the previous command. + */ + if (hp->Hnum < 0) + continue; + if (lp->word[0] == '\n') + continue; + if (!anyarg) { + p = cp; + q = lp->word; + do + if (!*p) + return (hp); + while (*p++ == *q++); + continue; + } + do { + for (dp = lp->word; *dp; dp++) { + p = cp; + q = dp; + do + if (!*p) { + quesarg = argno; + return (hp); + } + while (*p++ == *q++); + } + lp = lp->next; + argno++; + } while (lp->word[0] != '\n'); + } + seterror(ERR_NOEVENT, short2str(cp)); + return (0); +} + + +static void +setexclp(Char *cp) +{ + if (cp && cp[0] == '\n') + return; + exclp = cp; +} + +void +unreadc(Char c) +{ + peekread = (Char) c; +} + +eChar +readc(int wanteof) +{ + eChar c; + static int sincereal; /* Number of real EOFs we've seen */ + +#ifdef DEBUG_INP + xprintf("readc\n"); +#endif + if ((c = peekread) != 0) { + peekread = 0; + return (c); + } + +top: + aret = TCSH_F_SEEK; + if (alvecp) { + arun = 1; +#ifdef DEBUG_INP + xprintf("alvecp %c\n", *alvecp & 0xff); +#endif + aret = TCSH_A_SEEK; + if ((c = *alvecp++) != 0) + return (c); + if (alvec && *alvec) { + alvecp = *alvec++; + return (' '); + } + else { + alvecp = NULL; + aret = TCSH_F_SEEK; + return('\n'); + } + } + if (alvec) { + arun = 1; + if ((alvecp = *alvec) != 0) { + alvec++; + goto top; + } + /* Infinite source! */ + return ('\n'); + } + arun = 0; + if (evalp) { + aret = TCSH_E_SEEK; + if ((c = *evalp++) != 0) + return (c); + if (evalvec && *evalvec) { + evalp = *evalvec++; + return (' '); + } + aret = TCSH_F_SEEK; + evalp = 0; + } + if (evalvec) { + if (evalvec == INVPPTR) { + doneinp = 1; + reset(); + } + if ((evalp = *evalvec) != 0) { + evalvec++; + goto top; + } + evalvec = INVPPTR; + return ('\n'); + } + do { + if (arginp == INVPTR || onelflg == 1) { + if (wanteof) + return CHAR_ERR; + exitstat(); + } + if (arginp) { + if ((c = *arginp++) == 0) { + arginp = INVPTR; + return ('\n'); + } + return (c); + } +#ifdef BSDJOBS +reread: +#endif /* BSDJOBS */ + c = bgetc(); + if (c == CHAR_ERR) { +#ifndef WINNT_NATIVE +# ifndef POSIX +# ifdef TERMIO + struct termio tty; +# else /* SGTTYB */ + struct sgttyb tty; +# endif /* TERMIO */ +# else /* POSIX */ + struct termios tty; +# endif /* POSIX */ +#endif /* !WINNT_NATIVE */ + if (wanteof) + return CHAR_ERR; + /* was isatty but raw with ignoreeof yields problems */ +#ifndef WINNT_NATIVE +# ifndef POSIX +# ifdef TERMIO + if (ioctl(SHIN, TCGETA, (ioctl_t) & tty) == 0 && + (tty.c_lflag & ICANON)) +# else /* GSTTYB */ + if (ioctl(SHIN, TIOCGETP, (ioctl_t) & tty) == 0 && + (tty.sg_flags & RAW) == 0) +# endif /* TERMIO */ +# else /* POSIX */ + if (tcgetattr(SHIN, &tty) == 0 && + (tty.c_lflag & ICANON)) +# endif /* POSIX */ +#else /* WINNT_NATIVE */ + if (isatty(SHIN)) +#endif /* !WINNT_NATIVE */ + { +#ifdef BSDJOBS + pid_t ctpgrp; +#endif /* BSDJOBS */ + + if (numeof != 0 && ++sincereal >= numeof) /* Too many EOFs? Bye! */ + goto oops; +#ifdef BSDJOBS + if (tpgrp != -1 && + (ctpgrp = tcgetpgrp(FSHTTY)) != -1 && + tpgrp != ctpgrp) { + (void) tcsetpgrp(FSHTTY, tpgrp); +# ifdef _SEQUENT_ + if (ctpgrp) +# endif /* _SEQUENT */ + (void) killpg(ctpgrp, SIGHUP); +# ifdef notdef + /* + * With the walking process group fix, this message + * is now obsolete. As the foreground process group + * changes, the shell needs to adjust. Well too bad. + */ + xprintf(CGETS(16, 1, "Reset tty pgrp from %d to %d\n"), + (int)ctpgrp, (int)tpgrp); +# endif /* notdef */ + goto reread; + } +#endif /* BSDJOBS */ + /* What follows is complicated EOF handling -- sterling@netcom.com */ + /* First, we check to see if we have ignoreeof set */ + if (adrof(STRignoreeof)) { + /* If so, we check for any stopped jobs only on the first EOF */ + if ((sincereal == 1) && (chkstop == 0)) { + panystop(1); + } + } else { + /* If we don't have ignoreeof set, always check for stopped jobs */ + if (chkstop == 0) { + panystop(1); + } + } + /* At this point, if there were stopped jobs, we would have already + * called reset(). If we got this far, assume we can print an + * exit/logout message if we ignoreeof, or just exit. + */ + if (adrof(STRignoreeof)) { + /* If so, tell the user to use exit or logout */ + if (loginsh) { + xprintf("%s", CGETS(16, 2, + "\nUse \"logout\" to logout.\n")); + } else { + xprintf(CGETS(16, 3, + "\nUse \"exit\" to leave %s.\n"), + progname); + } + reset(); + } else { + /* If we don't have ignoreeof set, just fall through */ + ; /* EMPTY */ + } + } + oops: + doneinp = 1; + reset(); + } + sincereal = 0; + if (c == '\n' && onelflg) + onelflg--; + } while (c == 0); + Strbuf_append1(&histline, c); + return (c); +} + +static void +balloc(int buf) +{ + Char **nfbuf; + + while (buf >= fblocks) { + nfbuf = xcalloc(fblocks + 2, sizeof(Char **)); + if (fbuf) { + (void) blkcpy(nfbuf, fbuf); + xfree(fbuf); + } + fbuf = nfbuf; + fbuf[fblocks] = xcalloc(BUFSIZE, sizeof(Char)); + fblocks++; + } +} + +ssize_t +wide_read(int fildes, Char *buf, size_t nchars, int use_fclens) +{ + char cbuf[BUFSIZE + 1]; + ssize_t res, r = 0; + size_t partial; + int err; + + if (nchars == 0) + return 0; + assert (nchars <= sizeof(cbuf) / sizeof(*cbuf)); + USE(use_fclens); + res = 0; + partial = 0; + do { + size_t i; + size_t len = nchars > partial ? nchars - partial : 1; + + if (partial + len >= sizeof(cbuf) / sizeof(*cbuf)) + break; + + r = xread(fildes, cbuf + partial, len); + + if (partial == 0 && r <= 0) + break; + partial += r; + i = 0; + while (i < partial && nchars != 0) { + int tlen; + + tlen = normal_mbtowc(buf + res, cbuf + i, partial - i); + if (tlen == -1) { + reset_mbtowc(); + if ((partial - i) < MB_LEN_MAX && r > 0) + /* Maybe a partial character and there is still a chance + to read more */ + break; + buf[res] = (unsigned char)cbuf[i] | INVALID_BYTE; + } + if (tlen <= 0) + tlen = 1; +#ifdef WIDE_STRINGS + if (use_fclens) + fclens[res] = tlen; +#endif + i += tlen; + res++; + nchars--; + } + if (i != partial) + memmove(cbuf, cbuf + i, partial - i); + partial -= i; + } while (partial != 0 && nchars > 0); + /* Throwing away possible partial multibyte characters on error if the + stream is not seekable */ + err = errno; + lseek(fildes, -(off_t)partial, L_INCR); + errno = err; + return res != 0 ? res : r; +} + +static eChar +bgetc(void) +{ + Char ch; + int c, off, buf; + int numleft = 0, roomleft; + + if (cantell) { + if (fseekp < fbobp || fseekp > feobp) { + fbobp = feobp = fseekp; + (void) lseek(SHIN, fseekp, L_SET); + } + if (fseekp == feobp) { +#ifdef WIDE_STRINGS + off_t bytes; + size_t i; + + bytes = fbobp; + for (i = 0; i < (size_t)(feobp - fbobp); i++) + bytes += fclens[i]; + fseekp = feobp = bytes; +#endif + fbobp = feobp; + c = wide_read(SHIN, fbuf[0], BUFSIZE, 1); +#ifdef convex + if (c < 0) + stderror(ERR_SYSTEM, progname, strerror(errno)); +#endif /* convex */ + if (c <= 0) + return CHAR_ERR; + feobp += c; + } +#if !defined(WINNT_NATIVE) && !defined(__CYGWIN__) + ch = fbuf[0][fseekp - fbobp]; + fseekp++; +#else + do { + ch = fbuf[0][fseekp - fbobp]; + fseekp++; + } while(ch == '\r'); +#endif /* !WINNT_NATIVE && !__CYGWIN__ */ + return (ch); + } + + while (fseekp >= feobp) { + if ((editing +#if defined(FILEC) && defined(TIOCSTI) + || filec +#endif /* FILEC && TIOCSTI */ + ) && intty) { /* then use twenex routine */ + fseekp = feobp; /* where else? */ +#if defined(FILEC) && defined(TIOCSTI) + if (!editing) + c = numleft = tenex(InputBuf, BUFSIZE); + else +#endif /* FILEC && TIOCSTI */ + c = numleft = Inputl(); /* PWP: get a line */ + while (numleft > 0) { + off = (int) feobp % BUFSIZE; + buf = (int) feobp / BUFSIZE; + balloc(buf); + roomleft = BUFSIZE - off; + if (roomleft > numleft) + roomleft = numleft; + (void) memcpy(fbuf[buf] + off, InputBuf + c - numleft, + roomleft * sizeof(Char)); + numleft -= roomleft; + feobp += roomleft; + } + } else { + off = (int) feobp % BUFSIZE; + buf = (int) feobp / BUFSIZE; + balloc(buf); + roomleft = BUFSIZE - off; + c = wide_read(SHIN, fbuf[buf] + off, roomleft, 0); + if (c > 0) + feobp += c; + } + if (c == 0 || (c < 0 && fixio(SHIN, errno) == -1)) + return CHAR_ERR; + } +#ifdef SIG_WINDOW + if (windowchg) + (void) check_window_size(0); /* for window systems */ +#endif /* SIG_WINDOW */ +#if !defined(WINNT_NATIVE) && !defined(__CYGWIN__) + ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE]; + fseekp++; +#else + do { + ch = fbuf[(int) fseekp / BUFSIZE][(int) fseekp % BUFSIZE]; + fseekp++; + } while(ch == '\r'); +#endif /* !WINNT_NATIVE && !__CYGWIN__ */ + return (ch); +} + +static void +bfree(void) +{ + int sb, i; + + if (cantell) + return; + if (whyles) + return; + sb = (int) (fseekp - 1) / BUFSIZE; + if (sb > 0) { + for (i = 0; i < sb; i++) + xfree(fbuf[i]); + (void) blkcpy(fbuf, &fbuf[sb]); + fseekp -= BUFSIZE * sb; + feobp -= BUFSIZE * sb; + fblocks -= sb; + } +} + +void +bseek(struct Ain *l) +{ + switch (aret = l->type) { + case TCSH_E_SEEK: + evalvec = l->a_seek; + evalp = l->c_seek; +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 4, "seek to eval %x %x\n"), evalvec, evalp); +#endif + return; + case TCSH_A_SEEK: + alvec = l->a_seek; + alvecp = l->c_seek; +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 5, "seek to alias %x %x\n"), alvec, alvecp); +#endif + return; + case TCSH_F_SEEK: +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 6, "seek to file %x\n"), fseekp); +#endif + fseekp = l->f_seek; +#ifdef WIDE_STRINGS + if (cantell) { + if (fseekp >= fbobp && feobp >= fbobp) { + size_t i; + off_t o; + + o = fbobp; + for (i = 0; i < (size_t)(feobp - fbobp); i++) { + if (fseekp == o) { + fseekp = fbobp + i; + return; + } + o += fclens[i]; + } + if (fseekp == o) { + fseekp = feobp; + return; + } + } + fbobp = feobp = fseekp + 1; /* To force lseek() */ + } +#endif + return; + default: + xprintf(CGETS(16, 7, "Bad seek type %d\n"), aret); + abort(); + } +} + +/* any similarity to bell telephone is purely accidental */ +void +btell(struct Ain *l) +{ + switch (l->type = aret) { + case TCSH_E_SEEK: + l->a_seek = evalvec; + l->c_seek = evalp; +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 8, "tell eval %x %x\n"), evalvec, evalp); +#endif + return; + case TCSH_A_SEEK: + l->a_seek = alvec; + l->c_seek = alvecp; +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 9, "tell alias %x %x\n"), alvec, alvecp); +#endif + return; + case TCSH_F_SEEK: +#ifdef WIDE_STRINGS + if (cantell && fseekp >= fbobp && fseekp <= feobp) { + size_t i; + + l->f_seek = fbobp; + for (i = 0; i < (size_t)(fseekp - fbobp); i++) + l->f_seek += fclens[i]; + } else +#endif + /*SUPPRESS 112*/ + l->f_seek = fseekp; + l->a_seek = NULL; +#ifdef DEBUG_SEEK + xprintf(CGETS(16, 10, "tell file %x\n"), fseekp); +#endif + return; + default: + xprintf(CGETS(16, 7, "Bad seek type %d\n"), aret); + abort(); + } +} + +void +btoeof(void) +{ + (void) lseek(SHIN, (off_t) 0, L_XTND); + aret = TCSH_F_SEEK; + fseekp = feobp; + alvec = NULL; + alvecp = NULL; + evalvec = NULL; + evalp = NULL; + wfree(); + bfree(); +} + +void +settell(void) +{ + off_t x; + cantell = 0; + if (arginp || onelflg || intty) + return; + if ((x = lseek(SHIN, (off_t) 0, L_INCR)) == -1) + return; + fbuf = xcalloc(2, sizeof(Char **)); + fblocks = 1; + fbuf[0] = xcalloc(BUFSIZE, sizeof(Char)); + fseekp = fbobp = feobp = x; + cantell = 1; +} Index: vendor/tcsh/6.21.00-83c5be0/tc.const.c =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tc.const.c (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tc.const.c (revision 353870) @@ -0,0 +1,522 @@ +/* + * sh.const.c: String constants for tcsh. + */ +/*- + * Copyright (c) 1980, 1991 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; 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" + +Char STRlogout[] = { 'l', 'o', 'g', 'o', 'u', 't', '\0' }; +Char STRautologout[] = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't', + '\0' }; +Char STRdefautologout[] = { '6', '0', '\0' }; +#ifdef convex +Char STRrootdefautologout[] = { '1', '5', '\0' }; +#endif +Char STRautomatic[] = { 'a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c', + '\0' }; +Char STRanyerror[] = { 'a', 'n', 'y', 'e', 'r', 'r', 'o', 'r', '\0' }; +Char STRhangup[] = { 'h', 'a', 'n', 'g', 'u', 'p', '\0' }; +Char STRaout[] = { 'a', '.', 'o', 'u', 't', '\0' }; +Char STRtty[] = { 't', 't', 'y', '\0' }; +Char STRptssl[] = { 'p', 't', 's', '/', '\0' }; +Char STRany[] = { 'a', 'n', 'y', '\0' }; +Char STRstatus[] = { 's', 't', 'a', 't', 'u', 's', '\0' }; +Char STR0[] = { '0', '\0' }; +Char STR1[] = { '1', '\0' }; +/* STRm1 would look too much like STRml IMHO */ +Char STRminus1[] = { '-', '1', '\0' }; +Char STRmaxint[] = { '0', 'x', '7', 'f', 'f', 'f', 'f', 'f', 'f', 'f', + '\0' }; +Char STRcolon[] = { ':', '\0' }; +Char STR_[] = { '_', '\0' }; +Char STRNULL[] = { '\0' }; +Char STRtcsh[] = { 't', 'c', 's', 'h', '\0' }; +Char STRhome[] = { 'h', 'o', 'm', 'e', '\0' }; +Char STReuser[] = { 'e', 'u', 's', 'e', 'r', '\0'}; +Char STRuser[] = { 'u', 's', 'e', 'r', '\0' }; +Char STRgroup[] = { 'g', 'r', 'o', 'u', 'p', '\0' }; +#ifdef AFS +Char STRafsuser[] = { 'a', 'f', 's', 'u', 's', 'e', 'r', '\0' }; +#endif /* AFS */ +Char STRterm[] = { 't', 'e', 'r', 'm', '\0' }; +Char STRversion[] = { 'v', 'e', 'r', 's', 'i', 'o', 'n', '\0' }; +Char STReuid[] = { 'e', 'u', 'i', 'd', '\0' }; +Char STRuid[] = { 'u', 'i', 'd', '\0' }; +Char STRgid[] = { 'g', 'i', 'd', '\0' }; +Char STRunknown[] = { 'u', 'n', 'k', 'n', 'o', 'w', 'n', '\0' }; +Char STRnetwork[] = { 'n', 'e', 't', 'w', 'o', 'r', 'k', '\0' }; +Char STRdumb[] = { 'd', 'u', 'm', 'b', '\0' }; +Char STRHOST[] = { 'H', 'O', 'S', 'T', '\0' }; +#ifdef REMOTEHOST +Char STRREMOTEHOST[] = { 'R', 'E', 'M', 'O', 'T', 'E', 'H', + 'O', 'S', 'T', '\0' }; +#endif /* REMOTEHOST */ +Char STRHOSTTYPE[] = { 'H', 'O', 'S', 'T', 'T', 'Y', 'P', 'E', '\0' }; +Char STRVENDOR[] = { 'V', 'E', 'N', 'D', 'O', 'R', '\0' }; +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', + '\0' }; +Char STRnostat[] = { 'n', 'o', 's', 't', 'a', 't', '\0' }; +Char STRshell[] = { 's', 'h', 'e', 'l', 'l', '\0' }; +Char STRtmpsh[] = { '/', 't', 'm', 'p', '/', 's', 'h', '\0' }; +Char STRverbose[] = { 'v', 'e', 'r', 'b', 'o', 's', 'e', '\0' }; +Char STRecho[] = { 'e', 'c', 'h', 'o', '\0' }; +Char STRpath[] = { 'p', 'a', 't', 'h', '\0' }; +Char STRprompt[] = { 'p', 'r', 'o', 'm', 'p', 't', '\0' }; +Char STRprompt2[] = { 'p', 'r', 'o', 'm', 'p', 't', '2', '\0' }; +Char STRprompt3[] = { 'p', 'r', 'o', 'm', 'p', 't', '3', '\0' }; +Char STRrprompt[] = { 'r', 'p', 'r', 'o', 'm', 'p', 't', '\0' }; +Char STRellipsis[] = { 'e', 'l', 'l', 'i', 'p', 's', 'i', 's', '\0' }; +Char STRcwd[] = { 'c', 'w', 'd', '\0' }; +Char STRowd[] = { 'o', 'w', 'd', '\0' }; +Char STRstar[] = { '*', '\0' }; +Char STRdot[] = { '.', '\0' }; +Char STRhistory[] = { 'h', 'i', 's', 't', 'o', 'r', 'y', '\0' }; +Char STRhistdup[] = { 'h', 'i', 's', 't', 'd', 'u', 'p', '\0' }; +Char STRhistfile[] = { 'h', 'i', 's', 't', 'f', 'i', 'l', 'e', '\0' }; +Char STRsource[] = { 's', 'o', 'u', 'r', 'c', 'e', '\0' }; +Char STRmh[] = { '-', 'h', '\0' }; +Char STRmhT[] = { '-', 'h', 'T', '\0' }; +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' }; + +#ifdef NLS_CATALOGS +Char STRcatalog[] = { 'c', 'a', 't', 'a', 'l', 'o', 'g', '\0' }; +Char STRNLSPATH[] = { 'N', 'L', 'S', 'P', 'A', 'T', 'H', '\0' }; +#endif /* NLS_CATALOGS */ +#ifdef KANJI +Char STRnokanji[] = { 'n', 'o', 'k', 'a', 'n', 'j', 'i', '\0' }; +# ifdef DSPMBYTE +Char STRdspmbyte[] = { 'd', 's', 'p', 'm', 'b', 'y', 't', 'e', '\0' }; +# ifdef BSDCOLORLS +Char STRmmliteral[] = { '-', 'G', '\0' }; +# else +Char STRmmliteral[] = { '-', '-', 'l', 'i', 't', 'e', 'r', 'a', 'l', '\0' }; +# endif +Char STReuc[] = { 'e', 'u', 'c', '\0' }; +Char STRsjis[] = { 's', 'j', 'i', 's', '\0' }; +Char STRbig5[] = { 'b', 'i', 'g', '5', '\0' }; +Char STRutf8[] = { 'u', 't', 'f', '8', '\0' }; +Char STRstarutfstar8[] = { '*', 'u', 't', 'f', '*', '8', '\0' }; +Char STRGB2312[] = { 'g', 'b', '2', '3', '1', '2', '\0' }; +# ifdef MBYTEDEBUG /* Sorry, use for beta testing */ +Char STRmbytemap[] = { 'm', 'b', 'y', 't', 'e', 'm', 'a', 'p', '\0' }; +# endif /* MBYTEMAP */ +/* PATCH IDEA FROM Issei.Suzuki VERY THANKS */ +/* dspmbyte autoset trap */ +/* STRLANGEUCJP,STRLANGEUCJPB(,STRLANGEUCJPC) = EUCJP Trap */ +/* STRLANGEUCKR,STRLANGEUCKRB = EUCKR Trap */ +/* STRLANGEUCZH,STRLANGEUCZHB = EUCZH Trap */ +/* STRLANGSJIS,STRLANGSJISB = SJIS Trap */ +# if defined(__uxps__) || defined(sgi) || defined(aix) || defined(__CYGWIN__) +Char STRLANGEUCJP[] = { 'j', 'a', '_', 'J', 'P', '.', 'E', 'U', 'C', '\0' }; +Char STRLANGEUCKR[] = { 'k', 'o', '_', 'K', 'R', '.', 'E', 'U', 'C', '\0' }; +# if defined(__uxps__) +Char STRLANGEUCJPB[] = { 'j', 'a', 'p', 'a', 'n', '\0' }; +Char STRLANGEUCKRB[] = { 'k', 'o', 'r', 'e', 'a', '\0' }; +# elif defined(aix) +Char STRLANGEUCJPB[] = { 'j', 'a', '_', 'J', 'P', '\0' }; +Char STRLANGEUCKRB[] = { 'k', 'o', '_', 'K', 'R', '\0' }; +# else +Char STRLANGEUCJPB[] = { '\0' }; +Char STRLANGEUCKRB[] = { '\0' }; +# endif +Char STRLANGSJIS[] = { 'j', 'a', '_', 'J', 'P', '.', 'S', 'J', 'I', 'S', + '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5', + '\0' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +# elif defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +Char STRLANGEUCJP[] = { 'j', 'a', '_', 'J', 'P', '.', 'E', 'U', 'C', '-', + 'J', 'P', '\0' }; +Char STRLANGEUCKR[] = { 'k', 'o', '_', 'K', 'R', '.', 'E', 'U', 'C', '\0' }; +Char STRLANGEUCJPB[] = { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J', + 'P', '\0' }; +Char STRLANGEUCKRB[] = { 'k', 'o', '_', 'K', 'R', '.', 'e', 'u', 'c', '\0' }; +Char STRLANGEUCJPC[] = { 'j', 'a', '_', 'J', 'P', '.', 'u', 'j', 'i', 's', + '\0' }; +Char STRLANGSJIS[] = { 'j', 'a', '_', 'J', 'P', '.', 'S', 'J', 'I', 'S', + '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5', + '\0' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +# elif (defined(__FreeBSD__) || defined(__NetBSD__)) || defined(__MidnightBSD__) +Char STRLANGEUCJP[] = { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J', + 'P', '\0' }; +Char STRLANGEUCJPB[] = { 'j', 'a', '_', 'J', 'P', '.', 'E', 'U', 'C', '\0' }; +Char STRLANGEUCKR[] = { 'k', 'o', '_', 'K', 'R', '.', 'e', 'u', 'c', 'K', + 'R', '\0' }; +Char STRLANGEUCKRB[] = { 'k', 'o', '_', 'K', 'R', '.', 'E', 'U', 'C', '\0' }; +Char STRLANGEUCZH[] = { 'z', 'h', '_', 'C', 'N', '.', 'e', 'u', 'c', 'C', + 'N', '\0' }; +Char STRLANGEUCZHB[] = { 'z', 'h', '_', 'C', 'N', '.', 'E', 'U', 'C', '\0' }; +Char STRLANGSJIS[] = { 'j', 'a', '_', 'J', 'P', '.', 'S', 'J', 'I', 'S', + '\0' }; +Char STRLANGSJISB[] = { 'j', 'a', '_', 'J', 'P', '.', 'S', 'h', 'i', 'f', + 't', '_', 'J', 'I', 'S', '\0' }; +Char STRLANGBIG5[] = { 'z', 'h', '_', 'T', 'W', '.', 'B', 'i', 'g', '5', + '\0' }; +# elif defined(__uxpm__) +Char STRLANGEUCJP[] = { 'j', 'a', 'p', 'a', 'n', '\0' }; +Char STRLANGEUCKR[] = { 'k', 'o', 'r', 'e', 'a', '\0' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCJPB[] = { '\0' }; +Char STRLANGEUCKRB[] = { '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +Char STRLANGSJIS[] = { '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { '\0' }; +# elif defined(SOLARIS2) +Char STRLANGEUCJP[] = { 'j', 'a', '\0' }; +Char STRLANGEUCKR[] = { 'k', 'o', '\0' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCJPB[] = { 'j', 'a', 'p', 'a', 'n', 'e', 's', 'e', '\0' }; +Char STRLANGEUCKRB[] = { 'k', 'o', 'r', 'e', 'a', 'n', '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +Char STRLANGSJIS[] = { '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { '\0' }; +# elif defined(hpux) +Char STRLANGEUCJP[] = { 'j', 'a', '_', 'J', 'P', '.', 'e', 'u', 'c', 'J', 'P' }; +Char STRLANGEUCKR[] = { 'k', 'o', '_', 'K', 'R', '.', 'e', 'u', 'c', 'K', 'R' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCJPB[] = { '\0' }; +Char STRLANGEUCKRB[] = { '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +Char STRLANGSJIS[] = { '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { '\0' }; +# else +Char STRLANGEUCJP[] = { '\0' }; +Char STRLANGEUCKR[] = { '\0' }; +Char STRLANGEUCZH[] = { '\0' }; +Char STRLANGEUCJPB[] = { '\0' }; +Char STRLANGEUCKRB[] = { '\0' }; +Char STRLANGEUCZHB[] = { '\0' }; +Char STRLANGSJIS[] = { '\0' }; +Char STRLANGSJISB[] = { '\0' }; +Char STRLANGBIG5[] = { '\0' }; +# endif +# endif /* defined(DSPMBYTE) */ +#endif + +Char STRtildotdirs[] = { '~', '/', '.', 'c', 's', 'h', 'd', 'i', 'r', + 's', '\0' }; +Char STRdirsfile[] = { 'd', 'i', 'r', 's', 'f', 'i', 'l', 'e', '\0' }; +Char STRsavedirs[] = { 's', 'a', 'v', 'e', 'd', 'i', 'r', 's', '\0' }; +Char STRloginsh[] = { 'l', 'o', 'g', 'i', 'n', 's', 'h', '\0' }; +Char STRdirstack[] = { 'd', 'i', 'r', 's', 't', 'a', 'c', 'k', '\0' }; +Char STRargv[] = { 'a', 'r', 'g', 'v', '\0' }; +Char STRcommand[] = { 'c', 'o', 'm', 'm', 'a', 'n', 'd', '\0' }; +Char STRsavehist[] = { 's', 'a', 'v', 'e', 'h', 'i', 's', 't', '\0' }; +Char STRnormal[] = { 'n', 'o', 'r', 'm', 'a', 'l', '\0' }; +Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' }; +Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' }; +Char STRdefprompt[] = { '%', '#', ' ', '\0' }; +Char STRmquestion[] = { '%', 'R', (Char)('?' | QUOTE), ' ', '\0' }; +Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R', + ' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')', + (Char)('?' | QUOTE), ' ', '\0' }; +Char STRunalias[] = { 'u', 'n', 'a', 'l', 'i', 'a', 's', '\0' }; +Char STRalias[] = { 'a', 'l', 'i', 'a', 's', '\0' }; +Char STRprecmd[] = { 'p', 'r', 'e', 'c', 'm', 'd', '\0' }; +Char STRjobcmd[] = { 'j', 'o', 'b', 'c', 'm', 'd', '\0' }; /*GrP*/ +Char STRpostcmd[] = { 'p', 'o', 's', 't', 'c', 'm', 'd', '\0' }; +Char STRcwdcmd[] = { 'c', 'w', 'd', 'c', 'm', 'd', '\0' }; +Char STRperiodic[] = { 'p', 'e', 'r', 'i', 'o', 'd', 'i', 'c', '\0' }; +Char STRtperiod[] = { 't', 'p', 'e', 'r', 'i', 'o', 'd', '\0' }; +Char STRmf[] = { '-', 'f', '\0' }; +Char STRml[] = { '-', 'l', '\0' }; +Char STRslash[] = { '/', '\0' }; +Char STRdotsl[] = { '.', '/', '\0' }; +Char STRdotdotsl[] = { '.', '.', '/', '\0' }; +Char STRcdpath[] = { 'c', 'd', 'p', 'a', 't', 'h', '\0' }; +Char STRcd[] = { 'c', 'd', '\0' }; +Char STRpushdtohome[] = { 'p', 'u', 's', 'h', 'd', 't', 'o', 'h', 'o', 'm', + 'e', '\0' }; +Char STRpushdsilent[] = { 'p', 'u', 's', 'h', 'd', 's', 'i', 'l', 'e', 'n', + 't', '\0' }; +Char STRdextract[] = { 'd', 'e', 'x', 't', 'r', 'a', 'c', 't', '\0' }; +Char STRdunique[] = { 'd', 'u', 'n', 'i', 'q', 'u', 'e', '\0' }; +Char STRsymlinks[] = { 's', 'y', 'm', 'l', 'i', 'n', 'k', 's', '\0' }; +Char STRignore[] = { 'i', 'g', 'n', 'o', 'r', 'e', '\0' }; +Char STRchase[] = { 'c', 'h', 'a', 's', 'e', '\0' }; +Char STRexpand[] = { 'e', 'x', 'p', 'a', 'n', 'd', '\0' }; +Char STRecho_style[] = { 'e', 'c', 'h', 'o', '_', 's', 't', 'y', 'l', 'e', + '\0' }; +Char STRbsd[] = { 'b', 's', 'd', '\0' }; +Char STRsysv[] = { 's', 'y', 's', 'v', '\0' }; +Char STRboth[] = { 'b', 'o', 't', 'h', '\0' }; +Char STRnone[] = { 'n', 'o', 'n', 'e', '\0' }; +Char STRPWD[] = { 'P', 'W', 'D', '\0' }; +Char STRor2[] = { '|', '|', '\0' }; +Char STRand2[] = { '&', '&', '\0' }; +Char STRor[] = { '|', '\0' }; +Char STRcaret[] = { '^', '\0' }; +Char STRand[] = { '&', '\0' }; +Char STRequal[] = { '=', '\0' }; +Char STRbang[] = { '!', '\0' }; +Char STRtilde[] = { '~', '\0' }; +Char STRLparen[] = { '(', '\0' }; +Char STRLbrace[] = { '{', '\0' }; +Char STRfakecom[] = { '{', ' ', '.', '.', '.', ' ', '}', '\0' }; +Char STRRbrace[] = { '}', '\0' }; +Char STRKPATH[] = { 'P', 'A', 'T', 'H', '\0' }; +Char STRdefault[] = { 'd', 'e', 'f', 'a', 'u', 'l', 't', '\0' }; +Char STRmn[] = { '-', 'n', '\0' }; +Char STRminus[] = { '-', '\0' }; +Char STRnoglob[] = { 'n', 'o', 'g', 'l', 'o', 'b', '\0' }; +Char STRnonomatch[] = { 'n', 'o', 'n', 'o', 'm', 'a', 't', 'c', 'h', '\0' }; +Char STRglobstar[] = { 'g', 'l', 'o', 'b', 's', 't', 'a', 'r', '\0' }; +Char STRglobdot[] = { 'g', 'l', 'o', 'b', 'd', 'o', 't', '\0' }; +Char STRfakecom1[] = { '`', ' ', '.', '.', '.', ' ', '`', '\0' }; +Char STRampm[] = { 'a', 'm', 'p', 'm', '\0' }; +Char STRtime[] = { 't', 'i', 'm', 'e', '\0' }; +Char STRnotify[] = { 'n', 'o', 't', 'i', 'f', 'y', '\0' }; +Char STRprintexitvalue[] = { 'p', 'r', 'i', 'n', 't', 'e', 'x', 'i', 't', 'v', + 'a', 'l', 'u', 'e', '\0' }; +Char STRLparensp[] = { '(', ' ', '\0' }; +Char STRspRparen[] = { ' ', ')', '\0' }; +Char STRspace[] = { ' ', '\0' }; +Char STRspor2sp[] = { ' ', '|', '|', ' ', '\0' }; +Char STRspand2sp[] = { ' ', '&', '&', ' ', '\0' }; +Char STRsporsp[] = { ' ', '|', ' ', '\0' }; +Char STRsemisp[] = { ';', ' ', '\0' }; +Char STRsemi[] = { ';', '\0' }; +Char STRQQ[] = { '"', '"', '\0' }; +Char STRBB[] = { '[', ']', '\0' }; +Char STRspLarrow2sp[] = { ' ', '<', '<', ' ', '\0' }; +Char STRspLarrowsp[] = { ' ', '<', ' ', '\0' }; +Char STRspRarrow2[] = { ' ', '>', '>', '\0' }; +Char STRspRarrow[] = { ' ', '>', '\0' }; +Char STRgt[] = { '>', '\0' }; +Char STRcent2[] = { '%', '%', '\0' }; +Char STRcentplus[] = { '%', '+', '\0' }; +Char STRcentminus[] = { '%', '-', '\0' }; +Char STRcenthash[] = { '%', '#', '\0' }; +#ifdef BSDJOBS +Char STRcontinue[] = { 'c', 'o', 'n', 't', 'i', 'n', 'u', 'e', '\0' }; +Char STRcontinue_args[] = { 'c', 'o', 'n', 't', 'i', 'n', 'u', 'e', '_', 'a', + 'r', 'g', 's', '\0' }; +Char STRunderpause[] = { '_', 'p', 'a', 'u', 's', 'e', '\0' }; +#endif +Char STRbackqpwd[] = { '`', 'p', 'w', 'd', '`', '\0' }; +#if defined(FILEC) && defined(TIOCSTI) +Char STRfilec[] = { 'f', 'i', 'l', 'e', 'c', '\0' }; +#endif /* FILEC && TIOCSTI */ +Char STRhistchars[] = { 'h', 'i', 's', 't', 'c', 'h', 'a', 'r', 's', '\0' }; +Char STRpromptchars[] = { 'p', 'r', 'o', 'm', 'p', 't', 'c', 'h', 'a', 'r', + 's', '\0' }; +Char STRhistlit[] = { 'h', 'i', 's', 't', 'l', 'i', 't', '\0' }; +Char STRKUSER[] = { 'U', 'S', 'E', 'R', '\0' }; +Char STRLOGNAME[] = { 'L', 'O', 'G', 'N', 'A', 'M', 'E', '\0' }; +Char STRKGROUP[] = { 'G', 'R', 'O', 'U', 'P', '\0' }; +Char STRwordchars[] = { 'w', 'o', 'r', 'd', 'c', 'h', 'a', 'r', 's', '\0' }; +Char STRKTERM[] = { 'T', 'E', 'R', 'M', '\0' }; +Char STRKHOME[] = { 'H', 'O', 'M', 'E', '\0' }; +Char STRbackslash_quote[] = { 'b', 'a', 'c', 'k', 's', 'l', 'a', 's', 'h', '_', + 'q', 'u', 'o', 't', 'e', '\0' }; +Char STRcompat_expr[] = { 'c', 'o', 'm', 'p', 'a', 't', '_', 'e', 'x', 'p', + 'r', '\0' }; +Char STRRparen[] = { ')', '\0' }; +Char STRmail[] = { 'm', 'a', 'i', 'l', '\0' }; +#ifndef HAVENOUTMP +Char STRwatch[] = { 'w', 'a', 't', 'c', 'h', '\0' }; +#endif /* HAVENOUTMP */ + +Char STRsldottcshrc[] = { '/', '.', 't', 'c', 's', 'h', 'r', 'c', '\0' }; +Char STRsldotcshrc[] = { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' }; +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' }; +Char STRrecexact[] = { 'r', 'e', 'c', 'e', 'x', 'a', 'c', 't', '\0' }; +Char STRlistmaxrows[] = { 'l', 'i', 's', 't', 'm', 'a', 'x', 'r', 'o', 'w', + 's', '\0' }; +Char STRlistmax[] = { 'l', 'i', 's', 't', 'm', 'a', 'x', '\0' }; +Char STRlistlinks[] = { 'l', 'i', 's', 't', 'l', 'i', 'n', 'k', 's', '\0' }; +Char STRDING[] = { 'D', 'I', 'N', 'G', '!', '\0' }; +Char STRQNULL[] = { (Char)('\0' | QUOTE), '\0' }; +Char STRcorrect[] = { 'c', 'o', 'r', 'r', 'e', 'c', 't', '\0' }; +Char STRcmd[] = { 'c', 'm', 'd', '\0' }; +Char STRall[] = { 'a', 'l', 'l', '\0' }; +Char STRalways[] = { 'a', 'l', 'w', 'a', 'y', 's', '\0' }; +Char STRerase[] = { 'e', 'r', 'a', 's', 'e', '\0' }; +Char STRprev[] = { 'p', 'r', 'e', 'v', '\0' }; +Char STRcomplete[] = { 'c', 'o', 'm', 'p', 'l', 'e', 't', 'e', '\0' }; +Char STREnhance[] = { 'E', 'n', 'h', 'a', 'n', 'c', 'e', '\0' }; +Char STRenhance[] = { 'e', 'n', 'h', 'a', 'n', 'c', 'e', '\0' }; +Char STRigncase[] = { 'i', 'g', 'n', 'c', 'a', 's', 'e', '\0' }; +Char STRautoexpand[] = { 'a', 'u', 't', 'o', 'e', 'x', 'p', 'a', 'n', 'd', + '\0' }; +Char STRautocorrect[] = { 'a', 'u', 't', 'o', 'c', 'o', 'r', 'r', 'e', 'c', + 't', '\0' }; +Char STRautolist[] = { 'a', 'u', 't', 'o', 'l', 'i', 's', 't', '\0' }; +Char STRautorehash[] = { 'a', 'u', 't', 'o', 'r', 'e', 'h', 'a', 's', 'h', '\0' }; +Char STRbeepcmd[] = { 'b', 'e', 'e', 'p', 'c', 'm', 'd', '\0' }; +Char STRmatchbeep[] = { 'm', 'a', 't', 'c', 'h', 'b', 'e', 'e', 'p', '\0' }; +Char STRnomatch[] = { 'n', 'o', 'm', 'a', 't', 'c', 'h', '\0' }; +Char STRambiguous[] = { 'a', 'm', 'b', 'i', 'g', 'u', 'o', 'u', 's', '\0' }; +Char STRnotunique[] = { 'n', 'o', 't', 'u', 'n', 'i', 'q', 'u', 'e', '\0' }; +Char STRret[] = { '\n', '\0' }; +Char STRnobeep[] = { 'n', 'o', 'b', 'e', 'e', 'p', '\0' }; +Char STRnoding[] = { 'n', 'o', 'd', 'i', 'n', 'g', '\0' }; +Char STRpadhour[] = { 'p', 'a', 'd', 'h', 'o', 'u', 'r', '\0' }; +Char STRnoambiguous[] = { 'n', 'o', 'a', 'm', 'b', 'i', 'g', 'u', 'o', 'u', + 's', '\0' }; +Char STRvisiblebell[] = { 'v', 'i', 's', 'i', 'b', 'l', 'e', 'b', 'e', 'l', + 'l', '\0' }; +Char STRrecognize_only_executables[] = { 'r', 'e', 'c', 'o', 'g', 'n', 'i', + 'z', 'e', '_', 'o', 'n', 'l', 'y', + '_', 'e', 'x', 'e', 'c', 'u', 't', + 'a', 'b', 'l', 'e', 's', '\0' }; +Char STRinputmode[] = { 'i', 'n', 'p', 'u', 't', 'm', 'o', 'd', 'e', + '\0' }; +Char STRoverwrite[] = { 'o', 'v', 'e', 'r', 'w', 'r', 'i', 't', 'e', + '\0' }; +Char STRinsert[] = { 'i', 'n', 's', 'e', 'r', 't', '\0' }; +Char STRnohup[] = { 'n', 'o', 'h', 'u', 'p', '\0' }; +Char STRhup[] = { 'h', 'u', 'p', '\0' }; +Char STRnice[] = { 'n', 'i', 'c', 'e', '\0' }; +Char STRthen[] = { 't', 'h', 'e', 'n', '\0' }; +Char STRlistjobs[] = { 'l', 'i', 's', 't', 'j', 'o', 'b', 's', '\0' }; +Char STRlistflags[] = { 'l', 'i', 's', 't', 'f', 'l', 'a', 'g', 's', '\0' }; +Char STRlong[] = { 'l', 'o', 'n', 'g', '\0' }; +Char STRwho[] = { 'w', 'h', 'o', '\0' }; +Char STRsched[] = { 's', 'c', 'h', 'e', 'd', '\0' }; +Char STRrmstar[] = { 'r', 'm', 's', 't', 'a', 'r', '\0' }; +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 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' }; +Char STRKSHLVL[] = { 'S', 'H', 'L', 'V', 'L', '\0' }; +Char STRLANG[] = { 'L', 'A', 'N', 'G', '\0' }; +Char STRLC_ALL[] = { 'L', 'C', '_', 'A', 'L', 'L', '\0' }; +Char STRLC_CTYPE[] = { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E' ,'\0' }; +Char STRLC_NUMERIC[] = { 'L', 'C', '_', 'N', 'U', 'M', 'E', 'R', 'I', + 'C', '\0' }; +Char STRLC_TIME[] = { 'L', 'C', '_', 'T', 'I', 'M', 'E', '\0' }; +Char STRLC_COLLATE[] = { 'L', 'C', '_', 'C', 'O', 'L', 'L', 'A', 'T', + 'E', '\0' }; +Char STRLC_MESSAGES[] = { 'L', 'C', '_', 'M', 'E', 'S', 'S', 'A', 'G', + 'E', 'S', '\0' }; +Char STRLC_MONETARY[] = { 'L', 'C', '_', 'M', 'O', 'N', 'E', 'T', 'A', + 'R', 'Y', '\0' }; +Char STRNOREBIND[] = { 'N', 'O', 'R', 'E', 'B', 'I', 'N', 'D', '\0' }; + +#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 || 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', + '_', 'E', 'N', 'V', 'I', 'R', 'O', 'N', 'M', + 'E', 'N', 'T', '\0'}; +#endif /* _OSD_POSIX */ +Char STRCOMMAND_LINE[] = { 'C', 'O', 'M', 'M', 'A', 'N', 'D', '_', 'L', 'I', + 'N', 'E', '\0' }; + +#ifdef WARP +Char STRwarp[] = { 'w', 'a', 'r', 'p', '\0' }; +#endif /* WARP */ + +#ifdef apollo +Char STRSYSTYPE[] = { 'S', 'Y', 'S', 'T', 'Y', 'P', 'E', '\0' }; +Char STRoid[] = { 'o', 'i', 'd', '\0' }; +Char STRbsd43[] = { 'b', 's', 'd', '4', '.', '3', '\0' }; +Char STRsys53[] = { 's', 'y', 's', '5', '.', '3', '\0' }; +Char STRver[] = { 'v', 'e', 'r', '\0' }; +#endif /* apollo */ + +#ifndef IS_ASCII +Char STRwarnebcdic[] = { 'w', 'a', 'r', 'n', 'e', 'b', 'c', 'd', 'i', 'c', '\0' }; +#endif + +Char STRmCF[] = { '-', 'C', 'F', '\0', '\0' }; +#ifdef COLOR_LS_F +Char STRlsmF[] = { 'l', 's', '-', 'F', '\0' }; +Char STRcolor[] = { 'c', 'o', 'l', 'o', 'r', '\0' }; +#ifdef BSD_STYLE_COLORLS +Char STRmmcolormauto[] = { '-', 'G', '\0' }; +#else +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' }; + +Char STRup[] = { 'u', 'p', '\0' }; +Char STRdown[] = { 'd', 'o', 'w', 'n', '\0' }; +Char STRleft[] = { 'l', 'e', 'f', 't', '\0' }; +Char STRright[] = { 'r', 'i', 'g', 'h', 't', '\0' }; +Char STRend[] = { 'e', 'n', 'd', '\0' }; + +#ifdef COLORCAT +Char STRcolorcat[] = { 'c', 'o', 'l', 'o', 'r', 'c', 'a', 't', '\0' }; +#endif + +Char STRshwspace[] = { ' ', '\t', '\0' }; +Char STRshwordsep[] = { ' ', '\t', '&', '|', ';', '<', '>', '(', ')', '\0' }; +Char STRrepeat[] = { 'r', 'e', 'p', 'e', 'a', 't', '\0' }; + +Char STReof[] = { '^', 'D', '\b', '\b', '\0' }; +Char STRonlyhistory[] = { 'o', 'n', 'l', 'y', 'h', 'i', 's', 't', 'o', 'r', + 'y', '\0' }; +Char STRparseoctal[] = { 'p', 'a', 'r', 's', 'e', 'o', 'c', 't', 'a', 'l', + '\0' }; +Char STRli[] = { 'l', 'i', '#', '\0' }; +Char STRco[] = { 'c', 'o', '#', '\0' }; Index: vendor/tcsh/6.21.00-83c5be0/tc.sig.h =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tc.sig.h (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tc.sig.h (revision 353870) @@ -0,0 +1,172 @@ +/* + * tc.sig.h: Signal handling + * + */ +/*- + * Copyright (c) 1980, 1991 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; 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 _h_tc_sig +#define _h_tc_sig + +#if (SYSVREL > 0) || defined(BSD4_4) || defined(_MINIX) || defined(DGUX) || defined(WINNT_NATIVE) || defined(__QNXNTO__) +# include +# ifndef SIGCHLD +# define SIGCHLD SIGCLD +# endif /* SIGCHLD */ +#else /* SYSVREL == 0 */ +# include +#endif /* SYSVREL > 0 */ + +#if defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) +# define SAVESIGVEC +#endif /* SUNOS4 || DGUX || hp800 || SVR4 & VFORK */ + +#if SYSVREL > 0 +# ifdef BSDJOBS +/* here I assume that systems that have bsdjobs implement the + * the setpgrp call correctly. Otherwise defining this would + * work, but it would kill the world, because all the setpgrp + * code is the the part defined when BSDJOBS are defined + * NOTE: we don't want killpg(a, b) == kill(-getpgrp(a), b) + * cause process a might be already dead and getpgrp would fail + */ +# define killpg(a, b) kill(-(a), (b)) +# else +/* this is the poor man's version of killpg()! Just kill the + * current process and don't worry about the rest. Someday + * I hope I get to fix that. + */ +# define killpg(a, b) kill((a), (b)) +# endif /* BSDJOBS */ +#endif /* SYSVREL > 0 */ + +#ifdef _MINIX +# include +# define killpg(a, b) kill((a), (b)) +# ifdef _MINIX_VMD +# define signal(a, b) signal((a), (a) == SIGCHLD ? SIG_IGN : (b)) +# endif /* _MINIX_VMD */ +#endif /* _MINIX */ + +#ifdef _VMS_POSIX +# define killpg(a, b) kill(-(a), (b)) +#endif /* atp _VMS_POSIX */ + +#ifdef aiws +# undef killpg +# define killpg(a, b) kill(-getpgrp(a), b) +#endif /* aiws */ + +#if !defined(NSIG) && defined(SIGMAX) +# define NSIG (SIGMAX+1) +#endif /* !NSIG && SIGMAX */ +#if !defined(NSIG) && defined(_SIG_MAX) +# define NSIG (_SIG_MAX+1) +#endif /* !NSIG && _SIG_MAX */ +#if !defined(NSIG) && defined(_NSIG) +# define NSIG _NSIG +#endif /* !NSIG && _NSIG */ +#if !defined(NSIG) +#define NSIG (sizeof(sigset_t) * 8) +#endif /* !NSIG */ +#if !defined(MAXSIG) && defined(NSIG) +# define MAXSIG NSIG +#endif /* !MAXSIG && NSIG */ + +/* + * We choose a define for the window signal if it exists.. + */ +#ifdef SIGWINCH +# define SIG_WINDOW SIGWINCH +#else +# ifdef SIGWINDOW +# define SIG_WINDOW SIGWINDOW +# endif /* SIGWINDOW */ +#endif /* SIGWINCH */ + +#ifdef SAVESIGVEC +# define NSIGSAVED 7 + /* + * These are not inline for speed. gcc -traditional -O on the sparc ignores + * the fact that vfork() corrupts the registers. Calling a routine is not + * nice, since it can make the compiler put some things that we want saved + * into registers - christos + */ +# define savesigvec(sv, sm) \ + do { \ + sigset_t m__; \ + \ + sigaction(SIGINT, NULL, &(sv)[0]); \ + sigaction(SIGQUIT, NULL, &(sv)[1]); \ + sigaction(SIGTSTP, NULL, &(sv)[2]); \ + sigaction(SIGTTIN, NULL, &(sv)[3]); \ + sigaction(SIGTTOU, NULL, &(sv)[4]); \ + sigaction(SIGTERM, NULL, &(sv)[5]); \ + sigaction(SIGHUP, NULL, &(sv)[6]); \ + sigemptyset(&m__); \ + sigaddset(&m__, SIGINT); \ + sigaddset(&m__, SIGQUIT); \ + sigaddset(&m__, SIGTSTP); \ + sigaddset(&m__, SIGTTIN); \ + sigaddset(&m__, SIGTTOU); \ + sigaddset(&m__, SIGTERM); \ + sigaddset(&m__, SIGHUP); \ + sigprocmask(SIG_BLOCK, &m__, &sm); \ + } while (0) + +# define restoresigvec(sv, sm) \ + do { \ + sigaction(SIGINT, &(sv)[0], NULL); \ + sigaction(SIGQUIT, &(sv)[1], NULL); \ + sigaction(SIGTSTP, &(sv)[2], NULL); \ + sigaction(SIGTTIN, &(sv)[3], NULL); \ + sigaction(SIGTTOU, &(sv)[4], NULL); \ + sigaction(SIGTERM, &(sv)[5], NULL); \ + sigaction(SIGHUP, &(sv)[6], NULL); \ + sigprocmask(SIG_SETMASK, &sm, NULL); \ + } while (0) +# endif /* SAVESIGVEC */ + +extern int alrmcatch_disabled; +extern int pchild_disabled; +extern int phup_disabled; +extern int pintr_disabled; + +extern void sigset_interrupting(int, void (*) (int)); +extern int handle_pending_signals(void); + +extern void queue_alrmcatch(int); +extern void queue_pchild(int); +extern void queue_phup(int); +extern void queue_pintr(int); + +extern void disabled_cleanup(void *); +extern void pintr_disabled_restore(void *); +extern void pintr_push_enable(int *); + +#endif /* _h_tc_sig */ Index: vendor/tcsh/6.21.00-83c5be0/tcsh.man.new =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tcsh.man.new (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tcsh.man.new (revision 353870) @@ -0,0 +1,9733 @@ +.\" +.\" 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 May 8, 2019 +.Dt TCSH 1 +.Os Astron 6.21.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. +.Ss 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 +.Bl -tag -width indent -compact +.It ^W +Appends the rest of the word under the cursor to the search pattern. +.It 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. +.It ^G +If the previous search was successful, aborts the entire search. +If not, goes back to the last successful search. +.It escape +Ends the search, leaving the current line in the input buffer. +.El +.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: +.Pp +.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 +.Ss 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 XXXXXXXXXX -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 +.It Ar ${#name} +Substitutes the number of words in +.Va name +.It Ar $# +Equivalent to +.Sq $#argv +(+) +.It Ar $%name +.It Ar ${%name} +Substitutes the number of characters in +.Va name +(+) +.Pp +.It Ar $%number +.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 XXXXXXXXX -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 +.Bl -tag -width XXX -offset indent -compact +.It Ar A +Last file access time, as the number of seconds since the epoch +.It Ar A: +Like +.Va Ar A +, but in timestamp format, e.g., +.Sq Fri May 14 16:36:10 1993 +.It Ar M +Last file modification time +.It Ar M: +Like +.Va M +, but in timestamp format +.It Ar C +Last inode modification time +.It Ar C: +Like +.Va C +, but in timestamp format +.It Ar D +Device number +.It Ar I +Inode number +.It Ar F +Composite +.Va f +ile identifier, in the form +.Va device : +.Va inode +.It Ar L +The name of the file pointed to by a symbolic link +.It Ar N +Number of (hard) links +.It Ar P +Permissions, in octal, without leading zero +.It Ar P: +Like +.Va P +, with leading zero +.It Ar P +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 +.It Ar P: +Like +.Ar BP +.Va mode +, with leading zero +.It Ar U +Numeric userid +.It Ar U: +Username, or the numeric userid if the username is unknown +.It Ar G +Numeric groupid +.It Ar G: +Groupname, or the numeric groupid if the groupname is unknown +.It Ar Z +Size, in bytes +.El +.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" +.Bl -tag -width XXXXXXX -offset indent +.It Ar %job +A synonym for the +.Va fg +builtin command. +.It Ar %job \&& +A synonym for the +.Va bg +builtin command. +.It Ar \&: +Does nothing, successfully. +.Pp +.It Ar @ +.It Ar @ name = expr +.It Ar @ name[index] = expr +.It Ar @ name++|-- +.It Ar @name[index]++|-- +The first form prints the values of all shell variables. +.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 ( +.Sq ++ ) +or decrement +.Sq ( -- ) +.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. +.It Ar alias[name[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. +.It Ar 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 +.It Ar bg[%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 +.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+) +.\" .It Ar 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: +.Pp +.Bl -tag -width XXX -compact +.It Fl l +Lists all editor commands and a short description of each. +.It Fl d +Binds all keys to the standard bindings for the default editor, +as per +.Va -e +and +.Va -v +below. +.It Fl e +Binds all keys to +.Va emacs +(1)\-style bindings. +Unsets +.Va vimode +.It Fl v +Binds all keys to +.Va vi +(1)\-style bindings. +Sets +.Va vimode +.It Fl a +Lists or changes key-bindings in the alternative key map. +This is the key map used in +.Va vimode +command mode. +.It 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 +). +.It 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 +.It 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. +.It Fl c +.Va command +is interpreted as a builtin or external command instead of an +editor command. +.It 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. +.It Fl \&- +Forces a break from option processing, so the next word is taken as +.Va key +even if it begins with '\&-'. +.It Fl u +(or any invalid option) +Prints a usage message. +.El +.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: +.Pp +.Bl -tag -width XXXX -compact -offset indent +.It \ea +Bell +.It \eb +Backspace +.It \ee +Escape +.It \ef +Form feed +.It \en +Newline +.It \er +Carriage return +.It \et +Horizontal tab +.It \ev +Vertical tab +.It \e\fInnn +The ASCII character corresponding to the octal number +.Va nnn +.El +.Pp +`\e' nullifies the special meaning of the following character, if it has +any, notably +.Sq \e +and +.Sq ^ +.It 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) +.It 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. +.It breaksw +Causes a break from a +.Va switch +, resuming after the +.Va endsw + +.It builtins \fR(+) +Prints the names of all builtin commands. + +.It bye \fR(+) +A synonym for the +.Va logout +builtin command. +Available only if the shell was so compiled; +see the +.Va version +shell variable. + +.It case \fIlabel\fB: +A label in a +.Va switch +statement as discussed below. + +.It 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 + +.It chdir +A synonym for the +.Va cd +builtin command. + +.It 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 +.It 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 +.It C +Like +.Va c +, but includes +.Va pattern +when completing the current word. +.TP 4 +.It 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 +.It N +Like +.Va n +, but must match the beginning of the word two before the current word. +.TP 4 +.It 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 +.Bl -tag +.It a +Aliases +.It b +Bindings (editor commands) +.It c +Commands (builtin or external commands) +.It C +External commands which begin with the supplied path prefix +.It d +Directories +.It D +Directories which begin with the supplied path prefix +.It e +Environment variables +.It f +Filenames +.It F +Filenames which begin with the supplied path prefix +.It g +Groupnames +.It j +Jobs +.It l +Limits +.It n +Nothing +.It s +Shell variables +.It S +Signals +.It t +Plain ( +.Dq text ) +files +.It T +Plain ( +.Dq text ) +files which begin with the supplied path prefix +.It v +Any variables +.It u +Usernames +.It x +Like +.Va n , +but prints +.Va select +when +.Va list-choices +is used. +.It X +Completions +$ +.Va var +Words from the variable +.Va var +(...) +Words from the given list +\`...\` +Words from the output of command +.El +.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 > ~/._pause; % +.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@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 / +.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 #! +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 + +.Va +.Va + +.Va + +.Va +If the +.Va +code is undefined, the sequence +.Va +\fB +.Va +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 https://bugs.astron.com/, preferably with fixes. +If you want to +help maintain and test tcsh, add yourself to the mailing list in +https://mailman.astron.com/. +.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.21.00 (Astron) 2019-05-08. +.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@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@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 Index: vendor/tcsh/6.21.00-83c5be0/tests/lexical.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/lexical.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/lexical.at (revision 353870) @@ -0,0 +1,628 @@ +# Lexical analysis and substitutions + +AT_SETUP([Word splitting]) + +AT_CHECK([tcsh -f -v -c '&|;<>()&||<<>>space tab end'], 1, , +[& | ; < > ( ) & || << >> space tab end +Invalid null command. +]) + +# Note that the tab becomes a space! +AT_DATA([oneword.csh], +[[set var=('&|;<>()&||<<>>space tab end') +echo $var[1] +]]) +AT_CHECK([tcsh -f oneword.csh], , +[&|;<>()&||<<>>space tab end +]) + +# Note that the tab becomes a space! +AT_DATA([oneword.csh], +[[set var=("&|;<>()&||<<>>space tab end") +echo $var[1] +]]) +AT_CHECK([tcsh -f oneword.csh], , +[&|;<>()&||<<>>space tab end +]) + +AT_CLEANUP + + +AT_SETUP([Comments]) + +AT_CHECK([if [ ! -t 0 ]; then exit 77; fi],, [Skipping comment tests]) + +AT_CHECK([echo 'echo OK@%:@comment' | tcsh -f], , [OK +]) + +AT_CHECK([tcsh -f -c 'echo @%:@no comment'], , +[@%:@no comment +]) + +AT_DATA([comment2.csh], +[[echo testing...@%:@\ +OK +]]) +AT_CHECK([tcsh -f comment2.csh], , +[testing... OK +]) + +AT_CLEANUP + + +AT_SETUP([Escaping special characters]) + +AT_DATA([nosplit.csh], +[[echo \&\|\;\<\>\(\)\&\|\|\<\<\>\>\space\ tab\ end +echo '&|;<>()&||<<>>space tab end' +echo "&|;<>()&||<<>>space tab end" +set verbose +echo `&|;<>()&||<<>>space tab end` +]]) +AT_CHECK([tcsh -f nosplit.csh], 1, +[&|;<>()&||<<>>space tab end +&|;<>()&||<<>>space tab end +&|;<>()&||<<>>space tab end + +], +[echo `&|;<>()&||<<>>space tab end` +Invalid null command. +]) + +# backslash handling tested with $backslash_quote + +AT_CHECK([tcsh -f -c 'echo "foo\"bar"'], 1, , [Unmatched '"'. +]) +dnl " Pacify emacs + +AT_CHECK([tcsh -f -c "echo 'foo\'bar'"], 1, , [Unmatched '''. +]) + +AT_CLEANUP + + +AT_SETUP([Preventing substitution]) + +AT_CHECK([tcsh -f -c 'echo \$OK'], , [$OK +]) + +AT_CHECK([tcsh -f -c 'echo \`OK\`'], , [`OK` +]) + +AT_DATA([noalias.csh], +[[alias true='echo error' +\true +tru\e +]]) +AT_CHECK([tcsh -f noalias.csh]) + +AT_CHECK([tcsh -f -c 'echo g\?\*b'], , [g?*b +]) + +AT_DATA([novar.csh], +[[echo '$OK' +]]) +AT_CHECK([tcsh -f novar.csh], , [$OK +]) + +AT_DATA([nocmd.csh], +[[echo '`OK`' +]]) +AT_CHECK([tcsh -f nocmd.csh], , [`OK` +]) + +AT_DATA([noalias.csh], +[[alias true='echo error' +'t'rue +tru'e' +]]) +AT_CHECK([tcsh -f noalias.csh]) + +AT_DATA([noglob.csh], +[[echo 'g?*b' +]]) +AT_CHECK([tcsh -f noglob.csh], , [g?*b +]) + +AT_CHECK([tcsh -f -c 'echo \!OK'], , [!OK +]) + +AT_CHECK([tcsh -f -c "echo !OK"], 1, , +[OK: Event not found. +]) + +AT_CHECK([tcsh -f -c 'echo "$OK"'], 1, , [OK: Undefined variable. +]) + +AT_CHECK([tcsh -f -c 'echo "`OK`"'], 1, [ +], +[OK: Command not found. +]) + +AT_DATA([noalias.csh], +[[alias true='echo error' +"t"rue +tru"e" +]]) +AT_CHECK([tcsh -f noalias.csh]) + +AT_CHECK([tcsh -f -c 'echo "g?*b"'], , [g?*b +]) + +AT_CLEANUP + + +AT_SETUP([History basics]) + +# Printing prompt only when at end of input is rather nondeterministic... +AT_DATA([basic.csh], +[[echo 1 +echo 2 +!1 +]]) +AT_CHECK([tcsh -f -q -i < basic.csh], , +[> 1 +2 +1 +> exit +], +[echo 1 +]) + +AT_DATA([histlit.csh], +[[echo foo +!! +history | cut -d ' ' -f 1,3- +set histlit +history | cut -d ' ' -f 1,3- +]]) +AT_CHECK([tcsh -f -q -i < histlit.csh], , +[> foo +foo + 1 echo foo + 2 echo foo + 3 history | cut -d ' ' -f 1,3- + 1 echo foo + 2 !! + 3 history | cut -d ' ' -f 1,3- + 4 set histlit + 5 history | cut -d ' ' -f 1,3- +> exit +], +[echo foo +]) + +AT_DATA([nohist.csh], +[echo ! space ! tab != "!(" newline ! +]) +AT_CHECK([tcsh -f nohist.csh], , +[[! space ! tab != !( newline ! +]]) + +AT_CLEANUP + + +AT_SETUP([Event specification]) + +AT_DATA([positive.csh], +[[echo 1 +echo 2 +!1 +]]) +AT_CHECK([tcsh -f -q -i < positive.csh], , +[> 1 +2 +1 +> exit +], +[echo 1 +]) + +AT_DATA([negative.csh], +[[echo 1 +echo 2 +!-2 +]]) +AT_CHECK([tcsh -f -q -i < negative.csh], , +[> 1 +2 +1 +> exit +], +[echo 1 +]) + +AT_CHECK([echo 'echo !@%:@:0' | tcsh -f -q -i], , +[> echo +> exit +], +[echo echo +]) + +AT_CHECK([echo 'echo !@%:@:1' | tcsh -f -q -i], 1, +[> > exit +], +[Bad ! arg selector. +]) + +AT_DATA([bang.csh], +[[echo 1 +echo 2 +!! +]]) +AT_CHECK([tcsh -f -q -i < bang.csh], , +[> 1 +2 +2 +> exit +], +[echo 2 +]) + +AT_DATA([startsearch.csh], +[[echo 1 +echo 2 +true +!e +]]) +AT_CHECK([tcsh -f -q -i < startsearch.csh], , +[> 1 +2 +2 +> exit +], +[echo 2 +]) + +AT_DATA([subsearch.csh], +[[echo 1 +echo 12 +true +!?2 +!?1? +]]) +AT_CHECK([tcsh -f -q -i < subsearch.csh], , +[> 1 +12 +12 +12 +> exit +], +[echo 12 +echo 12 +]) + +AT_DATA([braces.csh], +[[echo 1 +!{!} +!{1} +!{-1} +!{e} +!{?e?} +]]) +AT_CHECK([tcsh -f -q -i < braces.csh], , +[> 1 +1 +1 +1 +1 +1 +> exit +], +[echo 1 +echo 1 +echo 1 +echo 1 +echo 1 +]) + +AT_DATA([1x], +[[#! /bin/sh +echo string +]]) +AT_DATA([number.csh], +[[echo number +set path=(. $path) +1x +!1x +!{1x} +!{1}x +]]) +AT_CHECK([chmod a+x 1x && tcsh -f -q -i < number.csh], , +[> number +string +string +string +numberx +> exit +], +[1x +1x +echo numberx +]) + +AT_CLEANUP + + +AT_SETUP([Word selection]) + +AT_DATA([words.csh], +[[echo 1 2 3 4 5 +: +echo !1:0 +echo !1:2 +echo !1:^ +echo !1:$ +echo !?4?% +echo !1:2-4 +echo !1:* +set foo=(!2:*) +echo ${#foo} +echo !1:4* +echo !1:2- +echo !1* +]]) +AT_CHECK([tcsh -f -q -i < words.csh], , +[> 1 2 3 4 5 +echo +2 +1 +5 +4 +2 3 4 +1 2 3 4 5 +0 +4 5 +2 3 4 +1 2 3 4 5 +> exit +], +[echo echo +echo 2 +echo 1 +echo 5 +echo 4 +echo 2 3 4 +echo 1 2 3 4 5 +set foo= ( ) +echo 4 5 +echo 2 3 4 +echo 1 2 3 4 5 +]) + +AT_CLEANUP + + +AT_SETUP([History modifiers]) + +AT_DATA([modifiers.csh], +[[echo foo bar baz quux /usr/src/sys/sys/malloc.c +^baz^bash +^bar^kPa^:p +echo !1:$:h +echo !1:$:t +echo !1:$:r +echo !1:$:e +echo !1:1-:u +echo !!:1-:l +echo !1:1-:s,ba,ab +echo '!1:$:s/src\/sys/&\&more/' +echo !echo:0:s//OK/ +echo !?ux?:*:s//uux/ +echo !!:*:& +echo !1:*:gu:gr +echo !1:*:gas/o/O/ +echo !1:*:gas/o/\[oo\]/ +echo !1:1-:p:au +set var=(!1:1-:gs/a/ /) +echo ${#var} +set var=(!1:1-:gs/a/ /:q) +echo ${#var} +set var=(!1:1-:gs/a/ /:x) +echo ${#var} +]]) +AT_CHECK([tcsh -f -q -i < modifiers.csh], , +[[> foo bar baz quux /usr/src/sys/sys/malloc.c +foo bar bash quux /usr/src/sys/sys/malloc.c +/usr/src/sys/sys +malloc.c +/usr/src/sys/sys/malloc +c +Foo bar baz quux +foo bar baz +foo abr baz quux +/usr/src/sys&more/sys/malloc.c +OK +foo abr baz quuux +foo abr baz quuuux +Foo Bar Baz Quux /Usr/src/sys/sys/malloc +fOO bar baz quux /usr/src/sys/sys/mallOc.c +f[oo][oo] bar baz quux /usr/src/sys/sys/mall[oo]c.c +6 +4 +6 +> exit +]], +[[echo foo bar bash quux /usr/src/sys/sys/malloc.c +echo foo kPa bash quux /usr/src/sys/sys/malloc.c +echo /usr/src/sys/sys +echo malloc.c +echo /usr/src/sys/sys/malloc +echo c +echo Foo bar baz quux +echo foo bar baz +echo foo abr baz quux +echo '/usr/src/sys&more/sys/malloc.c' +echo OK +echo foo abr baz quuux +echo foo abr baz quuuux +echo Foo Bar Baz Quux /Usr/src/sys/sys/malloc +echo fOO bar baz quux /usr/src/sys/sys/mallOc.c +echo f\[oo\]\[oo\] bar baz quux /usr/src/sys/sys/mall\[oo\]c.c +echo FOO bar baz quux +set var= ( foo b r b z quux ) +set var= ( foo b r b z quux ) +set var= ( foo b r b z quux ) +]]) + +AT_CLEANUP + + +AT_SETUP([Alias substitution]) + +AT_DATA([alias.csh], +[[alias simple 'echo OK' +simple +simple ; simple +alias compile 'echo cc -o \!^ \!^.c' +compile hw +alias echo 'echo no' +echo bug +unalias echo +alias l1 'l2 a' +alias l2 'l1 b' +l1 +]]) +AT_CHECK([tcsh -f alias.csh], 1, +[OK +OK +OK +cc -o hw hw.c +no bug +], +[Alias loop. +]) + +AT_CLEANUP + + +AT_SETUP([Variable substitution]) + +AT_DATA([var.csh], +[[set v=foo +set a=(foo bar baz 1 2 3) +set echo_style=none +echo $v "$v" '$v' \$v "\$v" '\$v' $ space $ tab $ +touch zzzabc +set filename='zzz*' +echo $filename $filename:q "$filename" +set a2=($a:q) +echo ${#a2} +set a2=("$a") +echo ${#a2} +echo ${v}tail +echo $env_var:l +echo $a[2] ${a[-2]} $a[5-] $a[*] ${a[-0]} +#echo ${a[7-]} +#a: Subscript out of range. +echo $a[$a[5]] +echo $0 $1 $2 +echo $* +echo $?v $?a $?this_is_unknown +echo $?0 +echo $#v $#a $# +echo $%v +echo $? +# untested: $$, $!, $_ +echo $<:q +]]) +AT_CHECK([echo '`"{}$@'"'" | env_var=ENV_VAL tcsh -f var.csh arg1 arg2], , +[foo foo $v $v \foo \$v $ space $ tab $ +zzzabc zzz* zzz* +6 +1 +footail +eNV_VAL +bar foo bar 2 3 foo bar baz 1 2 3 +bar +var.csh arg1 arg2 +arg1 arg2 +1 1 0 +1 +1 6 2 +3 +0 +`"{}$@' +]) + +AT_CLEANUP + + +AT_SETUP([Quoting of expansions in `...`]) + +AT_DATA([batchsystem.properties], +[[# Path to job setting file +asyncjobinfo.uri=file:///usr/bns/stbns01/batch/app/properties/asyncjobinfo.xml +purebatchjobinfo.uri=file:///usr/bns/stbns01/batch/app/properties/purebatchjobinfo.xml + +# DB connection info +jdbc_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03))) +sub_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03))) +mss_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03))) +dbuser=stbns01bt +dbpasswd=stbns01bt + +# OnBatch listener +run=3 +]]) +AT_DATA([uniformity_test.csh], +[[ +set SERVICE_NAME_LOG = `cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g'` +echo -n "$SERVICE_NAME_LOG" > ./output1 + +cat batchsystem.properties | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\s//g' | perl -pe 's/\)/\\\)/g' | perl -pe 's/\(/\\\(/g' > ./output2 + +diff -ur ./output1 ./output2 >& /dev/null + +if ( $? != 0 ) then + echo -n 'FAIL: tcsh does not have uniform output when `...` is used!' + exit 1 +else + echo -n 'OK' + exit 0 +endif +]]) +AT_DATA([quoting_result_test.csh], +[[ +echo "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP\)(HOST=db\)(PORT=1521\)\)(CONNECT_DATA=(SERVER=DEDICATED\)(SERVICE_NAME=bns03\)\)\)" > ./expected_result + +set string = "jdbc_url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=bns03)))" +set SERVICE_NAME_LOG = `echo "$string" | grep '^jdbc_url' | sed -ne 's/^[^=]*=[^@]*@[[:blank:]]*\([^$]*\)$/\1/p' | perl -pe 's/\)/\\\)/g'` + +echo "$SERVICE_NAME_LOG" > ./actual_result + +diff -ur ./expected_result ./actual_result >& /dev/null + +if ( $? != 0 ) then + echo -n 'FAIL: tcsh has unexpected result when `...` is used!' + exit 1 +else + echo -n 'OK' + exit 0 +endif +]]) +AT_CHECK([tcsh -f uniformity_test.csh], 0,[OK]) +AT_CHECK([tcsh -f quoting_result_test.csh], 0, [OK]) + +AT_CLEANUP + +AT_SETUP([\echo for git_tcsh_completion]) + +AT_DATA([escape_echo.csh], +[[ +set myvar = `\echo "1 2 3"` +echo ${myvar} +echo ${myvar[1]} +echo ${myvar[2]} +echo ${myvar[3]} +exit 0 +]]) + +AT_CHECK([tcsh -f escape_echo.csh], 0, +[1 2 3 +1 +2 +3 +]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/subst.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/subst.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/subst.at (revision 353870) @@ -0,0 +1,96 @@ +# Optional substitutions + +AT_SETUP([Command substitution]) + +AT_DATA([backq.csh], +[[set a=(a`echo 1 2; echo 3 4`b) +echo $#a +set a=(a"`echo 1 2; echo 3 4`b") +echo $#a +unset csubstnonl +echo `echo 1; \\ +echo 2` +set csubstnonl +echo `echo 1; \\ + echo 2` +]]) +AT_CHECK([tcsh -f backq.csh], 1, +[4 +2 +1 2 +1 +], +[ : Command not found. +]) + +AT_CLEANUP + + +AT_SETUP([Filename substitution]) + +AT_DATA([files.csh], +[[mkdir d +cd d +touch foo baz bar .quux '*' +echo *a* *[ox] [f.]* .q* ./*[ox] ./[f.]* ./.q* \* +echo [a-g]* [^b]* ^b?r +echo { ba{z,r} } {} +echo nothing* fo* +set nonomatch +echo nothing* +set noglob +echo foo* ab{c,d} ^fo* +]]) +AT_CHECK([tcsh -f files.csh], , +[bar baz foo foo .quux ./foo ./foo ./.quux * +bar baz foo * foo * baz foo +{ baz bar } {} +foo +nothing* +foo* ab{c,d} ^fo* +]) + +AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo 'echo ~; echo "$HOME"' | tcsh -f | uniq | wc -l | tr -d ' \t'], +, [1 +]) + +AT_CHECK([export HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }'); echo "echo ~$(id -un)/foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl + | wc -l | tr -d ' \t'], , [1 +]) + +AT_CLEANUP + + +AT_SETUP([Directory stack substitution]) + +AT_DATA([dirstack.csh], +[[set home=$cwd +pushd / +pushd /dev +echo =0/:foo +echo =1/:foo +echo =- +set noglob +echo =1 +unset noglob +sh -c 'echo 1 >&2' +(echo =5) +sh -c 'echo 2 >&2' +set nonomatch +echo =5 +]]) +AT_CHECK([tcsh -f dirstack.csh | sed "s,$PWD,CWD,"], , +[/ ~ @&t@ +/dev / ~ @&t@ +/dev/:foo +//:foo +CWD +=1 +=5 +], +[1 +Directory stack not that deep. +2 +]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/syntax.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/syntax.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/syntax.at (revision 353870) @@ -0,0 +1,194 @@ +# Command syntax + +AT_SETUP([Command combinations]) + +# False on OpenSolaris returns 255 +echo 'exit 1' > myfalse +chmod +x myfalse + +AT_CHECK([tcsh -f -c 'echo ok|tr ok OK'], , +[OK +]) + +AT_CHECK([tcsh -f -c 'echo 1;echo 2'], , +[1 +2 +]) + +AT_CHECK([tcsh -f -c 'true || echo fail']) + +AT_CHECK([tcsh -f -c 'false || echo OK'], , +[OK +]) + +AT_CHECK([tcsh -f -c 'true && echo OK'], , +[OK +]) + +AT_CHECK([tcsh -f -c './myfalse && echo fail'], 1) + +AT_CHECK([[tcsh -f -c '(sleep 1; echo async) & echo sync; wait' \ +| sed 's/ [0123456789]*$/ /']], , +[[[1] @&t@ +sync +async +]], +[[[1] Done ( sleep 1; echo async )]] +) + +AT_CLEANUP + + +AT_SETUP([Command execution]) + +AT_CHECK([tcsh -f -c '((true | cd ..; pwd); cd ..; pwd)' | uniq | wc -l dnl + | tr -d ' \t'], , +[1 +]) + +AT_DATA([other_script.csh], +[[echo OK +]]) +chmod u+x other_script.csh +AT_CHECK([tcsh -f -c 'set path=(. $path); other_script.csh'], , +[OK +]) + +AT_DATA([input], +[[OK +]]) +AT_CHECK([tcsh -f -c 'cat < input'], , +[OK +]) + +AT_DATA([heredoc.csh], +[[set var=- +cat << EOF +\$\\\` +a`echo b`c +foo${var}bar +EOF +cat << E\OF +$var +E\OF +cat << "E"OF +$var +"E"OF +cat << EO'F' +$var +EO'F' +cat << `EOF` +$var +`EOF` +]]) +AT_CHECK([tcsh -f heredoc.csh], , +[[$\` +abc +foo-bar +$var +$var +$var +$var +]]) + +AT_CHECK([tcsh -f -c 'echo OK > output']) +AT_CHECK([cat output], , +[OK +]) + +touch output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK > output'], 1, [], +[output: File exists. +]) + +touch output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >! output']) +AT_CHECK([cat output], , +[OK +]) + +AT_CHECK([tcsh -f -c '(echo OK; $this_does_not_exist) >& output'], 1) +AT_CHECK([cat output], , +[OK +this_does_not_exist: Undefined variable. +]) + +touch output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >& output'], 1, [], +[output: File exists. +]) + +touch output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >&! output']) +AT_CHECK([cat output], , +[OK +]) + +echo > output +AT_CHECK([tcsh -f -c 'echo OK >> output']) +AT_CHECK([cat output], , +[ +OK +]) + +echo > output +AT_CHECK([tcsh -f -c '(echo OK; echo $this_does_not_exist) >>& output'], 1) +AT_CHECK([cat output], , +[ +OK +this_does_not_exist: Undefined variable. +]) + +rm -f output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >> output'], 1, [], +[output: No such file or directory. +]) + +rm -f output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >>! output']) +AT_CHECK([cat output], , +[OK +]) + +rm -f output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >>& output'], 1, [], +[output: No such file or directory. +]) + +rm -f output +AT_CHECK([tcsh -f -c 'set noclobber; echo OK >>&! output']) +AT_CHECK([cat output], , +[OK +]) + +AT_CHECK([tcsh -f -c '(echo $this_does_not_exist) |& cat'], 1, +[this_does_not_exist: Undefined variable. +]) + +dnl noclobber=notempty +echo Hello > output +AT_CHECK([tcsh -f -c 'set noclobber=notempty; echo OK >& output'], 1, [], +[output: File exists. +]) + +rm -f output +touch output +AT_CHECK([tcsh -f -c 'set noclobber=notempty; echo OK >& output']) +AT_CHECK([cat output], , +[OK +]) + +dnl noclobber=ask +dnl touch output +dnl AT_CHECK([tcsh -f -c 'set noclobber=ask; echo "n" | echo OK >& output'], 0, [], +dnl [output: File exists. +dnl ]) +dnl T_CHECK([tcsh -f -c 'set noclobber=ask; echo "y" | echo OK >& output']) + +dnl noclobber=(notempty ask) +dnl rm -f output +dnl touch output +dnl AT_CHECK([tcsh -f -c 'set noclobber=(notempty ask); echo OK >& output']) + + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/variables.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/variables.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/variables.at (revision 353870) @@ -0,0 +1,1100 @@ +# Special shell variables + +# The space after $ is to avoid expanding the variables in testsuite output, +# to work-around a bug in autotest + +# Not testing any functionality +m4_define([VAR_UNSET], +[AT_SETUP([$ $1]) +AT_CHECK([tcsh -f -c 'echo $?$1'], , +[0 +]) +AT_CLEANUP +]) +m4_define([ENV_SET], +[AT_SETUP([$ $1]) +AT_CHECK([tcsh -f -c 'printenv $1'], 0, [ignore]) +AT_CLEANUP +]) +m4_define([ENV_UNSET], +[AT_SETUP([$ $1]) +AT_CHECK([tcsh -f -c 'printenv $1'], 1, +[0 +]) +AT_CLEANUP +]) + + +AT_SETUP([$ addsuffix]) + +AT_CHECK([tcsh -f -c 'echo $?addsuffix'], , +[1 +]) +# Nothing more + +AT_CLEANUP + + +VAR_UNSET([afsuser]) +VAR_UNSET([ampm]) + + +AT_SETUP([$ anyerror]) + +echo 'exit 1' > myfalse +chmod +x myfalse + +AT_DATA([exit_status.csh], +[[echo $?anyerror $anyerror +./myfalse | true ; echo $? +unset anyerror ; echo $?anyerror +./myfalse | true ; echo $? +set anyerror +./myfalse | true ; echo $? +]]) + +AT_CHECK([tcsh -f exit_status.csh],, +[1 +1 +0 +0 +1 +]) + +AT_CLEANUP + + +AT_SETUP([$ argv]) + +AT_CHECK([tcsh -f -c 'echo $argv; echo $2' foo bar baz], , +[foo bar baz +bar +]) + +AT_CLEANUP + + +VAR_UNSET([autocorrect]) +VAR_UNSET([autoexpand]) +VAR_UNSET([autolist]) +TCSH_UNTESTED([$ autologout]) + + +AT_SETUP([$ backslash_quote]) + +AT_DATA([backslash.csh], +[[echo $?backslash_quote +set echo_style=none +echo 'foo\\bar' +echo "foo\\bar" +echo 'foo\bar' +echo "foo\bar" +set backslash_quote +echo 'foo\\bar' +echo "foo\\bar" +echo 'foo\'bar' +echo 'foo\"bar' +echo "foo\"bar" +echo "foo\'bar" +echo 'foo\bar' +echo "foo\bar" +]]) +AT_CHECK([tcsh -f backslash.csh], , +[0 +foo\\bar +foo\\bar +foo\bar +foo\bar +foo\bar +foo\bar +foo'bar +foo"bar +foo"bar +foo'bar +foo\bar +foo\bar +]) + +AT_CLEANUP + + +VAR_UNSET([catalog]) + + +AT_SETUP([$ cdpath]) + +AT_DATA([cdpath.csh], +[[echo $?cdpath +set cdpath=($cwd /) +set home=$cwd +mkdir tcsh_test_dir +cd dev +cd tcsh_test_dir +]]) +AT_CHECK([tcsh -f cdpath.csh], , +[0 +/dev @&t@ +~/tcsh_test_dir @&t@ +]) + +AT_CLEANUP + + +VAR_UNSET([color]) +VAR_UNSET([colorcat]) + + +AT_SETUP([$ command]) + +AT_CHECK([tcsh -f -c 'echo $command'], , +[echo $command +]) + +AT_DATA([command.csh], +[[echo $?command +]]) +AT_CHECK([tcsh -f command.csh], , +[0 +]) + +AT_CLEANUP + + +VAR_UNSET([complete]) +VAR_UNSET([continue]) +VAR_UNSET([continue_args]) +VAR_UNSET([correct]) + + +AT_SETUP([$ csubstnonl]) + +touch test_file + +AT_DATA([csubstnonl.csh], +[[echo $?csubstnonl +echo `echo fail \ +| sed 's/fail/OK/'` +sh -c 'echo 1 >&2' +(echo `echo fail | \\ +sed 's/fail/OK/'`) +sh -c 'echo 2 >&2' +echo `echo a\ +b` +unset csubstnonl +sh -c 'echo 3 >&2' +(echo `echo fail \ +| sed 's/fail/OK/'`) +sh -c 'echo 4 >&2' +echo `echo fail | \\ +sed 's/fail/OK/'` +echo `echo \\ +?est_file` +echo `cat << END\ +OK\ +END` +]]) +AT_CHECK([tcsh -f csubstnonl.csh], , +[1 +OK + +a b +fail +OK +test_file +OK +], +[1 + sed: Command not found. +2 +3 +Invalid null command. +4 +]) + +AT_CLEANUP + + +AT_SETUP([$ cwd]) + +AT_DATA([cwd.csh], +[[echo $?cwd +printenv PWD +cd / +echo $cwd +pushd /dev +echo $cwd +popd +echo $cwd +printenv PWD +setenv PWD foo +echo $cwd +set cwd=bar +printenv PWD +]]) +AT_CHECK([tcsh -f cwd.csh | sed "s,$PWD,CWD,"], , +[1 +CWD +/ +/dev / @&t@ +/dev +/ @&t@ +/ +/ +/ +foo +]) + +AT_CLEANUP + + +VAR_UNSET([dextract]) # Behavior tested with pushd +VAR_UNSET([dirsfile]) + + +AT_SETUP([$ dirstack]) + +AT_DATA([dirstack.csh], +[[echo $dirstack +set home=$cwd +pushd / +echo $dirstack +set dirstack=(/ /dev $home) +# The first popd does nothing, looks like a bug +popd +popd +echo $dirstack +]]) +AT_CHECK([tcsh -f dirstack.csh | sed "s,$PWD,CWD,g"], , +[CWD +/ ~ @&t@ +/ CWD +/ /dev ~ @&t@ +/dev ~ @&t@ +/dev CWD +]) + +AT_CLEANUP + + +TCSH_UNTESTED([$ dspmbyte]) +VAR_UNSET([dunique]) # Behavior tested with pushd + + +AT_SETUP([$ echo]) + +touch some_file; + +AT_CHECK([tcsh -f -c 'echo $?echo'], , +[0 +]) + +AT_CHECK([tcsh -f -x -c 'echo $?echo'], , +[1 +], +[echo 1 +]) + +AT_DATA([echo.csh], +[[ls some_* +set echo +ls some_* $echo +echo some_* $echo +]]) +AT_CHECK([tcsh -f echo.csh], , +[some_file +some_file +some_file +], +[ls some_file +echo some_* +]) + +AT_CLEANUP + + +AT_SETUP([$ echo_style]) + +AT_DATA([echo_style.csh], +[[echo $?echo_style +set echo_style=bsd +echo -n foo +echo 'b\tr' +set echo_style=sysv +echo -n foo +echo 'b\tr' +set echo_style=both +echo -n foo +echo 'b\tr' +set echo_style=none +echo -n foo +echo 'b\tr' +]]) +AT_CHECK([tcsh -f echo_style.csh], , +[1 +foob\tr +-n foo +b r +foob r +-n foo +b\tr +]) + +AT_CLEANUP + + +AT_SETUP([$ edit]) + +AT_CHECK([if [ ! -t 0 ]; then exit 77; fi],, [Skipping $edit tests]) + +AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], , +[1 +]) + +AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], , +[0 +]) + +AT_CLEANUP + + +AT_SETUP([$ ellipsis]) + +AT_DATA([ellipsis0.csh], +[[echo $?ellipsis +set home=$cwd +mkdir -p a/b +cd a/b +set prompt='%c01 ' +]]) +AT_CHECK([tcsh -f -i -q < ellipsis0.csh], , +[> 0 +~/<1>b exit +]) + +AT_DATA([ellipsis0.csh], +[[set ellipsis +set home=$cwd +mkdir -p a/b +cd a/b +set prompt='%c01 ' +]]) +AT_CHECK([tcsh -f -i -q < ellipsis0.csh], , +[> ~...b exit +]) + +AT_CLEANUP + + +VAR_UNSET([fignore]) +VAR_UNSET([filec]) + + +AT_SETUP([$ gid]) + +AT_CHECK([(tcsh -f -c 'echo $gid'; id -gr) | uniq | wc -l | tr -d ' \t'], , +[1 +]) + +AT_CLEANUP + + +AT_SETUP([$ group]) + +AT_DATA([group.csh], +[[echo $?group +set group=foo +printenv GROUP +setenv GROUP bar +echo $group +]]) +AT_CHECK([tcsh -f group.csh], , +[1 +foo +bar +]) + +AT_CLEANUP + + +AT_SETUP([$ histchars]) + +AT_DATA([histchars.csh], +[[echo $?histchars +set histchars='/+' +echo OK +/3 ++K+k +]]) +AT_CHECK([tcsh -f -q -i < histchars.csh], , +[> 0 +OK +OK +Ok +> exit +], +[echo OK +echo Ok +]) + +AT_CLEANUP + + +AT_SETUP([$ histdup]) + +AT_DATA([histdup.csh], +[[echo $?histdup +history -c +: 1 +: 2 +: 1 +history +set histdup=all +history -c +: 1 +: 2 +: 1 +history +set histdup=prev +history -c +: 1 +: 2 +: 1 +: 3 +: 3 +history +set histdup=erase +history -c +: 1 +: 2 +: 1 +history +]]) +AT_CHECK([[tcsh -f -q -i < histdup.csh] dnl + [| sed 's/ [^ ]* / TIME /']], , +[> 0 + 3 TIME : 1 + 4 TIME : 2 + 5 TIME : 1 + 6 TIME history + 9 TIME : 1 + 10 TIME : 2 + 11 TIME history + 14 TIME : 1 + 15 TIME : 2 + 16 TIME : 1 + 17 TIME : 3 + 18 TIME history + 22 TIME : 2 + 23 TIME : 1 + 24 TIME history +> exit +]) + +AT_CLEANUP + + +VAR_UNSET([histfile]) + + +AT_SETUP([$ histlit]) + +AT_DATA([histlit.csh], +[[echo $?histlit +echo OK +!! +history +history -S hist1 +set histlit +history +history -S hist2 +]]) +AT_CHECK([[tcsh -f -q -i < histlit.csh] dnl + [| sed 's/ [^ ]* / TIME /']], , +[> 0 +OK +OK + 1 TIME echo $?histlit + 2 TIME echo OK + 3 TIME echo OK + 4 TIME history + 1 TIME echo $?histlit + 2 TIME echo OK + 3 TIME !! + 4 TIME history + 5 TIME history -S hist1 + 6 TIME set histlit + 7 TIME history +> exit +], +[echo OK +]) +AT_CHECK([[sed 's/^#+[0123456789]*$/#+STAMP/' < hist1]], , +[#+STAMP +echo $?histlit +#+STAMP +echo OK +#+STAMP +echo OK +#+STAMP +history +#+STAMP +history -S hist1 +]) +AT_CHECK([[sed 's/^#+[0123456789]*$/#+STAMP/' < hist2]], , +[#+STAMP +echo $?histlit +#+STAMP +echo OK +#+STAMP +!! +#+STAMP +history +#+STAMP +history -S hist1 +#+STAMP +set histlit +#+STAMP +history +#+STAMP +history -S hist2 +]) + +AT_CLEANUP + + +AT_SETUP([$ history]) + +AT_DATA([history.csh], +[[echo $#history $history +set home=$cwd +set var=value +set history=(1 '%/,%~,%h,%\!,\!,%%,%j,%$var,%#,%R\n') +: OK +history +]]) +AT_CHECK([tcsh -f -i -q < history.csh | sed "s,$PWD,CWD,"], , +[> 1 100 +CWD,~, 6, 6, 6,%,0,value,>,history +> exit +]) + +AT_CLEANUP + + +AT_SETUP([$ home]) + +AT_DATA([home.csh], +[[echo $?home +(echo $home; echo ~) | uniq | wc -l | tr -d ' \t' +set home=/foo +printenv HOME +setenv HOME /bar +echo $home +]]) +AT_CHECK([export HOME=$(getent passwd $(id -nu) | awk -F: '{ print $(NF - 1) }'); tcsh -f home.csh], , +[1 +1 +/foo +/bar +]) + +AT_CHECK([(unset HOME; tcsh -f -c 'echo $?home; printenv HOME')], 1, +[0 +]) + +AT_CLEANUP + + +VAR_UNSET([ignoreeof]) + + +AT_SETUP([$ implicitcd]) + +AT_DATA([implicitcd.csh], +[[echo $?implicitcd +mkdir subdir +set home=$cwd +sh -c 'echo 1 >&2' +(subdir) +sh -c 'echo 2 >&2' +(~/subdir) +sh -c 'echo 3 >&2' +set implicitcd +subdir +/bin/pwd +.. +~/subdir +/bin/pwd +cd +set implicitcd=verbose +subdir +.. +~/subdir +]]) +(echo 1; echo 'subdir: Command not found.'; + echo 2; echo "$PWD/subdir: Permission denied."; echo 3) > experr +AT_CHECK([tcsh -f -i -q < implicitcd.csh | sed "s,`/bin/pwd`,CWD,"], , +[> 0 +CWD/subdir +CWD/subdir +cd subdir +cd .. +cd ~/subdir +> exit +], [experr]) + +AT_CLEANUP + + +VAR_UNSET([inputmode]) +VAR_UNSET([killdup]) + + +AT_SETUP([$ killring]) + +AT_CHECK([tcsh -f -c 'echo $killring'], , +[30 +]) +# Nothing more + +AT_CLEANUP + + +AT_SETUP([$ listflags]) + +# First word checked with ls-F +AT_DATA([listflags.csh], +[[echo $?listflags +set listflags=(-xA $cwd/args.sh) +ls-F -something . +]]) +AT_DATA([args.sh], +[[echo "$@" +]]) +chmod a+x args.sh +AT_CHECK([tcsh -f listflags.csh], , +[0 +-xFA -something . +]) + +AT_CLEANUP + + +VAR_UNSET([listjobs]) +VAR_UNSET([listlinks]) # Functionality tested with ls-F +VAR_UNSET([listmax]) +VAR_UNSET([listmaxrows]) +VAR_UNSET([loginsh]) # Can't test the other case +VAR_UNSET([logout]) + + +AT_SETUP([$ mail]) + +AT_DATA([mail.csh], +[[echo $?mail +mkdir maildir +touch spool +set mail=(0 spool maildir) +echo > maildir/1 +echo > maildir/2 +echo >> spool +echo >> spool +]]) +AT_CHECK([tcsh -f mail.csh], , +[0 +]) + +AT_CLEANUP + + +AT_SETUP([$ cdtohome]) +AT_CHECK([export HOME=$(getent passwd $(id -nu) | awk -F: '{ print $(NF - 1) }'); tcsh -f -c 'cd'], 0) +AT_CLEANUP +AT_SETUP([$ noimplicithome]) +AT_CHECK([tcsh -f -c 'unset cdtohome; cd'], 1, , [cd: Too few arguments. +]) +AT_CLEANUP + + +VAR_UNSET([matchbeep]) +VAR_UNSET([nobeep]) +VAR_UNSET([noclobber]) # Functionality tested with "Command execution" +VAR_UNSET([noding]) +# Functionality tested with "Filename substitution" and +# "Directory stack substitution" +VAR_UNSET([noglob]) +VAR_UNSET([nostat]) +VAR_UNSET([notify]) +TCSH_UNTESTED([$ oid]) + + +AT_SETUP([$ owd]) + +AT_DATA([owd.csh], +[[echo $owd +cd / +echo $owd +pushd /bin +echo $owd +popd +echo $owd +]]) +AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,"], , +[ +CWD +/bin / @&t@ +/ +/ @&t@ +/bin +]) + +AT_CLEANUP + + +AT_SETUP([$ path]) + +mkdir subdir +AT_DATA([script.sh], +[[echo home +]]) +AT_DATA([subdir/script.sh], +[[echo subdir +]]) +chmod a+x script.sh subdir/script.sh +AT_DATA([path.csh], +[[echo $?path +set path=(. subdir) +script.sh +set path=(subdir .) +script.sh +printenv PATH +setenv PATH :foo::bar: +echo $path +]]) +AT_CHECK([tcsh -f path.csh], , +[1 +home +subdir +subdir:. +. foo . bar . +]) + +AT_CLEANUP + + +AT_SETUP([$ printexitvalue]) + +echo 'exit 1' > myfalse +chmod +x myfalse + +AT_DATA([printexitvalue.csh], +[[echo $?printexitvalue +set printexitvalue +./myfalse +(exit 3 >/dev/null) +: +]]) +AT_CHECK([tcsh -f printexitvalue.csh], , +[0 +Exit 1 +Exit 3 +]) + +AT_CLEANUP + + +AT_SETUP([$ prompt]) + +AT_DATA([prompt.csh], +[[echo "$prompt" +set home=$cwd +mkdir -p a/b +cd a/b +set var=value +set prompt='%/,%~,%c,%.,%c2,%.2,%c01,%.01,%C,%h,%\!,\!,%%,%j,%$var,%#,%? ' +(exit 50) +]]) +AT_CHECK([tcsh -f -i -q < prompt.csh | sed "s,$PWD,CWD,"], , +[> %# @&t@ +CWD/a/b,~/a/b,b,b,~/a/b,~/a/b,~/<1>b,~/<1>b,b,8,8,8,%,0,value,>,50 exit +]) + +AT_CLEANUP + + +AT_SETUP([$ prompt2]) + +AT_CHECK([echo 'echo "$prompt2"' | tcsh -f], , +[%R? @&t@ +]) + +AT_CLEANUP + + +AT_SETUP([$ prompt3]) + +AT_CHECK([echo 'echo "$prompt3"' | tcsh -f], , +[CORRECT>%R (y|n|e|a)? @&t@ +]) + +AT_CLEANUP + +AT_SETUP([$ promptchars]) + +AT_DATA([promptchars.csh], +[[echo $?promptchars +set promptchars=_x +]]) +AT_CHECK([tcsh -f -i -q < promptchars.csh], , +[> 0 +_ exit +]) + +AT_CLEANUP + + +VAR_UNSET([pushdtohome]) # Functionality tested with pushd +VAR_UNSET([pushdsilent]) # Functionality tested with pushd +VAR_UNSET([recexact]) +VAR_UNSET([recognize_only_executablers]) +VAR_UNSET([rmstar]) + + +AT_SETUP([$ rprompt]) + +AT_DATA([rprompt.csh], +[[echo $?rprompt +set home=$cwd +mkdir -p a/b +cd a/b +set var=value +set rprompt='%/,%~,%c,%.,%c2,%.2,%c01,%.01,%C,%h,%\!,\!,%%,%j,%$var,%#,%?' +(exit 50) +]]) +AT_CHECK([tcsh -f -i -q < rprompt.csh | sed "s,$PWD,CWD,"], , +[> 0 +> CWD/a/b,~/a/b,b,b,~/a/b,~/a/b,~/<1>b,~/<1>b,b,8,8,8,%,0,value,>,50 exit +]) + +AT_CLEANUP + + +VAR_UNSET([savedirs]) +VAR_UNSET([savehist]) +VAR_UNSET([sched]) + + +AT_SETUP([$ shell]) + +AT_CHECK([tcsh -f -c 'echo $?shell'], , +[1 +]) + +AT_CHECK([SHELL=foo/tcsh tcsh -f -c 'echo $shell'], , +[foo/tcsh +]) + +AT_CLEANUP + + +AT_SETUP([$ shlvl]) + +AT_DATA([shlvl.csh], +[[echo $shlvl +set shlvl=8 +printenv SHLVL +setenv SHLVL 2 +echo $shlvl +tcsh -f -c 'echo $shlvl' +tcsh -f -c 'tcsh -f -c "printenv SHLVL"' +tcsh -f -c 'exec tcsh -f -c "printenv SHLVL"' +tcsh -f -c '(exec tcsh -f -c "printenv SHLVL")' +]]) +AT_CHECK([SHLVL=5 tcsh -f shlvl.csh], , +[6 +8 +2 +3 +4 +3 +4 +]) + +AT_CLEANUP + + +AT_SETUP([$ status]) + +AT_DATA([status.csh], +[[echo $status +sh -c 'kill -ABRT $$' +if ( $status > 128 ) echo OK +true +echo $status +]]) +AT_CHECK([tcsh -f status.csh 2>&1 | sed 's/Abort (core dumped)/Abort/'], , +[0 +Abort +OK +0 +]) + +AT_CLEANUP + + +AT_SETUP([$ symlinks]) + +AT_DATA([symlinks.csh], +[[echo $?symlinks +set home=$cwd +mkdir -p a/b +ln -s a/b link +set symlinks=chase +cd link +echo $cwd +cd +set symlinks=ignore +cd link +echo $cwd +cd .. +echo $cwd +set symlinks=expand +cd a +(echo ../a; echo $cwd) | uniq | wc -l | tr -d ' \t' +]]) +AT_CHECK([tcsh -f symlinks.csh | sed "s,`tcsh -f -c echo\\ \\$PWD`,CWD,"], , +[0 +CWD/a/b +CWD/link +CWD +1 +]) + +AT_CLEANUP + + +AT_SETUP([$ tcsh]) + +AT_CHECK([tcsh -f -c 'echo $?tcsh'], , +[1 +]) + +AT_CLEANUP + + +AT_SETUP([$ term]) + +AT_DATA([term.csh], +[[echo $term +set term=foo +printenv TERM +setenv TERM bar +echo $term +]]) +AT_CHECK([TERM=something tcsh -f term.csh], , +[something +foo +bar +]) + +AT_CHECK([(unset TERM; tcsh -f -c 'echo $?term; printenv TERM')], 1, +[0 +]) + +AT_CLEANUP + + +VAR_UNSET([time]) +VAR_UNSET([tperiod]) + + +AT_SETUP([$ tty]) + +AT_CHECK([tcsh -f -c 'echo ">$tty<"' < /dev/null], , +[>< +]) + +AT_CLEANUP + + +AT_SETUP([$ uid]) + +AT_CHECK([(tcsh -f -c 'echo $uid'; id -ru) | uniq | wc -l | tr -d ' \t'], , +[1 +]) + +AT_CLEANUP + + +AT_SETUP([$ user]) + +AT_DATA([user.csh], +[[echo $?user +set user=foo +printenv USER +setenv USER bar +echo $user +]]) +AT_CHECK([tcsh -f user.csh], , +[1 +foo +bar +]) + +AT_CHECK([(unset USER; LOGNAME=foo tcsh -f -c 'echo $user; printenv USER')], , +[foo +foo +]) + +AT_CHECK([(unset LOGNAME; USER=foo tcsh -f -c 'echo $user; printenv LOGNAME')], + , +[foo +foo +]) + +AT_CLEANUP + + +AT_SETUP([$ verbose]) + +AT_CHECK([tcsh -f -v -c 'echo $verbose'], , [ +], +[echo $verbose +]) + +AT_DATA([verbose.csh], +[[echo $?verbose +set verbose +echo $verbose +!! +]]) +AT_CHECK([tcsh -f -i -q < verbose.csh], , +[> 0 + + +> exit +], +[echo $verbose +echo $verbose +]) + +AT_CLEANUP + + +AT_SETUP([$ version]) + +AT_CHECK([tcsh -f -c 'echo $?version'], , +[1 +]) + +AT_CLEANUP + + +VAR_UNSET([visiblebell]) +VAR_UNSET([watch]) +VAR_UNSET([who]) +VAR_UNSET([wordchars]) + + +# Nothing to test for environment variables, except for the synchronization +# above Index: vendor/tcsh/6.21.00-83c5be0/tests/commands.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/commands.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/commands.at (revision 353870) @@ -0,0 +1,1509 @@ +# Individual built-in commands + +TCSH_UNTESTED([%]) + + +AT_SETUP([:]) + +AT_CHECK([tcsh -f -c ': foo']) + +AT_CLEANUP + + +AT_SETUP([@]) + +# Not testing much... +AT_CHECK([tcsh -f -c 'set' > out1 && tcsh -f -c '@' > out2]) +AT_CHECK([diff out1 out2 | tail -n +2], , +[< command set +--- +> command @ +]) + +AT_CHECK([tcsh -f -c '@ var=2 * 3; echo $var'], , +[6 +]) + +AT_CHECK([[tcsh -f -c 'set var=(1 2); @ var[2] = 5; echo $var']], , +[1 5 +]) + +AT_CHECK([tcsh -f -c 'set var=1; @ var++; echo $var; @ var--; echo $var'], , +[2 +1 +]) + +AT_CHECK([[tcsh -f -c \ +'set var=(0 1); @ var[2]++; echo $var; @ var[2]--; echo $var']], , +[0 2 +0 1 +]) + +AT_CLEANUP + + +AT_SETUP([alias]) + +AT_CHECK([tcsh -f -c 'alias']) + +AT_CHECK([tcsh -f -c 'alias foo echo bar; alias; alias foo'], , +[foo (echo bar) +echo bar +]) + +AT_CHECK([tcsh -f -c 'alias foo "echo bar"; alias; alias foo'], , +[foo echo bar +echo bar +]) + +AT_CHECK([tcsh -f -c 'alias alias alias'], 1, [], +[alias: Too dangerous to alias that. +]) + +AT_CHECK([tcsh -f -c 'alias unalias unalias'], 1, [], +[unalias: Too dangerous to alias that. +]) + +# Alias expansion happens only on the next input line +AT_DATA([alias.csh], +[[alias foo echo bar; foo +foo +]]) +AT_CHECK([tcsh -f alias.csh 2>&1], , +[foo: Command not found. +bar +]) + +AT_CLEANUP + + +TCSH_UNTESTED([alloc]) +TCSH_UNTESTED([bg]) +TCSH_UNTESTED([bindkey]) +#TCSH_UNTESTED([bs2cmd]) + + +AT_SETUP([break]) + +# Evaluating the rest of the line is incredibly ugly +AT_DATA([break.csh], +[[while (1) + echo foo + break + echo bar +end +while (1) + echo Foo + break; echo Bar + echo Baz +end +foreach name (foo bar baz) + echo $name + while (1) + break; break + end +end +]]) +AT_CHECK([tcsh -f break.csh], , +[foo +Foo +Bar +foo +]) + +# Ugly tends to imply buggy +AT_DATA([break2.csh], +[[while (1) + break; cat << EOF +Line 1 +EOF + end + cat << EOF +Line 2 +EOF +]]) +AT_CHECK([tcsh -f break2.csh], , +[ cat << EOF +Line 2 +]) + +AT_CLEANUP + + +TCSH_UNTESTED([builtins]) +TCSH_UNTESTED([bye]) + + +AT_SETUP([cd]) + +AT_DATA([cd.csh], +[[set current=`/bin/pwd` +set home=$current +mkdir -p a +echo --- +cd a +/bin/pwd | sed "s,$current,," +echo --- +cd +/bin/pwd | sed "s,$current,," +echo --- +cd "$current/a" +/bin/pwd | sed "s,$current,," +echo --- +cd - +/bin/pwd | sed "s,$current,," +echo --- +cd a +set cdpath=($current) +echo --- +cd a +/bin/pwd | sed "s,$current,," +echo --- +cd current +/bin/pwd | sed "s,$current,," +echo --- +cd -p | sed "s,$current,," +echo --- +cd -l | sed "s,$current,," +(cd -z) +(cd - foo) +: +]]) +sed 's/^cd /chdir /; s/^(cd /(chdir /' < cd.csh > chdir.csh +AT_DATA([expout], +[[--- +/a +--- + +--- +/a +--- + +--- +--- +~/a @&t@ +/a +--- +~ @&t@ + +--- +~ @&t@ +--- + @&t@ +]]) +AT_CHECK([tcsh -f cd.csh], , [expout], +[[Usage: cd [-plvn][-|]. +Usage: cd [-plvn][-|]. +]]) +AT_CHECK([tcsh -f chdir.csh], , [expout], +[[Usage: chdir [-plvn][-|]. +Usage: chdir [-plvn][-|]. +]]) + +AT_CLEANUP + + +AT_SETUP([complete]) + +# We check only that the strings are preserved +AT_DATA([complete.csh], +[[complete +complete foo 'n/A/t:*/_' 'n/[^A]/t:*/_' +complete +complete foo +]]) +AT_CHECK([tcsh -f complete.csh], , +[[foo 'n/A/t:*/_' 'n/[^A]/t:*/_' +'n/A/t:*/_' 'n/[^A]/t:*/_' +]]) + +AT_CLEANUP + + +AT_SETUP([continue]) + +# See comments in tests of 'break' +AT_DATA([continue.csh], +[[foreach var (1) + echo foo + break + echo bar +end +foreach var (1) + echo Foo + break; echo Bar + echo Baz +end +foreach name (foo bar baz) + echo $name + while (1) + continue; break + end +end +]]) +AT_CHECK([tcsh -f continue.csh], , +[foo +Foo +Bar +foo +]) + +AT_DATA([continue2.csh], +[[foreach var (1) + continue; cat << EOF +Line 1 +EOF + end + cat << EOF +Line 2 +EOF +]]) +AT_CHECK([tcsh -f continue2.csh], , +[ cat << EOF +Line 2 +]) + +AT_CLEANUP + + +AT_SETUP([dirs]) + +AT_DATA([dirs.csh], +[[set current=`/bin/pwd` +set home=$current +mkdir a +echo --- +dirs +echo --- +pushd a +dirs +echo --- +dirs -p +echo --- +dirs -l | sed "s,$current,CWD,g" +echo --- +dirs -v +echo --- +dirs -lv | sed "s,$current,CWD,g" +dirs -S $current/saved +echo --- +pushd / +dirs | sed "s,$current,CWD,g" +echo --- +dirs -L $current/saved +dirs | sed "s,$current,CWD,g" +echo --- +dirs -c +dirs | sed "s,$current,CWD,g" +(dirs -z) +(dirs - foo) +: +]]) +AT_CHECK([tcsh -f dirs.csh], , +[--- +~ @&t@ +--- +~/a ~ @&t@ +~/a ~ @&t@ +--- +~/a ~ @&t@ +--- +CWD/a CWD @&t@ +--- +0 ~/a +1 ~ +--- +0 CWD/a +1 CWD +--- +/ ~/a ~ @&t@ +/ ~/a ~ @&t@ +--- +~/a ~ ~/a ~ @&t@ +--- +~/a @&t@ +], +[[Usage: dirs [-plvnSLc]. +Usage: dirs [-plvnSLc]. +]]) +AT_CHECK([echo x"`/bin/pwd`"x > /tmp/x && sed "s,`/bin/pwd`,CWD,g" < saved], , +[cd CWD +pushd CWD/a +]) + +AT_CLEANUP + + + +AT_SETUP([echo]) + +# Other functionality tested with $echo_style +AT_CHECK([tcsh -f -c 'echo OK'], , +[OK +]) + +AT_CLEANUP + + +TCSH_UNTESTED([echotc]) + + +AT_SETUP([eval]) + +AT_CHECK([tcsh -f -c 'set cmd="echo OK"; eval $cmd'], , +[OK +]) + +AT_CLEANUP + + +AT_SETUP([exec]) + +AT_CHECK([tcsh -f -c 'exec echo OK'], , +[OK +]) + +AT_CLEANUP + + +AT_SETUP([exit]) + +AT_CHECK([tcsh -f -c 'exit (50 * 4)'], 200) + +AT_CHECK([tcsh -f -c '(exit 50); exit'], 0) + +AT_CLEANUP + + +TCSH_UNTESTED([fg]) + + +AT_SETUP([filetest]) + +touch file1 file2 +chmod 6777 file1 +chmod 000 file2 + +AT_CHECK([tcsh -f -c 'filetest -r file1 file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -w file1 file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -x file1 file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -X ls unknown_command'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -e file1 nonexistent'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -o file1'], , +[1 +]) + +echo > nonempty +AT_CHECK([tcsh -f -c 'filetest -z file1 nonempty'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -s file1 nonempty'], , +[0 1 +]) + +mkdir dir +chmod +t dir +ln -s file2 link +mkfifo pipe + +AT_CHECK([tcsh -f -c 'filetest -f file1 dir'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -d dir file1'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -l link file1'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -p pipe file1'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -u file1 file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -g file1 file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -k dir file2'], , +[1 0 +]) + +AT_CHECK([tcsh -f -c 'filetest -t 0' < /dev/null], , +[0 +]) + +AT_CHECK([tcsh -f -c 'filetest -f link'], , +[1 +]) +AT_CHECK([tcsh -f -c 'filetest -Lf link'], , +[0 +]) + +AT_CHECK([tcsh -f -c 'filetest -rwx file1'], , +[1 +]) + +# -A, -A:, -M, -M:, -C, -C:, -D, -I, -F, -U, -U:, -G, -G: not tested + +AT_CHECK([tcsh -f -c 'filetest -L link'], , +[file2 +]) + +ln file2 file2link +AT_CHECK([tcsh -f -c 'filetest -N file1 file2'], , +[1 2] +) + +# S_ISVTX is masked out +AT_CHECK([tcsh -f -c 'filetest -P file1'], , +[6777 +]) +AT_CHECK([tcsh -f -c 'filetest -P: file1'], , +[06777 +]) +AT_CHECK([tcsh -f -c 'filetest -P111 file1'], , +[111 +]) +AT_CHECK([tcsh -f -c 'filetest -P111: file1'], , +[0111 +]) + +AT_CHECK([tcsh -f -c 'filetest -Z file1 nonempty'], , +[0 1 +]) + +AT_CHECK([tcsh -f -c 'filetest -N unknown'], , +[-1 +]) + +AT_CLEANUP + + +AT_SETUP([foreach]) + +AT_DATA([foreach.csh], +[[foreach var (a b c) + echo $var +end +]]) +AT_CHECK([tcsh -f foreach.csh], , +[a +b +c +]) + +AT_CLEANUP + + +TCSH_UNTESTED([getspath]) +TCSH_UNTESTED([getxvers]) + + +AT_SETUP([glob]) + +AT_CHECK([[tcsh -f -c 'glob a b c' | od -c] dnl + [| sed 's/[ ][ ]*/ /g; s/ $//']], , +[[0000000 a \0 b \0 c +0000005 +]]) + +AT_CLEANUP + + +AT_SETUP([goto]) + +AT_DATA([goto.csh], +[[goto first +echo fail + first: +again: +echo Here +if $?again == 0 then + echo First + set again=1 + goto again +endif +echo OK +]]) +AT_CHECK([tcsh -f goto.csh], , +[Here +First +Here +OK +]) + +AT_CLEANUP + + +TCSH_UNTESTED([hashstat]) + + +AT_SETUP([history]) + +AT_DATA([history.csh], +[[: cmd 1 +: cmd 2 +echo --- +history +echo --- +history 2 +echo --- +history -h 2 +echo --- +history -T 2 +echo --- +history -r 2 +history -S hist1 +set savehist=(1) +history -S hist2 +history -S hist3 +set savehist=(5 merge) +history -S hist3 +history -M hist2 +echo --- +history +history -L hist2 +echo --- +history 4 +history -c +echo --- +history +]]) +AT_CHECK([[tcsh -f -q -i < history.csh] dnl + [| sed 's/ [^ ]* / TIME /']], , +[> --- + 1 TIME : cmd 1 + 2 TIME : cmd 2 + 3 TIME echo --- + 4 TIME history +--- + 5 TIME echo --- + 6 TIME history 2 +--- +echo --- +history -h 2 +--- + 9 TIME echo --- + 10 TIME history -T 2 +--- + 12 TIME history -r 2 + 11 TIME echo --- +--- + 1 TIME : cmd 1 + 2 TIME : cmd 2 + 3 TIME echo --- + 4 TIME history + 5 TIME echo --- + 6 TIME history 2 + 7 TIME echo --- + 8 TIME history -h 2 + 9 TIME echo --- + 10 TIME history -T 2 + 11 TIME echo --- + 12 TIME history -r 2 + 13 TIME history -S hist1 + 14 TIME set savehist= ( 1 ) + 15 TIME history -S hist2 + 16 TIME history -S hist3 + 17 TIME set savehist= ( 5 merge ) + 18 TIME history -S hist3 + 19 TIME history -M hist2 + 20 TIME echo --- + 21 TIME history +--- + 22 TIME history -L hist2 + 23 TIME history -S hist2 + 24 TIME echo --- + 25 TIME history 4 +--- + 27 TIME echo --- + 28 TIME history +> exit +]) +AT_CHECK([[sed 's/^#+[0123456789]*$/#+STAMP/' < hist1]], , +[#+STAMP +: cmd 1 +#+STAMP +: cmd 2 +#+STAMP +echo --- +#+STAMP +history +#+STAMP +echo --- +#+STAMP +history 2 +#+STAMP +echo --- +#+STAMP +history -h 2 +#+STAMP +echo --- +#+STAMP +history -T 2 +#+STAMP +echo --- +#+STAMP +history -r 2 +#+STAMP +history -S hist1 +]) +AT_CHECK([[sed 's/^#+[0123456789]*$/#+STAMP/' < hist2]], , +[#+STAMP +history -S hist2 +]) +AT_CHECK([[sed 's/^#+[0123456789]*$/#+STAMP/' < hist3]], , +[#+STAMP +set savehist= ( 1 ) +#+STAMP +history -S hist2 +#+STAMP +history -S hist3 +#+STAMP +set savehist= ( 5 merge ) +#+STAMP +history -S hist3 +]) + +AT_CLEANUP + + +AT_SETUP([hup]) + +AT_DATA([hup.csh], +[[kill -s HUP $$ +echo OK +hup +kill -s HUP $$ +echo fail +]]) +# onintr - is necessary to keep setintr == 0; should dohup () be checking +# something else? +AT_CHECK([tcsh -f -c 'onintr -; nohup tcsh -f hup.csh' < /dev/null], ignore, +[[OK +]], +[[Hangup]] +) + +# The prefix form requires job control and is not tested + +AT_CLEANUP + + +AT_SETUP([if]) + +AT_DATA([if.csh], +[[if (0) echo fail +if (1) echo OK +if (0) then + echo fail +else if (0) then + echo fail +else + echo OK +endif +if (0) then + echo fail +else if (1) then + echo OK +else + echo fail +endif +if (0) then + echo fail +else if (0) then + echo fail +else if (1) then + echo OK +else + echo fail +endif +if (0) then + echo fail +else if (0) then + echo fail + else + echo OK +endif +if (1) then + echo OK +else if (0) then + echo fail +else + echo fail +endif +# skipping over an empty line +if (0) then + +endif +]]) +AT_CHECK([tcsh -f if.csh], , +[OK +OK +OK +OK +OK +OK +]) + +AT_CLEANUP + + +TCSH_UNTESTED([inlib]) +TCSH_UNTESTED([jobs]) + + +AT_SETUP([kill]) + +# Nested to ensure consistent output +AT_DATA([kill.csh], +[[kill $$ +kill -USR1 $$ +]]) +AT_CHECK([tcsh -f -c 'tcsh -f -i -q < kill.csh'], ignore, +[[> ]], +[[User signal 1]] +) + +# kill %job, kill -l untested untested + +AT_CLEANUP + + +TCSH_UNTESTED([limit]) + + +AT_SETUP([log]) + +AT_DATA([log.csh], +[[set watch=(this_user_does_not_exist) +log +]]) +AT_CHECK([tcsh -f log.csh]) + +AT_CLEANUP + + +TCSH_UNTESTED([login]) + + +AT_SETUP([logout]) + +AT_CHECK([tcsh -f -c 'logout'], 1, [], +[Not a login shell. +]) + +AT_CLEANUP + + +AT_SETUP([ls-F]) + +mkdir dir +touch file exec .hidden +chmod a+x exec +mkfifo pipe +ln -s file lfile +ln -s dir ldir +ln -s nowhere lnowhere +unset LS_COLORS + +AT_CHECK([tcsh -f -c 'ls-F' | grep -vF testsuite.log], , +[dir/ +exec* +file @&t@ +ldir@ +lfile@ +lnowhere@ +pipe| +]) + +AT_CHECK([tcsh -f -c 'set listlinks; ls-F' | grep -vF testsuite.log], , +[dir/ +exec* +file @&t@ +ldir> +lfile@ +lnowhere& +pipe| +]) + +AT_CHECK([tcsh -f -c 'set listflags=x; ls-F' | grep -vF testsuite.log], , +[dir/ +exec* +file @&t@ +ldir@ +lfile@ +lnowhere@ +pipe| +]) + +AT_CHECK([tcsh -f -c 'set listflags=A; ls-F' | grep -vF testsuite.log], , +[.hidden @&t@ +dir/ +exec* +file @&t@ +ldir@ +lfile@ +lnowhere@ +pipe| +]) + +AT_CHECK([tcsh -f -c 'set listflags=xa; ls-F' | grep -vF testsuite.log], , +[../ +./ +.hidden @&t@ +dir/ +exec* +file @&t@ +ldir@ +lfile@ +lnowhere@ +pipe| +]) + +AT_CLEANUP + + +TCSH_UNTESTED([migrate]) +TCSH_UNTESTED([newgrp]) + + +AT_SETUP([nice]) + +# Nothing really tested +AT_CHECK([tcsh -f -c 'nice set var=1; echo $?var'], , +[0 +]) + + +AT_CLEANUP + + +AT_SETUP([nohup]) + +AT_DATA([nohup.csh], +[[ +hup +nohup +kill -s HUP $$ +echo OK +]]) +# See commends in [hup] +AT_CHECK([tcsh -f -c 'onintr -; nohup tcsh -f nohup.csh' < /dev/null], , +[OK +]) + +AT_CLEANUP + + +TCSH_UNTESTED([notify]) + + +AT_SETUP([onintr]) + +AT_DATA([onintr.csh], +[[onintr label +kill -INT $$ +echo fail +label: +echo caught +onintr - +kill -INT $$ +echo OK +onintr - +kill -INT $$ +]]) +AT_CHECK([tcsh -f onintr.csh], , +[caught +OK +]) + +AT_CLEANUP + + +AT_SETUP([popd]) + +AT_DATA([popd.csh], +[[set current=`/bin/pwd` +set home=$current +pushd / +popd +pushd / +pushd $home +popd +2 +echo --- +dirs -c +pushd /; popd -l +pushd /; popd -v +pushd /; popd -lv +set pushdsilent +pushd /; popd +pushd /; echo ---; popd -p +(popd -z) +(popd - foo) +: +]]) +AT_CHECK([tcsh -f popd.csh | sed "s,`/bin/pwd`,CWD,"], , +[/ ~ @&t@ +~ @&t@ +/ ~ @&t@ +~ / ~ @&t@ +~ / @&t@ +--- +/ ~ @&t@ +CWD @&t@ +/ ~ @&t@ +0 ~ +/ ~ @&t@ +0 CWD +--- +~ @&t@ +], +[[Usage: popd [-plvn] [-|+]. +Usage: popd [-plvn] [-|+]. +]]) + +AT_CLEANUP + + +AT_SETUP([printenv]) + +AT_CHECK([env_var=value tcsh -f -c 'printenv env_var'], , +[value +]) + +AT_CHECK([env_var=value tcsh -f -c 'printenv' | grep env_var], , +[env_var=value +]) + +AT_CLEANUP + + +AT_SETUP([pushd]) + +AT_DATA([pushd.csh], +[[set home=`/bin/pwd` +mkdir a +pushd / +pushd /dev +pushd +set pushdtohome +pushd +pushd - +dirs -c +echo --- +pushd +pushd a +pushd /dev +pushd +2 +set dunique +pushd /dev +unset dunique +set dextract +pushd +2 +dirs -c +echo --- +pushd -l +pushd -v +pushd -lv +set pushdsilent +pushd +echo --- +pushd -p +(pushd -z) +(pushd - foo) +: +]]) +AT_CHECK([tcsh -f pushd.csh | sed "s,`/bin/pwd`,CWD,g"], , +[/ ~ @&t@ +/dev / ~ @&t@ +/ /dev ~ @&t@ +~ / /dev ~ @&t@ +/ ~ / /dev ~ @&t@ +--- +~ / @&t@ +~/a ~ / @&t@ +/dev ~/a ~ / @&t@ +~ / /dev ~/a @&t@ +/dev ~ / ~/a @&t@ +/ /dev ~ ~/a @&t@ +--- +CWD / @&t@ +0 ~ +1 ~ +2 / +0 CWD +1 CWD +2 CWD +3 / +--- +~ ~ ~ ~ ~ / @&t@ +], +[[Usage: pushd [-plvn] [-||+]. +Usage: pushd [-plvn] [-||+]. +]]) + +AT_CLEANUP + + +AT_SETUP([rehash]) + +AT_CHECK([tcsh -f -c 'rehash']) + +AT_CLEANUP + + +AT_SETUP([repeat]) + +AT_CHECK([tcsh -f -c 'repeat 3 echo OK'], , +[OK +OK +OK +]) + +AT_CHECK([tcsh -f -c 'repeat 0 echo > file' && test -f file -a ! -s file]) + +AT_CLEANUP + + +TCSH_UNTESTED([rootnode]) +TCSH_UNTESTED([sched]) # We don't want to wait for minutes, so ... + + +AT_SETUP([set]) + +touch file1 file2 + +AT_DATA([set.csh], +[[set my_var1=val1 +set my_var2=(val2a val2b) +set | grep my_var +set my_var3 +echo $?my_var3 ">$my_var3<" +set -r my_var4=(file* `echo foo bar`) +echo $#my_var4 $my_var4 +(set my_var4=other) +set -r +set -f my_var5=(a b c 1 b 2) +echo $my_var5 +set -l my_var5=(a b c 1 b 2) +echo $my_var5 +set my_var2[2]=val2x +echo $my_var2 +set var6=val6 var7 var8 = val8 +echo ">$var6<" ">$var7<" ">$var8<" +]]) +AT_CHECK([tcsh -f set.csh], , +[my_var1 val1 +my_var2 (val2a val2b) +1 >< +4 file1 file2 foo bar +my_var4 (file1 file2 foo bar) +a b c 1 2 +a c 1 b 2 +val2a val2x +>val6< >< >val8< +], +[set: $my_var4 is read-only. +]) + +AT_CLEANUP + + +AT_SETUP([setenv]) + +AT_CHECK([env_var=value tcsh -f -c 'setenv' | grep env_var], , +[env_var=value +]) + +AT_DATA([output.sh], +[[echo $env_var +]]) +chmod a+x output.sh +AT_CHECK([tcsh -f -c 'setenv env_var; ./output.sh'], , +[ +]) + +AT_CHECK([tcsh -f -c 'setenv env_var value; ./output.sh'], , +[value +]) + +AT_CLEANUP + + +TCSH_UNTESTED([setpath]) +TCSH_UNTESTED([setspath]) +TCSH_UNTESTED([settc]) +TCSH_UNTESTED([setty]) +TCSH_UNTESTED([setxvers]) + + +AT_SETUP([shift]) + +AT_DATA([shift.csh], +[[set var=(1 2) +echo $var +shift var +echo $var +shift var +echo $var +sh -c 'echo 1 >&2' +(shift var) +sh -c 'echo 2 >&2' +echo $argv +shift +echo $argv +shift +echo $argv +sh -c 'echo 3 >&2' +(shift) +sh -c 'echo 4 >&2' +]]) +AT_CHECK([tcsh -f shift.csh A B], , +[1 2 +2 + +A B +B + +], +[1 +shift: No more words. +2 +3 +shift: No more words. +4] +) + +AT_CLEANUP + + +AT_SETUP([source]) + +AT_DATA([script.csh], +[[set var=$1 +]]) +AT_CHECK([[tcsh -i -f -c 'source -h script.csh foo; history' \ + | sed 's/ [^ ]* / TIME /']], , +[ 1 TIME source -h script.csh foo ; history + 2 TIME set var=$1 +]) + +AT_CHECK([tcsh -f -c 'source -h script.csh foo; echo $var'], 1, [], +[var: Undefined variable. +]) + +AT_DATA([script2.csh], +[[echo OK +echo $this_does_not_exist +echo fail +]]) +AT_DATA([script3.csh], +[[source script2.csh +echo fail +]]) +AT_CHECK([tcsh -f -c 'source script3.csh'], 1, +[OK +], +[this_does_not_exist: Undefined variable. +]) + +AT_DATA([unreadable.csh], +[[echo fail +]]) +chmod 000 unreadable.csh +AT_CHECK([tcsh -f -c 'source unreadable.csh'], 1, [], [ignore]) + +AT_CLEANUP + + +TCSH_UNTESTED([stop]) +TCSH_UNTESTED([suspend]) + + +AT_SETUP([switch]) + +touch file1 +AT_DATA([switch.csh], +[[switch (file*) + case file1: + echo OK +endsw +switch (`echo foo`) + case *echo*: + echo fail + case foo: + echo OK +endsw +switch (string) + case ?string: + echo fail + case s*[i]?g: + echo OK + breaksw + default: + echo fail +endsw +switch (string) + case foo: + echo fail + default: + echo OK +endsw +switch (string) + case string: + echo OK1 + case foo: + echo OK2 + default: + echo OK3 +endsw +switch (nothing) + case foo: + case bar: + echo fail +endsw +]]) +AT_CHECK([tcsh -f switch.csh], , +[OK +OK +OK +OK +OK1 +OK2 +OK3 +]) + +AT_CLEANUP + + +TCSH_UNTESTED([telltc]) +TCSH_UNTESTED([termname]) +TCSH_UNTESTED([time]) + + +AT_SETUP([umask]) + +AT_DATA([umask.csh], +[[umask 000 +umask +umask 77 +umask +umask 700 +umask +umask 002 +umask +]]) +AT_CHECK([tcsh -f umask.csh], , +[0 +77 +700 +2 +]) + +AT_CLEANUP + + +AT_SETUP([unalias]) + +AT_DATA([unalias.csh], +[[unalias foo +alias foo bar +unalias fo? +alias +]]) +AT_CHECK([tcsh -f unalias.csh]) + +AT_CLEANUP + + +AT_SETUP([uncomplete]) + +AT_DATA([uncomplete.csh], +[[uncomplete foo +complete foo 'n/A/t:*/_' 'n/[^A]/t:*/_' +uncomplete f?* +complete +]]) +AT_CHECK([tcsh -f uncomplete.csh]) + +AT_CLEANUP + + +AT_SETUP([unhash]) + +AT_CHECK([tcsh -f -c 'unhash']) + +AT_CLEANUP + + +TCSH_UNTESTED([universe]) +TCSH_UNTESTED([unlimit]) + + +AT_SETUP([unset]) + +AT_DATA([unset.csh], +[[unset foo +set foo=var +unset f?o +echo $?foo +]]) +AT_CHECK([tcsh -f unset.csh], , +[0 +]) + +AT_CLEANUP + + +AT_SETUP([unsetenv]) + +AT_DATA([unsetenv.csh], +[[unsetenv env_foo +unsetenv env_* +sh -c 'echo ${env_bar+set}' +]]) +AT_CHECK([env_bar=value tcsh -f unsetenv.csh], , +[ +]) + +AT_CLEANUP + + +TCSH_UNTESTED([ver]) + + +AT_SETUP([wait]) + +# Not really... +AT_CHECK([tcsh -f -c 'wait']) + +AT_CLEANUP + + +TCSH_UNTESTED([warp]) +TCSH_UNTESTED([watchlog]) + + +AT_SETUP([where]) + +touch ls-F +chmod a+x ls-F +AT_DATA([where.csh], +[[alias ls-F foo bar +set path=(`/bin/pwd`) +where ls-F +where this_does_not_exist +]]) +AT_CHECK([tcsh -f where.csh | sed "s,`/bin/pwd`,CWD,"], , +[ls-F is aliased to foo bar +ls-F is a shell built-in +CWD/ls-F +]) + +AT_CLEANUP + + +AT_SETUP([which]) + +touch my_command +chmod a+x my_command +AT_DATA([which.csh], +[[alias my_alias my alias +set path=(`/bin/pwd`) +which my_command +which my_alias +which echo +which this_does_not_exist +alias echo echo_alias +which echo +]]) +AT_CHECK([tcsh -f which.csh | sed "s,`/bin/pwd`,CWD,"], , +[CWD/my_command +my_alias: aliased to my alias +echo: shell built-in command. +this_does_not_exist: Command not found. +echo: aliased to echo_alias +]) + +AT_CLEANUP + + +AT_SETUP([while]) + +AT_DATA([while.csh], +[[set i=0 +while ($i < 3) + echo $i + @ i++ +end +echo OK +]]) +AT_CHECK([tcsh -f while.csh], , +[0 +1 +2 +OK +]) + +AT_CLEANUP + + +AT_SETUP([jobs output]) + +AT_DATA([jobs_stdout.csh], +[[ +sleep 3 & +jobs -l > ./stdout + +if ( -z ./stdout ) then + echo "FAIL: 'jobs' output is not being displayed to stdout!" + exit 1 +else + exit 0 +endif +]]) +AT_CHECK([tcsh -f jobs_stdout.csh], 0, [ignore]) + +AT_CLEANUP + +AT_SETUP([time output]) + + +AT_DATA([time_output.csh], +[[ +set time_output=`time sleep 1 > /dev/null` +echo $time_output > ./output_result + +if ( -z ./output_result) then + echo "FAIL: 'time' output is not being displayed to stdout!" + exit 1 +else + exit 0 +endif +]]) +AT_CHECK([tcsh -f time_output.csh], 0, [ignore]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/parenthesis.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/parenthesis.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/parenthesis.at (revision 353870) @@ -0,0 +1,63 @@ +# Parenthesis handling + +AT_SETUP([Parenthesis no space]) +AT_DATA([no-space.csh], +[[ +if(1 == 1) then + echo 1 +else + if (2 == 22 )then + echo 2 + endif + echo 3 +endif +]]) +AT_CHECK([tcsh -f < no-space.csh], ,[1 +]) + +AT_CLEANUP + +AT_SETUP([Parenthesis space]) +AT_DATA([space.csh], +[[ +if (1 == 1) then + echo 1 +else + if (2 == 22 ) then + echo 2 + endif + echo 3 +endif +]]) +AT_CHECK([tcsh -f < space.csh], ,[1 +]) + +AT_CLEANUP + +AT_SETUP([Parenthesis space escaped]) +AT_DATA([space-escaped.csh], +[[ +if (1 == 1) then + echo 1 +else + if (2 == 22 )\ then + echo 2 + endif + echo 3 +endif +]]) +AT_CHECK([tcsh -f < space-escaped.csh], ,[1 +]) +AT_CLEANUP + +AT_SETUP([Parenthesis escaped]) +AT_DATA([parenthesis-escaped.csh], +[[ +if ( ')' == \) ) then + echo 1 +endif +]]) +AT_CHECK([tcsh -f < parenthesis-escaped.csh], ,[1 +]) +AT_CLEANUP + Index: vendor/tcsh/6.21.00-83c5be0/tests/testsuite.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/testsuite.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/testsuite.at (revision 353870) @@ -0,0 +1,27 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- + +AT_INIT +AT_TESTED([tcsh]) + +m4_define([TCSH_UNTESTED], +[AT_SETUP([$1]) +AT_CHECK([exit 77]) +AT_CLEANUP +]) + +m4_include([aliases.at]) +m4_include([arguments.at]) +m4_include([commands.at]) +m4_include([expr.at]) +# Disabled because of non-portable use of stat +#m4_include([history.at]) +m4_include([lexical.at]) +m4_include([mb-eucjp.at]) +m4_include([mb-utf8.at]) +m4_include([parenthesis.at]) +m4_include([subst.at]) +m4_include([syntax.at]) +m4_include([variables.at]) + +m4_include([noexec.at]) +m4_include([sh.dol.at]) Index: vendor/tcsh/6.21.00-83c5be0/tests/aliases.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/aliases.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/aliases.at (revision 353870) @@ -0,0 +1,56 @@ +# Special aliases + +TCSH_UNTESTED([beepcmd]) + + +AT_SETUP([cwdcmd]) + +AT_DATA([cwdcmd.csh], +[[alias cwdcmd 'echo ">>" $cwd' +cd / +]]) +AT_CHECK([tcsh -f cwdcmd.csh], , +[>> / +]) + +AT_CLEANUP + + +TCSH_UNTESTED([jobcmd]) +TCSH_UNTESTED([helpcommand]) +TCSH_UNTESTED([periodic]) +TCSH_UNTESTED([precmd]) + + +AT_SETUP([postcmd]) + +AT_DATA([postcmd.csh], +[[alias postcmd 'echo ">>" "\!#"' +echo foo +echo foo | cat +]]) +AT_CHECK([tcsh -f postcmd.csh], , +[>> echo foo +foo +>> echo foo | cat +foo +]) + +AT_CLEANUP + + +AT_SETUP([shell]) + +AT_DATA([script], +[OK +]) +chmod a+x script +AT_DATA([shell.csh], +[[alias shell `which cat` +./script +]]) +AT_CHECK([tcsh -f shell.csh], , +[OK +]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/arguments.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/arguments.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/arguments.at (revision 353870) @@ -0,0 +1,166 @@ +# Command-line argument handling + +AT_SETUP([-b]) + +AT_DATA([-script.csh], +[[echo $1 +]]) +AT_CHECK([tcsh -f -b -script.csh --version], , [--version +]) + +AT_CLEANUP + + +AT_SETUP([-c]) + +AT_CHECK([tcsh -f -c 'echo $1' foo], , [foo +]) + +AT_CHECK([tcsh -f -c 'exit 99'], 99) + +AT_CHECK([tcsh -f -c 'echo \\\'], 1, , +[Argument for -c ends in backslash. +]) + +AT_CHECK([tcsh -f -c 'echo \\'], , +[\ +]) + +AT_CHECK([tcsh -f -c]) + +AT_CLEANUP + + +TCSH_UNTESTED([-d]) + + +AT_SETUP([-e]) + +# Note that exit is a builtin, won't work here without using a subshell +AT_CHECK([tcsh -f -e -c 'echo 1; (exit 3); echo 2'], 3, [1 +]) + +AT_CLEANUP + + +TCSH_UNTESTED([-f]) + + +AT_SETUP([-i]) + +AT_CHECK([echo 'echo $1' | tcsh -f -q -i foo], , +[[> foo +> exit +]]) + +AT_CLEANUP + + +# Warning message contains strerror(EBADF), libc-dependent; can't be turned +# off using -q because -l works only when alone +TCSH_UNTESTED([-l]) + + + +TCSH_UNTESTED([-m]) + + +# -n tested in noexec.at + + +TCSH_UNTESTED([-q]) +#AT_SETUP([-q]) + +# Nested to make the SIGQUIT reporting predictable +#AT_CHECK([tcsh -f -q -c 'kill -QUIT $$'], 131, ,) + +#AT_CLEANUP + + +AT_SETUP([-s]) + +AT_CHECK([echo 'echo $1' | tcsh -f -s foo], , [foo +]) + +AT_CLEANUP + + +AT_SETUP([-t]) + +AT_DATA([input.csh], +[[echo 1\ +2 +]]) +AT_CHECK([tcsh -f -t < input.csh], , [1 2 +]) + +AT_CLEANUP + + +AT_SETUP([-v]) + +AT_CHECK([echo 'repeat 2 echo OK' | tcsh -f -v], , +[OK +OK +], +[repeat 2 echo OK +]) + +AT_CLEANUP + + +AT_SETUP([-x]) + +AT_CHECK([echo 'repeat 2 echo OK' | tcsh -f -x], , +[OK +OK +], +[repeat 2 echo OK +echo OK +echo OK +]) + +AT_CLEANUP + + +TCSH_UNTESTED([-V]) +TCSH_UNTESTED([-X]) + + +TCSH_UNTESTED([--help]) +TCSH_UNTESTED([--version]) + + +AT_SETUP([invalid option]) + +AT_CHECK([tcsh -f -Z], 1, , +[[Unknown option: `-Z' +Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. +]]) + +AT_CLEANUP + + + +AT_SETUP([non-option arguments]) + +AT_DATA([options.csh], +[[echo $0 +echo $1 +echo $#argv +echo $argv +]]) +AT_CHECK([tcsh -f ./././options.csh one two three], , +[./././options.csh +one +3 +one two three +]) + +AT_DATA([unreadable.csh], +[[echo fail +]]) +chmod 0 unreadable.csh +AT_CHECK([tcsh -f unreadable.csh], 1, [], [ignore]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/tests/expr.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/expr.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/expr.at (revision 353870) @@ -0,0 +1,167 @@ +# Expression evaluation + +AT_SETUP([Arithmetic operators]) + +AT_CHECK([tcsh -f -c 'exit (2 || 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (2 || 0)'], 1) +AT_CHECK([tcsh -f -c 'exit (0 || 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (0 || 0)'], 0) + +AT_CHECK([tcsh -f -c 'exit (2 && 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (2 && 0)'], 0) +AT_CHECK([tcsh -f -c 'exit (0 && 3)'], 0) +AT_CHECK([tcsh -f -c 'exit (0 && 0)'], 0) + +AT_CHECK([tcsh -f -c 'exit (1 | 2)'], 3) + +AT_CHECK([tcsh -f -c 'exit (2 ^ 3)'], 1) + +AT_CHECK([tcsh -f -c 'exit (2 & 3)'], 2) + +AT_CHECK([tcsh -f -c 'exit (2 == 3)'], 0) +AT_CHECK([tcsh -f -c 'exit (2 == 2)'], 1) +AT_CHECK([tcsh -f -c 'exit (02 == 2)'], 0) + +AT_CHECK([tcsh -f -c 'exit (2 != 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (2 != 2)'], 0) +AT_CHECK([tcsh -f -c 'exit (02 != 2)'], 1) + +AT_CHECK([tcsh -f -c 'exit (foo =~ f*o)'], 1) +AT_CHECK([tcsh -f -c 'exit (foo =~ b*o)'], 0) + +AT_CHECK([tcsh -f -c 'exit (foo !~ f*o)'], 0) +AT_CHECK([tcsh -f -c 'exit (foo !~ b*o)'], 1) + +AT_CHECK([tcsh -f -c 'exit (2 >= 3)'], 0) +AT_CHECK([tcsh -f -c 'exit (2 >= 2)'], 1) +AT_CHECK([tcsh -f -c 'exit (3 >= 2)'], 1) + +AT_CHECK([tcsh -f -c 'exit (2 <= 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (2 <= 2)'], 1) +AT_CHECK([tcsh -f -c 'exit (3 <= 2)'], 0) + +AT_CHECK([tcsh -f -c 'exit (2 > 3)'], 0) +AT_CHECK([tcsh -f -c 'exit (2 > 2)'], 0) +AT_CHECK([tcsh -f -c 'exit (3 > 2)'], 1) + +AT_CHECK([tcsh -f -c 'exit (2 < 3)'], 1) +AT_CHECK([tcsh -f -c 'exit (2 < 2)'], 0) +AT_CHECK([tcsh -f -c 'exit (3 < 2)'], 0) + +AT_CHECK([tcsh -f -c 'exit (2 << 3)'], 16) + +AT_CHECK([tcsh -f -c 'exit (3 >> 1)'], 1) + +AT_CHECK([tcsh -f -c 'exit (2 + 3)'], 5) + +AT_CHECK([tcsh -f -c 'exit (2 - 3)'], 255) + +AT_CHECK([tcsh -f -c 'exit (2 * 3)'], 6) + +AT_CHECK([tcsh -f -c 'exit (10 / 2)'], 5) + +AT_CHECK([tcsh -f -c 'exit (5 % 3)'], 2) + +AT_CHECK([tcsh -f -c 'exit (! 0)'], 1) +AT_CHECK([tcsh -f -c 'exit (! 3)'], 0) + +AT_CHECK([tcsh -f -c 'exit (~ 0)'], 255) +AT_CHECK([tcsh -f -c 'exit (~ 254)'], 1) + +AT_CHECK([tcsh -f -c 'exit ((3))'], 3) + +AT_CLEANUP + + +AT_SETUP([Primary expressions]) + +AT_CHECK([tcsh -f -c 'set parseoctal; exit (010)'], 8) +AT_CHECK([tcsh -f -c 'exit (010)'], 10) + +AT_CHECK([tcsh -f -c 'exit ( "" )'], 0) + +AT_CHECK([tcsh -f -c 'exit { true }'], 1) +AT_CHECK([tcsh -f -c 'exit { false }'], 0) + +touch file1 file2 +chmod 6777 file1 +chmod 000 file2 + +AT_CHECK([tcsh -f -c 'exit ( -r file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -r file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -w file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -w file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -x file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -x file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -X ls )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -X unknown_command )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -e file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -e nonexistent )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -o file1 )'], 1) + +echo > nonempty +AT_CHECK([tcsh -f -c 'exit ( -z file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -z nonempty )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -s file1 )'], 0) +AT_CHECK([tcsh -f -c 'exit ( -r nonempty )'], 1) + +mkdir dir +chmod +t dir +ln -s file2 link +mkfifo pipe + +AT_CHECK([tcsh -f -c 'exit ( -f file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -f dir )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -d dir )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -d file1 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -l link )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -l file1 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -p pipe )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -p file1 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -u file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -u file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -g file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -g file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -k dir )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -k file2 )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -t 0 )' < /dev/null], 0) + +AT_CHECK([tcsh -f -c 'exit ( -f link )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -Lf link )'], 0) + +AT_CHECK([tcsh -f -c 'exit ( -rwx file1 )'], 1) + +# -A, -A:, -M, -M:, -C, -C:, -D, -I, -F, -U, -U:, -G, -G: not tested + +AT_CHECK([tcsh -f -c 'exit ( -L link == file2 )'], 1) + +ln file2 file2link +AT_CHECK([tcsh -f -c 'exit ( -N file1 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -N file2 )'], 2) + +# S_ISVTX is masked out +AT_CHECK([tcsh -f -c 'exit ( -P file1 == 6777 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -P: file1 == 06777 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -P111 file1 == 111 )'], 1) +AT_CHECK([tcsh -f -c 'exit ( -P111: file1 == 0111 )'], 1) + +AT_CHECK([tcsh -f -c 'exit ( -Z file1 )'], 0) +AT_CHECK([tcsh -f -c 'exit ( -Z nonempty )'], 1) + +AT_CHECK([tcsh -f -c 'exit ( -N unknown )'], 255) + +AT_CLEANUP + Index: vendor/tcsh/6.21.00-83c5be0/tests/history.at =================================================================== --- vendor/tcsh/6.21.00-83c5be0/tests/history.at (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/tests/history.at (revision 353870) @@ -0,0 +1,444 @@ +# Test of the history functions. Some of these are already tested in +# variables and commands. + +AT_SETUP([history]) + +# Check history duplicate erase +AT_DATA([hist-base.csh], +[[set histdup=erase history=( 5 "%h TIME %R\n") +echo $histdup $history +: 1 +: 2 +: 3 +: 2 +: 4 +]]) +AT_CHECK([{ cat hist-base.csh; echo "!4"; } > hist.csh; \ + tcsh -f -q -i < hist.csh], 1, +[> erase 5 %h TIME %R + +> exit +], +[4: Event not found. +]) + +# Try all four variants with different values of histdup. +AT_CHECK([{ cat hist-base.csh; echo : 4; echo history 9; } > hist.csh; ] dnl + [tcsh -f -q -i < hist.csh], , +[> erase 5 %h TIME %R + + 3 TIME : 1 + 5 TIME : 3 + 6 TIME : 2 + 8 TIME : 4 + 9 TIME history 9 +> exit +],) +AT_CHECK([{ sed 's/erase/all/' hist-base.csh; echo : 4; echo history 9;}] dnl + [> hist.csh; tcsh -f -q -i < hist.csh], , +[> all 5 %h TIME %R + + 3 TIME : 1 + 4 TIME : 2 + 5 TIME : 3 + 6 TIME : 4 + 7 TIME history 9 +> exit +],) +AT_CHECK([{ sed 's/erase/prev/' hist-base.csh; echo : 4; echo history 9; }] dnl + [> hist.csh; tcsh -f -q -i < hist.csh], , +[> prev 5 %h TIME %R + + 4 TIME : 2 + 5 TIME : 3 + 6 TIME : 2 + 7 TIME : 4 + 8 TIME history 9 +> exit +],) +AT_CHECK([{ sed 's/erase//' hist-base.csh; echo : 4; echo history 9;}] dnl + [> hist.csh; tcsh -f -q -i < hist.csh], , +[> 5 %h TIME %R + + 5 TIME : 3 + 6 TIME : 2 + 7 TIME : 4 + 8 TIME : 4 + 9 TIME history 9 +> exit +],) + +# Illustrating reference credit scheme (Hist.Href) that preserves +# recently used items in the history list, instead of using a strictly +# FIFO discipline. +AT_DATA([hist-ev.csh], +[[: !3 +: : !6 +: : !3 +: x !6 +history 9 +]]) +AT_CHECK([[cat hist-base.csh hist-ev.csh > hist.csh; ] dnl + [ tcsh -f -q -i < hist.csh ]], , +[> erase 5 %h TIME %R + + 3 TIME : 1 + 6 TIME : 2 + 8 TIME : : 1 + 9 TIME : : : 2 + 10 TIME : : : 1 + 11 TIME : x : 2 + 12 TIME history 9 +> exit +], +[: : 1 +: : : 2 +: : : 1 +: x : 2 +]) + +# Repeat with a duplicate command. This demonstrates a problem in the +# old code that renumbers Href counters following a successful match in +# erase mode. +AT_CHECK([[{ cat hist-base.csh; sed 's/x !6/: !6/' hist-ev.csh;}] dnl + [> hist.csh; tcsh -f -q -i < hist.csh ]], , +[> erase 5 %h TIME %R + + 3 TIME : 1 + 6 TIME : 2 + 8 TIME : : 1 + 10 TIME : : : 1 + 11 TIME : : : 2 + 12 TIME history 9 +> exit +], +[: : 1 +: : : 2 +: : : 1 +: : : 2 +]) +# The old code discards events 3 & 6 and instead retains 7: +# - 3 TIME : 1 +# - 6 TIME : 2 +# + 7 TIME : 4 +# 8 TIME : : 1 + +AT_CLEANUP + +AT_SETUP([history performance]) + +# Now some scaling tests with large history. Unfortunately the +# reasonable settings here will depend on test hardware. + +# First a "test" that just generates a large history file. +AT_DATA([hist-generate.awk], +[[BEGIN { + if (ARGC != 2) { + print "Usage is: " ARGV[0] " " + exit 13 + } + lines = ARGV[1]; + tBase = 1234567890; + for (i = 1; i<= lines; i++) { + print "#+" tBase+i "\n: " i; + } +} +]]) +AT_CHECK([awk -f hist-generate.awk 5000 > test.history]) + +AT_DATA([hist-load-save.csh], +[[: echo Testing performance of history features of tcsh. +if ( $#argv < 3 ) then + echo Usage is: tcsh -f -i "[hist size (15000)]" "[use dup (erase)]" + echo " [use merge (1)]" "< $0" + exit 1 +endif +set histSize=$1 +set usedup=$2 +set usemerge=$3 + +: echo in tcshrc with history size $histSize at `date +%F\ %T.%N` +set histfile=test.history +echo Generating +@ len = `wc -l < $histfile` / 2 +if ( $len != $histSize ) then + awk -f hist-generate.awk $histSize > $histfile +endif + +set history=$histSize +set histdup=$usedup +if ( $usemerge ) then + set savehist=( $histSize merge ) +else + set savehist=$histSize +endif +: echo "savehist=$savehist" "history=$history" +: # Cannot use the time built-in because history is a shell function +echo Loading at `date +%F\ %T.%N` +history -L +: 'wc -l $histfile; history | wc -l; history | head -2; history | tail -2' +echo Saving at `date +%F\ %T.%N` +history -S +echo Done at `date +%F\ %T.%N` +]]) +AT_CHECK([[ tcsh -f -q -i 5000 erase 1 < hist-load-save.csh] dnl + [ | sed 's/ at [-: 0-9.]*/ at TIME/' ]], 0, +[> Generating +Loading at TIME +Saving at TIME +Done at TIME +> exit +], []) + +AT_CHECK([[ tcsh -f -q -i 4096 erase 1 < hist-load-save.csh] dnl + [ | sed 's/ at [-: 0-9.]*/ at TIME/' ]], 0, +[> Generating +Loading at TIME +Saving at TIME +Done at TIME +> exit +], []) + +# Could repeat test with different sizes (on a faster machine), with +# different histdup settings ("all", "prev", or "") and with merge (for +# savehist) set to 0 instead of 1. + +AT_CLEANUP + +AT_SETUP([history faults]) + +# Try some things that have caused failures before +AT_DATA([hist-err.csh], +[[set histfile=test.history histdup=erase history=0 +set savehist = (4096 merge) +echo next +set history="(5 %h TIME %R\n)" +]]) + +AT_CHECK([[ tcsh -f -q -i < hist-err.csh]], 0, +[> next +> exit +], []) + +AT_CHECK([[ ( cat hist-err.csh; echo history; echo echo done ) | ] dnl + [ tcsh -f -q -i ]], 1, +[> next +> exit +], +[history: Badly formed number. +]) + +AT_CLEANUP + +AT_SETUP([history hup]) + +# Test for problem introduced in 6.15 where the history file gets +# truncated if a tcsh is run from a pty that is closed unexpectedly. +# Test this three ways, depending on availability of local programs to +# create pseudo-ttys (pty). + +AT_DATA([hist-kill.sh], +[[#!/bin/sh + +program=script +[ $# -eq 0 ] || program=$1 +progpath=`which $program` +[ -n "$progpath" -a -x "$progpath" ] || { + echo $program was not found; exit 0 +} +echo Using $program "($progpath)" to run tcsh inside a pty + +set -e + +saveHistfile= +histfile=$PWD/test.history +# Initialize the history file to something small but non-zero. +{ echo "#+1234567890"; echo echo dummy history; } > $histfile + +setHistSize() { + histsize=`stat -c %s $histfile` + [ $histsize -gt 0 ] || exit 3 # should never happen + histdate=`stat -c %Y $histfile` + ls -l --full-time $histfile + echo size is $histsize date is $histdate at `date` +} + +checkHistSize () { + local oldS=$1 + local oldD=$2 + local newHistsize=`stat -c %s $histfile` + local newHistdate=`stat -c %Y $histfile` + ls -l --full-time $histfile + echo size is now $newHistsize date is now $newHistdate at `date` + # if the size not zero while the date and size are not both unchanged then + # the test is successful + [ $newHistsize -eq 0 ] && \ + { echo FAILED: history file truncated; return 66; } + [ $newHistsize -gt 0 -a \ + \( $oldS -ne $newHistsize -o $oldD -ne $newHistdate \) ] || \ + { echo check hist size/date failed, try rerunning test; return 66; } +} + +tcshPath=`which tcsh` +[ -x $tcshPath ] || exit 1 +tcshInput=hist-kill.csh +[ -e $tcshInput ] || exit 2 + +# To avoid the problem of large history files that may take more than 1 second +# to read, replace the user's history file with the small one created above. +saveHistfile=$PWD/save.history.$$ +origHistfile=$HOME/.history +mv $origHistfile $saveHistfile +cp $histfile $origHistfile # initialize contents created above + +if [ $program = script ]; then + # use script to create the pty + ( echo 'set histfile='$histfile; cat $tcshInput ; sleep 2; echo exit ) | \ + script -c "exec $tcshPath" /dev/null & scriptPid=$! + sleep 1 + setHistSize + # Not sure if there is a more standard way to do this. + childScript=`ps --ppid $scriptPid --no-headers --format pid` + [ -n $childScript -a $childScript -gt 1 ] && kill $childScript +elif [ $program = xterm ]; then + # use xterm to create the pty + # Can't override the default history file, so this test trashes user's real + # history file. We try to preserve it, above. + histfile=$origHistfile + xterm -iconic -geom -1+1 -e "$tcshPath" & xtermPid=$! + sleep 1 + setHistSize + kill $xtermPid +elif [ $program = ./hist-kill ]; then + # use custom C program to create the pty + ( echo 'set histfile='$histfile; cat $tcshInput ) | \ + ./hist-kill $tcshPath & histkillPid=$! + sleep 1 + setHistSize + kill $histkillPid +else + echo unsupported program $program +fi +sleep 1 +checkHistSize $histsize $histdate || rc=$? +# Restore original history file, if necessary +[ -n "$saveHistfile" ] && mv $saveHistfile $origHistfile +[ -z "$rc" ] || exit $rc +echo Done testing tcsh with $program successfully +]]) + +AT_DATA([hist-kill.csh], +[[set history = ( 20 "%h %D-%w-%y %P %R\n" ) +set savehist=(20 merge) +history -S +echo $version pid=$$ +/bin/ls -l --full-time ~/.hi* ./*history* +]]) + +# Try both variants of this script, then the C version. +AT_CHECK([sh hist-kill.sh script], 0, stdout, stderr) +AT_CHECK([[if [ -n "$DISPLAY" ]; then sh hist-kill.sh xterm; ] dnl + [ else echo Skip xterm test: no display; fi]], 0, stdout, stderr) + +AT_DATA([hist-kill.c], +[[/* Test tcsh response to loss of pseudo-terminal (pty) master. Creates a pty + * and attaches it to a child process, the pty slave. Sends the contents to + * stdin to the pty and echos output from the pty onto stdout. Takes one + * optional argument, which is the pathname to the program to run attached to + * the pty. The main process is the pty master and does not exit, but must be + * killed by the invoker. When the master dies, the slave process should + * receive a SIGHUP courtesy of the kernel. */ + +#include +#include +#include +#include /* for openpty and forkpty */ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + const char *binFile = "/bin/tcsh"; + if (argc > 1) + binFile = argv[1]; + int masterFd; + int pid = forkpty(&masterFd, NULL, NULL, NULL); + if (pid == 0) { /* child */ + printf("pty slave is %d\n", getpid()); + char *bin = strdup(binFile); + char *argv[] = { bin, NULL }; + execvp(bin, argv); + perror("execvp"); + exit(99); + } + if (pid < 0) { + perror("forkpty"); + exit(66); + } + { /* parent */ + int nbytes; + int input = dup(masterFd); + int output = dup(masterFd); + close(masterFd); + + printf("pty master is %d\n", getpid()); + + if (fork() == 0) { + /* subparent, sends data from our stdin to child pty, then exits */ + unsigned nSent = 0; + char buf[128]; + printf("sub parent is %d\n", getpid()); + while ((nbytes = read(0, buf, sizeof(buf))) > 0) { + int sent = write(output, buf, nbytes); + if (sent > 0) + nSent += sent; + if (sent != nbytes) + break; + } + printf("Sent %d bytes to child.\n", nSent); + exit(0); + } + + /* Main process reads data from the child pty and displays it. Unless + * killed or some unexpected error occurs, this process runs until the + * child pty exits. */ + unsigned count = 0; + while (1) { + char buf[72]; + nbytes = read(input, buf, sizeof(buf)-1); + if (nbytes < 0) + break; + count += nbytes; + unsigned i; + for (i = 0; i?`~ +]]) +AT_CHECK([tcsh -f cat.csh < input | cmp -s input -]) + +AT_CLEANUP Index: vendor/tcsh/6.21.00-83c5be0/BUGS =================================================================== --- vendor/tcsh/6.21.00-83c5be0/BUGS (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/BUGS (revision 353870) @@ -0,0 +1,601 @@ +============ +Bugs in TCSH +============ +-IAN! idallen@ncf.ca +April 2002 + +-------------------------------------------------------------------------------- +| *FIXED* +| From: idallen +| Subject: Can't redirect output of "source" +| % echo "date" >file +| % source file >output +| Thu Sep 3 17:47:19 EDT 1987 +-------------------------------------------------------------------------------- + +From: idallen +Subject: nice is not cumulative + % nice date + % nice nice date + + Both have a nice of 4; nice does not accumulate. + +From: idallen +Subject: no warning on integer overflow + % @ x=99999999999999999999999 + % echo $x + -159383553 + +From: idallen +Subject: goto seeks backwards in terminal input + % goto x + goto? ignored + goto? ignored + goto? ignored + goto? x: + % goto x + + The terminal is now hung - you have to break out. + +From: idallen +Subject: nice applied to too many commands + % nice +20 simple `long` + + The CSH shell applies the nice to both commands "simple" and "long". + +From: idallen +Subject: redirection always happens in single-line "if" + if ( 0 ) echo hi > date + + The file date is created empty. + +From: idallen +Subject: Expanding variable with newline generates syntax error + % set x="abc\ + def" + % echo "$x" + Unmatched ". + +From: idallen +Subject: Expanding variable with newline generates extra word + % set x="abc\ + def" + % echo $x + abc def + % set y=( $x ) ; echo $#y + 3 + +From: idallen +Subject: Modifier ":e" doesn't work on history + CSH is missing an entry in a case statement for it. + +From: idallen +Subject: Shell messages appear on stdout; get redirected + If a program in a shell script exits with a signal that the shell + reports (e.g. Terminated), the report appears on standard output + and if the output of the shell script is redirected the report + gets sent there and you never find out. + +From: Steve Hayman +Subject: No error message given for failure to NICE + % nice -10 date + Fri May 30 12:11:12 EDT 1986 + CSH never checks the error returns from nice(). + +From: Ray Butterworth +Subject: CSH history reading takes '#' as a comment + % echo a b # c d + a b # c d + % exit + % login + % history + ... + 99 echo a b + + '#' indicates a comment when reading from a shell script file, + and of course CSH thinks it is reading from a file when it reads + the history back in. + +From: idallen +Subject: csh: No current job, even if only one job + % somecommand ^Z + Suspended + % bg + [1] somecommand & + % fg + fg: No current job. + + The C shell always turns off the current job indicator for a job + that is put in the background with "bg" -- even if it is the only job. + +From: idallen (Ian! D. Allen) +Subject: Redirection ignored inside if ( { cmd >xxx } ) .... + % if ( { date >out } ) echo hi + Sun Apr 14 13:24:31 EDT 2002 + hi + + The shell does not set up its file descriptors for the forked + command. The redirection is completely ignored. + +>From idallen +Subject: Error in CSH script causes script exit + If a script has an error in a built-in command (e.g. redirection file not + found), the script exits instead of continuing. + +From: idallen (Ian! D. Allen) +Subject: Variables $$, $# don't accept :-modifiers + echo $$:q $#:q + 12345:q 0:q + +From: idallen (Ian! D. Allen) +Subject: Variable $* (a synonym for argv) doesn't accept subscripts. + % set argv=( a b c d ) + % echo $argv[2] + b + % echo $*[2] + echo: No match. + +>From idallen +Subject: Using WHICH from CSH + The WHICH command tells the wrong thing if you've created + a new file and haven't done a REHASH. WHICH thinks you + get the new file, but the CSH will give you the old one. + +From: idallen (Ian! D. Allen) +Subject: Redirected input to built-in functions misbehaves badly + % date | echo hi + hi + % % jobs + [1] + Running date | + + Note the duplicate prompt and spurious job entry. + + % % date | echo hi + hi + % % date | echo hi + hi + % % jobs + [1] + Running date | + [2] - Running date | + [3] Running date | + % fg + date | + % fg + date | + fg: No such job (badjob). + % fg + [tcsh shell hangs here in an infinite loop] + + Just a general mess of mishandled processes. + +From: idallen (Ian! D. Allen) +Subject: stopped pipes generate spurious job ID + % date | sleep 99 + ^Z + Suspended + [1] 123 456 + +>From idallen(idallen ) +Subject: NICE and NOHUP have no effect as last component of sub-shells. + % nice +10 ps -laxtd0 + UID PID PPID CP PRI NI RSS WCHAN STAT TT TIME COMMAND + 47 3559 1 0 15 0 33 ff000 S d0 0:16 -csh (csh) + 47 7606 3559125 76 10 23 R N d0 0:01 ps -laxtd0 + % (nice +10 ps -laxtd0) + UID PID PPID CP PRI NI RSS WCHAN STAT TT TIME COMMAND + 47 3559 1 3 15 0 33 ff000 S d0 0:16 -csh (csh) + 47 7605 3559 92 48 0 23 R d0 0:01 ps -laxtd0 + + % (nice ps lx) + ... Shows no nice. + % (nice ps lx;date) + ... Works. + % (nohup sleep 999)& + ... Doesn't ignore SIGHUP. + % (nohup sleep 999;date)& + ... Works. + % echo `nice ps lx >/dev/tty` + ... Shows no nice. + % echo `nice ps lx >/dev/tty;date` + ... Works. + % echo `nohup sleep 999` + ... Doesn't ignore SIGHUP. + % echo `nohup sleep 999;date` + ... Works. + +>From idallen +Subject: you can't nest back-quotes + % echo ` echo \`pwd\` ` + Unmatched `. + +From: idallen (Ian! D. Allen) +Subject: GLOB not applied to names in setenv or unsetenv + % setenv `echo abc` def + + It doesn't set abc, it sets the nasty variable: `echo abc` + + % unsetenv `echo abc def ghi` + + Doesn't unset abc or def or ghi + +>From idallen Thu Mar 15 09:48:35 1984 +Subject: Stopping jobs in list of command names throws away the rest. + % a ; b ; c + CSH documents that if you stop B, C will immediately start. + It doesn't. The rest of the list gets thrown away. + +From: idallen (Ian! D. Allen) +Subject: Stopping jobs in source'd file aborts the rest of the file. + With the file TEST containing: + + mail + echo Hi There you never see this + + and typing + + % source TEST + + and then using ^Z to stop MAIL, the rest of the TEST file is abandoned. + This is especially annoying in one's .login or .cshrc. + +>From idallen +Subject: CSH doesn't handle EXIT when it sees it. + % date; exit 99 ; date ; date + Wed Mar 14 19:21:51 EST 1984 + Wed Mar 14 19:21:52 EST 1984 + Wed Mar 14 19:21:53 EST 1984 + + The shell doesn't flush pending input when the EXIT is seen. + The shell then exits with status 0 instead of status 99. + +>From idallen +Subject: CSH mishandles suspend in subshells. + % ( date; suspend; date ) + Sun Mar 4 01:28:28 EST 1984 + + Suspended + % fg + ( date; suspend; date ) + + Suspended (tty input) + ...and you can never get it started again. + +>From idallenSun Mar 18 01:28:16 +Subject: ECHO mis-handles interrupts and errors in back-quotes + % echo `sleep 999` + + [1] 24244 + % jobs + [1] Interrupt ` ... ` + + Note the inability of CSH to tell you the command name used inside + the back-quotes. + +>From idallen +Subject: CSH botches $#X where X is environment var + % echo $#path + 4 + % echo $#PATH + /usr/ucb:/bin:/usr/bin:/usr/public + +>From idallen Wed Apr 18, 1984 +Subject: Inconsistent handling of variables + The manual says that "set x=word" assigns a single word to x. + To assign multiple words, one is supposed to use "set x=(words)". + But, CSH allows "set x=`date`", which sets x to the many words + resulting from `date`, and $x[1] prints "Mon". + + One observes that if x and y are single-word variables, the statements: + % set x=word2 + % set y[1]=word2 + are identical; both replace the contents of the variable with word2. + + But, you can't assign a word to y[1] if y doesn't exist, even though + you can (of course) assign a word to plain "y" if y doesn't exist. + +>From idallen(Ian! D. Allen) +Subject: extra next level when nested single-line IF line ends in THEN + Any IF line that ends in THEN is taken as another nesting level, and + requires a corresponding ENDIF: + + if ( 0 ) then + if ( 0 ) echo This line ends with then + endif + echo You do not see this. + endif # This shouldn't be needed; but it is. + echo Now you do. + +>From idallen +Subject: EXEC doesn't close the file descriptors + + /* This program will demonstrate that CSH leaves internal + * file descriptors open across an EXEC built-in command. + * + * % exec ./a.out + */ + main() + { + int i; + + for( i=0; i < 20; i++ ){ + printf("%d = %d\n", i, isatty(i) ); + } + } + + The output shows: + > exec ./a.out + 0 = 1 + 1 = 1 + 2 = 1 + 3 = 1 + 4 = 1 + 5 = 1 + 6 = 0 + 7 = 0 + 8 = 0 + 9 = 0 + ... + +From: idallen +Subject: can't test success of CD, CHDIR, etc. + cd nosuchdir || echo CD failed + cd nosuchdir && echo CD failed + cd nosuchdir ; echo CD failed + + None of the above work in CSH. + +>From idallen Mon Dec 16 21:40:32 1985 +Subject: GLOB loses memory on directories + echo /*/*/* + + If you interrupt the above GLOB, CSH loses memory. + +From: idallen +Subject: C Shells don't parse when looking for labels. + The shells just look at the first word on each line. You can + cause the shell to branch in to the middle of a HERE document: + + #!/bin/csh -f + onintr quit + sleep 999 + cat << EOF + quit: + echo Amazing how this prints. + exit 88 # this exit is taken when break is hit + EOF + quit: + echo You never get here. + +>From arwhite Thu Aug 26 13:53:58 1982 +Subject: CSH/Bourne shell inconsistent newlines + "`command`" deletes newlines from the command in the cshell, not in the + Bourne shell. + +>From idallen (Ian! D. Allen) +Subject: aliases aren't seen after redirection + % date >x + % >x date + + % alias foo date + % foo >x + % >x foo + foo: Command not found. + +>From idallen (Ian! D. Allen) +Subject: $< misbehaves in pipes + + % date | /bin/echo aaa $< bbb + abcdef + aaa a bbb + % bcdef + bcdef: Command not found. + +>From chris@pixutl.UUCP (chris) Fri Oct 5 14:01:13 1984 +Subject: bug in CSH (history) + There are a couple of bugs in the 'history' command of /bin/csh (and + offspring, such as newcsh): + + 1) The maximum number of arguments to the history command is set to 2. + % history -h -r 2 # fails + +>From idallen +Subject: C Shell expression operators explained + + Some odd CSH context-sensitive features. There is ambiguity on how + !~ != and !( should be interpreted: + + 1 - % ~idallen/study # a valid command line + 2 - % !~ # doesn't work + 3 - % echo " !~ " # no history + 4 - % if ( abc !~ def ) echo hi + + 1 - % =xxx # a valid command line + 2 - % != # doesn't work + 3 - % echo " != " # no history + 4 - % if ( 1 != 2 ) echo hi + + 1 - % ( date ) # a valid command line + 2 - % !( # doesn't work + 3 - % echo " !( " # no history + 4 - % if ( !( 1 + 1 ) ) echo hi + + The C Shell parser isn't clever enough to distinguish any of cases 2, + 3, or 4, so it always behaves as if the character pair was part of an + expression, not a history substitution. + +-------------------------------------------------------------------------------- +| *NOT A BUG* +| >From idallenThu Jun 27 08:20:08 1985 +| Subject: Re: Using > vs. | on shell built-in commands. +| +| CSH cannot put the output of the JOBS command into a pipe. In fact, +| the output is going into the pipe, but the output is empty. You +| couldn't know this, but these shells implement piped built-in commands +| by forking the shell to create an independent process for which the +| main shell can wait. But the internal process table is cleaned +| out after a fork(), since a forked shell is just like a subshell +| and must have its own clean process table in which to enter its own +| running jobs. So by the time the JOBS command executes, it's in a +| child shell that has no jobs running. Hence, the output is empty. +| "echo `jobs`" and "( jobs )" are both empty, for the same reason. +-------------------------------------------------------------------------------- + +From: jjg@security.UUCP (Jeff Glass) +Subject: csh and I/O redirection + + put these four lines in a file, say cshtest : + + #! /bin/csh -f + cat << END | ( sh & ) + echo hi there + END + + ( the intent is to send some commands to sh to be executed in the + background, without csh printing the job number of the sh. ) + + now, from csh, enter the command + + source cshtest + + and note that you see the message "hi there". + now enter the commands + + chmod +x cshtest + ./cshtest + + and you get no output. + + removing either the parentheses or the ampersand causes the message + to appear, but not quietly in the background. I don't understand why + it works when source'd but not when exec'd, either. + +-------------------------------------------------------------------------------- +| *FIXED* +| From: matt@prism.UUCP +| Subject: Pointless csh puzzle +| +| Here's a pointless little csh puzzle: In the c-shell, it is +| possible to set and environment variable whose name consist of +| more than one word, in the obvious way: +| +| % setenv "FOO BAR" quux +| +| The printenv builtin will show it residing happily in the +| environment. Now for the puzzle: can anyone find a way to GET +| TO the value of this variable, using only csh builtins? In +| other words, is there an such that +| +| % echo +| +| will print "quux" on the screen, where is formed +| only from csh commands? +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +| *FIXED* +| >From tim@ISM780B.UUCP Wed Nov 20 18:00:00 1985 +| Subject: Re: C-shell puzzles +| +| Here's another good C shell quirk: +| +| $ echo foo +| foo +| $ repeat 3 echo foo +| foo +| foo +| foo +| $ repeat 3 repeat 3 echo foo +| foo +| foo +| foo +| foo +| foo +| $ repeat $N repeat $M echo foo # $N and $M are integers +| [ $N + $M - 1 foo's ] +| $ repeat $N1 repeat $N2 ... repeat $Nk echo foo +| [ $N1 + $N2 + ... + $Nk - k + 1 foo's ] +| $ +-------------------------------------------------------------------------------- + +>From pur-ee!uiucdcsb!liberte Mon Dec 30 23:20:31 EST 1985 +Subject: Csh null strings + + There are at least two different-sized null strings in csh. + But sometimes they are equal anyway. + + % set x = "" + % set y = "`echo`" + % echo $#x $#y + 1 0 + + % set x = + % set y = `echo` + % echo $#x $#y + 1 0 + + % set x = ("") + % set y = ("`echo`") + % echo $#x $#y + 1 0 + + % set x = () + % set y = (`echo`) + % echo $#x $#y + 0 0 + + % if (() == "`echo`") echo huh + % if (() == ("`echo`")) echo huh + huh + % if ("" == ("`echo`")) echo huh + % if ("" == "`echo`") echo "huh?" + huh? + + +>On Jul 18, 8:15am, mark@peek.org (Mark Peek) wrote: +>-- Subject: Updated tcsh-6.12.0 release date? +> +>| Hi Christos, +>| I know I've been (part of) the cause of slipping the release date out +>| for tcsh-6.12.0. :-) Do you have an updated date for releasing it? +>| I'm trying to determine whether it will fit in the time frame for +>| shipment with the next FreeBSD 5.0-DP release. +> +>I hope to release it sometime next week. There are only minor changes in it. +>Is that convenient, or would you like me to push it more? + +I sent a note to the FreeBSD release engineers and they're inclined +to hold off on including the new version in the release which they're +branching later today. If DP2 slips out a bit they might consider +including it. I'd say go ahead with your current schedule and I'll +import it whenever it is available. I definitely will be including it +into the next -stable FreeBSD 4.7 release. + +BTW, one of the release engineers pointed out a bug with using +jobcmd. If you use the example in the book to update an xterm and +then run something like + grep bar `cat file.list` +It screws up the xterm title bar containing "Faulty alias 'jobcmd' +removed" plus the list of files from the cat command. + +The good news is that I was able to reproduce this at home last +night. The bad news is that it is working fine right now here at +work. Oh wait, let me log in remotely and look at the alias I was +using...got it! The command fails if you use: + + alias jobcmd 'echo -n "^[]2;\!#^G"' + +but works fine if you use: (note the switch of ' and " quotes) + + alias jobcmd "echo -n '^[]2;\!#^G'" + +Note: I used the above by vi'ing a file and sourcing it from the shell. + +If you can confirm, I think this just needs to be updated in the man page. + +>Thanks for all the help BTW... + +No problem. I like fixing bugs and contributing code...especially for +a great piece of software like tcsh that I use *all* the time. Thank +you for keeping it going! + +Mark Index: vendor/tcsh/6.21.00-83c5be0/Imakefile =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Imakefile (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Imakefile (revision 353870) @@ -0,0 +1,629 @@ +XCOMM +XCOMM Imakefile for tcsh 6.12 +XCOMM Marc Horowitz, MIT SIPB +XCOMM + +#ifdef DestDir +#undef DestDir +#endif +#ifdef ManSuffix +#undef ManSuffix +#endif + +/* All config options go in a separate file. */ + +#include "imake.config" + +#ifndef HasGcc +# define HasGcc 0 +#endif + +#ifndef HasGcc2 +# define HasGcc2 0 +#endif + +/* This is a giant conditional block. It should be set up right for +platforms which are in here, but it may need to be changed for new +ones. Please send in your fixes and additions! */ + +/**** tcsh configuration defines ****/ + +/* specific platforms */ + +#ifndef ConfigH +# ifdef UltrixArchitecture +# define ConfigH ultrix +# endif + +# ifdef UxpArchitecture +# define ConfigH sysv4 +# endif + +# if defined(LinuxArchitecture) || defined(GNUArchitecture) +# define ConfigH linux +# endif + +# ifdef AlphaArchitecture +# if !defined(LinuxArchitecture) && !defined(GNUArchitecture) +# define ConfigH decosf1 +# endif +# if !HasGcc +# define MyCflags -std1 -Olimit 2000 +# else +# define NoCombineRegs +# endif +# endif + +# if defined(VaxArchitecture) && !defined(UltrixArchitecture) +# define ConfigH bsd +# endif + +# ifdef NeXTArchitecture +# define ConfigH mach +# endif + +# if defined(SunArchitecture) +# if (OSMajorVersion == 3) +# define ConfigH sunos35 +# else +# if (OSMajorVersion == 4) +# if (OSMinorVersion == 0) +# define ConfigH sunos40 +# else /* OSMinorVersion == 1 */ +# if (OSTeenyVersion == 3) +# define ConfigH sunos413 +# else /* OsTeenyVersion in [0,1,2] */ +# define ConfigH sunos41 +# endif +# endif +# define NoCombineRegs +# else /* OSMajorVersion == 5 */ +# if (OSMinorVersion < 3) +# if (OSMinorVersion < 2) +# define ConfigH sol2 +# else +# define ConfigH sol22 +# endif +# else +# if (OSMinorVersion < 4) +# define ConfigH sol23 +# else +# if (OSMinorVersion < 6) +# define ConfigH sol24 +# else +# if (OSMinorVersion < 9) +# define ConfigH sol26 +# else +# define ConfigH sol29 +# endif +# endif +# endif +# endif +# define NoCombineRegs +# endif +# endif +# endif + +# ifdef HPArchitecture +/* For some stupid reason makedepend on HP requires this */ +DEPENDFLAGS = -o.o +# if (OSMajorVersion >= 8) +# define ConfigH hpux8 +# else +# define ConfigH hpux7 +# endif +# endif + +# ifdef CrayArchitecture +# define ConfigH cray +# endif + +# ifdef SGIArchitecture +# define ConfigH irix +# define UseLibBSD +# if (OSMajorVersion < 5) +# ifdef you_are_using_yp +# define UseSunLib +# endif +# if !HasGCC +# define MyStdc -D__STDC__ +# if SGICompilerMajorVersion < 4 +CCOPTIONS=-float # We don't want -cckr and -prototypes +# endif +# endif +# endif +# if (OSMajorVersion == 6) +# if (OSMinorVersion >= 2) +# undef UseLibBSD +# define ConfigH irix62 +# endif +# endif +# endif + +# ifdef IBMArchitecture +# undef UseLibBSD +# if (SystemV == YES) +# define ConfigH aix +# if OSMajorVersion < 3 +# if OSMinorVersion < 2 +# define UseLibBSD +# endif +# endif +# else +# define ConfigH bsd +# define AOSArchitecture +# endif +# endif + + +#ifdef AOSArchitecture +#define MyStdc -U__STDC__ +#endif + +# if defined(MipsBsdArchitecture) || defined(MipsSysvArchitecture) +# define ConfigH mips +# endif + +# ifdef DguxArchitecture +# define ConfigH dgux +# endif + +# ifdef ConvexArchitecture +# define ConfigH convex +# endif + +# if defined(SQNTArchitecture) || defined(SequentArchitecture) +# define ConfigH sequent +# endif + +# ifdef MacIIArchitecture +# define ConfigH mac2 +# endif + +# ifdef MinixArchitecture +/* Maybe conditional on MACH? */ +SYSSRCS=mi.termios.c mi.wait.h mi.varargs.h +SYSOBJS=mi.termios.${SUF} +EXTF=ma.setp.c vms.termcap.c +# else +/* Maybe conditional on MACH? */ +SYSSRCS=ma.setp.c +SYSOBJS=ma.setp.${SUF} +EXTF=mi.termios.c mi.wait.h mi.varargs.h vms.termcap.c +# endif + +# ifdef i386Isc +# if IscVersion != 202 +# define ConfigH isc +# define UseLibCposix +# else +# define ConfigH isc202 +# endif +# endif /* i386Isc */ + +# ifdef OpenBSDArchitecture +# define ConfigH bsd4.4 +# endif /* OpenBsdArchitecture */ + +# ifdef NetBSDArchitecture +# define ConfigH bsd4.4 +# endif /* NetBsdArchitecture */ + +# ifdef FreeBSDArchitecture +# define ConfigH bsd4.4 +# endif /* FreeBsdArchitecture */ + +# ifdef MidnightBSDArchitecture +# define ConfigH bsd4.4 +# endif /* MidnightBsdArchitecture */ + +# ifdef i386SVR4Architecture +# define ConfigH sysv4 +# ifdef DELL +# define NoCombineRegs +# endif +# endif + +#endif /* !ConfigH */ + +/* generic os's */ + +#ifndef ConfigH + +#if (SystemV == YES) +#define ConfigH sysv3 +#else +/* why this as a default? Why not? */ +#define ConfigH bsd +#endif + +#endif /* !ConfigH */ + +/**** libraries ****/ + +#if (SystemV == NO) || defined(HPArchitecture) || \ + defined(SQNTArchitecture) || defined(SequentArchitecture) || \ + defined(MacIIArchitecture) || defined(UseLibTermcap) +LIBTERMCAP = -ltermcap +#else +LIBTERMCAP = +#endif + +#if defined(SQNTArchitecture) || defined(SequentArchitecture) +LIBSQNT=-lsocket -linet -lnsl -lseq +#endif + +/* This may not be good enough - I don't have access to enough systems +to really test it. */ +#if (SystemV == YES) || defined(UseLibCurses) && !defined(HPArchitecture) +LIBCURSES = -lcurses +#else +LIBCURSES = +#endif + +#if defined(UseLibNet) +LIBNET = -lnet +#else +LIBNET = +#endif + +#if defined(UseLibSocket) +LIBSOCKET = -lsocket +#else +LIBSOCKET = +#endif + +#if defined(UseLibBSD) +LIBBSD = -lbsd +#else +LIBBSD = +#endif + +#if (defined(SGIArchitecture) && \ + (OSMajorVersion == 3) && (OSMinorVersion == 3)) || \ + defined(UseLibC_S) +LIBC_S = -lc_s +#else +LIBC_S = +#endif + +#if defined(UseLibSun) +LIBSUN = -lsun +#else +LIBSUN = +#endif + +#if defined(UseLibCposix) +LIBCPOSIX = -lcposix +#else +LIBCPOSIX = +#endif + +#if defined(UseLibInet) +LIBINET = -linet +#else +LIBINET = +#endif + +#if defined(UseLibDir) +LIBDIRECT = -ldir +#else +LIBDIRECT = +#endif + +#if defined(UseLibX) +LIBX = -lx +#else +LIBX = +#endif + +#if defined(UseLibIntl) +LIBINTL = -lintl +#else +LIBINTL = +#endif + +#if (HasLibCrypt == YES) +LIBCRYPT = -lcrypt +#else +LIBCRYPT = +#endif + +#if defined(MacIIArchitecture) || defined(UseLibPosix) +LIBPOSIX = -lposix +#else +LIBPOSIX = +#endif + +#if defined(ATTArchitecture) || defined(UseLibDirent) +LIBDIRECTENT = -ldirent +#else +LIBDIRECTENT = +#endif + +/* The order here is significant. Although nothing uses all of these, +some platforms which use more than one do care about the order. */ + +SYSLIBS = $(LIBPOSIX) $(LIBDIRECTENT) $(LIBTERMCAP) $(LIBCURSES) \ + $(LIBNET) $(LIBINTL) $(LIBSOCKET) $(LIBSUN) $(LIBBSD) $(LIBCPOSIX) \ + $(LIBINET) $(LIBDIRECT) $(LIBX) $(LIBC_S) $(LIBSQNT) $(LIBCRYPT) + +/* Past here, nothing should need to be changed to compile on a different +platform, unless you have a really weird architecture. */ + +#ifdef MyCC +CC = MyCC +#else +# if HasGcc +# if HasGcc2 +CC = gcc +# else +# ifdef NoCombineRegs +CC = gcc -finline-functions -fstrength-reduce +# else +CC = gcc -fcombine-regs -finline-functions -fstrength-reduce +# endif +# endif +# else +CC = cc +# endif +#endif + +#ifdef HESIOD +HESLIB = -L/usr/athena/lib -lhesiod +/* it seems to me that the -I shouldn't be necessary, but there seems +to be a bug in the Imake stuff, so here it is. */ +HESDEF = -DHESIOD -I/usr/athena/include +#else +HESLIB = +HESDEF = +#endif + +#ifdef AFS +#ifndef AFSDIR +AFSDIR = /usr/afsws +#endif +#ifdef AFS33 +#define AFS33LIB -laudit +#else +#define AFS33LIB +#endif +/* Auxilliary libs needed for AFS */ +/* Both HPUX and Solaris need the BSD libraries. We need -lc before + * the bsd library to avoid using any more of it than is necessary. + */ +#if defined(HPArchitecture) +#define AFSAUXLIB -lc -lBSD +/* This is probably a kludge, but so is imake. */ +#else +#if defined(SunArchitecture) && (OSMajorVersion == 5) +#define AFSAUXLIB -lsocket -lnsl -lc -lucb +#else +#define AFSAUXLIB +#endif +#endif /* AFSAUXLIB */ +AFSLIB = -L$(AFSDIR)/lib -L$(AFSDIR)/lib/afs -lkauth -lprot -lubik\ + -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\ + $(AFSDIR)/lib/afs/util.a AFS33LIB AFSAUXLIB +AFSDEF = -DAFS -I$(AFSDIR)/include +#else +AFSLIB = +AFSDEF = +#endif + +/* This is encore specific, but I don't know what encore's #define is, +and it shouldn't hurt to have it here, so here it is */ +PARALLEL=12 # Make the multi-max run fast. + +#ifndef TcshTop +#define TcshTop /usr/local +#endif +TCSHTOP = TcshTop + +#ifndef ManSuffix +#define ManSuffix 1 +#endif +MANSUFFIX = ManSuffix + +#ifdef TcshPath +PATH_TCSHELL = TcshPath +TCSHPATH = -D_PATH_TCSHELL='"$(PATH_TCSHELL)"' +#else +TCSHPATH = +#endif + +#ifdef DestBin +TCSH_BINDIR = DestBin +#else +TCSH_BINDIR = $(TCSHTOP)/bin +#endif +#ifdef DestMan +TCSH_MANDIR = DestMan +#else +TCSH_MANDIR = $(TCSHTOP)/man/man$(MANSUFFIX) +#endif + +LOCALLIBS = + +#ifndef MyCflags +#define MyCflags +#endif + +#ifndef MyDefines +#define MyDefines +#endif + +#ifndef MyIncludes +#define MyIncludes +#endif + +#ifndef MyStdc +#define MyStdc +#endif + +#ifdef CDebugFlags +CDEBUGFLAGS = CDebugFlags +#else +# if HasGcc2 +CDEBUGFLAGS = -O2 +# else +CDEBUGFLAGS = -O +# endif +#endif + + +#ifdef HostType +HOSTTYPE=HostType +HTDEF = -DHOSTTYPE='"$(HOSTTYPE)"' +#else +HTDEF = +#endif + +DEFINES = $(TCSHPATH) $(HESDEF) $(AFSDEF) $(HTDEF) MyDefines MyCflags MyStdc +INCLUDES = -I. MyIncludes +#ifdef MyLibs +LDLIBS = MyLibs +#endif + +SUF = o +VERSION = 6.12 + +SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \ + sh.char.c 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 glob.c \ + sh.char.h sh.dir.h sh.proc.h sh.h \ + sh.decls.h glob.h ${SYSSRCS} +SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ + 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} ${SYSOBJS} + +TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \ + tw.comp.c tw.color.c +TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ + tw.comp.${SUF} tw.color.${SUF} + +EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \ + ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h +EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ + ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} + +TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ + tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ + tc.who.c tc.h +TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ + tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \ + tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ + tc.vers.${SUF} tc.who.${SUF} + +MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \ + FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \ + tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ + Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ + Makefile.in configure.ac Makefile.win32 aclocal.m4 +CONFSRCS=config/[a-z]* + + +SRCS = $(SHSRCS) $(TWSRCS) $(EDSRCS) $(TCSRCS) +OBJS = $(SHOBJS) $(TWOBJS) $(EDOBJS) $(TCOBJS) + +ALLSRCS= $(MISCF) $(SRCS) $(EXTF) + +AllTarget(tcsh) + +ed.defns.h: config.h ed.defns.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_ed_defns' >> $@ + @echo '#define _h_ed_defns' >> $@ + egrep '[FV]_' ed.defns.c | egrep '^#define' >> $@ + @echo '#endif /* _h_ed_defns */' >> $@ + +sh.err.h: config.h sh.err.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_sh_err' >> $@ + @echo '#define _h_sh_err' >> $@ + egrep 'ERR_' sh.err.c | egrep '^#define' >> $@ + @echo '#endif /* _h_sh_err */' >> $@ + +tc.const.h: config.h tc.const.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_tc_const' >> $@ + @echo '#define _h_tc_const' >> $@ + ${CC} -E $(INCLUDES) ${DEFINES} -D_h_tc_const tc.const.c | \ + grep 'Char STR' | \ + sed -e 's/Char \([a-zA-Z0-9_]*\)\[\].*/extern Char \1[];/' | \ + sort >> $@ + @echo '#endif /* _h_tc_const */' >> $@ + +config.h: config_f.h + cp config/ConfigH config.h + +$(OBJS): sh.err.h tc.const.h ed.defns.h + +tar.Z: + rm -f tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tar.gz: + rm -f tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + +shar: + rm -f tcsh-*.shar + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \ + tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \ + tcsh-${VERSION}/?*/set?* + rm -rf tcsh-${VERSION} + +catalogs: + @(cd nls; make catalogs) + +world: + $(MAKE) clean ; $(MAKE) depend ; $(MAKE) tcsh ; $(MAKE) install + +clean:: + rm -f ed.defns.h sh.err.h tc.const.h config.h tc.defs.* + rm -f tcsh.*.m tcsh.*.cat + +depend:: config.h ed.defns.h sh.err.h tc.const.h $(SRCS) tc.defs.c + +tc.defs.${SUF}: tc.defs.c sh.h + +tc.defs.c: gethost host.defs + @rm -f $@ + @echo "/* Do not edit this file, make creates it */" > $@ + ./gethost host.defs >> $@ + +ALIB=$(HESLIB) $(AFSLIB) $(SYSLIBS) +AINC=ed.defns.h sh.err.h tc.const.h sh.h + +NormalProgramTarget(tcsh, $(OBJS), $(AINC), $(LOCALLIBS), $(ALIB)) +NormalProgramTarget(gethost, gethost.${SUF}, $(AINC), $(LOCALLIBS), $(ALIB)) + +InstallProgram(tcsh,$(TCSH_BINDIR)) +InstallManPage(tcsh,$(TCSH_MANDIR)) +DependTarget() Index: vendor/tcsh/6.21.00-83c5be0/MAKEDIFFS =================================================================== --- vendor/tcsh/6.21.00-83c5be0/MAKEDIFFS (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/MAKEDIFFS (revision 353870) @@ -0,0 +1,40 @@ +#!/bin/sh +# +# MAKEDIFFS.sh: Make context diffs for the csh sources +# +XINUDIR=/usr/share/src/mtXinu/bin/csh +BSDDIR=/usr/share/src/mtXinu/BSD/bin/csh +TAHOEDIR=/usr/share/src/mtXinu/TAHOE/bin/csh +RENODIR=/usr/share/src/mtXinu/RENO/bin/csh +TCSHDIR=`pwd` +case "x$1" in +xxinu) + CSHDIR=$XINUDIR;; +xbsd) + CSHDIR=$BSDDIR;; +xtahoe) + CSHDIR=$TAHOEDIR;; +xreno) + CSHDIR=$RENODIR;; +x*) + echo "Usage: `basename $0` [bsd|tahoe|xinu|reno]";exit 1;; +esac +DIFF1='sh.c sh.char.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.exp.c sh.file.c' +DIFF2='sh.func.c sh.glob.c sh.hist.c sh.init.c sh.lex.c sh.misc.c sh.parse.c sh.print.c' +DIFF3='sh.proc.c sh.sem.c sh.set.c sh.time.c sh.char.h sh.dir.h sh.h sh.local.h sh.proc.h' + +for i in $DIFF1 +do + diff -c $CSHDIR/$i $TCSHDIR/$i +done > DIFFS.1 + +for i in $DIFF2 +do + diff -c $CSHDIR/$i $TCSHDIR/$i +done > DIFFS.2 + +for i in $DIFF3 +do + diff -c $CSHDIR/$i $TCSHDIR/$i +done > DIFFS.3 +exit 0 Property changes on: vendor/tcsh/6.21.00-83c5be0/MAKEDIFFS ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: vendor/tcsh/6.21.00-83c5be0/MAKESHAR =================================================================== --- vendor/tcsh/6.21.00-83c5be0/MAKESHAR (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/MAKESHAR (revision 353870) @@ -0,0 +1,120 @@ +#!/bin/sh +# +# MAKESHAR.sh: Make a shar file for the sources +# + +AWK=/usr/bin/nawk # Must be nawk or gawk cause of 2D arrays +WC=/usr/ucb/wc +GREP=/usr/bin/egrep +SORT=/usr/bin/sort +SH=/bin/sh + +dirs= +name=kit +files= +verbose=0 +size=45000 + +for i +do + case $i in + -n) + name=;; + -v) + verbose=1;; + -d) + SH=/bin/cat;; + -s) + size=$1;; + *) + if [ -z "$name" ] + then + name=$i + elif [ -d $i ] + then + dirs="$dirs $i" + elif [ -f $i ] + then + files="$files $i" + else + echo "$0: File `$i' not found." 1>&2 + exit 1 + fi;; + esac +done + +if [ \( -z "$files" \) -a \( -z "$dirs" \) ] +then + echo "Usage: $0 [-n name] [-s size] [-vd] ." 1>&2 + exit 1 +fi + +$WC $files | $GREP -v total | $SORT +2 | $AWK ' + BEGIN { + i = 0; + seq = 1; + size = 0; + name = 1; + used = 2; + verbose='"$verbose"'; + tty = "/dev/tty"; + maxsize = '"$size"'; + dirs = "'"$dirs"'"; + }; + { + a[i, size] = $3; + a[i, name] = $4; + a[i, used] = 0; + i++; + }; + END { + for (maxi = i--; i >= 0; i--) { + idx = 0; + if (a[i, used] == 0) { + if (verbose && a[i, size] > maxsize) + printf("Warning: File %s is %d > %d\n", + a[i, name], a[i, size], maxsize) > tty; + s = a[i, size]; + a[i, used] = 1; + kit[seq, idx++] = i; + j = 0; + while (j < maxi) { + # Find the greatest file we can add + j = maxi; + for (k = 0; k < maxi; k++) + if (a[k, used] == 0 && a[k, size] + s < maxsize) + j = k; + if (j < maxi) { + s += a[j, size]; + a[j, used] = 1; + kit[seq, idx++] = j; + } + } + sizes[seq] = s; + kit[seq++, idx] = -1; + } + } + for (i = 1; i < seq; i++) { + printf("shar -n%d -e%d %s ", i, seq - 1, dirs); + if (verbose) { + printf("%3d of %3d: ", i, seq - 1) > tty; + len = 12; + } + for (j = 0; kit[i, j] != -1; j++) { + s = a[kit[i, j], name]; + if (verbose) { + clen = length(s) + 1; + len += clen; + if (len > 70) { + printf("\n ") > tty; + len = 12 + clen; + } + printf("%s ", s) > tty; + } + printf("%s ", s); + } + printf("> '"$name"'-%d.shar;", i); + if (verbose) + printf("= %5d\n", sizes[i]) > tty; + } + }' | $SH Property changes on: vendor/tcsh/6.21.00-83c5be0/MAKESHAR ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: vendor/tcsh/6.21.00-83c5be0/Makefile.in =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Makefile.in (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Makefile.in (revision 353870) @@ -0,0 +1,777 @@ +# +# C Shell with process control; VM/UNIX VAX Makefile +# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria +# +# With an input editor, command completion, etc. and ported to all sorts of +# things; Paul Placeway, CIS Dept., Ohio State University +# +SHELL=/bin/sh +VERSION=@PACKAGE_VERSION@ +BUILD=tcsh$(EXEEXT) +VPATH=@srcdir@ +srcdir=@srcdir@ + +################################################################ +## CFLAGS. For various -D things, see config.h +################################################################ +# +# These are the default suffixes from .c to .o and -c to get there +# but to use the global optimizer on the mips boxes, see below +# +SUF=o +CF=-c + +CPPFLAGS=-I. -I$(srcdir) + +LFLAGS= +# hpux lint +#LFLAGS= -Zn10000 + + +# This is set by autoconf: +CFLAGS = @CFLAGS@ +# debug: +#CFLAGS= -g +# production: +#CFLAGS= -O +# Broken optimizers.... +#CFLAGS= + +#CFLAGS= -g -pg -DPROF +#CFLAGS= -O -pg -DPROF + +# gcc 1.00-1.37 +#CFLAGS= -O -finline-functions -fstrength-reduce + +# gcc 1.37-1.40 +#CFLAGS= -O -fcombine-regs -finline-functions -fstrength-reduce +# add -msoft-float for 68881 machines. + +# gcc 2.0 +# On the sparc, don't use -O2; it breaks setjmp() and vfork() +#CFLAGS= -O + +# gcc-2.1+ +#CFLAGS= -O2 + +# lucid c on suns +#CFLAGS= -O5 + +# gcc 2.1 on linux +#CFLAGS= -O6 -fomit-frame-pointer + +# HP/UX 8.0, 9.0 +#CFLAGS= +O3 -Aa + +# Ultrix 4.2a +#CFLAGS= -O -Olimit 2000 + +# Intel Paragon OSF/1 with PGI compilers +#CFLAGS= -O -Mnodebug -Mnoperfmon + +# DEC Alpha OSF/1 +## Normal Optimization +#CFLAGS= -O2 -Olimit 2000 +## Full Optimization - may not work +#CFLAGS= -O3 -Olimit 2000 +#CF=-j +#SUF=u +#.SUFFIXES: .u + +# for silicon graphics (and other mips compilers) -- use the +# global optimizer! (-O3). +# On SGI 4.0+ you need to add -D__STDC__ too. +#CFLAGS= -O3 +## Ultrix 4.2a +#CFLAGS= -O3 -Olimit 2000 +#CF=-j +#SUF=u +#.SUFFIXES: .u ## Ultrix and gnu-make need that + +# mips systems +# CFLAGS= -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000 + +# for at&t machines +#CFLAGS= -O -Ksd + +# Stardent Titan +#CFLAGS = -O -43 + +# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc +#CFLAGS = -O4 + +# Intergraph clipper CLIX 3.1 +#CFLAGS= -w -O2 + +# Dnix 5.3 +#CFLAGS = -O -X7 + +# Pyramid OS/x +#CFLAGS = -OG + +# Multiflow (5M binary... if you choose -O5!) +#CFLAGS = -O5 -sb_trace 0 + +# DDE Supermax Unix SYSV Rel III. +# CFLAGS= -O3 + +# SINIX RMx00 +#CFLAGS= -O# -D_POSIX_SOURCE# -kansi + +# Apollo's with cc [apollo builtins don't work with gcc] +# and apollo should not define __STDC__ if it does not have +# the standard header files. RT's (aos4.3) need that too; +# you might want to skip the -O on the rt's... Not very wise. +# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA) +#DFLAGS=-U__STDC__ +#DFLAGS=-D_IBMESA +# On aix2.2.1 we need more compiler space. +#DFLAGS=-Nd4000 -Nn3000 +# AU/X 2.0 needs a flag for POSIX (read the config file) +#DFLAGS=-Zp +# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs: +#DFLAGS = -DUTek -DBSD +# VMS_POSIX needs: +#DFLAGS=-D_VMS_POSIX +# Multiflow and PCC compilers don't like void typedefs. +# You may also need -U__STDC__ if you use pcc (i.e. ibmrt aos4.3). +#DFLAGS=-DMULTIFLOW +#DFLAGS=-DPCC +# DELL SVR4 +#DFLAGS=-DDELL +#DFLAGS= +#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"' +## The following is set by autoconf. +DFLAGS = -D_PATH_TCSHELL='"${bindir}/tcsh"' @DFLAGS@ @CPPFLAGS@ + + +################################################################ +## LDFLAGS. Define something here if you need to +################################################################ +## This is set by autoconf: +LDFLAGS= @LDFLAGS@ +## The simplest, suitable for all. +#LDFLAGS= +## Stripped. Takes less space on disk. +#LDFLAGS= -s +## Pure executable. Spares paging over the network for machines with +## local swap but external /usr/local/bin . +#LDFLAGS= -s -n +## Without dynamic linking. (SunOS/cc) +#LDFLAGS= -s -n -Bstatic +## Without dynamic linking. (SunOS/gcc) +#LDFLAGS= -s -n -static +## Stripped, shared text (Unicos) +#LDFLAGS= -Wl,-s,-n +## Link statically. (linux) +#LDFLAGS= -s -static +## Impure executable (linux) +#LDFLAGS= -s -N + +################################################################ +## SBINLDFLAGS. Flags to build a tcsh suitable for installation in +## in /sbin under Solaris with gcc. See the "tcsh.sbin" +## target. +################################################################ +SBINLDFLAGS=-Wl,-R/etc/lib,-I/etc/lib/ld.so.1,-ldl,-Bstatic + +################################################################ +## LIBES. Pick one, or roll your own. +################################################################ +## This is set by autoconf. +LIBES= @LIBS@ +## BSD style things +#LIBES= -ltermcap +## SunOS, HP-UX, pyramid +#LIBES= -ltermcap +## Linux +#LIBES= -ltermcap +## Linux with PW_SHADOW +#LIBES= -ltermcap -lshadow +## Tek XD88/10 (UTekV) with PW_SHADOW +#LIBES= -ltermcap -lsec +## Motorola MPC (sysV88) with PW_SHADOW +#LIBES= -ltermcap -lsec +## Mach +#LIBES= -ltermcap -lcs +## DEC osf1 on the alpha +#LIBES= -ltermcap -lbsd +## Intel paragon +#LIBES= -ltermcap -lbsd +## Clipper intergraph +#LIBES= -ltermcap -lbsd +## Sequent's Dynix +#LIBES= -ltermcap -lseq +## Ultrix with Enhanced Security +#LIBES= -ltermcap -lauth +## Xenix 386 style things +#LIBES= -ltermcap -ldir -lx +## masscomp RTU6.0 +#LIBES= -ltermcap -lndir -lsocket -ljobs +## AIX on the rt +#LIBES= -lcurses +## TitanOS on the stellar +#LIBES= -lcurses +## SysV4 w/o BSDTIMES or Solaris 2 +#LIBES= -ltermlib -lsocket -lnsl +## SysV3 w/o networking +#LIBES= -lcurses +## SysV3 with networking +#LIBES= -lcurses -lnet +## SysV2 w/o networking & dirlib +#LIBES= -lcurses -ldir +## SysV2 with networking & dirlib +#LIBES= -lcurses -ldir -lnet +## AIX on the IBM 370 or rs6000 or ps2 +#LIBES= -lcurses -lbsd +## ETA10 +#LIBES= -lcurses -lbsd +## Irix3.1 on the SGI-IRIS4D +#LIBES= -lcurses -lbsd +## Irix3.3 on the SGI-IRIS4D w/o yp +#LIBES= -lcurses -lbsd -lc_s +## Irix3.3 on the SGI-IRIS4D with yp +#LIBES= -lcurses -lsun -lbsd -lc_s +## Amdahl UTS 2.1 +#LIBES= -lcurses -lsocket -lbsd +## Intel's hypercube. +#LIBES= -lcurses -lsocket +## ns32000 based Opus. +#LIBES= -lcurses -lsocket +## ISC 2.2 without networking +#LIBES= -lcurses -lcposix +## ISC 2.2 with networking +#LIBES= -lcposix -lc_s -lcurses -linet +## ISC 2.0.2 without networking +#LIBES= -lcurses -lsec -lc_s +## ISC 2.0.2 with networking +#LIBES= -lcurses -linet -lsec -lc_s +## SCO SysVR3.2v2.0 +#LIBES= -lcurses -lintl -lcrypt +## SCO+ODT1.1 +#LIBES= -lcurses -lintl -lsocket -lcrypt +## A/UX 2.0 +#LIBES= -lposix -ltermcap +## A/UX 3.0 +#LIBES= -lposix -ltermcap -lc_s +## att3b1 cc w/o shared lib & dirlib +#LIBES= -ldirent -lcurses +## att3b1 gcc with shared lib & dirlib +#LIBES= -shlib -ldirent -lcurses +## SysV4 with BSDTIMES +#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a +## Stardent Vistra +#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a +## emx under OS/2 +#LIBES= -ltermc +## Minix, VMS_POSIX +#LIBES= +## Multiflow +#LIBES= -ltermcap -lcrypt +## NetBSD +#LIBES= -ltermcap -lcrypt +## DDE Supermax +#LIBES= -lcurses + +################################################################ +## EXTRAFLAGS and EXTRALIBS +################################################################ +# Compiling for AFS with kerberos authentication +#AFSLIBDIR = /usr/afsws/lib +#AFSDEF = -DAFS -I/usr/afsws/include +#AFS33LIB = -laudit +# +#Solaris and HPUX require the BSD libraries with AFS. +#We use -lc to use only what we require. +# Solaris +#AFSAUXLIB = -lsocket -lnsl -lc -lucb +# HPUX +#AFSAUXLIB = -lc -lBSD +# +#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\ +# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\ +# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB) +# + +EXTRAFLAGS = @HESDEF@ $(AFSDEF) +EXTRALIBS = @HESLIB@ $(AFSLIB) @LIBICONV@ + + + +# The difficult choice of a c-compiler... +# First, you should try your own c-compiler. +# Gcc -traditional is also a safe choice. +# If you think that you have good include files try gcc -Wall... +# If you want to take out -traditional, make sure that your sys/ioctl.h +# is fixed correctly, otherwise you'll be stopped for tty input, or you +# will lose the editor and job control. + +# This is for setting your C preprocessor value. +# This is set by autoconf. +CPP = @CPP@ +# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which +# 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 -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 +# BSDI2.1 w/ shared libraries +#CC= shlicc +#CC= cc +#CC= occ +#CC= acc +#CC= pcc +#CC= hc -w +# For VMS/POSIX +#CC= c89 +# For suns, w/o gcc and SVR4 +#CC= /bin/cc +# FPS 500 (+FPX) with Sun C compiler +#CC= /usr/lib/sun.compile/cc +# Solaris 2.1 +#CC= /opt/SUNWspro/bin/cc +# Alliant fx2800 +#CC= scc +# for NEC SX-4 +#CC= cc -h0,ansi,novector,float0 +#CC= lcc -wa +CC_FOR_GETHOST = @CC_FOR_GETHOST@ +ED= ed +AS= as +RM= rm +CXREF= /usr/ucb/cxref +VGRIND= csh /usr/ucb/vgrind +CTAGS= /usr/ucb/ctags +#XSTR= /usr/ucb/xstr +SCCS= /usr/local/sccs +# Make the multi-max run fast. +PARALLEL=12 +# Use Sequent's parallel make +#P=& +P= +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@ +mandir=@datarootdir@/man +MANSECT=1 +DESTBIN=${DESTDIR}${bindir} +DESTMAN=${DESTDIR}${mandir}/man${MANSECT} +# A/UX +# DESTMAN=${DESTDIR}/catman/man${MANSECT} +# Stardent Vistra (SysVR4) +# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} +# Amiga unix (SysVR4) +# DESTMAN=/usr/catman/1l +EXEEXT=@EXEEXT@ +FTPAREA=/usr/spool/ftp + +BUILD_CATALOGS = @BUILD_CATALOGS@ + +ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ + 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 \ + tw.color.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} \ + 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} 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 \ + tw.comp.c tw.color.c +TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ + tw.comp.${SUF} tw.color.${SUF} + +EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \ + ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h +EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ + ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} + +TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ + tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ + tc.who.c tc.h +TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ + tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} tc.printf.${SUF} \ + tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ + tc.vers.${SUF} tc.who.${SUF} + +PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32 +AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ + WishList config_f.h eight-bit.me glob.3 patchlevel.h \ + pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ + complete.tcsh vmsreadme.txt termcap.vms snames.h 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/parenthesis.at tests/syntax.at \ + tests/subst.at tests/variables.at tests/sh.dol.at + +VHSRCS=${PVSRCS} ${AVSRCS} + +CONFSRCS=config/* + +ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS} +DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS} $(TESTFILES) + + +OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS} + + +all: ${BUILD} catalogs + +tcsh$(EXEEXT):$(P) ${OBJS} + rm -f tcsh$(EXEEXT) core + ${CC} -o tcsh$(EXEEXT) ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} + +tcsh.sbin:$(P) ${OBJS} + rm -f tcsh.sbin core + ${CC} -o tcsh.sbin ${SBINLDFLAGS} ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} + +# Purify +pure:$(P) ${OBJS} + rm -f tcsh$(EXEEXT) core + purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh$(EXEEXT) ${LDFLAGS} ${CFLAGS} ${CPPFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} +# OS/2 +#tcsh.exe: tcsh +# emxbind tcsh + +gethost: gethost.c sh.err.h tc.const.h sh.h + rm -f gethost + ${CC_FOR_GETHOST} -o gethost ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} $(srcdir)/gethost.c + +tc.defs.c: gethost host.defs + @rm -f $@.tmp + @echo "/* Do not edit this file, make creates it */" > $@.tmp + ./gethost $(srcdir)/host.defs >> $@.tmp + @if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi + +tcsh.ps: tcsh.man + rm -f tcsh.ps + -ptroff -t -man $(srcdir)/tcsh.man > tcsh.ps + +.c.${SUF}: + ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< + +.SUFFIXES: .s .i + +.c.i: + ${CC} -E ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< | cat -s > $@ + +.c.s: + ${CC} -S ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< + +# _VMS_POSIX #module addition +#.c.${SUF}: +# @(echo '#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c +# @echo ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c +# @${CC} ${CF} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c +# @mv $*..o $*.o +# @rm -f $*..c + + +# Don't do any special massaging of C files for sharing of strings!! +# it causes weird segmentation faults on some systems. +#.c.o: +# ${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c - +# ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} x.c +# mv -f x.o $*.o +# rm -f x.c + +#ed.init.o: ed.init.c +# ${CPP} ${CFLAGS} ${CPPFLAGS} $*.c | ${XSTR} -c - +# ${CC} -R ${CF} ${CFLAGS} ${CPPFLAGS} x.c +# mv -f x.o $*.o +# rm -f x.c + +#strings.o: strings +# ${XSTR} +# ${CC} -c -R xs.c +# mv -f xs.o strings.o +# rm -f xs.c + +##.DEFAULT: +## ${SCCS} get $< + +##.DEFAULT: +## co $< + +ed.defns.h: ed.defns.c + @rm -f $@.tmp + @echo '/* Do not edit this file, make creates it. */' > $@.tmp + @echo '#ifndef _h_ed_defns' >> $@.tmp + @echo '#define _h_ed_defns' >> $@.tmp + grep '[FV]_' $(srcdir)/ed.defns.c | grep '^#define' >> $@.tmp + @echo '#endif /* _h_ed_defns */' >> $@.tmp + @if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi + +sh.err.h: sh.err.c + @rm -f $@.tmp + @echo '/* Do not edit this file, make creates it. */' > $@.tmp + @echo '#ifndef _h_sh_err' >> $@.tmp + @echo '#define _h_sh_err' >> $@.tmp + grep 'ERR_' $(srcdir)/sh.err.c | grep '^#define' >> $@.tmp + @echo '#endif /* _h_sh_err */' >> $@.tmp + @if [ -f $@ ] && cmp -s $@.tmp $@; then echo $@ unchanged.; rm -f $@.tmp; else mv -f $@.tmp $@; echo $@ recreated.; fi + +tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h + @rm -f $@.tmp + @echo '/* Do not edit this file, make creates it. */' > $@.tmp + @echo '#ifndef _h_tc_const' >> $@.tmp + @echo '#define _h_tc_const' >> $@.tmp + ${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' | \ + 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.ac + { \ + echo '# Signature of the current package.'; \ + echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ + echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ + echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ + echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ + echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ + } >$(srcdir)/tests/package.m4 + +$(srcdir)/tests/testsuite: $(srcdir)/tests/package.m4 $(srcdir)/tests/testsuite.at $(TESTFILES) + autom4te --language=autotest -I $(srcdir)/tests \ + $(srcdir)/tests/testsuite.at -o $@.tmp + mv $@.tmp $@ + +atconfig: config.status + $(SHELL) ./config.status ./atconfig + + +csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF} + rm -f csh.prof + ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc + +sh.prof.${SUF}: + cp sh.c sh.prof.c + ${CC} ${CF} ${CFLAGS} ${CPPFLAGS} -DPROF sh.prof.c + +lint: tc.const.h ed.defns.h + lint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +alint: tc.const.h ed.defns.h + alint ${DFLAGS} ${CPPFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +print: + @pr READ_ME + @pr makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -h SIZES + @${CXREF} sh*.c | pr -h XREF + @ls -l | pr + @pr sh*.h [a-rt-z]*.h sh*.c alloc.c + +vprint: + @pr -l84 READ_ME TODO + @pr -l84 makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES + @${CXREF} sh*.c | pr -l84 -h XREF + @ls -l | pr -l84 + @${CXREF} sh*.c | pr -l84 -h XREF + @pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c + +vgrind: + @cp /dev/null index + @for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @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) + chmod 755 ${DESTBIN}/tcsh$(EXEEXT) + +install.catalogs: + @test "x${BUILD_CATALOGS}" = "xyes" && (cd nls; ${MAKE} install DESTDIR=${DESTDIR}) || exit 0 + +install.man: tcsh.man + -mkdir -p ${DESTMAN} + -rm -f ${DESTMAN}/tcsh.${MANSECT} + cp $(srcdir)/tcsh.man ${DESTMAN}/tcsh.${MANSECT} + chmod 444 ${DESTMAN}/tcsh.${MANSECT} + +# Amiga Unix +#install.man: tcsh.man +# compress tcsh.man +# cp tcsh.man.Z ${DESTMAN}/tcsh.Z +# chmod 444 ${DESTMAN}/tcsh.Z + +# Apple A/UX +#install.man: tcsh.man +# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z +# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z +# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z + +clean: clean.catalogs + ${RM} -f a.out strings x.c xs.c tcsh$(EXEEXT) tcsh.a _MAKE_LOG gethost + ${RM} -f *.${SUF} *.i *.s + ${RM} -f sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c + ${RM} -f tcsh.*.m tcsh.*.cat + +clean.catalogs: + @test "x${BUILD_CATALOGS}" = "xyes" && (cd nls; ${MAKE} clean) || exit 0 + +veryclean: clean + ${RM} -f Makefile config.h config_p.h + ${RM} -f config.status config.cache config.log tcsh.ps + ${RM} -f missing + ${RM} -rf autom4te.cache + ${RM} -f *~ #* + +distclean: veryclean + +cleandir: veryclean + +tags: /tmp + ${CTAGS} sh*.c + +tar.Z: + rm -f tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + -mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tar.gz: + rm -f tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + -mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + +shar: + rm -f tcsh-*.shar + rm -rf tcsh-${VERSION} + -mkdir tcsh-${VERSION} tcsh-${VERSION}/config tcsh-${VERSION}/tests + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \ + tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \ + tcsh-${VERSION}/?*/set?* + rm -rf tcsh-${VERSION} + +catalogs: + @test "x${BUILD_CATALOGS}" = "xyes" && (cd nls; ${MAKE} catalogs) || exit 0 + +tcsh-${VERSION}.tar.Z: + rm -rf tcsh-${VERSION} + rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123] + -mkdir tcsh-${VERSION} tcsh-${VERSION}/tests + ./MAKEDIFFS bsd + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION} + cp ${DISTSRCS} tcsh-${VERSION} + -mkdir tcsh-${VERSION}/config + cp ${CONFSRCS} tcsh-${VERSION}/config + cp Makefile tcsh-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tcsh.tahoe-${VERSION}.tar.Z: + rm -rf tcsh.tahoe-${VERSION} + rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123] + -mkdir tcsh.tahoe-${VERSION} + ./MAKEDIFFS tahoe + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION} + cp ${DISTSRCS} tcsh.tahoe-${VERSION} + -mkdir tcsh.tahoe-${VERSION}/config + cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config + cp Makefile tcsh.tahoe-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z + rm -rf tcsh.tahoe-${VERSION} + +tcsh.reno-${VERSION}.tar.Z: + rm -rf tcsh.reno-${VERSION} + rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123] + -mkdir tcsh.reno-${VERSION} + ./MAKEDIFFS reno + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION} + cp ${DISTSRCS} tcsh.reno-${VERSION} + -mkdir tcsh.reno-${VERSION}/config + cp ${CONFSRCS} tcsh.reno-${VERSION}/config + cp Makefile tcsh.reno-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z + rm -rf tcsh.reno-${VERSION} + +ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z + cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA} + cp tcsh.man ${FTPAREA} + +autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in + +$(srcdir)/configure: $(srcdir)/configure.ac + cd $(srcdir) && autoconf + +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in +$(srcdir)/stamp-h.in: $(srcdir)/configure.ac + cd $(srcdir) && autoheader + @echo timestamp > $(srcdir)/stamp-h.in + +check: atconfig $(srcdir)/tests/testsuite + $(SHELL) $(srcdir)/tests/testsuite + +# +# Dependencies +# +config.h: config_f.h + +TCH=tc.h tc.const.h tc.decls.h tc.nls.h tc.os.h tc.sig.h +SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \ + sh.decls.h ${TCH} +TWH=tw.h tw.decls.h +EDH=ed.h ed.decls.h + +# EDH +EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \ + sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \ + tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF} +${EDOBJS} ${EDINC} : ${EDH} + +# SHH +${OBJS}: config.h ${SHH} + +# TWH +TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \ + sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} tw.color.${SUF} +${TWOBJS} ${TWINC}: ${TWH} + +# 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 + +# tc.defs.o +tc.defs.${SUF}: tc.defs.c sh.h Index: vendor/tcsh/6.21.00-83c5be0/Makefile.std =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Makefile.std (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Makefile.std (revision 353870) @@ -0,0 +1,630 @@ +# +# C Shell with process control; VM/UNIX VAX Makefile +# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria +# +# With an input editor, command completion, etc. and ported to all sorts of +# things; Paul Placeway, CIS Dept., Ohio State University +# +SHELL=/bin/sh +VERSION=6.12 +BUILD=tcsh +srcdir=. + +################################################################ +## CFLAGS. For various -D things, see config.h +################################################################ +# +# These are the default suffixes from .c to .o and -c to get there +# but to use the global optimizer on the mips boxes, see below +# +SUF=o +CF=-c + +INCLUDES=-I. -I$(srcdir) + +LFLAGS=$(INCLUDES) +#LFLAGS=$(INCLUDES) -Zn10000 # hpux lint + + +#CFLAGS= $(INCLUDES) -g # debug +#CFLAGS= $(INCLUDES) -O # production +#CFLAGS= $(INCLUDES) # Broken optimizers.... + +#CFLAGS= -g -pg $(INCLUDES) -DPROF +#CFLAGS= -O -pg $(INCLUDES) -DPROF + +# gcc 1.00-1.37 +#CFLAGS=-O $(INCLUDES) -finline-functions -fstrength-reduce + +# gcc 1.37-1.40 +#CFLAGS=-O $(INCLUDES) -fcombine-regs -finline-functions -fstrength-reduce +# add -msoft-float for 68881 machines. + +# gcc 2.0 +# On the sparc, don't use -O2; it breaks setjmp() and vfork() +#CFLAGS=-O $(INCLUDES) + +# gcc-2.1+ +CFLAGS=-O2 $(INCLUDES) + +# lucid c on suns +#CFLAGS=-O5 $(INCLUDES) + +# gcc 2.1 on linux +#CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES) + +# HP/UX 8.0, 9.0 +#CFLAGS= $(INCLUDES) +O3 -Aa + +# Ultrix 4.2a +#CFLAGS= $(INCLUDES) -O -Olimit 2000 + +# Intel Paragon OSF/1 with PGI compilers +#CFLAGS=-O -Mnodebug -Mnoperfmon $(INCLUDES) + +# DEC Alpha OSF/1 +#CFLAGS= -O2 $(INCLUDES) -Olimit 2000 ## Normal Optimization +#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Full Optimization - may not work +#CF=-j +#SUF=u +#.SUFFIXES: .u + +# for silicon graphics (and other mips compilers) -- use the +# global optimizer! (-O3). +# On SGI 4.0+ you need to add -D__STDC__ too. +#CFLAGS= -O3 $(INCLUDES) +#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Ultrix 4.2a +#CF=-j +#SUF=u +#.SUFFIXES: .u ## Ultrix and gnu-make need that + +# mips systems +# CFLAGS= $(INCLUDES) -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000 + +# for at&t machines +#CFLAGS= -O -Ksd $(INCLUDES) + +# Stardent Titan +#CFLAGS = $(INCLUDES) -O -43 + +# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc +#CFLAGS = $(INCLUDES) -O4 + +# Intergraph clipper CLIX 3.1 +#CFLAGS= -w -O2 $(INCLUDES) + +# Dnix 5.3 +#CFLAGS = -O -X7 + +# Pyramid OS/x +#CFLAGS = -OG + +# Multiflow (5M binary... if you choose -O5!) +#CFLAGS = -O5 -sb_trace 0 + +# DDE Supermax Unix SYSV Rel III. +# CFLAGS= -O3 + +# SINIX RMx00 +#CFLAGS= -O # -D_POSIX_SOURCE # -kansi + +# Minix-VMD +# CFLAGS= -O -D_ANSI_H -I /usr/include/bsdcompat $(INCLUDES) + +# Apollo's with cc [apollo builtins don't work with gcc] +# and apollo should not define __STDC__ if it does not have +# the standard header files. RT's (aos4.3) need that too; +# you might want to skip the -O on the rt's... Not very wise. +# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA) +#DFLAGS=-U__STDC__ +#DFLAGS=-D_IBMESA +# On aix2.2.1 we need more compiler space. +#DFLAGS=-Nd4000 -Nn3000 +# AU/X 2.0 needs a flag for POSIX (read the config file) +#DFLAGS=-Zp +# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs: +#DFLAGS = -DUTek -DBSD +# VMS_POSIX needs: +#DFLAGS=-D_VMS_POSIX +# Multiflow and PCC compilers don't like void typedefs. +# You may also need -U__STDC__ if you use pcc (i.e. ibmrt aos4.3). +#DFLAGS=-DMULTIFLOW +#DFLAGS=-DPCC +# DELL SVR4 +#DFLAGS=-DDELL +# SCO_SV +#DFLAGS=-D_SPEED_T -DSCO +DFLAGS= +#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"' + + +################################################################ +## LDFLAGS. Define something here if you need to +################################################################ +LDFLAGS= ## The simplest, suitable for all. +#LDFLAGS= -s ## Stripped. Takes less space on disk. +#LDFLAGS= -s -n ## Pure executable. Spares paging over +# ## the network for machines with local +# ## swap but external /usr/local/bin . +#LDFLAGS= -s -n -Bstatic ## Without dynamic linking. (SunOS/cc) +#LDFLAGS= -s -n -static ## Without dynamic linking. (SunOS/gcc) +#LDFLAGS= -Wl,-s,-n ## Stripped, shared text (Unicos) +#LDFLAGS= -s -static ## Link statically. (linux) +#LDFLAGS= -s -N ## Impure executable (linux) +#LDFLAGS= -Bdynamic -dy ## SCO_SV + +################################################################ +## LIBES. Pick one, or roll your own. +################################################################ +LIBES= -ltermcap ## BSD style things +#LIBES= -ltermcap ## SunOS, HP-UX, pyramid +#LIBES= -ltermcap ## Linux +#LIBES= -ltermcap -lshadow ## Linux with PW_SHADOW +#LIBES= -ltermcap -lsec ## Tek XD88/10 (UTekV) with PW_SHADOW +#LIBES= -ltermcap -lsec ## Motorola MPC (sysV88) with PW_SHADOW +#LIBES= -ltermcap -lcs ## Mach +#LIBES= -ltermcap -lbsd ## DEC osf1 on the alpha +#LIBES= -ltermcap -lbsd ## Intel paragon +#LIBES= -ltermcap -lbsd ## Clipper intergraph +#LIBES= -ltermcap -lseq ## Sequent's Dynix +#LIBES= -ltermcap -lauth ## Ultrix with Enhanced Security +#LIBES= -ltermcap -ldir -lx ## Xenix 386 style things +#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0 +#LIBES= -lcurses ## AIX on the rt +#LIBES= -lcurses ## TitanOS on the stellar +#LIBES= -ltermlib -lsocket -lnsl ## SysV4 w/o BSDTIMES or Solaris 2 +#LIBES= -lcurses ## SysV3 w/o networking +#LIBES= -lcurses -lnet ## SysV3 with networking +#LIBES= -lcurses -ldir ## SysV2 w/o networking & dirlib +#LIBES= -lcurses -ldir -lnet ## SysV2 with networking & dirlib +#LIBES= -lcurses -lbsd ## AIX on the IBM 370 or rs6000 or ps2 +#LIBES= -lcurses -lbsd ## ETA10 +#LIBES= -lcurses -lbsd ## Irix3.1 on the SGI-IRIS4D +#LIBES= -lcurses -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D w/o yp +#LIBES= -lcurses -lsun -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D with yp +#LIBES= -lcurses -lsocket -lbsd ## Amdahl UTS 2.1 +#LIBES= -lcurses -lsocket ## Intel's hypercube. +#LIBES= -lcurses -lsocket ## ns32000 based Opus. +#LIBES= -lcurses -lcposix ## ISC 2.2 without networking +#LIBES= -lcposix -lc_s -lcurses -linet ## ISC 2.2 with networking +#LIBES= -lcurses -lsec -lc_s ## ISC 2.0.2 without networking +#LIBES= -lcurses -linet -lsec -lc_s ## ISC 2.0.2 with networking +#LIBES= -lcurses -lintl -lcrypt ## SCO SysVR3.2v2.0 +#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1 +#LIBES= -lcurses -lsocket -lcrypt ## SCO_SV +#LIBES= -lposix -ltermcap ## A/UX 2.0 +#LIBES= -lposix -ltermcap -lc_s ## A/UX 3.0 +#LIBES= -ldirent -lcurses ## att3b1 cc w/o shared lib & dirlib +#LIBES= -shlib -ldirent -lcurses ## att3b1 gcc with shared lib & dirlib +#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES +#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra +#LIBES= -ltermc ## emx under OS/2 +#LIBES= ## Minix, VMS_POSIX +#LIBES= -ltermcap -lcrypt ## Multiflow +#LIBES= -ltermcap -lcrypt ## NetBSD +#LIBES= -lcurses ## DDE Supermax + +################################################################ +## EXTRAFLAGS and EXTRALIBS +################################################################ +# Compiling for HESIOD +#HESDEF = -DHESIOD -I/usr/athena/include +#HESLIB = -L/usr/athena/lib -lhesiod +# +# Compiling for AFS with kerberos authentication +#AFSLIBDIR = /usr/afsws/lib +#AFSDEF = -DAFS -I/usr/afsws/include +#AFS33LIB = -laudit +# +#Solaris and HPUX require the BSD libraries with AFS. +#We use -lc to use only what we require. +#AFSAUXLIB = -lsocket -lnsl -lc -lucb # Solaris +#AFSAUXLIB = -lc -lBSD # HPUX +# +#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\ +# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\ +# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB) +# + +EXTRAFLAGS = $(HESDEF) $(AFSDEF) +EXTRALIBS = $(HESLIB) $(AFSLIB) + + +# The difficult choice of a c-compiler... +# First, you should try your own c-compiler. +# Gcc -traditional is also a safe choice. +# If you think that you have good include files try gcc -Wall... +# If you want to take out -traditional, make sure that your sys/ioctl.h +# is fixed correctly, otherwise you'll be stopped for tty input, or you +# will lose the editor and job control. + +# This is for setting your C preprocessor value. +CPP = ${CC} -E +# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which +# on the suns does not know how to make dynamically linked binaries. +CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic +#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux) +#CC= shlicc # BSDI2.1 w/ shared libraries +#CC= cc +#CC= occ +#CC= acc +#CC= pcc +#CC= hc -w +#CC= c89 # For VMS/POSIX +#CC= /bin/cc # For suns, w/o gcc and SVR4 +#CC= /usr/lib/sun.compile/cc # FPS 500 (+FPX) with Sun C compiler +#CC= /opt/SUNWspro/bin/cc # Solaris 2.1 +#CC= scc # Alliant fx2800 +#CC= lcc -wa +#CC= cc -b elf -Kpic # SCO_SV +ED= ed +AS= as +RM= rm +CXREF= /usr/ucb/cxref +#CXREF= /bin/cxref # SCO_SV +VGRIND= csh /usr/ucb/vgrind +CTAGS= /usr/ucb/ctags +#CTAGS= /usr/bin/ctags # SCO_SV +#XSTR= /usr/ucb/xstr +#XSTR= /usr/bin/xstr # SCO_SV +SCCS= /usr/local/sccs +PARALLEL=12 # Make the multi-max run fast. +#P=& # Use Sequent's parallel make +P= +DESTDIR=/usr/local +#DESTDIR=/usr/contrib +MANSECT=1 +DESTBIN=${DESTDIR}/bin +DESTMAN=${DESTDIR}/man/man${MANSECT} +# DESTMAN=${DESTDIR}/catman/man${MANSECT} # A/UX +# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4) +# DESTMAN=/usr/catman/1l # Amiga unix (SysVR4) +FTPAREA=/usr/spool/ftp + +ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ + 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 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} \ + 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} 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 \ + tw.comp.c tw.color.c +TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ + tw.comp.${SUF} tw.color.${SUF} + +EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \ + ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h +EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ + ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} + +TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ + tc.func.c tc.nls.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ + tc.who.c tc.h +TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ + tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} tc.printf.${SUF} \ + tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ + tc.vers.${SUF} tc.who.${SUF} + +PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32 +AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ + WishList config_f.h eight-bit.me glob.3 patchlevel.h \ + pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ + complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ + gethost.c tcsh.man2html configure.ac configure config.h.in \ + aclocal.m4 + +VHSRCS=${PVSRCS} ${AVSRCS} + +CONFSRCS=config/* + +ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS} +DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS} + + +OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS} + + +all: ${BUILD} + +tcsh:$(P) ${OBJS} + rm -f tcsh core + ${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} + +# Purify +pure:$(P) ${OBJS} + rm -f tcsh core + purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} +# OS/2 +tcsh.exe: tcsh + emxbind tcsh + +gethost: gethost.c sh.err.h tc.const.h sh.h + rm -f gethost + ${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${DFLAGS} $(srcdir)/gethost.c ${LIBES} ${EXTRALIBS} + +tc.defs.c: gethost host.defs + @rm -f $@ + @echo "/* Do not edit this file, make creates it */" > $@ + ./gethost $(srcdir)/host.defs >> $@ + +tcsh.ps: tcsh.man + rm -f tcsh.ps + -ptroff -t -man $(srcdir)/tcsh.man > tcsh.ps + + +.c.${SUF}: + ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< + +# _VMS_POSIX #module addition +#.c.${SUF}: +# @(echo '#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c +# @echo ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c +# @${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c +# @mv $*..o $*.o +# @rm -f $*..c + + +# Don't do any special massaging of C files for sharing of strings!! +# it causes weird segmentation faults on some systems. +#.c.o: +# ${CPP} ${CFLAGS} $*.c | ${XSTR} -c - +# ${CC} ${CF} ${CFLAGS} x.c +# mv -f x.o $*.o +# rm -f x.c + +#ed.init.o: ed.init.c +# ${CPP} ${CFLAGS} $*.c | ${XSTR} -c - +# ${CC} -R ${CF} ${CF} x.c +# mv -f x.o $*.o +# rm -f x.c + +#strings.o: strings +# ${XSTR} +# ${CC} -c -R xs.c +# mv -f xs.o strings.o +# rm -f xs.c + +##.DEFAULT: +## ${SCCS} get $< + +##.DEFAULT: +## co $< + +ed.defns.h: ed.defns.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_ed_defns' >> $@ + @echo '#define _h_ed_defns' >> $@ + grep '[FV]_' $(srcdir)/ed.defns.c | grep '^#define' >> $@ + @echo '#endif /* _h_ed_defns */' >> $@ + +sh.err.h: sh.err.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_sh_err' >> $@ + @echo '#define _h_sh_err' >> $@ + grep 'ERR_' $(srcdir)/sh.err.c | grep '^#define' >> $@ + @echo '#endif /* _h_sh_err */' >> $@ + +tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '#ifndef _h_tc_const' >> $@ + @echo '#define _h_tc_const' >> $@ + ${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[];/' | \ + LC_COLLATE=C sort >> $@ + @echo '#endif /* _h_tc_const */' >> $@ + +csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF} + rm -f csh.prof + ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc + +sh.prof.${SUF}: + cp sh.c sh.prof.c + ${CC} ${CF} ${CFLAGS} -DPROF sh.prof.c + +lint: tc.const.h ed.defns.h + lint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +alint: tc.const.h ed.defns.h + alint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +print: + @pr READ_ME + @pr makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -h SIZES + @${CXREF} sh*.c | pr -h XREF + @ls -l | pr + @pr sh*.h [a-rt-z]*.h sh*.c alloc.c + +vprint: + @pr -l84 READ_ME TODO + @pr -l84 makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES + @${CXREF} sh*.c | pr -l84 -h XREF + @ls -l | pr -l84 + @${CXREF} sh*.c | pr -l84 -h XREF + @pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c + +vgrind: + @cp /dev/null index + @for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @vgrind -t -x -h Index index >/crp/bill/csh/index.t + +install: tcsh + -mv -f ${DESTBIN}/tcsh ${DESTBIN}/tcsh.old + cp tcsh ${DESTBIN}/tcsh + -strip ${DESTBIN}/tcsh + chmod 555 ${DESTBIN}/tcsh + +install.man: tcsh.man + -rm -f ${DESTMAN}/tcsh.${MANSECT} + cp $(srcdir)/tcsh.man ${DESTMAN}/tcsh.${MANSECT} + chmod 444 ${DESTMAN}/tcsh.${MANSECT} + +# Amiga Unix +#install.man: tcsh.man +# compress tcsh.man +# cp tcsh.man.Z ${DESTMAN}/tcsh.Z +# chmod 444 ${DESTMAN}/tcsh.Z + +# Apple A/UX +#install.man: tcsh.man +# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z +# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z +# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z + +clean: + ${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost + ${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c + ${RM} -f tcsh.*.m tcsh.*.cat + +veryclean: clean + ${RM} -f config.h config.status config.cache config.log Makefile tcsh.ps + ${RM} -f *~ #* + +distclean: veryclean + +tags: /tmp + ${CTAGS} sh*.c + +tar.Z: + rm -f tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tar.gz: + rm -f tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + +shar: + rm -f tcsh-*.shar + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \ + tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \ + tcsh-${VERSION}/?*/set?* + rm -rf tcsh-${VERSION} + +catalogs: + @(cd nls; make catalogs) + +tcsh-${VERSION}.tar.Z: + rm -rf tcsh-${VERSION} + rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh-${VERSION} + ./MAKEDIFFS bsd + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION} + cp ${DISTSRCS} tcsh-${VERSION} + mkdir tcsh-${VERSION}/config + cp ${CONFSRCS} tcsh-${VERSION}/config + cp Makefile tcsh-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tcsh.tahoe-${VERSION}.tar.Z: + rm -rf tcsh.tahoe-${VERSION} + rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh.tahoe-${VERSION} + ./MAKEDIFFS tahoe + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION} + cp ${DISTSRCS} tcsh.tahoe-${VERSION} + mkdir tcsh.tahoe-${VERSION}/config + cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config + cp Makefile tcsh.tahoe-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z + rm -rf tcsh.tahoe-${VERSION} + +tcsh.reno-${VERSION}.tar.Z: + rm -rf tcsh.reno-${VERSION} + rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh.reno-${VERSION} + ./MAKEDIFFS reno + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION} + cp ${DISTSRCS} tcsh.reno-${VERSION} + mkdir tcsh.reno-${VERSION}/config + cp ${CONFSRCS} tcsh.reno-${VERSION}/config + cp Makefile tcsh.reno-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z + rm -rf tcsh.reno-${VERSION} + +ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z + cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA} + cp tcsh.man ${FTPAREA} + +autoconfigure: $(srcdir)/configure $(srcdir)/config.h.in + +$(srcdir)/configure: $(srcdir)/configure.ac + cd $(srcdir) && autoconf + +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in +$(srcdir)/stamp-h.in: $(srcdir)/configure.ac + cd $(srcdir) && autoheader + @echo timestamp > $(srcdir)/stamp-h.in + +# +# Dependencies +# +config.h: config_f.h + +TCH=tc.h tc.const.h tc.decls.h tc.nls.h tc.os.h tc.sig.h +SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \ + sh.decls.h ${TCH} +TWH=tw.h tw.decls.h +EDH=ed.h ed.decls.h + +# EDH +EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \ + sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \ + tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF} +${EDOBJS} ${EDINC} : ${EDH} + +# SHH +${OBJS}: config.h ${SHH} + +# TWH +TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \ + sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} tw.color.${SUF} +${TWOBJS} ${TWINC}: ${TWH} + +# 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 + +# tc.defs.o +tc.defs.${SUF}: tc.defs.c sh.h Index: vendor/tcsh/6.21.00-83c5be0/Makefile.vms =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Makefile.vms (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Makefile.vms (revision 353870) @@ -0,0 +1,592 @@ +# +# C Shell with process control; VM/UNIX VAX Makefile +# Bill Joy UC Berkeley; Jim Kulp IIASA, Austria +# +# With an input editor, command completion, etc. and ported to all sorts of +# things; Paul Placeway, CIS Dept., Ohio State University +# +SHELL=/bin/sh +VERSION=6.12 +BUILD=tcsh + +################################################################ +## CFLAGS. For various -D things, see config.h +################################################################ +# +# These are the default suffixes from .c to .o and -c to get there +# but to use the global optimizer on the mips boxes, see below +# +SUF=o +CF=-c + +INCLUDES=-I. -I.. + +LFLAGS=$(INCLUDES) +#LFLAGS=$(INCLUDES) -Zn10000 # hpux lint + + +#CFLAGS= $(INCLUDES) -g # debug +#CFLAGS= $(INCLUDES) -O # production +#CFLAGS= $(INCLUDES) # Broken optimizers.... + +#CFLAGS= -g -pg $(INCLUDES) -DPROF +#CFLAGS= -O -pg $(INCLUDES) -DPROF + +# gcc 1.00-1.37 +#CFLAGS=-O $(INCLUDES) -finline-functions -fstrength-reduce + +# gcc 1.37-1.40 +#CFLAGS=-O $(INCLUDES) -fcombine-regs -finline-functions -fstrength-reduce +# add -msoft-float for 68881 machines. + +# gcc 2.0 +# On the sparc, don't use -O2; it breaks setjmp() and vfork() +#CFLAGS=-O $(INCLUDES) + +# gcc-2.1+ +#CFLAGS=-O2 $(INCLUDES) + +# lucid c on suns +#CFLAGS=-O5 $(INCLUDES) + +# gcc 2.1 on linux +#CFLAGS=-O6 -fomit-frame-pointer $(INCLUDES) + +# HP/UX 8.0, 9.0 +#CFLAGS= $(INCLUDES) +O3 -Aa + +# Ultrix 4.2a +#CFLAGS= $(INCLUDES) -O -Olimit 2000 + +# Intel Paragon OSF/1 with PGI compilers +#CFLAGS=-O -Mnodebug -Mnoperfmon $(INCLUDES) + +# DEC Alpha OSF/1 +#CFLAGS= -O2 $(INCLUDES) -Olimit 2000 ## Normal Optimization +#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Full Optimization - may not work +#CF=-j +#SUF=u +#.SUFFIXES: .u + +# for silicon graphics (and other mips compilers) -- use the +# global optimizer! (-O3). +# On SGI 4.0+ you need to add -D__STDC__ too. +#CFLAGS= -O3 $(INCLUDES) +#CFLAGS= -O3 $(INCLUDES) -Olimit 2000 ## Ultrix 4.2a +#CF=-j +#SUF=u +#.SUFFIXES: .u ## Ultrix and gnu-make need that + +# mips systems +# CFLAGS= $(INCLUDES) -O -systype bsd43 -Wf,-XNd5000 -Wf,-XNp6000 -Olimit 2000 + +# for at&t machines +#CFLAGS= -O -Ksd $(INCLUDES) + +# Stardent Titan +#CFLAGS = $(INCLUDES) -O -43 + +# Stardent Stellar or sunos4 /bin/cc or Solaris2.1 /opt/SUNWspro/bin/cc +#CFLAGS = $(INCLUDES) -O4 + +# Intergraph clipper CLIX 3.1 +#CFLAGS= -w -O2 $(INCLUDES) + +# Dnix 5.3 +#CFLAGS = -O -X7 + +# Pyramid OS/x +#CFLAGS = -OG + +# Multiflow (5M binary... if you choose -O5!) +#CFLAGS = -O5 -sb_trace 0 + +# DDE Supermax Unix SYSV Rel III. +# CFLAGS= -O3 + +# Apollo's with cc [apollo builtins don't work with gcc] +# and apollo should not define __STDC__ if it does not have +# the standard header files. RT's (aos4.3) need that too; +# you might want to skip the -O on the rt's... Not very wise. +# AIX/ESA needs -D_IBMESA on command line (this may disappear by GA) +#DFLAGS=-U__STDC__ +#DFLAGS=-D_IBMESA +# On aix2.2.1 we need more compiler space. +#DFLAGS=-Nd4000 -Nn3000 +# AU/X 2.0 needs a flag for POSIX (read the config file) +#DFLAGS=-Zp +# Tektronix 4300 running UTek 4.0 (BSD 4.2) needs: +#DFLAGS = -DUTek -DBSD +# VMS_POSIX needs: +#DFLAGS=-D_VMS_POSIX +# Multiflow +#DFLAGS=-DMULTIFLOW +# DELL SVR4 +#DFLAGS=-DDELL +DFLAGS= +#DFLAGS=-D_PATH_TCSHELL='"${DESTBIN}/tcsh"' + + +################################################################ +## LDFLAGS. Define something here if you need to +################################################################ +LDFLAGS= ## The simplest, suitable for all. +#LDFLAGS= -s ## Stripped. Takes less space on disk. +#LDFLAGS= -s -n ## Pure executable. Spares paging over +# ## the network for machines with local +# ## swap but external /usr/local/bin . +#LDFLAGS= -s -n -Bstatic ## Without dynamic links. (SunOS) +#LDFLAGS= -Wl,-s,-n ## Stripped, shared text (Unicos) +#LDFLAGS= -s -static ## Link statically. (linux) +#LDFLAGS= -s -N ## Impure executable (linux) + +################################################################ +## LIBES. Pick one, or roll your own. +################################################################ +#LIBES= -ltermcap ## BSD style things +#LIBES= -ltermcap ## SunOS, HP-UX, pyramid +#LIBES= -ltermcap ## Linux +#LIBES= -ltermcap -lshadow ## Linux with PW_SHADOW +#LIBES= -ltermcap -lsec ## Tek XD88/10 (UTekV) with PW_SHADOW +#LIBES= -ltermcap -lsec ## Motorola MPC (sysV88) with PW_SHADOW +#LIBES= -ltermcap -lcs ## Mach +#LIBES= -ltermcap -lbsd ## DEC osf1 on the alpha +#LIBES= -ltermcap -lbsd ## Intel paragon +#LIBES= -ltermcap -lbsd ## Clipper intergraph +#LIBES= -ltermcap -lseq ## Sequent's Dynix +#LIBES= -ltermcap -lauth ## Ultrix with Enhanced Security +#LIBES= -ltermcap -ldir -lx ## Xenix 386 style things +#LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0 +#LIBES= -lcurses ## AIX on the rt +#LIBES= -lcurses ## TitanOS on the stellar +#LIBES= -ltermlib -lsocket -lnsl ## SysV4 w/o BSDTIMES or Solaris 2 +#LIBES= -lcurses ## SysV3 w/o networking +#LIBES= -lcurses -lnet ## SysV3 with networking +#LIBES= -lcurses -ldir ## SysV2 w/o networking & dirlib +#LIBES= -lcurses -ldir -lnet ## SysV2 with networking & dirlib +#LIBES= -lcurses -lbsd ## AIX on the IBM 370 or rs6000 or ps2 +#LIBES= -lcurses -lbsd ## ETA10 +#LIBES= -lcurses -lbsd ## Irix3.1 on the SGI-IRIS4D +#LIBES= -lcurses -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D w/o yp +#LIBES= -lcurses -lsun -lbsd -lc_s ## Irix3.3 on the SGI-IRIS4D with yp +#LIBES= -lcurses -lsocket -lbsd ## Amdahl UTS 2.1 +#LIBES= -lcurses -lsocket ## Intel's hypercube. +#LIBES= -lcurses -lsocket ## ns32000 based Opus. +#LIBES= -lcurses -lcposix ## ISC 2.2 without networking +#LIBES= -lcposix -lc_s -lcurses -linet ## ISC 2.2 with networking +#LIBES= -lcurses -lsec -lc_s ## ISC 2.0.2 without networking +#LIBES= -lcurses -linet -lsec -lc_s ## ISC 2.0.2 with networking +#LIBES= -lcurses -lintl -lcrypt ## SCO SysVR3.2v2.0 +#LIBES= -lcurses -lintl -lsocket -lcrypt ## SCO+ODT1.1 +#LIBES= -lposix -ltermcap ## A/UX 2.0 +#LIBES= -lposix -ltermcap -lc_s ## A/UX 3.0 +#LIBES= -ldirent -lcurses ## att3b1 cc w/o shared lib & dirlib +#LIBES= -shlib -ldirent -lcurses ## att3b1 gcc with shared lib & dirlib +#LIBES= -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a ## SysV4 with BSDTIMES +#LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra +#LIBES= -ltermc ## emx under OS/2 +LIBES= ## Minix, VMS_POSIX +#LIBES= -ltermcap -lcrypt ## Multiflow +#LIBES= -ltermcap -lcrypt ## NetBSD +#LIBES= -lcurses ## DDE Supermax + +################################################################ +## EXTRAFLAGS and EXTRALIBS +################################################################ +# Compiling for HESIOD +#HESDEF = -DHESIOD -I/usr/athena/include +#HESLIB = -L/usr/athena/lib -lhesiod +# +# Compiling for AFS with kerberos authentication +#AFSLIBDIR = /usr/afsws/lib +#AFSDEF = -DAFS -I/usr/afsws/include +#AFS33LIB = -laudit +# +#Solaris and HPUX require the BSD libraries with AFS. +#We use -lc to use only what we require. +#AFSAUXLIB = -lsocket -lnsl -lc -lucb # Solaris +#AFSAUXLIB = -lc -lBSD # HPUX +# +#AFSLIB = -L$(AFSLIBDIR) -L$(AFSLIBDIR)/afs -lkauth -lprot -lubik\ +# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err\ +# $(AFSLIBDIR)/afs/util.a $(AFS33LIB) $(AFSAUXLIB) +# + +EXTRAFLAGS = $(HESDEF) $(AFSDEF) +EXTRALIBS = $(HESLIB) $(AFSLIB) + + +# The difficult choice of a c-compiler... +# First, you should try your own c-compiler. +# Gcc -traditional is also a safe choice. +# If you think that you have good include files try gcc -Wall... +# If you want to take out -traditional, make sure that your sys/ioctl.h +# is fixed correctly, otherwise you'll be stopped for tty input, or you +# will lose the editor and job control. + +# The -B tells gcc to use /bin/ld. This is to avoid using the gnu ld, which +# on the suns does not know how to make dynamically linked binaries. +#CC= gcc -Wall -pipe -B/bin/ # -ansi -pedantic +#CC= gcc -m486 -pipe -Wall # Generate code for Intel 486 (linux) +#CC= cc +#CC= occ +#CC= acc +#CC= pcc +#CC= hc -w +CC= c89 # For VMS/POSIX +#CC= /bin/cc # For suns, w/o gcc and SVR4 +#CC= /usr/lib/sun.compile/cc # FPS 500 (+FPX) with Sun C compiler +#CC= /opt/SUNWspro/bin/cc # Solaris 2.1 +#CC= scc # Alliant fx2800 +#CC= lcc -wa +ED= ed +AS= as +RM= rm +CXREF= /usr/ucb/cxref +VGRIND= csh /usr/ucb/vgrind +CTAGS= /usr/ucb/ctags +#XSTR= /usr/ucb/xstr +SCCS= /usr/local/sccs +PARALLEL=12 # Make the multi-max run fast. +#P=& # Use Sequent's parallel make +P= +DESTDIR=/usr/local +MANSECT=1 +DESTBIN=${DESTDIR}/bin +DESTMAN=${DESTDIR}/man/man${MANSECT} +# DESTMAN=${DESTDIR}/catman/man${MANSECT} # A/UX +# DESTMAN=${DESTDIR}/usr/share/man/man${MANSECT} # Stardent Vistra (SysVR4) +# DESTMAN=/usr/catman/1l # Amiga unix (SysVR4) +FTPAREA=/usr/spool/ftp + +ASSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ + 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 \ + vms.termcap.c +SHSRCS= ${ASSRCS} ${PSSRCS} +SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ + sh.char.${SUF} sh.exp.${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} 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 \ + tw.comp.c tw.color.c +TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ + tw.comp.${SUF} tw.color.${SUF} + +EDSRCS= ed.chared.c ed.decls.h ed.defns.c ed.h ed.init.c ed.inputl.c \ + ed.refresh.c ed.screen.c ed.xmap.c ed.term.c ed.term.h +EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ + ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} + +TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ + tc.func.c tc.os.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ + tc.who.c tc.h +TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ + tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.os.${SUF} tc.printf.${SUF} \ + tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ + tc.vers.${SUF} tc.who.${SUF} + +PVSRCS= Makefile.std Makefile.vms Makefile.in Makefile.win32 +AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ + WishList config_f.h eight-bit.me glob.3 patchlevel.h \ + pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ + complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ + gethost.c tcsh.man2html configure.ac aclocal.m4 + +VHSRCS=${PVSRCS} ${AVSRCS} + +CONFSRCS=config/* + +ALLSRCS= ${SHSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${VHSRCS} +DISTSRCS= ${PSSRCS} ${TWSRCS} ${EDSRCS} ${TCSRCS} ${AVSRCS} + + +OBJS= ${SHOBJS} ${TWOBJS} ${EDOBJS} ${TCOBJS} + + +all: ${BUILD} + +tcsh:$(P) ${OBJS} + rm -f tcsh core + ${CC} -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} + +# Purify +pure:$(P) ${OBJS} + rm -f tcsh core + purify `echo ${CC} | sed -e s,-B/bin/,,` -o tcsh ${LDFLAGS} ${CFLAGS} ${OBJS} ${LIBES} ${EXTRALIBS} +# OS/2 +tcsh.exe: tcsh + emxbind tcsh + +gethost: gethost.c sh.err.h tc.const.h sh.h + rm -f gethost + ${CC} -o gethost ${LDFLAGS} ${CFLAGS} ${DFLAGS} gethost.c ${LIBES} ${EXTRALIBS} + +tc.defs.c: gethost host.defs + @rm -f $@ + @echo "/* Do not edit this file, make creates it */" > $@ + ./gethost host.defs >> $@ + +tcsh.ps: tcsh.man + rm -f tcsh.ps + -ptroff -man tcsh.man > tcsh.ps + + +#.c.${SUF}: +# ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $< + +# _VMS_POSIX #module addition +.c.${SUF}: + @(echo '\#module '`echo $< | sed -e 's/\./_/g'`; cat $<) > $*..c + @echo ${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*.c + @${CC} ${CF} ${CFLAGS} ${DFLAGS} ${EXTRAFLAGS} $*..c + @mv $*..o $*.o + @rm -f $*..c + + +# Don't do any special massaging of C files for sharing of strings!! +# it causes weird segmentation faults on some systems. +#.c.o: +# ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c - +# ${CC} ${CF} ${CFLAGS} x.c +# mv -f x.o $*.o +# rm -f x.c + +#ed.init.o: ed.init.c +# ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c - +# ${CC} -R ${CF} ${CF} x.c +# mv -f x.o $*.o +# rm -f x.c + +#strings.o: strings +# ${XSTR} +# ${CC} -c -R xs.c +# mv -f xs.o strings.o +# rm -f xs.c + +##.DEFAULT: +## ${SCCS} get $< + +##.DEFAULT: +## co $< + +ed.defns.h: ed.defns.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '\#ifndef _h_ed_defns' >> $@ + @echo '\#define _h_ed_defns' >> $@ + grep '[FV]_' ed.defns.c | grep '^\#define' >> $@ + @echo '\#endif /* _h_ed_defns */' >> $@ + +sh.err.h: sh.err.c + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '\#ifndef _h_sh_err' >> $@ + @echo '\#define _h_sh_err' >> $@ + grep 'ERR_' sh.err.c | grep '^#define' >> $@ + @echo '\#endif /* _h_sh_err */' >> $@ + +tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h + @rm -f $@ + @echo '/* Do not edit this file, make creates it. */' > $@ + @echo '\#ifndef _h_tc_const' >> $@ + @echo '\#define _h_tc_const' >> $@ + ${CC} -E $(INCLUDES) ${DFLAGS} -D_h_tc_const tc.const.c | \ + grep 'Char STR' | \ + sed -e 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' | \ + sort >> $@ + @echo '\#endif /* _h_tc_const */' >> $@ + +csh.prof: ${OBJS} sh.prof.${SUF} mcrt0.${SUF} + rm -f csh.prof + ld -X mcrt0.${SUF} ${OBJS} -o csh.prof ${LIBES} -lc + +sh.prof.${SUF}: + cp sh.c sh.prof.c + ${CC} ${CF} ${CFLAGS} -DPROF sh.prof.c + +lint: tc.const.h ed.defns.h + lint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +alint: tc.const.h ed.defns.h + alint ${DFLAGS} ${LFLAGS} sh*.c tw*.c ed*.c tc.*.c ${LIBES} + +print: + @pr READ_ME + @pr makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -h SIZES + @${CXREF} sh*.c | pr -h XREF + @ls -l | pr + @pr sh*.h [a-rt-z]*.h sh*.c alloc.c + +vprint: + @pr -l84 READ_ME TODO + @pr -l84 makefile makefile.* + @(size -l a.out; size *.${SUF}) | pr -l84 -h SIZES + @${CXREF} sh*.c | pr -l84 -h XREF + @ls -l | pr -l84 + @${CXREF} sh*.c | pr -l84 -h XREF + @pr -l84 sh*.h [a-rt-z]*.h sh*.c alloc.c + +vgrind: + @cp /dev/null index + @for i in *.h; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @for i in *.c; do vgrind -t -h "C Shell" $$i >/crp/bill/csh/$$i.t; done + @vgrind -t -x -h Index index >/crp/bill/csh/index.t + +install: tcsh + -mv -f ${DESTBIN}/tcsh ${DESTBIN}/tcsh.old + cp tcsh ${DESTBIN}/tcsh + -strip ${DESTBIN}/tcsh + chmod 555 ${DESTBIN}/tcsh + +install.man: tcsh.man + -rm -f ${DESTMAN}/tcsh.${MANSECT} + cp tcsh.man ${DESTMAN}/tcsh.${MANSECT} + chmod 444 ${DESTMAN}/tcsh.${MANSECT} + +# Amiga Unix +#install.man: tcsh.man +# compress tcsh.man +# cp tcsh.man.Z ${DESTMAN}/tcsh.Z +# chmod 444 ${DESTMAN}/tcsh.Z + +# Apple A/UX +#install.man: tcsh.man +# -rm -f ${DESTMAN}/tcsh.${MANSECT}.Z +# nroff -man tcsh.man | compress > ${DESTMAN}/tcsh.${MANSECT}.Z +# chmod 444 ${DESTMAN}/tcsh.${MANSECT}.Z + +clean: + ${RM} -f a.out strings x.c xs.c tcsh tcsh.a _MAKE_LOG core gethost + ${RM} -f *.${SUF} sh.prof.c ed.defns.h tc.const.h sh.err.h tc.defs.c + ${RM} -f tcsh.*.m tcsh.*.cat + +veryclean: clean + ${RM} -f config.h + ${RM} -f *~ #* + +tags: /tmp + ${CTAGS} sh*.c + +tar.Z: + rm -f tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tar.gz: + rm -f tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | gzip > tcsh-${VERSION}.tar.gz + rm -rf tcsh-${VERSION} + +shar: + rm -f tcsh-*.shar + rm -rf tcsh-${VERSION} + mkdir tcsh-${VERSION} tcsh-${VERSION}/config + cp ${ALLSRCS} tcsh-${VERSION} + cp ${CONFSRCS} tcsh-${VERSION}/config + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + MAKESHAR -v -n tcsh-${VERSION} tcsh-${VERSION} \ + tcsh-${VERSION}/?* tcsh-${VERSION}/config/?* \ + tcsh-${VERSION}/?*/set?* + rm -rf tcsh-${VERSION} + +catalogs: + @(cd nls; make catalogs) + +tcsh-${VERSION}.tar.Z: + rm -rf tcsh-${VERSION} + rm -f tcsh-${VERSION}.tar tcsh-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh-${VERSION} + ./MAKEDIFFS bsd + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh-${VERSION} + cp ${DISTSRCS} tcsh-${VERSION} + mkdir tcsh-${VERSION}/config + cp ${CONFSRCS} tcsh-${VERSION}/config + cp Makefile tcsh-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh-${VERSION} | compress > tcsh-${VERSION}.tar.Z + rm -rf tcsh-${VERSION} + +tcsh.tahoe-${VERSION}.tar.Z: + rm -rf tcsh.tahoe-${VERSION} + rm -f tcsh.tahoe-${VERSION}.tar tcsh.tahoe-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh.tahoe-${VERSION} + ./MAKEDIFFS tahoe + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.tahoe-${VERSION} + cp ${DISTSRCS} tcsh.tahoe-${VERSION} + mkdir tcsh.tahoe-${VERSION}/config + cp ${CONFSRCS} tcsh.tahoe-${VERSION}/config + cp Makefile tcsh.tahoe-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.tahoe-${VERSION} | compress > tcsh.tahoe-${VERSION}.tar.Z + rm -rf tcsh.tahoe-${VERSION} + +tcsh.reno-${VERSION}.tar.Z: + rm -rf tcsh.reno-${VERSION} + rm -f tcsh.reno-${VERSION}.tar tcsh.reno-${VERSION}.tar.Z DIFFS.[123] + mkdir tcsh.reno-${VERSION} + ./MAKEDIFFS reno + mv DIFFS.1 DIFFS.2 DIFFS.3 tcsh.reno-${VERSION} + cp ${DISTSRCS} tcsh.reno-${VERSION} + mkdir tcsh.reno-${VERSION}/config + cp ${CONFSRCS} tcsh.reno-${VERSION}/config + cp Makefile tcsh.reno-${VERSION}/Makefile.new + tar cf - nls/Makefile nls/?*/set?* | (cd tcsh-${VERSION}; tar xpf -) + tar cvf - tcsh.reno-${VERSION} | compress > tcsh.reno-${VERSION}.tar.Z + rm -rf tcsh.reno-${VERSION} + +ftp: tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z + cp tcsh-${VERSION}.tar.Z tcsh.tahoe-${VERSION}.tar.Z ${FTPAREA} + cp tcsh.man ${FTPAREA} + +# +# Dependencies +# +config.h: config_f.h + +TCH=tc.h tc.const.h tc.decls.h tc.nls.h tc.os.h tc.sig.h +SHH=sh.h sh.types.h sh.char.h sh.err.h sh.dir.h sh.proc.h pathnames.h \ + sh.decls.h ${TCH} +TWH=tw.h tw.decls.h +EDH=ed.h ed.decls.h + +# EDH +EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \ + sh.set.${SUF} tc.bind.${SUF} tc.os.${SUF} tc.prompt.${SUF} \ + tc.sched.${SUF} tw.parse.${SUF} +${EDOBJS} ${EDINC} : ${EDH} + +# SHH +${OBJS}: config.h ${SHH} + +# TWH +TWINC=ed.chared.${SUF} ed.inputl.${SUF} sh.exec.${SUF} sh.func.${SUF} \ + sh.set.${SUF} tc.func.${SUF} tc.nls.${SUF} +${TWOBJS} ${TWINC}: ${TWH} + +# glob.h +glob.${SUF} sh.glob.${SUF}: glob.h + +# ed.defns.h +EDDINC=tc.bind.${SUF} tc.func.${SUF} tc.os.${SUF} +${EDOBJS} ${EDDINC}: ed.defns.h + +# tc.defs.o +tc.defs.${SUF}: tc.defs.c sh.h Index: vendor/tcsh/6.21.00-83c5be0/Ported =================================================================== --- vendor/tcsh/6.21.00-83c5be0/Ported (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/Ported (revision 353870) @@ -0,0 +1,1073 @@ + +Hello, + +This file contains a list of machines used, libraries compiler etc. If you +find it out-of-date, or you have additions or changes, please let me know. + +christos + + +VENDOR : Sun +MODELS : sun3, sun4, sun386i +COMPILER: cc, gcc, acc +CFLAGS : normal +LIBES : -ltermcap +OS : sunos 3.5, 4.0, 4.1, 4.1.1, 4.1.2, 4.1.3, 4.1.4 +CONFIG : sunos* +ENVIRON : n/a +NOTES : Don't compile with /usr/5bin/cc +VERSION : 6.08 + +VENDOR : Sun +MODELS : sun4, ultra +COMPILER: cc, gcc +CFLAGS : normal +LIBES : -lcurses -lsocket -lnsl +OS : solaris 2.1, 2.2, 2.3, 2.4, 2.5, 2.5.1 +CONFIG : sol* +ENVIRON : n/a +NOTES : The sunpro compiler cannot compile tcsh with -O, it crashes + : on some files. In any case do not use -O with any of the + : tcsh files, because the optimized code assumes that the + : floating point is already initialized and does not do the + : necessary initializations. This results in weird floating + : point failures of programs exec'ed from tcsh. +VERSION : 6.08 + +VENDOR : Sun +MODELS : ultra +COMPILER: WorkShop cc +CFLAGS : normal +LIBES : -lcurses -lsocket -lnsl +OS : solaris 2.6, 2.7, 8 +CONFIG : sol26 +ENVIRON : n/a +NOTES : none +VERSION : 6.08 + +VENDOR : Sun +MODELS : ultra, i686, x86_64 +COMPILER: Sun Studio cc +CFLAGS : normal +LIBES : -lcurses -lsocket -lnsl +OS : solaris 9, 10 +CONFIG : sol29 +ENVIRON : n/a +NOTES : none +VERSION : 6.18 + +VENDOR : Sun +MODELS : i386 +COMPILER: cc, gcc +CFLAGS : -D__STDC__=0 +LIBES : -lcurses -lsocket -lnsl +OS : solaris 2.1 +CONFIG : sol2 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.04.13 + +VENDOR : Sun +MODELS : sun4 +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap +OS : linux 2.0.x, 2.1.x +CONFIG : linux +ENVIRON : n/a +NOTES : none +VERSION : 6.07.03 + +VENDOR : hp +MODELS : apollo +COMPILER: cc +CFLAGS : -U__STDC__ -I. -O +LIBES : -ltermcap +OS : domain 10.4.3 +CONFIG : bsd +ENVIRON : bsd4.3 +NOTES : Don't use gcc; breaks tc.os.c +VERSION : 6.01.00 + +VENDOR : hp +MODELS : hp9000s300, hp9000s700, hp9000s800 +COMPILER: cc, gcc +CFLAGS : normal (-Aa -O3 hpux 8.0, 8.07, 9.05) +LIBES : -ltermcap +OS : hpux 6.5, 7.0.x, 8.0, 9.05 +CONFIG : hpux{7,8} +ENVIRON : n/a +NOTES : Don't use -lBSD; breaks getpgrp(). Config.hp-3.2 obsolete? + : Some versions of the compiler are broken with -O3. Try 'ls *' + : If it does not work, lower the optimization level... +VERSION : 6.05.06 + +VENDOR : hp +MODELS : hp9000s700 +COMPILER: cc, c89, gcc +CFLAGS : +O3 -Aa (cc), +O3 (c89), normal (gcc) +LIBES : -ltermcap +OS : hpux 10.00, 10.01 +CONFIG : hpux8 +ENVIRON : n/a +NOTES : Carl-Olof Almbladh (coa@teorfys.lu.se) + : To make a statically linked version: in config_f.h, #undef NLS + : and use these LDFLAGS in the Makefile: LDFLAGS= -Wl,-a,archive + : [orban@kato.den.csci.csc.com (Tom Orban) +VERSION : 6.08 + +VENDOR : hp +MODELS : SPP-1200 SPP-1600 S-2X00 X-2X00 +COMPILER: cc +CFLAGS : -Ae +LIBES : -ltermcap +OS : SPP-UX 5.X +CONFIG : hpux8 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.07.02 + +VENDOR : hp +MODELS : hp9000s500 +COMPILER: cc +CFLAGS : -I. -O +LIBES : -ltermcap +OS : hpux 5.2 +CONFIG : hp-5.2 +ENVIRON : n/a +NOTES : very slow in executing commands (I think the reason is +NOTES : a very slow fork) +VERSION : 6.00.01 + +VENDOR : digital +MODELS : vax +COMPILER: cc, gcc +CFLAGS : normal +LIBES : -ltermcap +OS : bsd4.3, bsd4.4 +CONFIG : bsd* +ENVIRON : n/a +NOTES : cc broken: typedef void sigret_t; typedef void pret_t; +VERSION : 6.00.03 + +VENDOR : digital +MODELS : vax +COMPILER: cc, gcc +CFLAGS : normal +LIBES : -ltermcap +OS : mtXinu 4.3 +CONFIG : mtxinu +ENVIRON : n/a +NOTES : cc broken: typedef void sigret_t; typedef void pret_t; +VERSION : 6.03.09 + +VENDOR : digital +MODELS : vax, DECstation +COMPILER: cc, gcc +CFLAGS : -O -Olimit 2000 (cc), normal (gcc) +LIBES : -ltermcap +OS : ultrix 3.0 (vax), 4.0, 4.1, 4.2, 4.3, 4.4, 4.5 +CONFIG : ultrix +ENVIRON : n/a +NOTES : pcc broken: typedef void sigret_t (vax); +NOTES : mips compiler on ultrix 3.5 needs -Dvoid=int +NOTES : vax compiler on ultrix 3.0 needs -Dvoid=int +NOTES : Does Ultrix 4.x still need YPBUGS? +NOTES : Ultrix4.2 may need NAMEI_BUG +VERSION : 6.09.00 + +VENDOR : Apple +MODELS : macII +COMPILER: cc +CFLAGS : normal (-ZP) +LIBES : -ltermcap (-lposix -ltermcap) +OS : aux 2.0 +CONFIG : mac2 (-DPOSIX -DPOSIXJOBS) +ENVIRON : n/a +NOTES : Tcsh can compile both in non POSIX and POSIX mode. The +NOTES : default configuration is non POSIX. The flags in parentheses +NOTES : are the changes that are needed to compile in POSIX mode +VERSION : 6.00.01 + +VENDOR : ibm +MODELS : ps/2, rs6000, ibm370, ibmESA +COMPILER: cc +CFLAGS : normal +LIBES : -lcurses -lbsd [No -lbsd for 4.1] +OS : aix 3.1,3.2,4.1 (rs6000) aix 1.1 (ps/2) aix G9.9 (ibm370) + : aix (ibmESA) +CONFIG : aix +ENVIRON : n/a +NOTES : aix G9.9 sfname() frees bad pointers. Use TCF with care! +NOTES : aix 3.2 may need NAMEI_BUG +NOTES : aix 3.2 may need _BSD_INCLUDES defined in h +NOTES : aix 4.1 does not need -lbsd anymore. +VERSION : 6.06.00 (rs6000) + +VENDOR : ibm +MODELS : ibm390 +COMPILER: c89 +CFLAGS : normal +LIBES : -lcurses +OS : os390 R 2.7 +CONFIG : os390 +ENVIRON : USS (formerly OpenEdition, aka POSIX) +NOTES : Used GNU make for OS/390. +NOTES : Use `CFLAGS="" ./configure` to avoid -g and make binary +NOTES : half as large. +VERSION : 6.09.00 + +VENDOR : ibm +MODELS : rt +COMPILER: hc, gcc +CFLAGS : -I. -U__STDC__ +LIBES : -ltermcap +OS : aos 4.3 +CONFIG : bsd +ENVIRON : n/a +NOTES : Old versions of the compiler break with -O. No ansi include +NOTES : files so we have to undef __STDC__ +VERSION : 6.05.06 + +VENDOR : ibm +MODELS : rt +COMPILER: pcc +CFLAGS : -I. -U__STDC__ -DPCC +LIBES : -ltermcap +OS : aos 4.3 +CONFIG : bsd +ENVIRON : n/a +NOTES : Old versions of the compiler break with -O. No ansi include +NOTES : files so we have to undef __STDC__ +NOTES : pcc broken: typedef void sigret_t; typedef void pret_t; +VERSION : 6.05.06 + +VENDOR : ibm +MODELS : rt +COMPILER: cc +CFLAGS : -I. -Nd4000 -Nn3000 +LIBES : -lcurses +OS : aix 2.2.1 +CONFIG : aix +ENVIRON : n/a +NOTES : Stacksize limit is 1K off? +VERSION : 6.00.03 + +VENDOR : sequent +MODELS : balance, symmetry +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap -lseq +OS : Dynix 3.1, 3.2, ptx 1.2 +CONFIG : sequent +ENVIRON : universe on Dynix 3.1, 3.2: ucb +NOTES : none +VERSION : 6.04.00 + +VENDOR : sequent +MODELS : symmetry +COMPILER: gcc 2.6.2 +CFLAGS : -m486 +LIBES : -ltermcap -lseq -lsocket -linet -lnsl +OS : DYNIX/ptx 2.1.0, 4.1.3 +CONFIG : sequent +ENVIRON : +NOTES : Didn't work for me with Sequent's /bin/cc +NOTES : 4.1.3 does not need libinet anymore. +VERSION : 6.05.00 + +VENDOR : encore +MODELS : multimax +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap +OS : umax 4.2 +CONFIG : bsd +ENVIRON : n/a +NOTES : none +VERSION : 6.00.00 + +VENDOR : sony +MODELS : news 1850, 1750 +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap +OS : bsd 4.3, news-os 3.3,4.1C +CONFIG : bsd +ENVIRON : n/a +NOTES : none +VERSION : 6.05.06 + +VENDOR : ibm + compatibles +MODELS : i386,i286 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap -ldir -lx +OS : xenix +CONFIG : xenix +ENVIRON : n/a +NOTES : none +VERSION : 6.00.01 + +VENDOR : hp +MODELS : hp300 +COMPILER: cc, gcc +CFLAGS : normal +LIBES : -ltermcap +OS : MORE/bsd 4.3+ +CONFIG : mtxinu +ENVIRON : n/a +NOTES : none +VERSION : 6.05.06 + +VENDOR : hp, motorola +MODELS : hp300, m68k +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap -lcrypt +OS : NetBSD 1.0A +CONFIG : bsd4.4 +ENVIRON : n/a +NOTES : none +VERSION : 6.05.06 + +VENDOR : digital +MODELS : vax +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap +OS : bsd 4.3reno +CONFIG : bsdreno +NOTES : ttyname() is buggy. calls closedir() twice. See BUILDING +ENVIRON : n/a +VERSION : 6.00.04 + +VENDOR : Cray Research +MODELS : Y-MP +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap +OS : Unicos 6.0 +CONFIG : cray +ENVIRON : n/a +NOTES : none +VERSION : 6.00.01 + +VENDOR : Cray Research +MODELS : C90 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap +OS : Unicos 9.0.2.1 +CONFIG : cray +ENVIRON : n/a +NOTES : none +VERSION : 6.08 + +VENDOR : Cray Research +MODELS : SV1, probably also SV2 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermlib +OS : Unicos 10.0.1.0 +CONFIG : cray +ENVIRON : n/a +NOTES : none +VERSION : 6.11 + +VENDOR : pyramid +MODELS : MIS4/2T +COMPILER: cc +CFLAGS : -OG +LIBES : -ltermcap +OS : OSx5.1,6.4 +CONFIG : pyr +ENVIRON : n/a +NOTES : If there are problems with the global optimizer, use -OP +NOTES : If you only have the AT&T universe, use the pyratt config +NOTES : file and define -D_PID_T -Dpyr. +VERSION : 6.06.00 + +VENDOR : next +MODELS : any +COMPILER: gcc or cc -arch m68k -arch i386 +CFLAGS : -O2 -g +LIBES : -ltermcap # [-lcs 2.0] +OS : next os 2.x, 3.x +CONFIG : mach +ENVIRON : n/a +NOTES : NeXTSTeP 3.3 on intel defines speed_t so compile with -D_SPEED_T +NOTES : NeXT's cc -E adds spaces before and after array brackets! +NOTES : You'll need to change the sed expression in the Makefile to +NOTES : something like: +NOTES : 's/Char \([a-zA-Z0-9_]*\) *\[ *\].*/extern Char \1[];/' +VERSION : 6.04.00 + +VENDOR : Apple +MODELS : any +COMPILER: cc +CFLAGS : -O3 -pipe -g -arch ppc -arch i386 -UNeXT +OS : Rhapsody 5 +CONFIG : rhapsody +ENVIRON : n/a +NOTES : CFLAGS="-O3 -pipe -g -UNeXT" configure && make +VERSION : 6.08.00 + +VENDOR : Apple +MODELS : any +COMPILER: cc +CFLAGS : -O3 -pipe -g -arch ppc -arch i386 +OS : Darwin +CONFIG : darwin +ENVIRON : n/a +NOTES : CFLAGS="-O3 -pipe -g -arch ppc -arch i386 -UNeXT" configure && make +VERSION : 6.11.05 + +VENDOR : Heurikon +MODELS : HK68 +COMPILER: gcc (Green Hills C-68000) +CFLAGS : -ga -X138 -X25 -I. +LDFLAGS : -n +LIBES : -lcurses -ltermcap -ldirent +OS : UniPlus+ 5.0 +CONFIG : hk68 +ENVIRON : n/a +NOTES : Need Doug Gwyn's POSIX directory library (libdirent.a) +VERSION : 6.00.01 + +VENDOR : Amdahl +MODELS : n/a +COMPILER: cc/gcc +CFLAGS : normal +LIBES : -lcurses -lsocket -lbsd +CONFIG : amdahl +ENVIRON : n/a +VERSION : 6.00.01 + +VENDOR : prime +MODELS : exl 300 series +COMPILER: cc +CFLAGS : -O -s -I. +LIBES : -lcurses -lstcp +OS : system v.3.1.2 +CONFIG : sysv +ENVIRON : sysv +NOTES : Is libstcp.a on all exl 300s? +VERSION : 6.00.01 + +VENDOR : convex +MODELS : c220 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap +OS : 9.0.6 (bsd 4.3) +CONFIG : convex +ENVIRON : n/a +NOTES : Dont use the -pcc flag. + : Use setty to fix the default tty settings. +VERSION : 6.00.01 + +VENDOR : Norsk Data +MODELS : nd5000 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap +OS : Ndix Version C +CONFIG : bsd +ENVIRON : n/a +NOTES : The -O option makes the compiler run for ages! +VERSION : 6.00.03 + +VENDOR : SGI +MODELS : 4D, 3000 +COMPILER: cc +CFLAGS : -D__STDC__ +LIBES : -lcurses -lsun -lbsd -lc_s +OS : IRIX (3.?) 3.2 3.3 4.0 +CONFIG : sgi +ENVIRON : n/a +NOTES : AUTOLOGOUT is probably best undef'ed +NOTES : For 4.0, the NLS define in h can be enabled. +NOTES : 4.0.5a cc does not have -O3 anymore. +NOTES : If you don't like -lbsd, you can define POSIXJOBS in +NOTES : config.h and omit it. +VERSION : 6.06.00 + +VENDOR : SGI +MODELS : R8000 PowerIndigo2 +COMPILER: cc -n32 +CFLAGS : -D__STDC__ +LIBES : -lcurses -lsun -lbsd -lc_s +OS : IRIX 6.2 +CONFIG : sgi +ENVIRON : n/a +NOTES : CCOPTIONS=-OPT:fold_arith_limit=4000 +NOTES : SHLIBDIR=/usr/lib32 +NOTES : LDPOSTLIB = -nostdlib -L$(ROOT)$(SHLIBDIR)/mips3 \ +NOTES : -L$(ROOT)$(SHLIBDIR) +NOTES : In config.h #undef NLS and #undef NLS_CATALOGS +VERSION : 6.06.00 + +VENDOR : SGI +MODELS : Onyx R10000 +COMPILER: gcc-2.7.2.1 configured for mips-sgi-irix5.3 +CFLAGS : none +LIBES : -ltermcap -lbsd +OS : IRIX 6.2 +CONFIG : sgi +ENVIRON : n/a +VERSION : 6.07.02 + +VENDOR : ibm + compatibles +MODELS : i386,i486 +COMPILER: /bin/cc +CFLAGS : normal +LIBES : -ltermlib -lsocket -lnsl (without BSDTIMES) +LIBES : -ltermlib -lsocket -lnsl -lc /usr/ucblib/libucb.a (BSDTIMES) +OS : SVR4 (DELL, ESIX, ISC, UHC) +CONFIG : sysv4 +ENVIRON : n/a +NOTES : none +VERSION : 6.05.06 + +VENDOR : ibm + compatibles +MODELS : i386,i486 +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermcap +OS : linux 0.8x, 0.9x, 1.x +CONFIG : linux +ENVIRON : n/a +NOTES : none +VERSION : 6.05.06 + +VENDOR : ibm + compatibles +MODELS : i386,i486 +COMPILER: gcc +CFLAGS : normal +LIBES : -lcurses -lc_s [for crypt] +OS : SVR3.2.2 [SCO] +CONFIG : sco32v2 +ENVIRON : n/a +NOTES : none +VERSION : 6.03.00 + +VENDOR : stardent +MODELS : gs2600 +COMPILER: /bin/cc +CFLAGS : -O +LIBES : -lcurses +OS : stellix +CONFIG : stellar +ENVIRON : n/a +NOTES : works but not worth compiling with -O4... +NOTES : setpgrp() and SIGCHLD work the BSD way, not the way documented. +NOTES : we need to define BACKPIPE +VERSION : 6.00.04 + +VENDOR : stardent +MODELS : titan 3000 series +COMPILER: /bin/cc +CFLAGS : -O -43 +LIBES : -ltermcap +OS : OS 3.0.3 +CONFIG : bsd +ENVIRON : n/a +NOTES : Kernel bug with SIGTTIN, Try vi, ^Z, bg, fg.... +VERSION : 6.01.01 + +VENDOR : stardent +MODELS : titan 1500 series +COMPILER: cc +CFLAGS : -O -43 +LIBES : -ltermcap +OS : OS 2.5 +CONFIG : bsd +ENVIRON : n/a +NOTES : Kernel bug with SIGTTIN, Try vi, ^Z, bg, fg.... +NOTES : You can add -w to the CFLAGS to suppress the warnings. +VERSION : 6.02.07 + +VENDOR : SGI +MODELS : INDIGO +COMPILER: cc +CFLAGS : -D__STDC__ +LIBES : -lcurses -lsun -lbsd -lc_s +OS : IRIX (3.?) 3.2 3.3 4.0 +CONFIG : sgi +ENVIRON : n/a +NOTES : AUTOLOGOUT is probably best undef'ed +NOTES : For 4.0, the NLS define in h can be enabled. +VERSION : 6.01 + +VENDOR : SGI +MODELS : INDY +COMPILER: cc +CFLAGS : +LIBES : -lcurses -lbsd +OS : IRIX 5.1 +CONFIG : sgi +ENVIRON : n/a +NOTES : it will build without -lbsd but then job control +NOTES : won't actually work. +VERSION : 6.04.00 + +VENDOR : alliant +MODELS : FX/2800 series +COMPILER: scc +CFLAGS : normal +LIBES : -ltermcap +OS : Alliant Concentrix 2800 2.2.00 +CONFIG : bsd +ENVIRON : n/a +NOTES : For a newer version of the operating system try defining + : NEW_OS in alliant [or better find a way to tell + : them apart. +VERSION : 6.03.00 + +VENDOR : stardent +MODELS : Vistra 800 +COMPILER: /bin/cc +CFLAGS : -O +LIBES : -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a +OS : SYSVR4 +CONFIG : sysv4 +ENVIRON : n/a +NOTES : Works like a charm +VERSION : 6.01 + +VENDOR : Evans & Sutherland +MODELS : ESV +COMPILER: cc +CFLAGS : mips systems +LIBES : -ltermcap +OS : ES/os 2.2 (UMIPS mips ATT_V3_0) +CONFIG : mips +ENVIRON : bsd4.3 +NOTES : would it be preferable to have HOSTTYPE of +NOTES : "esv" instead of "mips"? +VERSION : 6.01.00 + +VENDOR : masscomp +MODELS : Masscomp 6000 +COMPILER: cc +CFLAGS : production +LIBES : -ltermcap +OS : RTU 5.0 +CONFIG : masscomp +ENVIRON : Link in the "bsd" universe as opposed to "att". +NOTES : For pre RTU 6.0, remember to remove the #define RTU6 in the +NOTES : masscomp file. +NOTES : As of tcsh v6.02.07, try putting "bindkey ^t stuff-char" +NOTES : in your /etc/csh.cshrc for masscomp kernel (ctrl-t) status. +VERSION : 6.02.07 + +VENDOR : masscomp +MODELS : Masscomp 5400 +COMPILER: cc +CFLAGS : normal +LIBES : -ltermcap -lndir -lsocket -ljobs +OS : RTU 6.0 +CONFIG : masscomp +ENVIRON : Link in the "bsd" universe as opposed to "att". +NOTES : n/a +VERSION : 6.01.00 + +VENDOR : Cray Computer +MODELS : CRAY-2 & CRAY-3 +COMPILER: cc +CFLAGS : normal +LIBES : -lcurses -lnet +OS : CSOS 1.0 +CONFIG : csos +ENVIRON : n/a +NOTES : none +VERSION : 6.02 + +VENDOR : Motorola +MODELS : Delta 3000/Delta 4000 +COMPILER: cc +CFLAGS : normal +LIBES : -lcurses +OS : System V/68 R3V6.2, R3V7 +CONFIG : sysV68 +ENVIRON : n/a +NOTES : none +VERSION : 6.01.00, 6.02.00 + +VENDOR : Motorola +MODELS : MPC 3062 +COMPILER: cc +CFLAGS : Broken optimizers... +LIBES : -lcurses -lsec +OS : System V/88 R32V2 +CONFIG : sysV88 +ENVIRON : n/a +NOTES : If you're using the bundled Greenhills compiler, don't use -O. +NOTES : One error -O causes is failure to exec scripts with /bin/sh +NOTES : if they don't have a #! header on top. +VERSION : 6.02.07 + +VENDOR : alliant +MODELS : FX/8X series +COMPILER: pcc +CFLAGS : normal +LIBES : -ltermcap +OS : Concentrix 6.0.00 beta +CONFIG : bsd +ENVIRON : n/a +NOTES : Needs to define DIRENT in h +VERSION : 6.02.00 + +VENDOR : alliant +MODELS : FX/8X series +COMPILER: pcc +CFLAGS : normal +LIBES : -ltermcap +OS : Concentrix 5.7.00 +CONFIG : bsd +ENVIRON : n/a +NOTES : n/a +VERSION : 6.00.01 + +VENDOR : gould (encore) +MODELS : NP1 +COMPILER: cc +CFLAGS : production +LIBES : -ltermcap +OS : UTX/32 3.1A +CONFIG : bsd +ENVIRON : n/a +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : gould (encore) +MODELS : 9050 +COMPILER: cc +CFLAGS : production +LIBES : -ltermcap +OS : UTX/32 2.1A +CONFIG : bsd +ENVIRON : n/a +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : ibm & compatible +MODELS : i386 +COMPILER: cc +CFLAGS : production +LIBES : -lcurses -lcposix +OS : 3.2 +CONFIG : isc +ENVIRON : ISC386 +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : att +MODELS : 3b2-600GR (RISC) +COMPILER: cc +CFLAGS : production +LIBES : -lcurses +OS : SystemV R4.0 +CONFIG : sysv4 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : att +MODELS : 3b2-600G +COMPILER: cc +CFLAGS : production +LIBES : -lcurses +OS : SystemV R3.2.3 +CONFIG : sysv3 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : tektronix +MODELS : XD88/10 +COMPILER: cc +CFLAGS : Broken optimizers... +LIBES : -ltermcap -lsec +OS : UTekV 3.2e +CONFIG : tekXD88 +ENVIRON : n/a +NOTES : If you're using the bundled Greenhills compiler, don't use -O. +NOTES : One error -O causes is failure to exec scripts with /bin/sh +NOTES : if they don't have a #! header on top. +VERSION : 6.02.07 + +VENDOR : tektronix +MODELS : 4300 +COMPILER: cc +CFLAGS : production +LIBES : -ltermcap +OS : UTek 4.0 (BSD 4.2) +CONFIG : bsd +ENVIRON : n/a +NOTES : set DFLAGS = -DUTek -DBSD in the Makefile +VERSION : 6.02.07 + +VENDOR : BBN +MODELS : butterfly gp1000 +COMPILER: cc +CFLAGS : production +LIBES : -ltermcap +OS : Mach 1000 version 2.5 +CONFIG : mach +ENVIRON : n/a +NOTES : n/a +VERSION : 6.02.07 + +VENDOR : sony +MODELS : news 3700 +COMPILER: cc +CFLAGS : -O -Wf,-XNp15000,-XNd15000,-XNh15000 +LIBES : -lcurses -lc /usr/ucblib/libucb.a +OS : sysvr4, news-os 5.02 +CONFIG : sysv4 +ENVIRON : n/a +NOTES : Use /usr/bin/cc, not /usr/ucb/cc. +VERSION : 6.00.03 + +VENDOR : ibm & compatible +MODELS : i386, i486 +COMPILER: cc +CFLAGS : production +LIBES : -lterm +OS : Coherent 4.0 +CONFIG : coh3 +ENVIRON : gnu tools (see below) +NOTES : The standard make, /bin/sh and sed that come with Coherent are +NOTES : not quite up to the makefile. Either use gnu make or change +NOTES : occurances of '# to '\# since Coherent's make takes all '#'s to +NOTES : be a comment, even when quoted, except when escaped by '\'. +NOTES : Coherent's /bin/sh does not allow you to set VERSION, etc. +NOTES : since they are hard-wired internal variables. Either use +NOTES : /usr/bin/ksh, another sh or change the name of the offending +NOTES : variables. Coherent's sed, unfortunately, is broken beyond a +NOTES : workaround. Either get gnu sed or run that portion of the +NOTES : makefile on a machine with a full sed and import the output. +VERSION : 6.02.08 + +VENDOR : Control Data Systems +MODELS : CD4680 +COMPILER: cc, cc2.20 (mips) +CFLAGS : mips systems, DFLAGS=-DCDC +LIBES : -ltermcap +OS : EP/IX 1.4.3 (RiscOS based) +CONFIG : mips +ENVIRON : bsd4.3 (if sysv, need "set path=(/usr/bsd43/bin $path)" ) +NOTES : n/a +VERSION : 6.02.00 + +VENDOR : alliant +MODELS : FX/8X series +COMPILER: pcc +CFLAGS : normal +LIBES : -ltermcap -lresolv +OS : Concentrix 6.0.00 beta +CONFIG : alliant (see NOTES) +ENVIRON : n/a +NOTES : Needs to define DIRENT and BSDLIMIT in h. The +NOTES : beta release of the Concentrix 6.0.00 has some errors +NOTES : in the system header files, namely, /usr/include/sys/dir.h. +VERSION : 6.03.00 + +VENDOR : hp +MODELS : hp9000s700 +COMPILER: cc +CFLAGS : No -O here!!! Breaks quoting! Try echo 'foo | bar'... +LIBES : -ltermcap +OS : HP OSF/1 1.0 +CONFIG : hposf1 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.03.00 + +VENDOR : digital +MODELS : DEC 3000/400 (alpha) +COMPILER: cc +CFLAGS : -call_shared -I. -I.. -O -Olimit 2000 -std1 +LIBES : -lcurses +OS : OSF1 1.2 +CONFIG : decosf1 +ENVIRON : n/a +NOTES : none +VERSION : 6.03 + +VENDOR : digital +MODELS : DEC 3000/400 (alpha) +COMPILER: cc +CFLAGS : -O2 -I. -I.. -Olimit 2000 +LIBES : -lcurses +OS : OSF1 (Digital Unix) 1.3, 2.0, 3.0, 3.2, 4.0 +CONFIG : decosf1 +ENVIRON : n/a +NOTES : none +VERSION : 6.07.11 + +VENDOR : Intel +MODELS : Paragon +COMPILER: icc +CFLAGS : -O2 +LIBES : -ltermcap +OS : Paragon OSF/1 Release 1.0.1 Server 1.0 R1.0 +CONFIG : parosf1 +ENVIRON : n/a +NOTES : I have gotten two different config files that both seem to + : work! +VERSION : 6.03.00 + +VENDOR : Data General +MODELS : AViiON mc88000 +COMPILER: cc +CFLAGS : -O2 +LIBES : -lcurses +OS : DGUX 5.4R2.01 +CONFIG : dgux5.4 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.04.00 + +VENDOR : Data General +MODELS : Aviion +COMPILER: gcc 2.5.8 +CFLAGS : -g -O2 -msvr4 +LIBES : -ltermcap +OS : DGUX 5.4.1 +CONFIG : dgux5.4 +ENVIRON : sde m88kdguxelf +VERSION : 6.05.00 + +VENDOR : Harris +MODELS : Tahoe +COMPILER: cc, gcc 1.42 +CFLAGS : -O +LIBES : -ltermcap +OS : CX/UX 5.1 CX/UX 7.1 +CONFIG : hcx +ENVIRON : universe bsd +NOTES : n/a +VERSION : 6.06.01 + +VENDOR : Multiflow +MODELS : multiflow +COMPILER: cc +CFLAGS : -O5 -sb_trace 0 -DMULTIFLOW +LIBES : -ltermcap -lcrypt +OS : 4.3 BSD TRACE/UNIX +CONFIG : bsd +ENVIRON : n/a +NOTES : Lower the optimization or you'll get a 5M binary! +NOTES : cc broken: typedef void sigret_t; typedef void pret_t; +VERSION : 6.04.00 + +VENDOR : Unixware +MODELS : all +COMPILER: cc +CFLAGS : normal +LIBES : -lcrypt -ltermlib -lsocket -lnsl -lgen +OS : Unixware 2.03 (4.2MP) +CONFIG : svr4 +ENVIRON : n/a +NOTES : Remove PW_SHADOW from config file, or add -lgen for getspnam +VERSION : 6.07.00 + +VENDOR : Intergraph +MODELS : clipper +COMPILER: cc +CFLAGS : n/a +LIBES : -ltermcap -lbsd +OS : clix 7.1.3 +CONFIG : clipper +ENVIRON : n/a +NOTES : n/a +VERSION : 6.05.00 + +VENDOR : SNI (Siemens Nixdorf Information Systems) +MODELS : rm400 (R4000 mips) +COMPILER: /usr/bin/cc +CFLAGS : -kansi; xmkmf (=> -DSVR4 -DSNI -DSMSINFO -DR3000) +LIBES : -ltermcap -lc -L/usr/ucblib -lucb +OS : SINIX 5.42 +CONFIG : sysv4 +ENVIRON : +NOTES : This is a POSIX (XPG-4) system. +NOTES : Make sure that -lucb is included _last_ (even after -lc) +NOTES : so use: -ltermcap -lc -L/usr/ucblib -lucb +NOTES : In config.h, set HAVEUTMPX und unset BSDSIGS and BSDTIMES +NOTES : +VERSION : 6.06.03 + +VENDOR : U/WIN +MODELS : i386 +COMPILER: cc +CFLAGS : -O +LIBES : -lcurses +OS : Windows NT with U/WIN +CONFIG : uwin +ENVIRON : +NOTES : Needs POSIX.DLL from U/WIN version later than 1.6 +NOTES : Did not function correctly when using #define SYSMALLOC +VERSION : 6.07.02 + +VENDOR : SNI (Siemens Nixdorf Information Systems) +MODELS : rm600 (R4000 mips) +COMPILER: /usr/bin/cc +CFLAGS : -kansi -DSVR4 -DSNI -DSMSINFO -DR3000 +LIBES : -ltermcap -lsocket -lxnet -lc -L/usr/ucblib -lucb +OS : SINIX 5.43 +CONFIG : sysv4 +ENVIRON : +NOTES : In config.h, set HAVEUTMPX und unset BSDSIGS, +NOTES : BSDTIMES, and BSDLIMIT, since otherwise resource.h +NOTES : is falsely searched in /usr/ucbinclude/sys/ +NOTES : +VERSION : 6.07.02 + +VENDOR : FUJITSU +MODELS : ds90 +COMPILER: cc +CFLAGS : -O -I. -DSVR4 -DANSICPP +LIBES : -lsocket -lnsl -ltermcap +OS : UXP/DS V20L10(SVR4.2) +CONFIG : sysv4 +ENVIRON : n/a +NOTES : n/a +VERSION : 6.07.02 + +VENDOR : Fujitsu ICL +MODELS : SuperServer Intel based +COMPILER: gcc 2.7.2 +CFLAGS : normal for gcc 2.1+ .... -O2 $(INCLUDES) +LIBES : -ltermlib -lsocket -lnsl -lcrypt -lgen +OS : SCO UnixWare 2.1 SysVR4.2 i386 x86at +CONFIG : sysv4 +ENVIRON : n/a +NOTES : none +VERSION : 6.06.00 + +VENDOR : NEC +MODELS : SX-4, SX-5 +COMPILER: cc +CFLAGS : -h0,ansi,novector,float0 # for NEC SX-4 +LIBES : -Gsmall +OS : NEC's +CONFIG : superux8 +ENVIRON : n/a +NOTES : none +VERSION : 6.08.01 + +VENDOR : Unixware 7.1.0 +MODELS : all +COMPILER: gcc +CFLAGS : normal +LIBES : -ltermlib -lsocket -lgen +OS : Unixware 7.1.0 +CONFIG : svr5 +ENVIRON : n/a +NOTES : none +VERSION : 6.09.00 + Index: vendor/tcsh/6.21.00-83c5be0/aclocal.m4 =================================================================== --- vendor/tcsh/6.21.00-83c5be0/aclocal.m4 (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/aclocal.m4 (revision 353870) @@ -0,0 +1,1409 @@ +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +# iconv.m4 serial 19 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, + dnl Solaris 10. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + ]], + [[int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + 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, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + 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, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + 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. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + 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, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; +]])], + [am_cv_func_iconv_works=yes], , + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to +dnl avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +dnl This is tricky because of the way 'aclocal' is implemented: +dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. +dnl Otherwise aclocal's initial scan pass would miss the macro definition. +dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. +dnl Otherwise aclocal would emit many "Use of uninitialized value $1" +dnl warnings. +m4_define([gl_iconv_AC_DEFUN], + m4_version_prereq([2.64], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [m4_ifdef([gl_00GNULIB], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [[AC_DEFUN( + [$1], [$2])]])])) +gl_iconv_AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#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(); +#endif + ]], + [[]])], + [am_cv_proto_iconv_arg1=""], + [am_cv_proto_iconv_arg1="const"]) + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([ + $am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test -n "$am_cv_proto_iconv_arg1"; then + ICONV_CONST="const" + fi + ]) + fi +]) + +# lib-ld.m4 serial 6 +dnl Copyright (C) 1996-2003, 2009-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid +dnl collision with libtool.m4. + +dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 /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. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # 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" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL([acl_cv_path_LD], +[if test -z "$LD"; then + 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 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 = 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE([rpath], + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) + +# lib-prefix.m4 serial 7 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008-2016 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) + Index: vendor/tcsh/6.21.00-83c5be0/complete.tcsh =================================================================== --- vendor/tcsh/6.21.00-83c5be0/complete.tcsh (nonexistent) +++ vendor/tcsh/6.21.00-83c5be0/complete.tcsh (revision 353870) @@ -0,0 +1,1280 @@ +# +# example file using the new completion code +# +# Debian GNU/Linux +# /usr/share/doc/tcsh/examples/complete.gz +# +# This file may be read from user's ~/.cshrc or ~/.tcshrc file by +# decompressing it into the home directory as ~/.complete and +# then adding the line "source ~/.complete" and maybe defining +# some of the shell variables described below. +# +# Added two Debian-specific completions: dpkg and dpkg-deb (who +# wrote them?). Changed completions of several commands. The ones +# are evaluated if the `traditional_complete' shell variable is +# defined. +# +# Debian enhancements by Vadim Vygonets . +# Bugfixes and apt completions by Miklos Quartus . +# Cleanup by Martin A. Godisch . + +onintr - +if ( ! $?prompt ) goto end + +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 + endif + unset rev rel +endif + +if ( ! $?_has_complete ) goto end + +if ( ! $?noglob ) set noglob _unset_noglob + +# Old TCSH versions don't define OSTYPE. +# Use a close approximation instead. + +if ( ! $?OSTYPE ) then + setenv OSTYPE `echo "$HOSTTYPE" | sed -e 's/^(i[3456]86|(amd|x86_)64)-//'` +endif + +if ( ! $?hosts ) set hosts + +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 + +if ( -r "$HOME/.netrc" ) then + set hosts=($hosts `awk '$1 == "machine" { print $2 }' "$HOME/.netrc"`) +endif + +set hosts=(`echo $hosts | tr ' ' '\012' | sort -u`) + +if ( ! $#hosts ) then + # This is just a hint for the user. + set hosts=(ftp.funet.fi ftp.gnu.org ftp.uu.net) +endif + +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:''/ n/*/n/ + +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 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@-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@-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:'/ \ + 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:'/ + +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 -%* c/%/j/ # fill in the jobs builtin +complete {fg,bg,stop} c/%/j/ p/1/"(%)"// + +complete limit c/-/"(h)"/ n/*/l/ +complete unlimit c/-/"(h)"/ n/*/l/ + +#complete -co* p/0/"(compress)"/ # make compress completion +# # not ambiguous + +# "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 + +complete finger c/*@/\$hosts/ n/*/u/@ +complete ping p/1/\$hosts/ +complete traceroute p/1/\$hosts/ + +complete {talk,ntalk,phone} \ + p/1/'`users | tr " " "\012" | uniq`'/ \ + n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/ + +complete ftp c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/ + +# this one is simple... +#complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/: +# From Michael Schroeder +# 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 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:''/ \ + n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/= + +complete nslookup p/1/x:''/ p/2/\$hosts/ + +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/ + +# these should be merged with the MH completion hacks below - jgotts +complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \ + "c@+@F:$HOME/Mail/@" + +# these and interrupt handling from Jaap Vermeulen +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}'"'"'`/' + +# these from Marc Horowitz +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 ./configure \ + 'c@--{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:'@ \ + 'c/--cachefile=*/x:/' \ + 'c/--{enable,disable,with}-*/x://' \ + 'c/--*=/x://' \ + '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 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 printenv 'n/*/e/' +complete setenv 'p/1/e/' 'c/*:/f/' + +# these and method of setting hosts from Kimmo Suominen +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/:.*//'`" + + set folders = ( $FOLDERS ) + set mha = ( $MHA ) + + complete ali \ + 'c/-/(alias nolist list nonormalize normalize nouser user help)/' \ + 'n,-alias,f,' + + 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 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 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 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 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 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 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 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 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 mhmail \ + 'c/-/(body cc from subject help)/' \ + 'n,-cc,$mha,' \ + 'n,-from,$mha,' \ + 'n/*/$mha/' + + complete mhpath \ + 'c/-/(help)/' \ + 'c,+,$folders,' \ + 'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,' + + complete msgchk \ + 'c/-/(nodate date nonotify notify help)/' + + complete msh \ + 'c/-/(prompt noscan scan notopcur topcur help)/' + + 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 packf \ + 'c/-/(file help)/' \ + 'c,+,$folders,' \ + '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 " " "\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 prompter \ + 'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' + + 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`,' + + complete rmf \ + 'c/-/(nointeractive interactive help)/' \ + 'c,+,$folders,' + + complete rmm \ + 'c/-/(help)/' \ + 'c,+,$folders,' \ + 'n,*,`(mark | sed "s/:.*//" ; echo next cur prev first last)|tr " " "\012" | sort -u`,' + + 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 +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 -)"/ \ + n/*/f:*.{bz2,tbz}/ +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@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@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \ + 'n@ls@(file:/// svn+ssh:// svn://)@@' \ + 'n@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@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@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@-interface@`ifconfig -l`@' +complete netstat 'n@-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/' \ + '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=)/' \ + '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)'/ \ + p@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@-f=@F:${HOME}/Mail/@" \ + n/-a/f/ \ + n/-F/f/ \ + n/-H/f/ \ + n/-s/x:''/ \ + n/-e/x:''/ \ + n@-b@'`cat "${HOME}/.muttrc-alias" | awk '"'"'{print $2 }'"'"\`@ \ + n@-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 )/' + +complete nm \ + 'c/--radix=/x:/' \ + 'c/--target=/x:/' \ + '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}/' + +complete nmap 'n@-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@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:""/' +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 + +# this one works but is slow and doesn't descend into subdirectories +# complete cd C@[./\$~]*@d@ \ +# p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@ + +if ( -r /etc/shells ) then + complete setenv p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@ +else + complete setenv p@1@e@ n@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@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ + n@-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@+@F:$HOME/Mail@" C@[./\$~]@f@ n/-s/x:''/ \ + n@-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 + setenv MANPATH /usr/man: + endif +endif + +if ($?traditional_complete) then + # use of $MANPATH from Dan Nicolaescu + # use of 'find' adapted from Lubomir Host + complete man \ + 'n@1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\ + 'n@2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\ + 'n@3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\ + 'n@4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\ + 'n@5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\ + 'n@6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\ + 'n@7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\ + 'n@8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\ + 'n@9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\ + 'n@0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\ + 'n@n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\ + 'n@o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\ + 'n@l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\ + 'n@p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\ + c@-@"(- f k M P s S t)"@ n@-f@c@ n@-k@x:''@ n@-[MP]@d@ \ + 'N@-[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@' \ + 'n@-[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@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \ + n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \ + n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \ + n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \ + n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \ + n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \ + n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \ + n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \ +n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \ +n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \ +n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \ +n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \ +n@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \ +n@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:''/ n/-P/d/ \ + N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/ +endif + +complete ps c/-t/x:''/ c/-/"(a c C e g k l S t u v w x)"/ \ + n/-k/x:''/ N/-k/x:''/ n/*/x:''/ +complete compress c/-/"(c f v b)"/ n/-b/x:''/ n/*/f:^*.Z/ +complete uncompress c/-/"(c f v)"/ n/*/f:*.Z/ + +complete uuencode p/1/f/ p/2/x:''/ 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:''/ \ + n/-g/x:''/ n/-remote/x:''/ \ + n/-rgb/x:''/ n/-papercolor/x:''/ \ + n/-{t1lib,freetype}/x:''/ \ + n/-ps/x:''/ n/-paperw/x:''/ \ + n/-paperh/x:''/ n/-upw/x:''/ \ + n/-/f:*.{pdf,PDF}/ \ + N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \ + N/-/x:''/ p/1/f:*.{pdf,PDF}/ p/2/x:''/ + +complete tcsh c/-D*=/'x:'/ c/-D/'x:'/ \ + 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:''/ n/--triggeredby/x:''/\ + n/--what{provides,requires}/x:''/ n/--root/d/ \ + n/--{qf,queryformat}/x:''/ n/--buildroot/d/ \ + n/--excludepath/x:''/ n/--prefix/x:''/ \ + n/--relocate/x:''/ n/--target/x:''/\ + n/--rcfile/x:''/ n/--specfile/x:''/ \ + n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/ + +# these conform to the latest GNU versions available at press time ... +# updates by John Gotts +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:''/ \ + n/{-t,--terminal}/x:''/ n/{-d,--display}/x:''/ \ + n/{-u,--user}/u/ n/{-f,--funcall}/x:''/ \ + n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \ + n/--eval/x:''/ 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:''/ \ + 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:''/ \ + 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:''/ N/-*e/f/ \ + n/-*e/x:''/ 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:''/ N/-*e/f/ \ + n/-*e/x:''/ 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:''/ N/-*e/f/ \ + n/-*e/x:''/ 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 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:''/ N/-*e/f/ \ + n/-*e/x:''/ 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:''/ N/-*e/f/ \ + n/-*e/x:''/ 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:''/ N/-*e/f/ \ + n/-*e/x:''/ n/-*f/f/ n/*/f/ + +complete sed c/--/"(quiet silent version help expression file)"/ \ + c/-/"(n V e f -)"/ n/{-e,--expression}/x:'