From c175751b501a3a4cb40ad4787340a597ea769be4 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Thu, 15 Apr 1999 18:05:35 +0000 Subject: Initial revision --- .cvsignore | 10 + .distfiles | 7 + .lastloc | 5 + ChangeLog | 2328 +++++++++++++++++++++++++++++ ChangeLog.3.0 | 3671 ++++++++++++++++++++++++++++++++++++++++++++++ Config/.distfiles | 4 + Config/clean.mk | 43 + Config/config.mk | 38 + Config/defs.mk | 83 ++ Config/version.mk | 31 + Doc/.cvsignore | 15 + Doc/.distfiles | 16 + Doc/META-FAQ.yo | 44 + Doc/Makefile.in | 172 +++ Doc/Zsh/.distfiles | 9 + Doc/Zsh/.lastloc | 1 + Doc/Zsh/arith.yo | 73 + Doc/Zsh/builtins.yo | 1184 +++++++++++++++ Doc/Zsh/compat.yo | 69 + Doc/Zsh/compctl.yo | 526 +++++++ Doc/Zsh/cond.yo | 158 ++ Doc/Zsh/exec.yo | 25 + Doc/Zsh/expn.yo | 1052 +++++++++++++ Doc/Zsh/filelist.yo | 15 + Doc/Zsh/files.yo | 26 + Doc/Zsh/func.yo | 107 ++ Doc/Zsh/grammar.yo | 335 +++++ Doc/Zsh/guide.yo | 149 ++ Doc/Zsh/index.yo | 24 + Doc/Zsh/intro.yo | 38 + Doc/Zsh/invoke.yo | 23 + Doc/Zsh/jobs.yo | 91 ++ Doc/Zsh/metafaq.yo | 142 ++ Doc/Zsh/mod_cap.yo | 28 + Doc/Zsh/mod_clone.yo | 19 + Doc/Zsh/mod_comp1.yo | 11 + Doc/Zsh/mod_compctl.yo | 7 + Doc/Zsh/mod_deltochar.yo | 12 + Doc/Zsh/mod_example.yo | 16 + Doc/Zsh/mod_files.yo | 100 ++ Doc/Zsh/mod_sched.yo | 17 + Doc/Zsh/mod_stat.yo | 145 ++ Doc/Zsh/mod_zftp.yo | 421 ++++++ Doc/Zsh/mod_zle.yo | 193 +++ Doc/Zsh/modules.yo | 64 + Doc/Zsh/options.yo | 1039 +++++++++++++ Doc/Zsh/params.yo | 812 ++++++++++ Doc/Zsh/prompt.yo | 209 +++ Doc/Zsh/redirect.yo | 183 +++ Doc/Zsh/restricted.yo | 44 + Doc/Zsh/seealso.yo | 25 + Doc/Zsh/zle.yo | 1076 ++++++++++++++ Doc/intro.ms | 2701 ++++++++++++++++++++++++++++++++++ Doc/zmacros.yo | 32 + Doc/zman.yo | 192 +++ Doc/zsh.yo | 83 ++ Doc/zshbuiltins.yo | 3 + Doc/zshcompctl.yo | 3 + Doc/zshexpn.yo | 3 + Doc/zshmisc.yo | 12 + Doc/zshmodules.yo | 3 + Doc/zshoptions.yo | 3 + Doc/zshparam.yo | 3 + Doc/zshzle.yo | 3 + Doc/ztexi.yo | 246 ++++ Etc/.cvsignore | 3 + Etc/.distfiles | 5 + Etc/BUGS | 41 + Etc/CONTRIBUTORS | 127 ++ Etc/FAQ.yo | 2018 +++++++++++++++++++++++++ Etc/FEATURES | 74 + Etc/FTP-README | 61 + Etc/MACHINES | 94 ++ Etc/Makefile.in | 59 + Etc/NEWS | 203 +++ Etc/pubring.pgp | 150 ++ Functions/.distfiles | 5 + Functions/acx | 6 + Functions/cat | 16 + Functions/cdmatch | 23 + Functions/cdmatch2 | 15 + Functions/checkmail | 26 + Functions/cx | 6 + Functions/harden | 6 + Functions/mere | 3 + Functions/multicomp | 80 + Functions/proto | 8 + Functions/pushd | 13 + Functions/randline | 3 + Functions/run-help | 72 + Functions/yp | 2 + Functions/yu | 2 + Functions/zed | 65 + Functions/zls | 55 + INSTALL | 242 +++ Makefile.in | 124 ++ Misc/.distfiles | 4 + Misc/.lastloc | 2 + Misc/c2z | 128 ++ Misc/compctl-examples | 716 +++++++++ Misc/globtests | 107 ++ Misc/globtests.ksh | 91 ++ Misc/lete2ctl | 301 ++++ README | 135 ++ acconfig.h | 221 +++ aclocal.m4 | 52 + aczsh.m4 | 433 ++++++ config.guess | 698 +++++++++ config.sub | 924 ++++++++++++ configure.in | 1113 ++++++++++++++ install-sh | 238 +++ mkinstalldirs | 32 + patchlist.txt | 41 + 113 files changed, 27065 insertions(+) create mode 100644 .cvsignore create mode 100644 .distfiles create mode 100644 .lastloc create mode 100644 ChangeLog create mode 100644 ChangeLog.3.0 create mode 100644 Config/.distfiles create mode 100644 Config/clean.mk create mode 100644 Config/config.mk create mode 100644 Config/defs.mk create mode 100644 Config/version.mk create mode 100644 Doc/.cvsignore create mode 100644 Doc/.distfiles create mode 100644 Doc/META-FAQ.yo create mode 100644 Doc/Makefile.in create mode 100644 Doc/Zsh/.distfiles create mode 100644 Doc/Zsh/.lastloc create mode 100644 Doc/Zsh/arith.yo create mode 100644 Doc/Zsh/builtins.yo create mode 100644 Doc/Zsh/compat.yo create mode 100644 Doc/Zsh/compctl.yo create mode 100644 Doc/Zsh/cond.yo create mode 100644 Doc/Zsh/exec.yo create mode 100644 Doc/Zsh/expn.yo create mode 100644 Doc/Zsh/filelist.yo create mode 100644 Doc/Zsh/files.yo create mode 100644 Doc/Zsh/func.yo create mode 100644 Doc/Zsh/grammar.yo create mode 100644 Doc/Zsh/guide.yo create mode 100644 Doc/Zsh/index.yo create mode 100644 Doc/Zsh/intro.yo create mode 100644 Doc/Zsh/invoke.yo create mode 100644 Doc/Zsh/jobs.yo create mode 100644 Doc/Zsh/metafaq.yo create mode 100644 Doc/Zsh/mod_cap.yo create mode 100644 Doc/Zsh/mod_clone.yo create mode 100644 Doc/Zsh/mod_comp1.yo create mode 100644 Doc/Zsh/mod_compctl.yo create mode 100644 Doc/Zsh/mod_deltochar.yo create mode 100644 Doc/Zsh/mod_example.yo create mode 100644 Doc/Zsh/mod_files.yo create mode 100644 Doc/Zsh/mod_sched.yo create mode 100644 Doc/Zsh/mod_stat.yo create mode 100644 Doc/Zsh/mod_zftp.yo create mode 100644 Doc/Zsh/mod_zle.yo create mode 100644 Doc/Zsh/modules.yo create mode 100644 Doc/Zsh/options.yo create mode 100644 Doc/Zsh/params.yo create mode 100644 Doc/Zsh/prompt.yo create mode 100644 Doc/Zsh/redirect.yo create mode 100644 Doc/Zsh/restricted.yo create mode 100644 Doc/Zsh/seealso.yo create mode 100644 Doc/Zsh/zle.yo create mode 100644 Doc/intro.ms create mode 100644 Doc/zmacros.yo create mode 100644 Doc/zman.yo create mode 100644 Doc/zsh.yo create mode 100644 Doc/zshbuiltins.yo create mode 100644 Doc/zshcompctl.yo create mode 100644 Doc/zshexpn.yo create mode 100644 Doc/zshmisc.yo create mode 100644 Doc/zshmodules.yo create mode 100644 Doc/zshoptions.yo create mode 100644 Doc/zshparam.yo create mode 100644 Doc/zshzle.yo create mode 100644 Doc/ztexi.yo create mode 100644 Etc/.cvsignore create mode 100644 Etc/.distfiles create mode 100644 Etc/BUGS create mode 100644 Etc/CONTRIBUTORS create mode 100644 Etc/FAQ.yo create mode 100644 Etc/FEATURES create mode 100644 Etc/FTP-README create mode 100644 Etc/MACHINES create mode 100644 Etc/Makefile.in create mode 100644 Etc/NEWS create mode 100644 Etc/pubring.pgp create mode 100644 Functions/.distfiles create mode 100755 Functions/acx create mode 100644 Functions/cat create mode 100755 Functions/cdmatch create mode 100644 Functions/cdmatch2 create mode 100644 Functions/checkmail create mode 100755 Functions/cx create mode 100755 Functions/harden create mode 100755 Functions/mere create mode 100755 Functions/multicomp create mode 100755 Functions/proto create mode 100644 Functions/pushd create mode 100755 Functions/randline create mode 100755 Functions/run-help create mode 100755 Functions/yp create mode 100755 Functions/yu create mode 100755 Functions/zed create mode 100644 Functions/zls create mode 100644 INSTALL create mode 100644 Makefile.in create mode 100644 Misc/.distfiles create mode 100644 Misc/.lastloc create mode 100755 Misc/c2z create mode 100644 Misc/compctl-examples create mode 100755 Misc/globtests create mode 100755 Misc/globtests.ksh create mode 100755 Misc/lete2ctl create mode 100644 README create mode 100644 acconfig.h create mode 100644 aclocal.m4 create mode 100644 aczsh.m4 create mode 100755 config.guess create mode 100755 config.sub create mode 100644 configure.in create mode 100755 install-sh create mode 100755 mkinstalldirs create mode 100644 patchlist.txt diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 000000000..efdcc4439 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,10 @@ +Makefile +META-FAQ +config.cache +config.h +config.h.in +config.log +config.status +configure +stamp-h +stamp-h.in diff --git a/.distfiles b/.distfiles new file mode 100644 index 000000000..84316b5e9 --- /dev/null +++ b/.distfiles @@ -0,0 +1,7 @@ +DISTFILES_SRC=' + .cvsignore .distfiles Makefile.in + ChangeLog ChangeLog.3.0 INSTALL META-FAQ README + acconfig.h aclocal.m4 aczsh.m4 configure.in + configure config.h.in stamp-h.in + config.guess config.sub install-sh mkinstalldirs +' diff --git a/.lastloc b/.lastloc new file mode 100644 index 000000000..c927e76e2 --- /dev/null +++ b/.lastloc @@ -0,0 +1,5 @@ +(("/home/user2/pws/src/zsh-3.1.5/patchlist.txt" . 861) + ("/home/user2/pws/src/zsh-3.1.5/patch-match" . 74776) + ("/home/user2/pws/src/zsh-3.1.5/sven_fix2.dif" . 6081) + ("/home/user2/pws/src/zsh-3.1.5/ci_notes.txt" . 1267) + ("/home/user2/pws/src/zsh-3.1.5/configure.in" . 28530)) diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..a1a22e495 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2328 @@ +Thu Oct 29 21:51:10 1998 Andrew Main + + * Config/version.mk: Version 3.1.5. + + * Doc/Makefile.in, Doc/META-FAQ.yo: Format the plain-ASCII + META-FAQ in a manner consistent with the other plain-ASCII + documents. + + * Src/exec.c: Retry reading from a pipe on EINTR, to avoid + getting truncated output. (schaefer, u1880) + + * acconfig.h, aczsh.m4, configure.in, Src/compat.c, Src/system.h, + Src/watch.c: New zsh_STRUCT_MEMBER macro for structure member + tests (changes names of some existing preprocessor defines). + Test for d_ino and d_stat in struct dire[nc]t. New code in + zgetdir() to make use of d_stat if available. + + * Src/params.c, Src/system.h, Src/watch.c: Move definition of + DEFAULT_WATCHFMT into watch.c (where the decision about which + utmp structure to use is made). + + * Doc/Zsh/metafaq.yo: Another mirror (sunsite.doc.ic.ac.uk). + +Wed Oct 28 21:02:28 1998 Andrew Main + + * Src/builtin.c: More accurate test for ncurses, for the benefit + of systems where ncurses' termcap.h is used. + + * Etc/BUGS, Etc/CONTRIBUTORS, Etc/FEATURES, Etc/MACHINES, + Etc/NEWS, INSTALL, README, Util/zsh-development-guide: + Consistent formatting. + + * Etc/NEWS: List universal-argument and POSIX character classes. + + * Doc/Zsh/metafaq.yo, Etc/CONTRIBUTORS: Use more zsh.org email + addresses. + +Tue Oct 27 20:23:18 1998 Andrew Main + + * Etc/FAQ.yo: New version, 1998-10-26. (pws) + +Mon Oct 26 21:13:42 1998 Andrew Main + + * Doc/Zsh/guide.yo, Doc/Zsh/metafaq.yo, Etc/CONTRIBUTORS, + Functions/checkmail, Functions/run-help, Functions/zed, + Misc/compctl-examples, Misc/lete2ctl, README, + Src/Builtins/rlimits.awk, Src/Zle/zle_main.c, Src/makepro.awk, + Src/signames.awk, Util/helpfiles, Util/reporter: Consistently + use zsh.org email addresses where available. Remove some + stray individual credits from the source, in favour of the + more usual credit in ChangeLog and CONTRIBUTORS files. + + * acconfig.h, configure.in, Src/watch.c: Some systems have ut_tv + in struct utmpx, rather than ut_xtime or ut_time. + +Sun Oct 25 21:04:01 1998 Andrew Main + + * Src/exec.c: Save and restore simple_pline. (pws, 4390) + + * Src/loop.c: Set isfirstln to get the right behaviour on ^D + in select. (pws, 4389) + + * Src/exec.c: Don't fail to AUTO_CD if there is an improperly + hashed external command of the same name. (pws, 4426; + schaefer, 4434) + + * Src/builtin.c: getopts wasn't resetting all its counters + correctly. (schaefer, 4416) + + * Src/Zle/zle_tricky.c: Prevent removable suffixes remaining in + effect when a new completion is attempted. + + * Doc/Zsh/compctl.yo: Add an example of usage of n[...] to the + compctl manual. (pws, u1857) + + * Src/Zle/zle_main.c, Src/Zle/zle_misc.c: Give ungetkey() + external linkage. + + * Doc/Zsh/zle.yo, Src/Zle/zle_misc.c: Make universal-argument + accept a typed integer, EMACS-style. (pws, 4425) + + * Src/Zle/zle.h, Src/Zle/zle_misc.c: Fix neg-argument. (pws, + 4420) + +Sat Oct 17 17:12:31 1998 Andrew Main + + * Doc/Zsh/mod_files.yo: Note that mv won't move across devices. + + * Doc/Zsh/expn.yo: Add some examples to the parameter expansion + section. (schaefer, 4402) + + * Src/jobs.c: Unset STAT_DONE when adding a process to a job, + in case $() processes finish before all the processes have + been started. (pws, 4397) + + * Doc/Zsh/builtins.yo, Src/builtin.c, Src/hashtable.c, Src/zsh.h: + type/whence/where/which -w gives machine-readable output. + (pws, 4388) + + * Doc/Zsh/builtins.yo: Document the effect of unset on a local + parameter. + + * Src/params.c: unset should not remove the localness of a + local parameter. (pws, 4317) + + * Src/compat.c, Src/prototypes.h: Give gethostname() the right + prototype (the length argument is a size_t), and implement it + to spec. + + * Doc/Zsh/metafaq.yo: New address for web-based mailing list + archive (http://www.zsh.org/mla/). + + * Doc/Zsh/metafaq.yo: New mirror (foad.org). + +Thu Oct 15 19:07:17 1998 Andrew Main + + * configure.in, Src/Modules/cap.c, Src/utils.c: Check for the + existence of cap_get_proc() rather than cap_init(), because + some systems have a different cap_init(). + + * Etc/MACHINES: Format changes. Removed some entries that didn't + actually contain any intelligible information. + + * Etc/MACHINES: Tested on FreeBSD 2.2.7. (Roland Jesse + , u1770) + + * acconfig.h, configure.in, Src/watch.c: Handle systems where + struct utmpx has a member named ut_time rather than ut_xtime. + + * Src/parse.c: Do not require a separator after esac. (hzoli, + 4376) + + * Doc/Makefile.in: Ignore errors from makeinfo. + + * Src/Zle/zle_thingy.c: Use permanent allocation when executing + widgets. (schaefer, 4350) + + * Functions/multicomp: Fix for leading tildes; made + case-insensitive. (schaefer, 4342) + + * Src/Zle/zle_utils.c: Fix an uninitialised pointer in + mkundoent(). (pws, 4315) + + * config.guess: Support Netwinder (arm-unknown-linux). + (Jason Naughton , 4308) + + * configure.in: Dynamic linking on OSF. (, + 4258) + + * Misc/lete2ctl: Update for Perl5.004. Use compctl -/ and -W. + Some other fixes. (pws, 4245) + + * Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo: Minor typo fixes. + (schaefer, 4232) + + * Src/signals.h: A variable was being modified twice without an + intervening sequence point. (Gray Watson , + 4221) + + * Makefile.in: Remove spurious ";\". (Gray Watson + , 4221) + +Tue Oct 13 21:42:47 1998 Andrew Main + + * Doc/Zsh/expn.yo, Src/glob.c: Add the [:blank:] character class + required by POSIX, which has no corresponding ctype macro. + + * Doc/Zsh/expn.yo, Misc/globtests, Src/glob.c, Src/lex.c: + Add POSIX globbing character classes ([:alnum:] etc.). + (pws, 4209+4212) + +Sun Oct 11 20:39:06 1998 Andrew Main + + * Src/Zle/zle_tricky.c: Make compctl -S '' work properly (i.e., + suppress the addition of the default suffix). (schaefer, u1668) + + * Src/loop.c: Fix the handling of empty user input to select. + (schaefer, 4200) + + * Src/utils.c: Y2K bugfix in %y sequence in ztrftime(). + (zefram, 4198) + + * Src/init.c, Src/main.c: Abort on parse errors, except when + reading input from stdin. (pws, 4191; some semantic changes + by zefram) + + * Misc/compctl-examples: Fix the setopt completion in the case + where KSH_OPTION_PRINT is set. (schaefer, 4176) + + * Doc/Zsh/compctl.yo: Mention the read builtin in the + documentation of compctl -K. (sven, 4150) + + * Src/Zle/zle_tricky.c: Fixed a bug where completing in a word + could duplicate part of the word due to it being in both the + common prefix and the common suffix. (sven, 4147) + + * Doc/Zsh/builtins.yo, Doc/Zsh/compat.yo, Doc/Zsh/expn.yo, + Doc/Zsh/grammar.yo, Doc/Zsh/intro.yo, Doc/Zsh/options.yo, + Doc/Zsh/params.yo, Doc/Zsh/restricted.yo, Doc/Zsh/zle.yo: + Spelling/typo fixes in documentation. (schaefer, 4136) + + * Misc/compctl-examples: Better implementations of the CVS + compctl functions. (schaefer, 4130) + +Sun Sep 27 18:31:55 1998 Andrew Main + + * Doc/zsh.yo, Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo, + Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo, Doc/Zsh/guide.yo, + Doc/Zsh/intro.yo, Doc/Zsh/params.yo, Doc/Zsh/redirect.yo, + Doc/Zsh/zle.yo: Clarification of the expansion documentation. + Several other documentation bugfixes. (schaefer, 4116) + + * Src/Modules/rlimits.awk: Cosmetic fix of the generated file. + + * Src/Modules/rlimits.awk: Avoid using the sub() function, + which some older awks lack. + + * Doc/Zsh/grammar.yo: List "builtin" as a precommand modifier. + + * Doc/Zsh/builtins.yo: Fuller details of the interaction between + options of the read builtin. (schaefer, 4109) + + * Src/Modules/stat.c: The ls-style mode string was not being + terminated. (Goran Larsson , 4105) + + * Src/Zle/zle_hist.c: Make use of repeat count in history + searches. (wayne, 4104) + + * Src/Zle/zle_hist.c: Some bugfixes and code simplifications + for {vi-,}{up,down}-line-or-{history,search}. (wayne, 4086) + +Sat Sep 26 16:08:53 1998 Andrew Main + + * Etc/zsh-development-guide: Expanded the section on C coding + style. Added some notes about documentation. + + * configure.in, Src/exec.c, Src/glob.c, Src/hashtable.c, + Src/init.c, Src/params.c, Src/system.h, Src/utils.c, + Src/Modules/stat.c, Src/Zle/zle_tricky.c: Cope with systems + that lack , , nice(), getpw{ent,nam,uid}(), + getgr{gid,nam}(). + + * Doc/Zsh/metafaq.yo: uiarchive now mirrors ftp.zsh.org. + + * Doc/ztexi.yo, Doc/Zsh/expn.yo, Doc/Zsh/options.yo, + Doc/Zsh/redirect.yo, Doc/Zsh/zle.yo: Some minor documentation + fixes. (schaefer, 4045) + + * Src/hist.c, Src/input.c, Src/parse.c: Simplification and + bugfixes of the input flushing code on history and parse + errors. (pws, 4172) + + * configure.in: Use "1,$s" instead of ",s" in the generated + ed script, for compatibility with historical systems. + +Mon Sep 21 19:16:03 1998 Andrew Main + + * Src/Makefile.in: Clean up conditionals in install/uninstall + rules. + + * Config/clean.mk, Config/config.mk, Src/Makemod.in.in: Avoid + empty argument list in for loops, for /bin/sh. + + * aczsh.m4, configure.in, Etc/MACHINES: Check for systems with + broken static/shared library combinations, such as SINIX. + + * Doc/Zsh/params.yo, Src/builtin.c, Src/params.c: Make PWD and + OLDPWD parameters non-special. (hzoli, 3990; doc by zefram) + + * Src/builtin.c: Don't crash when exporting an unset special + parameter. (hzoli, 3983) + + * Src/Zle/zle_utils.c: Mark sticks to preceding character instead + of the following one. (wayne, 3969) + + * Src/builtin.c, Src/init.c, Src/utils.c: Set stdin to read + blockingly where appropriate. (hzoli, 3950; POSIXification + by zefram) + +Mon Sep 14 14:44:32 1998 Andrew Main + + * Makefile.in, configure.in, Config/.distfiles, Config/config.mk, + Config/defs.mk, Config/version.mk, Doc/.cvsignore, + Doc/.distfiles, Doc/Makefile.in, Doc/paths.yo.in, + Doc/zman.yo, Doc/zsh.yo, Doc/ztexi.yo, Doc/Zsh/builtins.yo, + Doc/Zsh/filelist.yo, Doc/Zsh/files.yo, Doc/Zsh/mod_comp1.yo, + Doc/Zsh/modules.yo, Doc/Zsh/options.yo, Doc/Zsh/params.yo, + Etc/Makefile.in, Src/.distfiles, Src/Makefile.in, + Src/Makemod.in.in, Src/version.h, Src/zsh.mdd: Move version + data into a single file, Config/version.mk. Remove all site + dependencies from the documentation. Some related Makefile + cleanups. + +Sun May 31 09:28:18 1998 Andrew Main + + * Src/version.h: Version 3.1.4. + + * Doc/paths.yo.in: New date. + + * configure.in, aczsh.m4, acconfig.h, Src/system.h, + Src/watch.c: Don't confuse utmp and utmpx files. Don't rely + on having a utmp structure at all. + + * Src/system.h, Src/Modules/clone.c, Src/Modules/files.c, + Src/builtin.c, Src/compat.c, Src/exec.c, Src/hist.c, Src/init.c, + Src/utils.c: Use O_NOCTTY on all open() calls, to get consistent + behaviour (no controlling tty) on all systems. + + * Doc/Zsh/grammar.yo: Correct and clarify the "simple commands & + pipelines" section. (schaefer, u1548; markup and some additions + by zefram) + + * Src/params.c: When unsetting paired special parameters (e.g., + CDPATH/cdpath), don't try to remove names that don't exist. + (hzoli, 3974) + +Sat May 30 16:16:13 1998 Andrew Main + + * Src/system.h: #define _XPG_IV on SINIX (Reliant UNIX). It is + reported that this is necessary in order to get the right + version of gettimeofday(). + + * Doc/Zsh/grammar.yo, Src/lex.c, Src/subst.c, Src/utils.c, + Etc/NEWS: ksh93 $'' syntax. (hzoli, 3952; documentation + clarifications by zefram) + +Thu May 28 21:13:04 1998 Andrew Main + + * Functions/checkmail: Zero-length folders don't count as + containing new mail, regardless of when they've been examined. + (hzoli, 3963) + + * Src/glob.c: When globbing `foo/', stat `foo/.', so that only + directories are matched (as POSIX requires). With (-T) + qualifier, dangling symlinks should be matched as normal. + With (T-/), etc., stat the pathname *before* modification by + (T). (hzoli, 3960) + + * Src/Modules/stat.c: Some old K&R compilers don't like automatic + aggregate initialisation. (hzoli, 3962) + + * Src/glob.c: tail was assumed to be NULL when pattern parsing + was called. (hzoli, 3961) + + * Src/builtin.c: Fix off-by-one allocation bug in read. + (hzoli, 3951) + + * Src/builtin.c: Cleanup of read builtin. Also backslash should + quote characters, as well as performing line continuation. + (hzoli, 3949) + + * Src/Zle/zle_tricky.c: Remove prototype cast for + yp_callback.foreach, because on some systems the prototype + is wrong. (hzoli, 3948) + + * Src/math.c: Avoid an unbalanced stack error on $((0x1+0x1)). + (hzoli, 3947) + + * Src/params.c: PM_UNIQUE should persist across changes of + parameter type. (hzoli, 3946) + + * Etc/NEWS: List major changes from 3.0. + +Tue May 26 21:39:06 1998 Andrew Main + + * Src/glob.c, Doc/Zsh/expn.yo: `~' alone should not trigger + globbing. + +Mon May 25 21:13:41 1998 Andrew Main + + * Src/mkmakemod.sh, configure.in, aczsh.m4: Link modules against + $(LIBS), and include -lc in $(LIBS), in case a module requires + a function that only exists in static libraries. + + * Src/makepro.awk: Change `\{' to `[{]' in regexps, because some + nawks dislike the former. + + * configure.in: Use tr to avoid giving backslashes to echo + (which may interpret them). + +Fri May 1 19:39:12 1998 Andrew Main + + * Doc/Zsh/metafaq.yo: ftp.math.technion.ac.il now mirrors + ftp.zsh.org. + +Thu Apr 30 20:19:47 1998 Andrew Main + + * Src/version.h: Version 3.1.3. + + * Doc/paths.yo.in: New date. + + * Src/Modules/stat.c: Remove some unused variables. + + * configure.in: Start of configuration for dynamic modules + on netbsd. (gcw) + + * Doc/Zsh/metafaq.yo: New mirror (ftp.roedu.net). ftp.cs.elte.hu + and ftp.cenatls.cena.dgac.fr now mirror ftp.zsh.org. + +Wed Apr 29 20:24:16 1998 Andrew Main + + * many files: Remove RCS Id lines. + + * Etc/pubring.pgp: Change mason's DSS/DH key. + + * Doc/Zsh/metafaq.yo: New mirror (sunsite.auc.dk). + ftp.math.gatech.edu now mirrors ftp.zsh.org. + +Tue Apr 28 23:18:44 1998 Andrew Main + + * Doc/Zsh/metafaq.yo: New primary archive, ftp.zsh.org. + + * Etc/FAQ.yo: New version, 1998-04-24. (pws) + + * Etc/FTP-README, Etc/pubring.pgp, Etc/.distfiles: Include these + files from the FTP site in the distribution. + + * configure.in, Util/mkdisttree.sh, Config/, Config/clean.mk, + Config/config.mk, Config/defs.mk Makefile.in, + Doc/Makefile.in, Etc/Makefile.in, Functions/Makefile.in, + Misc/Makefile.in, Src/Makefile.in, Src/Makemod.in.in, + StartupFiles/Makefile.in, Util/Makefile.in, .distfiles, + Config/.distfiles, Doc/.distfiles, Doc/Zsh/.distfiles, + Etc/.distfiles, Functions/.distfiles, Misc/.distfiles, + Src/.distfiles, Src/Builtins/.distfiles, Src/Modules/.distfiles, + Src/Zle/.distfiles, StartupFiles/.distfiles, Util/.distfiles: + Modify config.status to add a file inclusion facility; + this is used to remove common code from many Makefiles. + New distribution-building mechanism: `.distfiles' files list + the files to go in the distribution, and Util/mkdisttree.sh + processes these. As a result, directories in which nothing + is ever built no longer need Makefiles. + +Sun Apr 26 22:08:06 1998 Andrew Main + + * configure.in, Src/mkmakemod.sh: Modify config.status to allow + .in files in the build tree. + +Sun Apr 26 19:35:17 1998 Andrew Main + + * Src/glob.c: Glob patterns with | alternation at the top level + were not setting C_LAST flags correctly. (zefram, 3876) + +Sun Apr 26 13:49:28 1998 Andrew Main + + * Src/cond.c, Src/glob.c, Src/system.h, Src/utils.c, + Src/Modules/files.c, Src/Modules/stat.c, Src/Zle/zle_tricky.c: + Use POSIX S_I* macros instead of fixed octal values. (zefram, + 3875) + + * configure.in, Src/params.c, Src/system.h: Don't need configure + test for sizeof(long). + + * configure.in, Src/cond.c, Src/glob.c, Src/system.h, + Src/Modules/files.c, Src/Modules/stat.c, Src/Zle/zle_tricky.c: + Use S_IS* macros in all cases instead of S_IF*. Define S_IS* + macros for file types that don't exist, to avoid needing + conditionals; support readlink() similarly. Add more file + type letters to the stat module. (zefram, 3874) + +Sat Apr 25 22:58:34 1998 Andrew Main + + * Src/Zle/zle_misc.c: Fix an array overrun in suffix removal, + caused by a signed/unsigned char mixup. (zefram, 3873) + +Sat Apr 25 17:15:32 1998 Andrew Main + + * Src/utils.c: Make CHASE_LINKS take effect on cd, as documented. + (zefram, 3872) + + * Misc/globtest, Misc/globtest.ksh, Src/glob.c: Fix for exclusions + nested inside more complex glob patterns. (pws, 3870) + +Thu Apr 23 21:21:29 1998 Andrew Main + + * META-FAQ, Doc/META-FAQ.yo, Doc/Makefile.in, Doc/Zsh/guide.yo, + Doc/Zsh/intro.yo, Doc/Zsh/metafaq.yo, Doc/Zsh/seealso.yo: + Generate the META-FAQ and the related parts of the documentation + from a common source (Doc/Zsh/metafaq.yo). Updated list of + mirror sites. + + * Src/exec.c: Back out patch 3859. NO_CLOBBER should allow + opening non-regular files (POSIX.2 clause 3.7.2). Instead fix + the errno handling. (zefram, 3869) + +Wed Apr 22 21:11:30 1998 Andrew Main + + * Etc/BUGS, Etc/MACHINES: sed is no longer used for generating + prototypes. We also now know about /proc/self/fd. + + * Misc/compctl-examples: Remove some code to cope with very old + zsh versions. + + * Etc/CONTRIBUTORS, Util/zsh-development-guide, Doc/Zsh/intro.yo, + META-FAQ, README: New coordinator. + + * Src/exec.c: NO_CLOBBER should prevent opening FIFOs, not just + overwriting regular files. (zefram, 3859) + +Wed Apr 8 20:29:28 1998 Andrew Main + + * Src/version.h: Version 3.1.2-zefram4. + + * Src/Zle/zle_keymap.c: Bind "^[OA" etc. as well as "^[[A". + Change vi arrow key bindings to match vi practice. (zefram) + + * Src/jobs.c: Don't read tty settings when ZLE is active. + (pws, 3818) + + * Src/Zle/zle_keymap.c: Don't set errflag in bindkey. (pws, 3815) + + * Etc/FAQ: New FAQ version, 1998-03-24. (pws, a76) + + * Misc/compctl-examples: tar completion that lists files in + the archive. (pws, u1409) + + * Src/glob.c: Fix foo(:s/foo/bar). (pws, 3808) + + * Src/subst.c: Fix ${i:s/foo/bar}. (pws, 3806) + + * Doc/Zsh/expn.yo: Mention in the parameter expansion section + that history modifiers can be used. (pws, 3805) + +Mon Apr 6 21:45:30 1998 Andrew Main + + * Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Src/glob.c, Src/options.c, + Src/parse.c: More glob changes: + + remove `-(...)' glob qualifier syntax + + allow normal qualifier syntax with KSH_GLOB + + add option BARE_GLOB_QUAL (emulation-relevant, zsh-only) + that enables glob qualifiers + + remove the paren twiddling when using patterns in [[ ]] + and case + (zefram) + + * Misc/globtests, Misc/globtests.ksh: More tests for exclusions, + which currently don't work properly. (zefram) + +Sun Apr 5 20:00:40 1998 Andrew Main + + * Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Src/glob.c: Glob changes: + + KSH_GLOB doesn't affect parens that are not preceded by the + special characters + + correctly handle combinations like ?(foo)## + + parens always trigger globbing + + with EXTENDED_GLOB, embedded `~' triggers globbing, + as the documentation already states + + remove incorrect special handling of (^...) + + general documentation cleanup + (zefram) + + * Doc/Zsh/expn.yo, Doc/Zsh/options.yo, Misc/globtests, + Misc/globtests.ksh, Src/glob.c, Src/options.c, Src/parse.c, + Src/zsh.h: KSH_GLOB. (pws, 3764) + +Sat Apr 4 15:44:05 1998 Andrew Main + + * Src/Zle/zle_tricky.c: expand-or-complete-prefix rewrite. + (pws, 3770) + +Wed Mar 25 21:51:15 1998 Andrew Main + + * Src/builtin.c: getopts bugfixes. (bugs pointed out by Bernd + Eggink , 3797) + + * Misc/compctl-examples: Completions for ssh, nslookup, telnet, + ping, finger and gdb. (, u1274; some fiddling) + + * Misc/compctl-examples: pine completion. (pws, u1359) + +Tue Mar 24 21:36:47 1998 Andrew Main + + * Src/compat.c, Src/prototypes.h: gettimeofday() returns int, + not void. (zefram) + + * Misc/compctl-examples: cvs completion. (, + u1243; much fiddling) + + * Misc/compctl-examples: lynx completion. (Oliver Kiddle + , 3760; some fiddling for portability) + +Mon Mar 23 21:18:11 1998 Andrew Main + + * Src/loop.c: Don't reprint the select list after non-empty input. + (Bernd Eggink , 3796) + + * configure.in: Display module compiler flags. (zefram) + + * Src/signames.awk, Src/Builtins/rlimits.awk: Remove leading + zeros from decimal constants to avoid interpretation as octal. + + * configure.in: define CLOBBERS_TYPEAHEAD for SINIX. (Andrej + Borsenkow , 3737) + + * Misc/compctl-examples: mount completion. (Stefan Monnier + , u1238) + +Sun Mar 22 19:02:04 1998 Andrew Main + + * Doc/Zsh/prompt.yo, Src/utils.c: %L strftime sequence to do %l + without fill. (pws, 3731) + + * Src/prompt.c, Doc/Zsh/prompt.yo: %L prompt escape for $SHLVL. + (Phil Pennock ) + + * Src/Makefile.in: Use LD_RUN_PATH instead of -R. (Andrej + Borsenkow , 3739) + + * Etc/FAQ: New FAQ version, 1998-03-02. (pws, a75) + +Thu Jan 15 23:28:02 1998 Andrew Main + + * Src/makepro.awk, Src/mkmakemod.sh, Src/mkmodindex.sh: + Portability fixes. (zefram, 3713) + + * configure.in: Test for yp_all(), not getdomainname(), to see + if -lnsl is required. (zefram, 3715) + + * Makefile.in, Src/Makefile.in, Src/Makemod.in.in: Accept + $(INSTALL) being a relative pathname, set by configure. + (zefram, 3716) + + * configure.in, Src/Makefile.in: More logical name for libzsh. + Install/uninstall/clean libzsh. Link with a -R option to + indicate where libzsh will be installed. (zefram, 3714) + + * Src/glob.c: Don't use up more digits in a <-> glob pattern + than the range can match. There are still several cases that + don't work; backtracking is required. (pws, 3680) + +Sun Jan 11 19:22:13 1998 Andrew Main + + * Src/version.h: Version 3.1.2-zefram3. + + * Src/builtins.c: Rewrote getopts to remove its various bugs. + +Sun Jan 11 14:22:50 1998 Andrew Main + + * Doc/Makefile.in, Etc/Makefile.in, Functions/Makefile.in, + Makefile.in, Misc/Makefile.in, Src/Makefile.in, + Src/Makemod.in.in, StartupFiles/Makefile.in, Util/Makefile.in: + Pass on all configuration variables to all Makefiles. + + * Src/mkmakemod.sh: Fix $sed_normalise script to allow for + compilation in the source tree. + +Sat Jan 10 23:56:33 1998 Andrew Main + + * Src/version.h: Version 3.1.2-zefram2. + + * Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/comp1.c, + Src/Zle/compctl.c, Src/Zle/zle_tricky.c: compctl -Y is like -X, + but performs expansion on the string. compctl -y allows the + displayed completions to be user-generated. (pws, 3636) + +Sat Jan 10 16:27:30 1998 Andrew Main + + * Misc/compctl-examples: Use compctl -W where appropriate. + + * Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/compctl.c, + Src/Zle/zle_tricky.c: compctl -W applies an invisible prefix + when matching pathnames. (pws, 3498+3502) + + * Misc/compctl-examples: Use compctl -/ where appropriate. + + * Doc/Zsh/compctl.yo, Src/Zle/comp.h, Src/Zle/compctl.c, + Src/Zle/zle_tricky.c: compctl -/ completes directories in the + manner of -f. (pws, 3492+3493+3495+3502) + +Sat Jan 10 00:36:04 1998 Andrew Main + + * Makefile.in, Src/Makefile.in, Src/Makemod.in.in: make clean + fixes. + +Fri Jan 9 21:04:38 1998 Andrew Main + + * Src/system.h, Src/zsh.h, Src/utils.c, Src/parse.c: Don't + depend on any relation between sizes of ints and pointers when + duplicating/freeing structures. + + * Src/Zle/zle_refresh.c: Refresh bugfix. (schaefer, 3511) + + * Util/helpfiles: Updated. (pws, 3598) + + * Doc/Zsh/intro.yo: Mention the list archives. + + * configure.in: Prefer -lcurses to -ltermcap on HP-UX 10.*. + (pws, 3360) + +Fri Jan 9 01:28:46 1998 Andrew Main + + * Src/Makefile.in: ansi2knr was being built as a.out. + +Wed Jan 7 23:44:16 1998 Andrew Main + + * Src/glob.c, Misc/globtests: Backtrack in globbing, to support + nested closures. (pws, 3513+3514+3515+3525) + + * Doc/Zsh/expn.yo: Clarifications and corrections to the + documentation for history expansion modifiers. (pws, 3549) + + * Src/subst.c: Fix for a typo that made RC_EXPAND_PARAM expansion + of an empty array go horribly wrong. (hzoli, 3548) + + * Src/builtin.c, Src/hist.c: Neater method to remove fc commands + from the history list. (pws, 3531) + + * Src/builtin.c, Src/init.c, Src/main.c: Make $(r) work. + (pws, 3526) + +Wed Jan 7 22:17:31 1998 Andrew Main + + * Doc/Zsh/options.yo, Src/Zle/zle_tricky.c: Completion in brace + expansion, with magic suffix removal on `,' and `}' triggered by + AUTO_PARAM_KEYS. (pws, 3438; suffix code rewritten by zefram) + + * Src/Zle/zle_tricky.c, Doc/Zsh/compctl.yo: Print -X explanation + iff there was not a unique match, rather than iff there were + no matches. (code: hzoli, 3423. doc: pws, 3424) + +Wed Jan 7 20:44:46 1998 Andrew Main + + * Src/init.c, Doc/Zsh/func.yo: preexec shell function is run + immediately before running each command. (pws, u1068) + + * Src/Zle/zle_main.c: Select keymap earlier; apparently + this avoids a crash in some circumstances. (Bernd Eggink + , 3625) + + * Src/mem.c: zrealloc() should check for out-of-memory condition. + (hzoli, 3522) + + * Src/subst.c: A fix for `a="a "; print -l ${(o)=a}b'. (hzoli, + 3522) + + * Src/rlimits.awk: Some awks do not like || in the pattern. + (hzoli, 3522) + + * Misc/c2z: Many corrections. (schaefer, 3484) + + * Doc/Zsh/expn.yo: An extra paragraph explaining RC_EXPAND_PARAM + behaviour. (pws, 3417; markup brought into line with the rest + of the documentation) + + * Src/zsh.h, Src/subst.c, Src/utils.c: Make parameter expansion + with RC_EXPAND_PARAM behave the same as brace expansion, + and make it make sense. (hzoli, 3403) + + * Src/parse.c: Fix error recovery on inputs such as + `( [[ $I bug 10 ]] )', which previously got mangled. + (hzoli, 3383) + + * configure.in, Src/Builtins/rlimits.awk: Find and correctly + handle the GNU hurd , which defines RLIMIT_* + in an enum. (Kunihiro Ishiguro , 3369) + + * Src/glob.c: restrict leaf optimisation of recursive globs to + the case of nlink == 2. Some systems don't keep proper link + counts for directories, but will probably distinguish themselves + by having a link count of 1 or 0 for directories. (hzoli, 3368) + +Tue Jan 6 23:29:43 1998 Andrew Main + + * Src/version.h: Version 3.1.2-zefram1. + + * Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: Rewrite of the + removable suffix mechanism. In all cases, the longest possible + meaningful suffix is added, and on following insertions the + minimum trailing part of the suffix removed in order to put + the character in a sensible place. (zefram, 3353) + + * Doc/Zsh/options.yo, Src/options.c, Src/utils.c, Src/zsh.h: + Option PRINT_EIGHT_BIT, indicates that characters >= 0x80 are + printable, even if isprint() says otherwise. (pws, 3318) + + * Src/Zle/zle_utils.c: Spaces were getting added to the end of + the line when menu completing. (pws, 3308) + + * Src/jobs.c: Set STAT_NOSTTY in bg. The result is that + STAT_NOSTTY is set if a job is ever run backgrounded. + (Suzuki Hisao , 3302) + + * Src/Zle/zle_tricky.c, Src/params.c: A couple of memory leaks. + (pws, 3301) + + * Src/zsh.h, Src/exec.c, Src/jobs.c: New job flag STAT_NOSTTY + means don't inherit the tty settings from this job when it + exits. Is set on jobs that are started in the background. + (hzoli, 3297) + + * Src/params.c: Keep actual inherited environment strings around + while importing individual variables. This is required because + the special behaviour when setting $TERM (and potentially + other variables) depends on the value of other variables. + (hzoli, 3293) + + * Src/glob.c: In `*(-M)', the (-) should affect the type of stat + used for (M). (pws, 3285) + + * Src/Zle/zle_refresh.c: Buffer overrun bug fix. (gcw, 3260) + + * INSTALL, Makefile.in, configure.in, Src/Makefile.in, + Src/**/*.c, Src/mkbltnmlst.sh, Src/prototypes.h, + Src/signals.h, Src/signames.awk, Src/xmods.conf, Src/zsh.h, + Src/Zle/comp.h, Src/Zle/zle.h, Src/Makemod.in.in, + Src/mkmakemod.sh, Src/mkmodindex.sh, Src/zsh.mdd, + Src/Builtins/rlimits.mdd, Src/Builtins/sched.mdd, + Src/Modules/cap.mdd, Src/Modules/clone.mdd, + Src/Modules/example.mdd, Src/Modules/files.mdd, + Src/Modules/stat.mdd, Src/Zle/comp1.mdd, Src/Zle/compctl.mdd, + Src/Zle/deltochar.mdd, Src/Zle/zle.mdd, Src/conf.sed, + Src/mkstamp.sh, Src/mods.conf, Src/Builtins/Makefile.in, + Src/Modules/Makefile.in, Src/Zle/Makefile.in: Rewrite of + the module build system. Knowledge specific to each module + is localised in a .mdd file for that module. Makefiles and + headers are automatically generated. (zefram, 3252) + + * Src/jobs.c: `disown' was leaking memory. (pws, 3251) + + * Src/subst.c: `set "$@"' was freeing strings while still needed, + due to paramsubst() not duplicating them. (zefram, 3250) + + * Src/glob.c: globbing of `foo*r~foob*' was failing, due to + the character before the ~ not being marked as being the end + of a pattern. (pws, 3249) + + * Src/Zle/zle_tricky.c: AUTO_PARAM_KEYS was adding suffix + characters in the middle of a word if completing within a word. + (hzoli, 3247) + + * Src/params.c: filter out garbage when importing environment + variables. (hzoli, 3246) + + * Doc/Zsh/builtins.yo, Doc/Zsh/mod_compctl.yo, + Doc/Zsh/mod_sched.yo, Doc/Zsh/mod_zle.yo: Move documentation + of the standard moduleified builtins into zshmodules(1). + (zefram, 3244) + + * Src/Makefile.in, Src/builtin.c, Src/exec.c, Src/glob.c, + Src/globals.h, Src/hashtable.c, Src/hashtable.h, Src/hist.c, + Src/init.c, Src/input.c, Src/jobs.c, Src/lex.c, Src/loop.c, + Src/makepro.awk, Src/math.c, Src/mem.c, Src/module.c, + Src/options.c, Src/params.c, Src/parse.c, Src/prompt.c, + Src/prototypes.h, Src/signals.c, Src/signals.h, + Src/signames.awk, Src/subst.c, Src/utils.c, Src/zsh.h, + Src/Builtins/Makefile.in, Src/Modules/Makefile.in, + Src/Zle/Makefile.in, Src/Zle/comp.h, Src/Zle/comp1.c, + Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c, + Src/Zle/zle_main.c, Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, + Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: Move all object + declarations into .c files, so that they are processed by + makepro.awk. (zefram, 3243) + + * Src/Makefile.in, Src/builtin.c, Src/exec.c, Src/glob.c, + Src/globals.h, Src/hist.c, Src/init.c, Src/jobs.c, + Src/lex.c, Src/main.c, Src/math.c, Src/mem.c, Src/options.c, + Src/params.c, Src/parse.c, Src/signals.c, Src/watch.c, + Src/zsh.h, Src/Builtins/Makefile.in, Src/Modules/Makefile.in, + Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_bindings.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, Src/makepro.sh, + Src/makepro.awk: Generate prototypes with an awk script, which + handles data declarations as well as functions. Make data + objects static where appropriate. (zefram, 3242) + + * Src/builtin.c, Src/exec.c, Src/hashtable.c, Src/hashtable.h, + Src/module.c, Src/zsh.h, Src/Builtins/rlimits.c, + Src/Builtins/sched.c, Src/Modules/cap.c, Src/Modules/clone.c, + Src/Modules/example.c, Src/Modules/files.c, Src/Modules/stat.c, + Src/Zle/compctl.c, Src/Zle/zle_main.c: Use struct builtin + instead of struct binlist, avoiding some dynamic memory + allocation. (zefram, 3241) + + * configure.in, Src/builtin.c, Src/Builtins/Makefile.in, + Src/Builtins/rlimits.c, Src/Modules/cap.c: Always build the + rlimits module. (zefram, 3240) + + * Src/builtin.c, Src/globals.h, Src/init.c, Src/input.c, + Src/loop.c, Src/prompt.c, Src/utils.c, Src/Zle/zle.h, + Src/Zle/zle_main.c, Src/Zle/zle_refresh.c: Format prompts once + per editing session, so that they don't get changed improperly. + (zefram, 3239) + + * Doc/Zsh/compat.yo, Doc/Zsh/options.yo, Doc/Zsh/prompt.yo, + Src/options.c, Src/prompt.c, Src/zsh.h: Options PROMPT_PERCENT + and PROMPT_BANG, controlling which type of sequences get + expanded in prompts. Set appropriately for sh and ksh + emulation. (zefram, 3052) + + * Doc/Zsh/options.yo, Src/exec.c, Src/options.c, Src/zsh.h: + Option HIST_NO_FUNCTIONS, to exclude function definitions + from the history list. Option alias NO_LOG (from ksh). + (zefram, 3050) + + * Src/init.c: When emulating sh or ksh, make the default prompts + "$ " (or "# ") and "> ". (zefram, 3004) + + * Doc/Zsh/options.yo, Src/builtin.c, Src/options.c, Src/utils.c, + Src/zsh.h: Option RM_STAR_WAIT to wait ten seconds at the `rm + *' prompt. (zefram, 2999) + +Tue Jun 3 06:14:14 1997 Zoltán Hidvégi + + * Src/version.h: zsh-3.1.2 released + + * Src/params.c: Some compilers do not like ? (void *) : + + * Src/jobs.c: pg(){ less;};:|pg caused suspended (tty input) + +Mon Jun 2 07:52:31 1997 Zoltán Hidvégi + + * Doc/paths.yo.in: Updated date + + * Doc/paths.yo, Doc/zsh.1, Doc/zsh.texi, Doc/zshall.1, + Doc/zshbuiltins.1, Doc/zshcompctl.1, Doc/zshexpn.1, + Doc/zshmisc.1, Doc/zshmodules.1, Doc/zshoptions.1, + Doc/zshparam.1, Doc/zshzle.1: generated zsh-3.1.2 manuals + + * Doc/Zsh/builtins.yo, Doc/Zsh/params.yo: Typo fixes from Tomasz + Cholewo (3163) + + * Src/Zle/zle_refresh.c: Xterm cut & paste fixes from Geoff (3135) + + * Src/hist.c: Fix !# history expansion during completion. From + Peter (3132) + + * Doc/Zsh/builtins.yo, Doc/Zsh/compat.yo, Doc/Zsh/expn.yo, + Doc/Zsh/func.yo: Minor documentation fixes from Zefram (3125) + + * Doc/Zsh/guide.yo, Doc/Zsh/intro.yo: The zsh web site moved + + * Etc/FAQ, Etc/FAQ.yo: FAQ from Peter: Id: zshfaq.yo,v 1.6 + 1997/05/29 09:15:00 pws Exp + + * Etc/Makefile.in: Do not make FAQ.yodl by default + + * INSTALL: Instructions about dynamic modules and builtin modules + + * Functions/zls: Improved zll module renamed to zls supporting the + ailLFd options + + * Src/glob.c: The T glob flag did not work + +Sun Jun 1 08:02:19 1997 Zoltán Hidvégi + + * Src/system.h: Use _POSIX_VDISABLE is available. Fixes ^@ in zle + on some systems. + + * Src/Zle/zle_tricky.c: expand-or-complete-prefix fixed + + * Src/Builtins/rlimits.c, Src/Builtins/sched.c, + Src/Modules/clone.c, Src/Modules/example.c, Src/Zle/comp1.c, + Src/Zle/compctl.c, Src/Zle/deltochar.c, Src/Zle/zle_hist.c, + Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_move.c, Src/Zle/zle_params.c, Src/Zle/zle_refresh.c, + Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, + Src/Zle/zle_vi.c, Src/Zle/zle_word.c, Src/builtin.c, + Src/compat.c, Src/cond.c, Src/exec.c, Src/glob.c, + Src/hashtable.c, Src/hist.c, Src/init.c, Src/input.c, Src/jobs.c, + Src/lex.c, Src/linklist.c, Src/loop.c, Src/main.c, Src/math.c, + Src/mem.c, Src/module.c, Src/options.c, Src/params.c, + Src/parse.c, Src/prompt.c, Src/prototypes.h, Src/signals.c, + Src/subst.c, Src/text.c, Src/utils.c, Src/watch.c: Declare + functions used locally in one file static. + +Sat May 31 07:29:53 1997 Zoltán Hidvégi + + * Src/Zle/comp.h, Src/prototypes.h, Src/makepro.sh, + Src/Builtins/Makefile.in, Src/Makefile.in, + Src/Modules/Makefile.in, Src/Zle/Makefile.in, Src/Zle/zle.h, + Src/module.c: Use fixed names for module make/cleanup funxtions. + Generate prototypes for static functions. Ideas from articles + 3123 and 3124 from Zefram. + +Thu May 29 05:17:31 1997 Zoltán Hidvégi + + * Src/cond.c: directories are always executable by root + + * META-FAQ: The zsh web page moved. + + * aclocal.m4, configure, configure.in: --enable-ansi2knr configure + option added. From Zefram (3122) + +Tue May 20 05:22:16 1997 Zoltán Hidvégi + + * Src/utils.c: if abort or edit used on a correct prompt, do not + attempt to correct further words on the line. + +Sun May 18 18:57:08 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c, Src/init.c, Src/signals.c, Src/jobs.c: + Do not handle SIGPIPE specially for shells with job control + + * Src/init.c, Src/jobs.c, Src/utils.c: (:); while true; do; done + was uninterruptible. Sometimes LINES/COLUMNS was not set + properly for non-interractive shells. + + * Src/exec.c, Src/signals.c: `:`; while true; do; done was + uninterruptible + +Mon May 12 09:01:55 1997 Zoltán Hidvégi + + * configure, configure.in: on NetBSD is needed for + rlimit type checks. From Geoff. + + * Src/hist.c: !:2-1 history expansion caused memory corruption + +Sun May 11 08:52:00 1997 Zoltán Hidvégi + + * Src/lex.c: $((foo);bar) syntax works + + * Src/hist.c: A terminal hangup caused coredump while saving history + + * Src/globals.h, Src/init.c, Src/params.c: if we cannot get the + correct window size with ioctl, set LINES and COLUMNS from + termcap. + + * Src/builtin.c: make sure zexit is not reentered when its + execution is interrupted by a signal. + +Fri May 9 07:59:00 1997 Zoltán Hidvégi + + * Src/utils.c: print_if_link (used by whence -s) did not work well. + + * Doc/zsh.texi: @br{} removed + + * Src/exec.c: Quick hack: do not open file redirections if noexec + is set + + * Src/jobs.c: printjobs() set errflag when the foreground process + was interrupted. + +Thu May 8 09:18:56 1997 Zoltán Hidvégi + + * Src/cond.c: [[ -x file ]] does stat for privileged users + + * Src/Zle/zle_utils.c: do no read line[ll] (which is undefined) + + * Src/signals.c: flush the input queue on interrupt + + * Src/lex.c, Src/parse.c: improve parsing of for ((...)) + + * Src/Zle/zle_tricky.c, Src/hist.c, Src/lex.c, Src/parse.c: + ((foo);bar) now works + +Wed May 7 14:50:08 1997 Zoltán Hidvégi + + * Etc/Makefile.in: make clean should delete generated htmls + +Tue May 6 06:33:06 1997 Zoltán Hidvégi + + * Etc/Makefile.in: rules to create FAQ and FAQ.html from the yodl + source + + * Doc/Makefile.in, Doc/Zsh/guide.yo, Doc/Zsh/mod_cap.yo, + Doc/Zsh/mod_clone.yo, Doc/Zsh/modules.yo, Doc/Zsh/prompt.yo, + Src/Modules/Makefile.in, Src/Modules/cap.c, Src/mods.conf, + Src/prompt.c, Src/system.h, Src/utils.c, config.h.in, configure, + configure.in: Make the shell aware of POSIX.1e capabilities and + add a cap builtin module. From Zefram (3088) + + * Src/Zle/zle_main.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: vi + line range bugfix from Zefram (3094) + + * Src/signals.c: WINCH traps did not work. From Peter (3093) + + * Src/hashtable.h, Src/params.c: LC_* parameters stopped working + after patch 3014. From Zefram (3089) + + * Doc/Zsh/builtins.yo, Doc/Zsh/restricted.yo, Src/builtin.c, + Src/hashtable.h: hash builtin fixes from Zefram (3061) + + * Src/Zle/zle_thingy.c, Src/hashtable.c, Src/params.c, Src/zsh.h: + Allow adding/deleting nodes during scanhashtable. From Zefram + (3058) + +Mon May 5 09:29:22 1997 Zoltán Hidvégi + + * Src/hist.c: % word designator fix from Bruce Murphy + (3065) + + * Doc/Zsh/builtins.yo, Src/builtin.c, Src/hashtable.h, + Src/utils.c: whence -s prints expanded symlinks (idea from + art. 3067 by Juergen A. Erhard ). Use zputs + in whence. xsymlinks return 1 iff it found some symlinks or ../ + (previously it always returned 0 although it had some + never-reached return 1 statements). + + * Src/params.c: zero LINES/COLUMNS should not set narrow/short + term. From Zefram (3063) + + * Src/builtin.c: typeset -R UID caused a coredump + + * Src/globals.h, Src/mem.c, Src/prototypes.h: alloc/ncalloc + declarations moved to globals.h. From Zefram (3057) + + * Doc/Makefile.in, Doc/zsh.yo: doc install and zshall fixes. From + Zefram (3056) + + * Src/prototypes.h, Src/system.h, config.h.in, configure, + configure.in: checks for memcpy and memmove. From Zefram (3055) + + * Doc/Zsh/params.yo: parameter documentation improvements. From + Zefram (3051) + + * Src/utils.c: simplify adjustwinsize(). Based on art. 3053 from + Zefram. + + * Src/Zle/zle_main.c, Src/Zle/zle_params.c, Src/builtin.c, + Src/exec.c, Src/globals.h, Src/init.c, Src/params.c: remove + locallist. From Zefram (3049) + + * Doc/Zsh/builtins.yo, Doc/Zsh/guide.yo, Doc/Zsh/params.yo, + Src/builtin.c, Src/params.c: local parameters can hide special + parameters. From Zefram (3048) + +Sun May 4 06:16:44 1997 Zoltán Hidvégi + + * Src/Builtins/Makefile.in, Src/Makefile.in, + Src/Modules/Makefile.in, Src/Zle/Makefile.in, aczsh.m4, + configure, configure.in: Strip shared modules and executables if + possible. From Zefram (3038) + + * Doc/Zsh/mod_sched.yo, Doc/Zsh/guide.yo, Doc/Zsh/mod_files.yo, + Doc/Zsh/mod_stat.yo, Doc/Zsh/modules.yo, + Src/Builtins/Makefile.in, Src/Builtins/sched.c, Src/Makefile.in, + Src/builtin.c, Src/globals.h, Src/hashtable.h, Src/init.c, + Src/linklist.c, Src/mods.conf, Src/utils.c, Src/xmods.conf, + Src/zsh.h: The sched builtin moved to a separate module. From + Zefram (3037) + + * Src/Builtins/rlimits.c, Src/prototypes.h, Src/hashtable.h, + Src/mods.conf, Src/xmods.conf, Src/Builtins/Makefile.in, + Src/Makefile.in, configure, configure.in: Src/Builtins directory + created. rlimits.c moved to Src/Builtins and converted into a + loadable module. + +Wed Apr 30 07:40:30 1997 Zoltán Hidvégi + + * Doc/Zsh/grammar.yo, Src/globals.h, Src/lex.c, Src/loop.c, + Src/parse.c, Src/text.c, Src/zsh.h: ksh style ;& case + fall-through feature from Zefram (3062) + + * Src/text.c: printing case commands were broken. From Zefram (3062) + + * Doc/Zsh/builtins.yo, Doc/Zsh/func.yo, Doc/Zsh/options.yo, + Src/builtin.c, Src/exec.c, Src/hashtable.c, Src/options.c, + Src/utils.c, Src/zsh.h: KSH_AUTOLOAD option from Zefram (3060) + + * Src/module.c: Do not remove dependencies for a module when it is + unloaded. From Zefram (3033) + + * Src/Zle/zle_main.c, Src/Zle/zle_tricky.c, Src/builtin.c, + Src/exec.c, Src/utils.c: get{sh,fp}func() return &dummy_list for + non-existent functions. This allows autoloading empty + functions. From Zefram (3036) + + * Src/exec.c: Assume ksh-autoloading only if the autoloaded file + is a single function definition. From Zefram (3032) + + * Src/Makefile.in, Src/mkbltnmlst.sh, Src/mkstamp.sh, + Src/xmods.conf, aczsh.m4, configure, configure.in: Link comp1 + into the main zsh if the system lacks RTDL_GLOBAL functionality. + From Zefram (3030) + + * config.h.in, configure, aczsh.m4, configure.in, Makefile.in, + acconfig.h, aclocal.m4: The config part of the nameclash patch + from Zefram (3028). The code part does not work with ansi2knr. + +Mon Apr 28 07:28:34 1997 Zoltán Hidvégi + + * Src/Zle/comp.h, Src/Zle/comp1.c, Src/Zle/compctl.c, + Src/Zle/deltochar.c, Src/Zle/zle.h, Src/Zle/zle_bindings.c, + Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, + Src/Zle/zle_misc.c, Src/Zle/zle_move.c, Src/Zle/zle_params.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_thingy.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, + Src/Zle/zle_word.c, Src/builtin.c, Src/globals.h, Src/init.c, + Src/zsh.h: move compctl related read stuff global variables from + the main binary into the comp1 module. From Zefram (3029) + + * Src/Zle/zle_tricky.c: Yet an other suffix removal fix from + Zefram (3024) + + * Src/builtin.c, Src/system.h, acconfig.h, config.h.in, configure, + configure.in, Src/Builtins/rlimits.c: Use rlim_t if available + + * Doc/Zsh/builtins.yo, Doc/Zsh/restricted.yo, Src/globals.h, + Src/init.c, Src/jobs.c, Src/main.c: jobs -Z documented, improved + and disabled in restricted mode. From Zefram (3027) + + * Doc/Zsh/builtins.yo, Src/hashtable.h, Src/jobs.c: jobs -d prints + the working current directory of jobs. From Peter (2889) + + * Doc/Zsh/restricted.yo, Src/module.c: disallow adding module + dependencies with absolute pathnames in restricted mode. From + Zefram (3025) + + * Doc/Zsh/options.yo, Src/options.c: New option aliases to please + bash users: dotglob, hashall, histappend, histexpand, mailwarn, + onecmd and promptvars. From Zefram (3026) + + * Etc/FAQ.yo: from Peter: Id: zshfaq.yo,v 1.5 1997/04/24 10:19:15 + pws Exp + + * Etc/FAQ: April 24 1997 FAQ from Peter + + * Src/Makefile.in, Src/Zle/zle_params.c, Doc/Zsh/zle.yo, + Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_main.c, + Src/exec.c, Src/hashtable.h, Src/mods.conf, Src/params.c, + Src/zsh.h: New special parameters {,L,R}BUFFER, CURSER added + only present in zle widget functions. Virtualised unset method + in struct param. pm->data modev to pm->u.data. From Zefram + (3014) + + * Src/Zle/zle_thingy.c: Fix a memory leak when unloading zle with + user-defined widgets. From Zefram (3015) + + * Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_main.c, + Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/builtin.c, + Src/globals.h, Src/init.c, Src/input.c, Src/loop.c, Src/utils.c, + Src/zsh.h: Remove in_vared and use a third parameter to zleread + to allow history recall. histallowed is a new zle global + variable for that. Rename inzlefunc to incompctlfunc. Add some + checks to avoid dangerous recursive zle calls. From Zefram + (3013) + + * Src/Zle/zle_main.c, Src/Zle/zle_tricky.c: menu completion did + not work well with auto_param_keys. From Zefram (3011) + +Sat Apr 26 06:26:11 1997 Zoltán Hidvégi + + * Functions/zed: Reenter zed if it fails to save the file + + * Functions/zed: Use bindkey -L to temporarily save bindings. + From Zefram (3012) + + * Src/builtin.c, Src/init.c: Do not retry failed autoloads. From + Zefram (3010) + + * Src/Makefile.in, Src/mkbltnmlst.sh: non-dynamic zsh can be built + without zle. From Zefram (3008) + + * Doc/Zsh/builtins.yo, Src/module.c: Rearrange modules.c. + zmodload -qu removes dependencies. From Zefram (3009) + + * Doc/Zsh/builtins.yo, Src/module.c: zmodload -i -a works as one + would expect. From Zefram (3007) + + * Doc/Zsh/builtins.yo, Src/module.c: zmodload -a argument swap to + allow autoloading multiple builtins from a single file in one + command. From Zefram (2997) + +Fri Apr 25 06:41:36 1997 Zoltán Hidvégi + + * Doc/zman.yo: use UPPERCASE yodl macro + + * Functions/cdmatch, Misc/compctl-examples: compctl-examples + improvements from Zefram (3006) + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in, + Src/Zle/zle_hist.c, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, + Src/Zle/zle_thingy.c: ZLE unload code from Zefram (3005) + + * Src/options.c: NOTIFY is off in sh/ksh mode. From Zefram (3003) + + * Doc/Zsh/builtins.yo, Doc/Zsh/zle.yo, Misc/compctl-examples, + Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/iwidgets.list, + Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_main.c, Src/Zle/zle_misc.c, Src/Zle/zle_move.c, + Src/Zle/zle_things.sed, Src/Zle/zle_thingy.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c, Src/Zle/zle_widget.sed, + Src/Zle/zle_word.c, Src/xmods.conf: New ZLE widgets allow + user-defind ZLE functions. From Zefram (3002) + + * Src/params.c: ${foo#bar} writes to the value of foo which can be + a const causing SEGV. From Zefram (2998) + + * Src/Modules/files.c: files module fixes from Zefram (2996) + + * Functions/zll, Src/Modules/Makefile.in, Src/Modules/stat.c, + Src/mods.conf: stat module fixes from Zefram (2995) + + * Functions/zll, Src/Modules/stat.c: stat module from Peter (2994) + + * Doc/Makefile.in, Doc/Zsh/compctl.yo, Doc/Zsh/guide.yo, + Doc/Zsh/intro.yo, Doc/Zsh/mod_clone.yo, Doc/Zsh/mod_comp1.yo, + Doc/Zsh/mod_compctl.yo, Doc/Zsh/mod_deltochar.yo, + Doc/Zsh/mod_example.yo, Doc/Zsh/mod_files.yo, + Doc/Zsh/mod_stat.yo, Doc/Zsh/mod_zle.yo, Doc/Zsh/modules.yo, + Doc/Zsh/seealso.yo, Doc/zsh.yo, Doc/zshmodules.yo: Module + documentations from zefram (2994) + +Sun Apr 20 07:24:12 1997 Zoltán Hidvégi + + * Src/init.c, Src/params.c, Src/utils.c: Remove setintenv() + +Tue Apr 15 05:51:27 1997 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c: SGTABTYPE can contain more than one bit + set. From Geoff (2976) + + * Doc/Zsh/prompt.yo, Src/prompt.c, Src/utils.c, Src/watch.c: New + escapes %K and %f inside %D{...} promt sequences. %k and %e are + now compatible with strftime(). From Peter (2963) + + * Src/Zle/zle_keymap.c: bindkey -s "^X^L" "^@" produced a pound + sterling sign. From Zefram (2951) + + * Src/Zle/zle_main.c: vared 1 caused a coredump. From Peter (2909) + + * Src/exec.c, Src/signals.c: execute trap on EXIT in the caller's + environment. From Peter (2896) + + * Src/Zle/zle_tricky.c: Autoparamkeys broken by earlier patch + fixed. From Zefram and Peter (2894) + + * Src/Zle/zle_tricky.c: Clear menucur in invalidatelist(). From + Peter (2881) + + * Src/Zle/zle_main.c: vared path caused permanent + allocation in arrayfixenv + +Sat Apr 12 04:27:34 1997 Zoltán Hidvégi + + * Src/Zle/zle_misc.c: Overwrite mode did not work + +Sat Mar 8 00:17:24 1997 Zoltán Hidvégi + + * Src/Zle/compctl.c: Sometimes an incorrect compctl caused a core + dump. From Peter (2942) + +Fri Mar 7 23:54:18 1997 Zoltán Hidvégi + + * Src/Makefile.in: zle_binding.pro is not used + + * Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_refresh.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/builtin.c, + Src/globals.h, Src/init.c, Src/params.c, Src/prompt.c, + Src/zsh.h: termok changed to termflags. Modified version of + art. 2970 from Geoff + +Thu Mar 6 18:06:17 1997 Zoltan T. Hidvegi + + * Src/init.c, Src/params.c, Src/utils.c: handle narrow and short + terminals centralized in zlevarsetfn(). From Bart and me + (2956, 2957) + +Wed Mar 5 23:37:30 1997 Zoltan T. Hidvegi + + * Src/Zle/zle.h, Src/Zle/zle_refresh.c: act as if single_line_zle + were set when LINES < 3. From Geoff (2865) + + * Doc/zmacros.yo: Use UPPERCASE() yodl macro instead of chartable + hacks. From Zefram (2873) + + * Src/Zle/zle_tricky.c: menu completing parameters removed + non-existent / suffix. From Zefram (2872) + + * Src/Zle/zle_bindings.c: Some zle functions did not use + ZLE_KEEPSUFFIX. From Zefram (2871) + + * Src/Zle/Makefile.in, Src/Zle/zle.h: zle_bindings doesn't define + any functions so zle_bindings.pro is not needed + + * Src/loop.c: $? was incorrectly reset before executing case, + while, for + +Tue Feb 18 20:59:51 1997 Zoltan Hidvegi + + * Src/Zle/zle_bindings.c: M-p and M-n defaults to + history-beginning-search-* + + * Src/builtin.c: getopts handling of required argument fix from + Andrew Robinson (2846) + + * Src/builtin.c, Src/globals.h, Src/hist.c, Src/lex.c, Src/zsh.h: + History fixes: fc -AI;fc -R now do not confuse hist_ignore_dups + and some other cleanups from Peter (2845). Contains changes + from articles 2748 and 2755. + + * Src/signals.c: An #ifdef SIGWINCH was missing. From Hrvoje + Niksic (2844) + + * Src/Modules/files.c: fix problems on machines with unsigned long + mode_t. From Zefram (2843) + + * Doc/Makefile.in, Doc/Zsh/builtins.yo, Doc/Zsh/compctl.yo, + Doc/Zsh/expn.yo, Doc/Zsh/guide.yo, Doc/Zsh/prompt.yo, + Doc/Zsh/restricted.yo, Doc/zman.yo, Doc/zsh.yo, Doc/ztexi.yo, + configure.in: Various documentation fixes from Zefram (2842) + + * Src/exec.c: return from a function called from a loop breaked + the loop + + * Src/lex.c: eval \$\{$#\} did not work + +Tue Feb 11 20:25:59 1997 Zoltan Hidvegi + + * config.h.in, Src/compat.c, Src/utils.c, configure, configure.in: + stupid AIX 3.2 does not have fchdir + +Tue Jan 28 00:57:37 1997 Zoltán Hidvégi + + * Src/version.h: zsh-3.1.1 released + + * Doc/paths.yo, Doc/zsh.1, Doc/zsh.texi, Doc/zshall.1, + Doc/zshbuiltins.1, Doc/zshcompctl.1, Doc/zshexpn.1, + Doc/zshmisc.1, Doc/zshoptions.1, Doc/zshparam.1, Doc/zshzle.1: + yodl generated generated documentation + +Mon Jan 27 22:04:29 1997 Zoltán Hidvégi + + * Src/signals.c: temprarily set breaks to zero when executing a trap + + * Src/exec.c: do not reset breaks in doshfunc + + * Src/parse.c: words following for ((...)) are in command position. + +Sun Jan 26 23:29:48 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/hashtable.h: fix cd -, use unrecognized + option arguments literally + + * Src/exec.c: localoptions should not restore RESTRICTED + + * Src/signals.c: terminate a restricted shell if an untrapped INT + signal is received + + * Src/init.c: set noerrexit to -1 in setupvals() + +Sat Jan 25 20:07:46 1997 Zoltán Hidvégi + + * Src/subst.c, Src/utils.c: some assignments were missing from my + spacesplit fix + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.23 1997/01/24 13:21:16 + pws Exp + + * config.h.in, configure, configure.in: check for setsid() + + * Src/Modules/Makefile.in, Src/Modules/clone.c: new builtin: start + a forked instance of the current shell on a new terminal + +Thu Jan 23 15:45:27 1997 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c, Src/globals.h, Src/prompt.c: + redisplay fix for multiline prompts from Geoff (2817) + + * Src/subst.c, Src/utils.c: a${=:- }b expanded to `ab' + + * Doc/Zsh/compctl.yo, Doc/Zsh/guide.yo, Doc/Zsh/options.yo, + Doc/Zsh/restricted.yo, Doc/zsh.yo, Doc/zshmisc.yo: RESTRICTED + option documentation + + * Doc/Makefile.in: generate everything with yodl + + * Doc/zman.yo, Doc/ztexi.yo: itemize environment added + + * Src/module.c: disable zmodload -a and loading explicitely given + modules when restricted + + * Doc/Zsh/zle.yo: what-cursor-position zle function documented + +Wed Jan 22 00:54:02 1997 Zoltán Hidvégi + + * Doc/Zsh/builtins.yo: cd -sLP documentation + + * Doc/Zsh/builtins.yo, Src/module.c: zmodload -au removes defined + but not yet loaded builtins + +Tue Jan 21 20:38:24 1997 Zoltán Hidvégi + + * Doc/ztexi.yo: sitem() fix for TeX + + * Misc/compctl-examples: limit/unlimit compctl improvemenmt + + * Doc/Zsh/builtins.yo, Doc/ztexi.yo: TeX changes + +Mon Jan 20 21:11:22 1997 Zoltán Hidvégi + + * Src/hashtable.h, acconfig.h, config.h.in, configure, + configure.in: some old compilers cannot initialise a union + + * Src/Zle/zle.h, Src/Zle/zle_keymap.c, Src/options.c: changes for + K&R compilers + + * Src/Zle/deltochar.c: deltochar is IN_ZLE + + * Src/Modules/files.c, Src/Zle/zle_misc.c, Src/mem.c: stupid SunOS + 4 has broken headers + + * Src/system.h: cast alloca in VARARR + + * Src/Zle/zle_bindings.c, Src/Zle/zle_keymap.c, + Src/Zle/zle_misc.c: what-cursor-position zle function added + + * Src/Zle/zle_utils.c: move the mark when characters are + inserted/deleted. From Peter (2807) + + * Src/builtin.c, Src/hashtable.h: bash/ksh compatible cd -LP options + + * Src/utils.c: lchdir fix + + * Src/Modules/files.c: rm -r works with arbitrary deep + hierarchies. rm -r can be interrupted + +Sun Jan 19 13:30:36 1997 Zoltán Hidvégi + + * Src/glob.c: glob arbitrary deep directory structures + + * Src/mem.c, Src/Zle/zle_keymap.c, Src/subst.c, Src/utils.c, + Src/zsh.h: add real hrealloc() + +Sat Jan 18 22:34:17 1997 Zoltán Hidvégi + + * Src/Zle/zle_keymap.c: in bindkey -s the string was not zrdupped. + + * Src/utils.c: after Zefram's changes getkeystring should return + the result on the heap + + * Src/utils.c: fix file descriptor leak in lchdir + + * acconfig.h, config.h.in, configure, configure.in: use the + AC_FUNC_STRCOLL builtin autoconf test + + * Src/subst.c, Src/system.h, config.h.in, configure, configure.in: + alloca() and VARARR macro added which defines a variable sized + automatic array + +Tue Jan 14 23:17:34 1997 Zoltán Hidvégi + + * Src/glob.c: debugging changes (the change is mostrly reindentation) + + * Src/Zle/zle_move.c: vi-goto-column did not move to the last column + + * Src/glob.c: some old C compilers cannot use typedefed type + defined function prototypes + + * Src/exec.c: PATH=foo somecommand gives error in restricted mode + + * Src/options.c, Src/init.c: the -r command line option turns on + restricted mode + +Mon Jan 13 21:28:35 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c, Src/hashtable.h, Src/init.c, + Src/options.c, Src/params.c, Src/text.c, Src/zsh.h: RESTRICTED + option added + +Sun Jan 12 01:00:04 1997 Zoltán Hidvégi + + * Src/Zle/zle_tricky.c: automenu starts iff lastambig is true. + From Zefram (2781) + + * Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_main.c, Src/Zle/zle_move.c: add ZLE_LASTCOL flag to + zle-commands which set lastcol. From Zefram (2780) + + * Src/Zle/deltochar.c, Src/Zle/zle.h, Src/Zle/zle_bindings.c, + Src/Zle/zle_hist.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: zle removable suffix + cleanup. ZLE_INSERT and ZLE_DELETE is gone and ZLE_KEEPSUFFIX + added for commands which do not remove autoremovable suffixes. + From Zefram (2779) + + * Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_utils.c: remove + some code duplications and undo fixes. From Zefram (2769) + +Sat Jan 11 23:45:50 1997 Zoltán Hidvégi + + * Src/compat.c: lstat is defined to stat on systems without lstat + + * Src/system.h: define lstat(X,Y) instead of lstst if HAVE_LSTAT + is not defined + + * Src/Zle/zle_tricky.c: ll was not restored for xorrec + + * Src/builtin.c: read -l forgot to duplicate line before assignment + + * Src/jobs.c: do not execute trap when only the child receives the + signal. Based on article 2480 from Zefram. + + * Src/builtin.c, Src/jobs.c: move job control builtins to jobs.c + + * Src/builtin.c: fix bugs when there was no current job after disown + +Thu Jan 9 16:07:31 1997 Zoltán Hidvégi + + * Src/rlimits.c: zstrtorlimit was defined instead of zstrtorlimt + + * Src/Modules/Makefile.in, Src/Zle/Makefile.in: some buggy makes + could not find out how to make .so from .c + +Wed Jan 8 22:02:51 1997 Zoltán Hidvégi + + * Doc/Zsh/zle.yo, Doc/zsh.texi, Doc/zshzle.man, Src/Zle/zle.h, + Src/Zle/zle_bindings.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_utils.c: zle undo rewrite from Zefram (2746) + + * Src/Zle/zle.h, Src/Zle/zle_hist.c, Src/Zle/zle_main.c, + Src/Zle/zle_misc.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, + Src/utils.c: feep() just sets a flag and the main zle loop calls + beep() when this flag is set so multiple feeps cause only one + beep. From Zefram (2745) + + * Src/hist.c, Src/main.c, Src/utils.c: use shout instead of stderr + where appropriate. From Zefram (2743) + + * configure, configure.in: on NetBSD is needed for + rlimit type checks. Based on article 2742 from Geoff + + * Src/builtin.c: empty cd caused a coredump + + * Doc/Makefile.in: texi -> dvi suffix rule added + + * Doc/Zsh/redirect.yo: fix a typo. From Zefram (2685) + + * Doc/Zsh/expn.yo, Doc/Zsh/grammar.yo: brace related bugfixes + + * Doc/Makefile.in, Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo, + Doc/Zsh/compat.yo, Doc/Zsh/compctl.yo, Doc/Zsh/cond.yo, + Doc/Zsh/exec.yo, Doc/Zsh/expn.yo, Doc/Zsh/filelist.yo, + Doc/Zsh/files.yo, Doc/Zsh/func.yo, Doc/Zsh/grammar.yo, + Doc/Zsh/guide.yo, Doc/Zsh/index.yo, Doc/Zsh/intro.yo, + Doc/Zsh/invoke.yo, Doc/Zsh/jobs.yo, Doc/Zsh/options.yo, + Doc/Zsh/params.yo, Doc/Zsh/prompt.yo, Doc/Zsh/redirect.yo, + Doc/Zsh/seealso.yo, Doc/Zsh/zle.yo, Doc/paths.yo.in, + Doc/zmacros.yo, Doc/zman.yo, Doc/zsh.yo, Doc/zshbuiltins.yo, + Doc/zshcompctl.yo, Doc/zshexpn.yo, Doc/zshmisc.yo, + Doc/zshoptions.yo, Doc/zshparam.yo, Doc/zshzle.yo, Doc/ztexi.yo: + documentation rewritten into yodl format by Zefram. + +Tue Jan 7 23:10:24 1997 Zoltán Hidvégi + + * Src/params.c, Src/builtin.c, Src/exec.c: print error when + changing read-only variables, prevent core dump when assigning + an array to read-only scalar and some other fixes + + * Src/Zle/zle_tricky.c: compctl -S bugfix + +Mon Jan 6 20:43:36 1997 Zoltán Hidvégi + + * Src/exec.c, acconfig.h, config.h.in, configure, configure.in: + better /dev/fd filesystem check + + * Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_tricky.c: make + dependency cleanups + + * Src/Zle/Makefile.in, Src/Zle/zle.h, Src/Zle/zle_keymap.c, + Src/Zle/zle_things.sed: autogenerate the enum of z_* and t_* + macros. From Zefram (2731) + + * Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_move.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c: zle + prefix commands rewrite from Zefram (2722) + + * Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c: + history-search-*ward serch for complete words. From Zefram + (2721, 2730) + + * Doc/zsh.texi, Doc/zshbuiltins.man, Src/Zle/zle_keymap.c, + Src/Zle/zle_main.c: remove bindkey -u -U options. From Zefram + (2711) + + * Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/zle.h, + Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_thingy.c, Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c, + Src/mods.conf: first zle extendability patch from Zefram (2710) + +Sun Jan 5 23:33:32 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c: do builtin autoloading in execcmd and + do not ignore BINF_PSPECIAL and BINF_MAGICEQUALS flags for the + builtin being loaded + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in, + Src/builtin.c, Src/prototypes.h, Src/rlimits.c, Src/utils.c: + move limit/ulimit/unlimit builtins to rlimits.c + + * Src/builtin.c, Src/system.h, Src/utils.c, acconfig.h, + config.h.in, configure, configure.in: checks for quad_t and + unsigned resource types + + * Src/Modules/example.c, Src/Modules/files.c: the copyright notice + was different from the rest of the code + + * Src/jobs.c: set_clktck() function added + + * Src/compat.c, Src/Modules/files.c, Src/builtin.c, Src/utils.c, + Src/zsh.h: safe rm and cd which do not follow any symlinks + + * Src/builtin.c, Src/rlimits.awk: safe fallback when RLIM_ macros + are not found + + * Src/Zle/zle_main.c: EOF ignored in interactive mode when not in + the first line. From Peter (2713) + +Fri Jan 3 02:26:03 1997 Zoltán Hidvégi + + * Misc/compctl-examples: setopt/unsetopt compctl fixes + + * Src/Zle/comp.h, Src/Zle/comp1.c, Src/Zle/compctl.c, + Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/mods.conf, Src/xmods.conf, Src/Zle/Makefile.in: compctl base + module. compctl no longer depends on zle instead both zle and + compctl depends on this new comp1 module. From Zefram (2700) + + * Src/Zle/zle.h, Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, + Src/Zle/zle_utils.c, Src/utils.c: add showmsg() which displays + an arbitrary message below the ZLE buffer and minibuffer. From + Zefram (2699) + + * Src/Zle/zle_keymap.c, Src/hashtable.c: omit resize option from + emptytable thus make is available as a generic emptytable + method. From Zefram (2698) + + * Src/Zle/zle_utils.c: literal ^ characters were not escaped when + printing key sequences. From Zefram (2689) + + * Src/utils.c: finddir() now can cope with arbitrary long + directories. From Zefram (2688) + + * Src/prompt.c: my long directories in prompt fix broke prompt + truncation. From Zefram (2687) + +Thu Jan 2 20:57:33 1997 Zoltán Hidvégi + + * configure, configure.in: alpha-linux defines signals in + . From David Krinsky + (2706) + + * Src/Makefile.in: . does not set positional parameters + + * Src/builtin.c, Src/compat.c: zchdir returns -2 when it looses + the current directory. + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in, + Src/Zle/compctl.c, Src/Zle/zle.h, Src/params.c, Src/zsh.h: + header dependencies and inclusions fixes from Zefram (2697) + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in, + Src/conf.sed, Src/mkbltnmlst.sh, Src/mkstamp.sh, Src/mods.conf, + Src/xmods.conf: more Makefile fixes from Zefram (2703) + + * Src/Modules/files.c, Src/utils.c: files module rm -r fixes + + * Src/Modules/files.c: make rm -r safe so that it never follows + symlinks. + + * Src/utils.c (lchdir): paranoid chdir which does not follow + symlinks. From Zefram (2690) + + * Src/Modules/Makefile.in, Src/Modules/files.c: module with + builtin ln, mkdir, mv, rm, rmdir, sync utilities. From Zefram + (2621) + + * Src/compat.c: do not use lstat if HAVE_LSTAT is not defined + + * Src/conf.sed, Src/mkbltnmlst.sh, Src/mkstamp.sh: move big shell + scripts from the Makefile to separate files. + +Wed Jan 1 20:04:06 1997 Zoltán Hidvégi + + * Src/options.c: remove union initialisation hacks and use optno + for aliases + + * Src/params.c, Src/hashtable.h: remove the struct iparam hack + which assumed that sizeof(long) == sizeof(void*) + + * Src/system.h, configure, configure.in: dgux CLOBBERS_TYPEAHEAD. + From Roderick Schertler (2623) + +Tue Dec 31 02:28:09 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in: + improve proto dependency rules + + * Doc/zshbuiltins.man, Doc/zshzle.man, Src/Zle/Makefile.in, + Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_keymap.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_move.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, + Src/hashtable.c, Src/mods.conf, Src/utils.c, Util/reporter: + keymap rewrite from Zefram (2648) + + * Src/Makefile.in: avoid using -nt test operator + + * Src/Zle/zle_tricky.c, Src/params.c, Src/utils.c: use + dupstrpfx/ztrduppfx + +Mon Dec 30 23:24:46 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/init.c, Src/mods.conf, Src/xmods.conf: + automatic generation of linked-in module boot code and automatic + autoload code. From Zefram (2647) + + * Src/utils.c: dupsctruct/freestruct now work even if sizeof(int) + != sizeof(void*) + + * Src/options.c: option initialisation did not work on Alpha + + * Src/Makefile.in: some sh's do not like empty for lists + + * Src/options.c: use short instead of enum + + * Src/globals.h, Src/input.c, Src/lex.c, Src/zsh.h: after alias + foo='echo ' ; alias bar=foo, foo bar should expand to foo echo. + From Peter (2558) + + * Src/compat.c: zgetcwd's result should not be freed + + * Src/prompt.c (putpromptchar): handle long pwd + + * Src/builtin.c, Src/compat.c, Src/init.c: zgetcwd's result should + not be freed + + * Src/glob.c: make functions only called from glob.c static. + Rearrange functions so that they are already defined when first + referenced. + +Sun Dec 29 22:34:21 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshexpn.man, Doc/zshmisc.man, Src/glob.c, + Src/lex.c: brace related bugfixes + + * Src/glob.c, Src/utils.c: fix a buffer overflow bug in parsecomp() + + * Src/exec.c, Src/loop.c, Src/parse.c: case argument should not be + globbed + +Sat Dec 28 19:55:04 1996 Zoltán Hidvégi + + * Src/options.c (optlookup): no prefix was ignored + + * Src/Makefile.in, Src/Modules/example.c, Src/Zle/compctl.c, + Src/Zle/zle_main.c, Src/init.c, Src/module.c, Src/zsh.h: + addbuiltins() and deletebuiltins() functions to add/delete a + group of builtins. From Zefram (2646) + +Fri Dec 27 23:33:20 1996 Zoltán Hidvégi + + * Src/Modules/example.c, Src/Zle/compctl.c, Src/Zle/zle_main.c, + Src/init.c, Src/module.c: addbuiltin can now set all members of + the builtin structure. From Zefram (2643) + + * Src/options.c: set ALWAYSLASTPROMPT, APPENDHISTORY, AUTOLIST, + AUTOMENU, AUTOPARAMKEYS, AUTOPARAMSLASH, AUTOREMOVESLASH, + LISTAMBIGUOUS, LISTTYPES options by default + + * Src/main.c, Src/options.c, Src/zsh.h: use the hastable functions + for optiontab instead of the optns array. + + * Src/exec.c: minor noclobber changes + +Thu Dec 26 22:43:13 1996 Zoltán Hidvégi + + * Src/exec.c, Src/hist.c, Src/lex.c, Src/mem.c, Src/params.c, + Src/subst.c, Src/text.c, Src/utils.c: all "can't happen" + messages start with a BUG: From Zefram (2633) + + * Src/Makefile.in: better rules for version changes + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in: + some Makefile cleanups + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in, + configure, configure.in: use ..o suffix for module objects. + From Zefram (2632) + + * Src/Makefile.in, Src/init.c, Src/zsh.h: only init.o depends on + zshxmods.h. From Zefram (2631) + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in: + some hacks to get parallel make work. From Zefram (2630) + + * Src/Zle/zle.h, Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, + Src/Zle/zle_main.c, Src/Zle/zle_misc.c, Src/Zle/zle_move.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, + Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, Src/Zle/zle_word.c, + Src/globals.h, Src/init.c, Src/module.c, Src/zsh.h: zle module + autoloading interface cleanup from Zefram (2627) + + * Src/Zle/compctl.c, Src/Zle/zle_main.c: remove unnecessary + contitional code for printcompctlp. From Zefram (2629) + + * Src/module.c: print error message when module's boot/cleanup + function not found. From Zefram (2628) + + * Src/module.c: zmodload -L did not handle module names starting + with `-'. From Zefram (2626) + + * Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c, + Util/reporter: zmodload -a lists builtins declared for + autoloading. -L prints everything in sourcable format. From + Zefram (2620) + + * Src/Zle/zle_main.c, Src/hashtable.c, Src/options.c, + Src/params.c, Src/zsh.h: Make ZSH_HASH_DEBUG less visible. From + Zefram (2619) + + * Src/builtin.c, Src/compat.c, Src/utils.c: handle arbitrary long + pathnames in pwd + +Wed Dec 25 16:04:45 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshoptions.man, Src/Makefile.in, + Src/Zle/zle_tricky.c, Src/builtin.c, Src/glob.c, Src/globals.h, + Src/init.c, Src/main.c, Src/params.c, Src/prototypes.h, + Src/utils.c, Src/zsh.h, Src/options.c: New hash table for + options, option aliases. From Zefram (2612) + +Tue Dec 24 02:25:20 1996 Zoltán Hidvégi + + * Src/Zle/zle_tricky.c, Src/glob.c, Src/hashtable.c, Src/utils.c: + move . and .. special case handling into zreaddir(). From + Zefram (2617) + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in: + parallel make support gone again as it always rebuilt everything + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Zle/Makefile.in: + More Makefile cleanups. Parallel make now runs fine + + * Src/Zle/zle.h, Src/Zle/zle_main.c, Src/globals.h, Src/init.c, + Src/main.c, Src/module.c, Src/zsh.h, Src/Makefile.in, + Src/Modules/Makefile.in, Src/Zle/Makefile.in: module makefile + improvements, better support for builtin modules. From Zefram + (2611) + +Sat Dec 21 02:00:12 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.1.0 released + + * Makefile.in: modifications for the beta series + + * Src/Zle/zle_main.c, Src/globals.h, Src/hist.c, Src/module.c, + Src/zsh.h: changes to allow compilation on SunOS 4 with K&R + compiler + + * Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c, Src/hashtable.h: + pwd now accepts -L and -P to be compatible with bash and ksh + + * configure, configure.in: SunOS 4 shared libraries do not work + when they are stripped + +Thu Dec 19 21:27:17 1996 Zoltán Hidvégi + + * Src/init.c: work around a bug in NeXTStep 3.2 which caused slow + refresh + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.22 1996/12/19 09:52:11 + pws Exp + +Wed Dec 18 23:51:24 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Etc/FAQ, META-FAQ: ftp.prz.tu-berlin.de no longer + mirrors zsh, uiarchive.uiuc.edu name correction + +Tue Dec 17 20:08:58 1996 Zoltán Hidvégi + + * Src/params.c: remove some compiler varnings + + * Src/Makefile.in: rlimits.h depends on rlimits.awk. Cosmetic + changes. From Zefram (2589) + +Mon Dec 16 03:33:12 1996 Zoltán Hidvégi + + * README: unknown limits should no longer be a problem + + * Src/glob.c: toggles were not reset after a comma in a glob + qualifier list (e.g. *(@-.,/)) + + * Src/builtin.c: fg %% failed and disabled job control sometimes + when there were no current job + +Sun Dec 15 01:07:40 1996 Zoltán Hidvégi + + * README: beta warning + + * Misc/compctl-examples: compctl for zmodload + +Sat Dec 14 22:50:00 1996 Zoltán Hidvégi + + * Src/Zle/zle_main.c: Remove unnecessary prefix delay in zle. + From Zefram (2583) + + * Src/exec.c (execcmd): builtin < / > / closed stdin + + * configure, Src/Makefile.in, Src/builtin.c, Src/rlimits.awk, + configure.in: awk generated rlimits from Peter (2573) + + * config.guess, config.sub, configure, configure.in: upgrade to + autoconf-2.12. Linux machines are still recognized without the + -gnu suffix + + * configure, configure.in: working fifos should be tested in /tmp + +Wed Dec 11 02:30:39 1996 Zoltán Hidvégi + + * Src/Zle/zle_tricky.c, Src/builtin.c, Src/exec.c, Src/globals.h, + Src/hist.c, Src/init.c, Src/input.c, Src/lex.c, Src/zsh.h: + remove the alias stack and fix several related bugs. From Peter + (2548, 2551) + + * Doc/zsh.texi, META-FAQ: ftp mirror site changes + + * Src/params.c: use the heap in getstrvalue() + +Tue Dec 10 02:27:35 1996 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c: single line zle refresh bugfix from Geoff + (2549) + + * Src/subst.c: ${(l:4:)foo} stopped working between 3.0.0 and 3.0.1 + + * Src/math.c: $((#\c)) character code expansion did not work when + c was a metafied + + * Src/params.c: $foo[i] did not work when foo[i] was a metafied + character + + * Src/builtin.c: use the heap in zexit() + +Sun Dec 8 21:32:06 1996 Zoltán Hidvégi + + * Src/utils.c, Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c: + zmodload can be used to define atoloaded builtins and module + dependencies + + * Doc/zsh.texi, Doc/zshoptions.man: options documentation + improvements from Zefram (2529) + + * Src/globals.h, Src/hist.c, Src/zsh.h: HIST_REDUCE_BLANKS from + Wayne (2446) + + * Etc/FEATURES, Etc/NEWS: news in zsh-3.1 + + * Src/hashtable.h: security: do not import MODULE_PATH + + * Src/input.c: no further input should be attempted when lexstop + is true (e.g. after eof). + + * Src/Makefile.in: make tags fix + + * Misc/compctl-examples: MH compctl changes from Peter (2535) + + * Src/Zle/zle_tricky.c, Src/glob.c, Src/hashtable.c, Src/utils.c: + unmetafy did not put a null terminator to the end of the string. + zreaddir discarded the metafied filename. readdir was used + instead of zreaddir in zle_tricky.c. From Zefram (2533) + + * Src/Zle/zle_vi.c: vi-replace-chars now emulates better the real + vi. From Zefram (2496) + + * Src/jobs.c: CLK_TCK is 60 on NeXT not 64 as defined in the + system headers. From Robert F Tobler + (2522) + + * Src/input.c, Src/zsh.h: alias foo='a=b foo' ; foo caused an + infinite loop. From Peter (2515) + + * Src/builtin.c, Src/zsh.h: put hash tables to a linked list when + hash-debug is enabled and move the simplified bin_hashinfo into + hashtable.c. From Zefram (2509) + + * Src/builtin.c, Src/Zle/compctl.c: more bad option fixes. Make + the getopts builtin 8-bit clean. From Zefram (2508) + + * Src/builtin.c: show metafied characters correctly in bad option + errors. From Zefram (2497) + +Thu Dec 5 03:59:45 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/Modules/Makefile.in, Src/Modules/example.c, + Src/Zle/Makefile.in, Src/Zle/deltochar.c, Src/Zle/zle.h, + Src/Zle/zle_bindings.c, Src/Zle/zle_hist.c, Src/Zle/zle_main.c, + Src/Zle/zle_misc.c, Src/Zle/zle_move.c, Src/Zle/zle_refresh.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, + Src/Zle/zle_word.c, Src/builtin.c, Src/globals.h, + Src/hashtable.c, Src/hashtable.h, Src/init.c, Src/input.c, + Src/loop.c, Src/main.c, Src/module.c, Src/modules-bltin, + Src/prompt.c, Src/prototypes.h, Src/utils.c, Src/zsh.h, + configure, configure.in: Move zle into a separate directory and + convert it to an optional auto-loadable module. Create Modules + subdirectory. Many Makefile changes. boot_modname and + cleanup_modname is back since on elf all module use one common + name space. Lots of other changes. + +Wed Nov 27 03:20:53 1996 Zoltán Hidvégi + + * Src/Zle/zle_main.c, Src/Zle/zle_vi.c: ANSI was broken and fixed + again in zle_main.c ESC in vi command mode caused SEGV. From + Zefram (2479) + + * configure, configure.in: -pedantic is used with + --enable-zsh-debug. Link non-debugged zsh with -s. From Zefram + (2479) + +Tue Nov 26 02:45:15 1996 Zoltán Hidvégi + + * Src/exec.c: the STTY parameter did not work well when pipes were + used. From Peter (2474) + + * Src/Zle/zle_main.c: little fix for the bindkey patch from Peter + (2470) + + * Doc/zshbuiltins.man, Src/Zle/zle.h, Src/Zle/zle_bindings.c, + Src/Zle/zle_hist.c, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c, Src/builtin.c, + Src/globals.h, Src/hashtable.c, Src/init.c: big multi-character + key bindings fix from Zefram (2464) + + * Doc/zshbuiltins.man, Src/hashtable.h, Src/module.c, Src/zsh.h: + The -f option of zmodload is removed. Improved zmodload + documentation. + + * Src/hashtable.h, Doc/zshbuiltins.man, Src/module.c: zmodload + with -i will not complain and will succeed without doing + anything if an already loaded module is loaded or a non-loaded + module is unloaded. From Zefram (2463) + + * Doc/Makefile.in, Doc/zshbuiltins.man, Doc/zshparam.man: zmodload + documentation. It only appears in the final manual if dynamic + modules are enabled. Note that the texinfo documentation is + still missing. From Zefram (2460) + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.21 1996/11/25 09:13:28 + pws Exp + +Mon Nov 25 02:39:08 1996 Zoltán Hidvégi + + * Src/module.c: try to load the modules with .DL_EXT appended + first. Honor PATH_DIRS when loading a module. + + * Src/Makefile.in: handle force ruleas as in the top-level Makefile + + * Makefile.in, Src/Makefile.in, Src/init.c: module install added, + default module_path is $(libdir)/zsh/$(VERSION). From Zefram + (2458 and 2465 with modifications) + + * Src/Makefile.in: optimized and made more silent + + * Src/Makefile.in, Src/Modules/example.c, Src/Zle/deltochar.c, + Src/init.c, Src/main.c, Src/module.c: modules can now statically + compiled into zsh. From Zefram (2455) + +Sun Nov 24 22:44:12 1996 Zoltán Hidvégi + + * Src/Zle/zle_move.c: vi-goto-mark fix from Thorsten + + * Src/utils.c: dupnode mergerd into the simplified dupstruct2, + freetreenode merged into the simplified freestruct + + * Src/globals.h, Src/text.c, Doc/zsh.texi, Doc/zshmisc.man, + Src/lex.c, Src/loop.c, Src/parse.c, Src/utils.c, Src/zsh.h: for + ((expr; expr; expr)) command added + +Sat Nov 23 23:34:58 1996 Zoltán Hidvégi + + * Src/exec.c: + ((...)) substituted the expression twice and coredumped on (()) + + * Doc/zsh.texi, Doc/zshcompctl.man: compctl -e clarification from + Peter (2453) + + * Src/hist.c (hend): minor cleanup from Wayne (2447) + + * Doc/zsh.texi, Doc/zshzle.man, Src/Zle/zle_hist.c: + insert-last-word with numeric arguments inserts the given word + from the previous history event. From Bart (2445), + documentation by me. + + * Src/subst.c, acconfig.h, config.h.in, configure, configure.in: + added configure check for variable-length automatic arrays + +Wed Nov 20 00:58:06 1996 Zoltán Hidvégi + + * Src/utils.c: The spell checker always tries to fix as many + leading directory compontents as possible. From Bart (2429) + + * Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_tricky.c, Src/Zle/zle_vi.c: the source was not ANSI + C compatible. From Thorsten Meinecke + + * Src/Zle/zle_tricky.c: my spell-word fix used an uninitialised + pointer. Fix from Bart (2428) + +Sun Nov 17 21:21:22 1996 Zoltán Hidvégi + + * Src/Makefile.in: fix the .SUFFIXES list + + * Src/module.c: do not call dlclose() if cleanup_module failed + (returned nonzero) + + * Src/Makefile.in, Src/init.c, Src/main.c, Src/prototypes.h, + configure, configure.in: try to support dynamic loading on SVR4 + systems + + * config.h.in: Makefile and configure fixes from Zefram (2416) + + * Src/params.c: remove a few memory leaks when initialising the + parameter table. + + * Src/exec.c, Src/zsh.h: allow arbitrary number of multios. From + Zefram (2414) + + * Src/exec.c, Src/parse.c, Src/text.c, Src/zsh.h: do not convert + ((...)) to builtin let internally. + +Sat Nov 16 23:57:40 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: spell-word zle function did not work for word + beginning with a tilde + + * Src/hist.c: histignoredups ignores insignificant whitespace + changes. From Peter (1949) + + * Src/zle_main.c: execute-last-named-cmd may point to an already + removed zle function after a zle module is deleted. From Zefram + (2418) + + * Doc/Makefile.in: give some explanation if the user compiling zsh + has no makeinfo + + * configure.in: fix a problem introduced by patch 2338. From + Zefram (2416) + + * Makefile.in, acconfig.h, configure.in: Makefile and configure + fixes from Zefram (2416) + + * Src/zle_tricky.c: the cursor moved back on TAB when it was on + "". From Zefram (2415) + +Thu Nov 14 12:59:25 1996 Zoltán Hidvégi + + * Src/zle_refresh.c: one more refresh fix from Geoff (2404) + + * Src/Makefile.in, Src/Modules/deltochar.c, Src/Modules/example.c, + configure, configure.in: move modules into Src/Modules + +Wed Nov 13 21:47:28 1996 Zoltán Hidvégi + + * Src/Modules/deltochar.c, Src/Modules/example.c, Src/module.c: + unload the module if the boot routine failed + + * config.guess, config.sub: recognize i[6-9]86 + + * Src/globals.h, Src/init.c, Src/utils.c: make fdtable dynamic + + * Src/zle_refresh.c: zle_refresh fix from Geoff (2387) + + * Src/zle_refresh.c: some checks added. From Geoff (2386) + + * Src/zle_refresh.c: fix an off-by-one array bound bug. From + Geoff (2359) + + * Doc/zsh.texi, Doc/zshbuiltins.man, Src/Modules/deltochar.c, + Src/hashtable.h, Src/module.c, Src/zle_main.c: handle name + clashes when adding zle modules and remove bindings when a zle + module is removed. From Peter (2370) + + * Src/zle_refresh.c: zle_refresh scrolling change from Geoff (2351) + + * Src/Modules/deltochar.c, Src/module.c, Src/zle.h, + Src/zle_main.c, Src/zle_misc.c, Src/zle_tricky.c, Src/zle_vi.c: + zle function modules from Peter (2339) + +Tue Nov 12 21:35:18 1996 Zoltán Hidvégi + + * Src/init.c, Src/zle_refresh.c: zle-refresh patch from Geoff (2336) + + * Src/hashtable.h, Src/module.c: rename modload to zmodload. From + Peter (2333) + + * Src/Makefile.in: added automatic ansi2knr rules + +Mon Nov 11 21:55:17 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/Modules/example.c, Src/module.c, configure, + configure.in: various module changes from Zefram (2338) + + * configure, configure.in: a $ was missing. IRIX gcc needs + -shared for modules. From Peter + +Wed Nov 6 20:54:33 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/mod_example.c: moduule modifications for + old compilers + +Sun Nov 3 23:00:05 1996 Zoltán Hidvégi + + * Src/system.h: set OPEN_MAX to 64 if NOFILE is not defined + + * Src/hashtable.c: disable -f TRAPxxx permanently removed the + function + + * Functions/pushd: setopt localoptions must come after + emulate -R zsh + +Sat Nov 2 22:47:53 1996 Zoltán Hidvégi + + * Src/compat.c, Src/hashtable.c, Src/utils.c: do not blindly + assume that . and .. are always the first two enrties in a + directory. Problem discovered by Hideki ONO and fixed by Bart + (2309) + + * Src/utils.c: max_zsh_fd should not be decreased below zero + +Thu Oct 31 01:38:10 1996 Zoltán Hidvégi + + * Src/Makefile.in, Src/globals.h, Src/hashtable.c, + Src/hashtable.h, Src/init.c, Src/mod_example.c, Src/module.c, + Src/prototypes.h, Src/zsh.h, acconfig.h, config.h.in, configure, + configure.in: support dynamically loaded binary modules + + * Src/hist.c: zsh splitted lines longer than 1022 while reading + the history file + + * Src/glob.c (doesmatch): <-number> range glob did not work + + * Src/builtin.c: read -c ignored its first parameter + +Fri Oct 25 20:50:38 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0.1 released diff --git a/ChangeLog.3.0 b/ChangeLog.3.0 new file mode 100644 index 000000000..56aa342a5 --- /dev/null +++ b/ChangeLog.3.0 @@ -0,0 +1,3671 @@ +Tue Jun 3 06:14:14 1997 Zoltán Hidvégi + + * Src/version.h: zsh-3.0.3 released + + * Src/params.c: Some compilers do not like ? (void *) : + + * Src/jobs.c: pg(){ less;};:|pg caused suspended (tty input) + +Mon Jun 2 07:17:08 1997 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c: Xterm cut & paste fixes from Geoff (3135) + + * Src/hist.c: Fix !# history expansion during completion. From + Peter (3132) + +Sun Jun 1 08:02:19 1997 Zoltán Hidvégi + + * Src/system.h: Use _POSIX_VDISABLE is available. Fixes ^@ in zle + on some systems. + +Thu May 29 05:17:31 1997 Zoltán Hidvégi + + * Src/cond.c: directories are always executable by root + + * META-FAQ: The zsh web page moved. + +Tue May 20 05:22:16 1997 Zoltán Hidvégi + + * Src/utils.c: if abort or edit used on a correct prompt, do not + attempt to correct further words on the line. + +Sun May 18 18:57:08 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c, Src/init.c, Src/signals.c, Src/jobs.c: + Do not handle SIGPIPE specially for shells with job control + + * Src/init.c, Src/jobs.c, Src/utils.c: (:); while true; do; done + was uninterruptible. Sometimes LINES/COLUMNS was not set + properly for non-interractive shells. + + * Src/exec.c, Src/signals.c: `:`; while true; do; done was + uninterruptible + +Mon May 12 09:01:55 1997 Zoltán Hidvégi + + * Src/hist.c: !:2-1 history expansion caused memory corruption + +Sun May 11 08:52:00 1997 Zoltán Hidvégi + + * Src/lex.c: $((foo);bar) syntax works + + * Src/hist.c: A terminal hangup caused coredump while saving history + + * Src/globals.h, Src/init.c, Src/params.c: if we cannot get the + correct window size with ioctl, set LINES and COLUMNS from + termcap. + + * Src/builtin.c: make sure zexit is not reentered when its + execution is interrupted by a signal. + +Fri May 9 07:59:00 1997 Zoltán Hidvégi + + * Doc/zsh.texi: @br{} removed + + * Src/exec.c: Quick hack: do not open file redirections if noexec + is set + + * Src/jobs.c: printjobs() set errflag when the foreground process + was interrupted. + +Thu May 8 09:18:56 1997 Zoltán Hidvégi + + * Src/cond.c: [[ -x file ]] does stat for privileged users + + * Src/Zle/zle_utils.c: do no read line[ll] (which is undefined) + + * Src/signals.c: flush the input queue on interrupt + + * Src/Zle/zle_tricky.c, Src/hist.c, Src/lex.c, Src/parse.c: + ((foo);bar) now works + +Tue May 6 05:56:36 1997 Zoltán Hidvégi + + * Src/signals.c: WINCH traps did not work. From Peter (3093) + +Wed Apr 30 07:40:30 1997 Zoltán Hidvégi + + * Src/text.c: printing case commands were broken. From Zefram (3062) + +Mon Apr 28 07:28:34 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/system.h, acconfig.h, config.h.in, configure, + configure.in, Src/Builtins/rlimits.c: Use rlim_t if available + + * Etc/FAQ: March 24 1997 FAQ from Peter + +Sat Apr 26 06:26:11 1997 Zoltán Hidvégi + + * Functions/zed: Reenter zed if it fails to save the file + + * Functions/zed: Use bindkey -L to temporarily save bindings. + From Zefram (3012) + +Fri Apr 25 06:41:36 1997 Zoltán Hidvégi + + * Functions/cdmatch, Misc/compctl-examples: compctl-examples + improvements from Zefram (3006) + + * Src/globals.h: NOTIFY is off in sh/ksh mode. From Zefram (3003) + +Sun Apr 20 07:24:12 1997 Zoltán Hidvégi + + * Src/init.c, Src/params.c, Src/utils.c: Remove setintenv() + +Tue Apr 15 05:51:27 1997 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c: SGTABTYPE can contain more than one bit + set. From Geoff (2976) + + * Src/builtin.c: vared 1 caused a coredump. From Peter (2909) + + * Src/exec.c, Src/signals.c: execute trap on EXIT in the caller's + environment. From Peter (2896) + + * Src/builtin.c: vared path caused permanent + allocation in arrayfixenv + +Sat Mar 8 00:17:24 1997 Zoltán Hidvégi + + * Src/builtin.c: Sometimes an incorrect compctl + caused a core dump. From Peter (2942) + + * Src/Zle/zle.h, Src/Zle/zle_main.c, Src/Zle/zle_misc.c, + Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, Src/builtin.c, + Src/globals.h, Src/init.c, Src/params.c, Src/zsh.h: termok + changed to termflags. Modified version of art. 2970 from Geoff + + * Src/init.c, Src/params.c, Src/utils.c: handle narrow and short + terminals centralized in zlevarsetfn(). From Bart and me (2956, + 2957) + +Fri Mar 7 23:54:18 1997 Zoltán Hidvégi + + * Src/Zle/zle.h, Src/Zle/zle_misc.c, Src/Zle/zle_refresh.c, + Src/utils.c: act as if single_line_zle were set when LINES < 3. + From Geoff (2865) + +Wed Mar 5 23:37:30 1997 Zoltan T. Hidvegi + + * Src/loop.c: $? was incorrectly reset before executing case, + while, for + +Tue Feb 18 20:59:51 1997 Zoltan Hidvegi + + * Src/builtin.c: getopts handling of required argument fix from + Andrew Robinson (2846) + + * Src/signals.c: An #ifdef SIGWINCH was missing. From Hrvoje + Niksic (2844) + + * Src/exec.c: return from a function called from a loop breaked + the loop + + * Src/lex.c: eval \$\{$#\} did not work + +Mon Jan 27 22:04:29 1997 Zoltán Hidvégi + + * Src/signals.c: temprarily set breaks to zero when executing a trap + + * Src/exec.c: do not reset breaks in doshfunc + +Sun Jan 26 02:55:02 1997 Zoltán Hidvégi + + * Src/init.c: set noerrexit to -1 in setupvals() + +Sat Jan 25 20:07:46 1997 Zoltán Hidvégi + + * Src/subst.c, Src/utils.c: some assignments were missing from my + spacesplit fix + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.23 1997/01/24 13:21:16 + pws Exp + + * Src/Zle/zle.h, Src/Zle/zle_misc.c, Src/Zle/zle_refresh.c: + redisplay fix for multiline prompts from Geoff (2817) + +Mon Jan 20 21:11:22 1997 Zoltán Hidvégi + + * Src/hashtable.h, acconfig.h, config.h.in, configure, + configure.in: some old compilers cannot initialise a union + + * Src/Zle/zle_utils.c: move the mark when characters are + inserted/deleted. From Peter (2807) + +Sat Jan 18 22:34:17 1997 Zoltán Hidvégi + + * acconfig.h, config.h.in, configure, configure.in: use the + AC_FUNC_STRCOLL builtin autoconf test + +Tue Jan 14 13:52:36 1997 Zoltán Hidvégi + + * Src/Zle/zle_move.c: vi-goto-column did not move to the last column + +Sat Jan 11 23:45:50 1997 Zoltán Hidvégi + + * Src/system.h: define lstat(X,Y) instead of lstst if HAVE_LSTAT + is not defined + + * Src/Zle/zle_tricky.c: ll was not restored for xorrec + + * Src/builtin.c: read -l forgot to duplicate line before assignment + + * Src/jobs.c: do not execute trap when only the child receives the + signal. Based on article 2480 from Zefram. + + * Src/builtin.c: fix bugs when there was no current job after disown + +Thu Jan 9 14:44:28 1997 Zoltán Hidvégi + + * Src/hist.c: Peter's patch broke history expansion in some cases. + From Peter (2755) + +Wed Jan 8 22:02:51 1997 Zoltán Hidvégi + + * Src/globals.h, Src/hist.c, Src/lex.c: hist_ignore_dups did not + work with fc in precmd(). From Peter (2748) + + * configure, configure.in: on NetBSD is needed for + rlimit type checks. Based on article 2742 from Geoff + +Tue Jan 7 23:10:24 1997 Zoltán Hidvégi + + * Src/params.c, Src/builtin.c, Src/exec.c: print error when + changing read-only variables, prevent core dump when assigning + an array to read-only scalar and some other fixes + + * Src/Zle/zle_tricky.c: compctl -S bugfix + +Mon Jan 6 20:43:36 1997 Zoltán Hidvégi + + * Src/exec.c, acconfig.h, config.h.in, configure, configure.in: + better /dev/fd filesystem check + +Sun Jan 5 23:33:32 1997 Zoltán Hidvégi + + * Src/builtin.c, Src/system.h, Src/utils.c, acconfig.h, + config.h.in, configure, configure.in: checks for quad_t and + unsigned resource types + + * Src/jobs.c: set_clktck() function added + + * Src/builtin.c, Src/rlimits.awk: safe fallback when RLIM_ macros + are not found + + * Src/Zle/zle_main.c: EOF ignored in interactive mode when not in + the first line. From Peter (2713) + +Fri Jan 3 02:26:03 1997 Zoltán Hidvégi + + * Misc/compctl-examples: setopt/unsetopt compctl fixes + +Thu Jan 2 20:57:33 1997 Zoltán Hidvégi + + * configure, configure.in: alpha-linux defines signals in + . From David Krinsky + (2706) + +Wed Jan 1 20:04:06 1997 Zoltán Hidvégi + + * Src/params.c, Src/hashtable.h: remove the struct iparam hack + which assumed that sizeof(long) == sizeof(void*) + + * Src/system.h, configure, configure.in: dgux CLOBBERS_TYPEAHEAD. + From Roderick Schertler (2623) + +Tue Dec 31 02:28:09 1996 Zoltán Hidvégi + + * Src/Zle/zle_tricky.c, Src/params.c, Src/utils.c: use + dupstrpfx/ztrduppfx + + * Src/globals.h, Src/input.c, Src/lex.c, Src/zsh.h: after alias + foo='echo ' ; alias bar=foo, foo bar should expand to foo echo. + From Peter (2558) + +Sun Dec 29 22:34:21 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshexpn.man, Doc/zshmisc.man, Src/glob.c, + Src/lex.c: brace related bugfixes + + * Src/glob.c, Src/utils.c: fix a buffer overflow bug in parsecomp() + + * Src/exec.c, Src/loop.c, Src/parse.c: case argument should not be + globbed + +Thu Dec 19 21:37:17 1996 Zoltán Hidvégi + + * zsh-3.0.2 repacked + + * Src/init.c: work around a bug in NeXTStep 3.2 which caused slow + refresh + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.22 1996/12/19 09:52:11 + pws Exp + +Tue Dec 17 20:08:58 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0.2 released + + * Src/params.c: remove some compiler varnings + + * Src/Makefile.in: rlimits.h depends on rlimits.awk. Cosmetic + changes. From Zefram (2589) + +Mon Dec 16 03:33:12 1996 Zoltán Hidvégi + + * README: unknown limits should no longer be a problem + + * Src/glob.c: toggles were not reset after a comma in a glob + qualifier list (e.g. *(@-.,/)) + + * Src/builtin.c: fg %% failed and disabled job control sometimes + when there were no current job + +Sun Dec 15 22:09:21 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshzle.man, Src/Zle/zle_hist.c: + insert-last-word with numeric arguments inserts the given word + from the previous history event. From Bart (2445), + documentation by me. + +Sat Dec 14 02:44:21 1996 Zoltán Hidvégi + + * Src/exec.c (execcmd): builtin < / > / closed stdin + + * configure, Src/Makefile.in, Src/builtin.c, Src/rlimits.awk, + configure.in: awk generated rlimits from Peter (2573) + + * config.guess, config.sub, configure, configure.in: upgrade to + autoconf-2.12. Linux machines are still recognized without the + -gnu suffix + + * configure, configure.in: working fifos should be tested in /tmp + +Wed Dec 11 02:30:39 1996 Zoltán Hidvégi + + * Src/Zle/zle_tricky.c, Src/builtin.c, Src/exec.c, Src/globals.h, + Src/hist.c, Src/init.c, Src/input.c, Src/lex.c, Src/zsh.h: + remove the alias stack and fix several related bugs. From Peter + (2548, 2551) + + * Doc/zsh.texi, META-FAQ: ftp mirror site changes + + * Src/params.c: use the heap in getstrvalue() + +Tue Dec 10 02:27:35 1996 Zoltán Hidvégi + + * Src/Zle/zle_refresh.c: single line zle refresh bugfix from Geoff + (2549) + + * Src/subst.c: ${(l:4:)foo} stopped working between 3.0.0 and 3.0.1 + + * Src/math.c: $((#\c)) character code expansion did not work when + c was a metafied + + * Src/params.c: $foo[i] did not work when foo[i] was a metafied + character + + * Src/builtin.c: use the heap in zexit() + +Sun Dec 8 21:32:06 1996 Zoltán Hidvégi + + * Src/input.c: no further input should be attempted when lexstop + is true (e.g. after eof). + + * Misc/compctl-examples: MH compctl changes from Peter (2535) + + * Src/signals.c: use the heap when reading TMOUT + + * Src/jobs.c: use the heap when reading REPORTTIME. From Peter (3534) + + * Src/Zle/zle_tricky.c, Src/glob.c, Src/hashtable.c, Src/utils.c: + unmetafy did not put a null terminator to the end of the string. + zreaddir discarded the metafied filename. readdir was used + instead of zreaddir in zle_tricky.c. From Zefram (2533) + + * Src/jobs.c: CLK_TCK is 60 on NeXT not 64 as defined in the + system headers. From Robert F Tobler + (2522) + + * Src/input.c, Src/zsh.h: alias foo='a=b foo' ; foo caused an + infinite loop. From Peter (2515) + + * Src/builtin.c, Src/Zle/compctl.c: more bad option fixes. Make + the getopts builtin 8-bit clean. From Zefram (2508) + + * Src/builtin.c: show metafied characters correctly in bad option + errors. From Zefram (2497) + +Tue Nov 26 02:45:15 1996 Zoltán Hidvégi + + * Src/exec.c: the STTY parameter did not work well when pipes were + used. From Peter (2474) + + * Etc/FAQ: FAQ from Peter: Id: zsh.FAQ,v 2.21 1996/11/25 09:13:28 + pws Exp + +Sun Nov 24 22:44:12 1996 Zoltán Hidvégi + + * Src/Zle/zle_move.c: vi-goto-mark fix from Thorsten + +Sat Nov 23 23:34:58 1996 Zoltán Hidvégi + + * Src/exec.c: + ((...)) substituted the expression twice and coredumped on (()) + + * Doc/zsh.texi, Doc/zshcompctl.man: compctl -e clarification from + Peter (2453) + +Wed Nov 20 00:58:06 1996 Zoltán Hidvégi + + * Src/utils.c: The spell checker always tries to fix as many + leading directory compontents as possible. From Bart (2429) + + * Src/Zle/zle_tricky.c: my spell-word fix used an uninitialised + pointer. Fix from Bart (2428) + +Sun Nov 17 21:21:22 1996 Zoltán Hidvégi + + * Src/params.c: remove a few memory leaks when initialising the + parameter table. + + * Src/exec.c, Src/zsh.h: allow arbitrary number of multios. From + Zefram (2414) + + * Src/exec.c, Src/parse.c, Src/text.c, Src/zsh.h: do not convert + ((...)) to builtin let internally. + +Sat Nov 16 23:57:40 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: spell-word zle function did not work for word + beginning with a tilde + + * Doc/Makefile.in: give some explanation if the user compiling zsh + has no makeinfo + + * Makefile.in, acconfig.h, configure.in, config.h.in: Makefile and + configure fixes from Zefram (2416) + + * Src/zle_tricky.c: the cursor moved back on TAB when it was on + "". From Zefram (2415) + +Thu Nov 14 12:59:25 1996 Zoltán Hidvégi + + * Src/zle_refresh.c: one more refresh fix from Geoff (2404) + +Wed Nov 13 21:47:28 1996 Zoltán Hidvégi + + * config.guess, config.sub: recognize i[6-9]86 + + * Src/globals.h, Src/init.c, Src/utils.c: make fdtable dynamic + + * Src/zle_refresh.c: zle_refresh fix from Geoff (2387) + + * Src/zle_refresh.c: some checks added. From Geoff (2386) + + * Src/zle_refresh.c: fix an off-by-one array bound bug. From + Geoff (2359) + + * Src/zle_refresh.c: zle_refresh scrolling change from Geoff (2351) + +Tue Nov 12 21:35:18 1996 Zoltán Hidvégi + + * Src/init.c, Src/zle_refresh.c: zle-refresh patch from Geoff (2336) + +Sun Nov 3 23:00:05 1996 Zoltán Hidvégi + + * Src/system.h: set OPEN_MAX to 64 if NOFILE is not defined + + * Src/hashtable.c: disable -f TRAPxxx permanently removed the + function + + * Functions/pushd: setopt localoptions must come after + emulate -R zsh + +Sat Nov 2 22:47:53 1996 Zoltán Hidvégi + + * Src/compat.c, Src/hashtable.c, Src/utils.c: do not blindly + assume that . and .. are always the first two enrties in a + directory. Problem discovered by Hideki ONO and fixed by Bart + (2309) + + * Src/utils.c: max_zsh_fd should not be decreased below zero + +Thu Oct 31 01:38:10 1996 Zoltán Hidvégi + + * Src/hist.c: zsh splitted lines longer than 1022 while reading + the history file + + * Src/glob.c (doesmatch): <-number> range glob did not work + + * Src/builtin.c: read -c ignored its first parameter + +Fri Oct 25 20:50:38 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0.1 released + + * Functions/pushd: First version + + * Functions/pushd: empty dummy revision + + * Src/zle_main.c: key binding coredump fix from Peter (2131) + +Thu Oct 24 10:02:00 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: A minor bugfix related to alwayslastprompt and + compctl -X from Geoff (2255) + +Thu Oct 24 09:15:18 1996 pws + + * Etc/FAQ: checked in with -k by hzoli at 1996/10/25 19:57:51 + +Mon Oct 21 20:39:19 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshoptions.man: Better documentation of + GLOB_ASSIGN and MAGIC_EQUAL_SUBST from Peter (2164) + +Sun Oct 20 00:08:41 1996 Zoltán Hidvégi + + * configure, configure.in: I made a stupid mistake in the Cray + hacks for nis_list + +Sat Oct 19 19:39:12 1996 Zoltán Hidvégi + + * configure, configure.in: allow cross-compiling + +Fri Oct 18 20:34:06 1996 Zoltán Hidvégi + + * Doc/zsh.man, Doc/zsh.texi, Doc/zshall.man: Paul Falstad's + preferred E-mail address is pjf@cts.com + + * Src/hist.c: A little simplifiction. + +Wed Oct 16 22:58:08 1996 Zoltán Hidvégi + + * Etc/BUGS: sed in HP-UX 10.20 is broken. + + * Src/builtin.c: popd to a non-existent directory did not remove + that from the directory stack. popd should warn when the + directory stack is empty. From Bart (zsh-users 437) + +Tue Oct 15 21:07:03 1996 Zoltán Hidvégi + + * Src/zle_utils.c: use int instead of char in getzlequery + + * Doc/Makefile.in, Doc/zsh.texi, Etc/Makefile.in, + Functions/Makefile.in, Makefile.in, Misc/Makefile.in, + Src/Makefile.in, Src/builtin.c, Src/compat.c, Src/cond.c, + Src/exec.c, Src/glob.c, Src/globals.h, Src/hashtable.c, + Src/hashtable.h, Src/hist.c, Src/init.c, Src/input.c, + Src/jobs.c, Src/lex.c, Src/linklist.c, Src/loop.c, Src/math.c, + Src/mem.c, Src/params.c, Src/parse.c, Src/prototypes.h, + Src/signals.c, Src/signals.h, Src/subst.c, Src/system.h, + Src/text.c, Src/utils.c, Src/watch.c, Src/zle.h, + Src/zle_bindings.c, Src/zle_hist.c, Src/zle_main.c, + Src/zle_misc.c, Src/zle_move.c, Src/zle_refresh.c, + Src/zle_tricky.c, Src/zle_utils.c, Src/zle_vi.c, Src/zle_word.c, + Src/zsh.h, Src/ztype.h, StartupFiles/Makefile.in, + Util/Makefile.in, configure.in: copyright condition changes + + * Src/zle_refresh.c: bugfix and optimisation for poor terminals + from Geoff (2221) + +Tue Oct 8 23:19:38 1996 Zoltán Hidvégi + + * Etc/BUGS, Etc/CONTRIBUTORS, Etc/MACHINES, Etc/NEWS: spell fixes + from Geoff (2190) + + * Src/builtin.c: there was an extra check for unknown limits + + * Src/prototypes.h, acconfig.h, config.h.in, configure, + configure.in: make compilation possible on OSF/1 V4.x with gcc + +Tue Oct 8 00:16:29 1996 Zoltán Hidvégi + + * Src/init.c: PS3 and PS4 were only initialized in non-interactive + shells + + * Src/utils.c: getquery always returned n on cray-unicos. From + Richard D. Slater (2136) + + * config.guess, config.sub: recognize c90-cray and t90-cray machines. + From Richard D. Slater (2136) + + * configure, configure.in: changes to enable NIS+ username + completion on Unicos based on information provided by Charles + Finan . + + * Src/zle_tricky.c: get_comp_string simplification and a little + bugfix based on art. 2198 from Zefram + + * Src/builtin.c: print -P '\0hehe' printed nothing. + + * Src/zle_misc.c: handle meta characters in prompts + + * Src/utils.c: a litle optimization + +Sun Oct 6 12:21:08 1996 Zoltán Hidvégi + + * Functions/cdmatch, Functions/cdmatch2, Functions/multicomp: add + emulate -R zsh to some function examples. From Bart (2172) + + * Src/exec.c, Src/jobs.c, Src/zsh.h: =(...) arguments to a + function were deleted after the first command of the function + was executed. Fix from Louis.Granboulan@ens.fr (2165). + + * Doc/zsh.texi, Doc/zshexpn.man, Etc/NEWS, Src/glob.c: trailing / + in a glob pattern now works like in other shells. + +Thu Oct 3 00:02:35 1996 Zoltán Hidvégi + + * configure, configure.in: on AIX curses should always be + preferred to termcap + + * Util/zsh-development-guide: added description about the coding + style. + + * Src/subst.c: expand arithmetic expressions in substitution flags + and modifiers + + * Src/glob.c: echo foo(:t:r) gave no matches error + +Tue Oct 1 00:50:49 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c, Src/hashtable.h, Src/params.c, + Src/zle_tricky.c: dots no longer appear in place of empty + components of PATH, MANPATH etc. + +Sat Sep 28 21:22:31 1996 Zoltán Hidvégi + + * Src/zsh.h, Src/builtin.c, Src/hashtable.h, Src/init.c, + Src/jobs.c, Src/params.c, Src/utils.c, Src/zle_misc.c, + Src/zle_refresh.c, Src/zle_tricky.c: COLUMNS=1 causes a + coredump. From Bart (2173) + + * Src/subst.c: tilde expansion did not work for usernames + beginning with a digit + + * Src/utils.c: zstrtol did not handle signs + + * Src/globals.h, Src/init.c, Src/utils.c: when an error occurs in + a sourced script the full pathname of the script is included in + the message. From Peter (2170) + + * Src/init.c: initialise ttystrname in init_io to avoid duplicated + call of ttyname + +Tue Sep 24 19:45:30 1996 Zoltán Hidvégi + + * Src/zle_refresh.c: one character long prompts did not work. + From Geoff (2118) + + * Src/zle_main.c: getkey shoud use EOF instead of -1 when no + characters were read. From hoh@approve.se (Goran Larsson) + (2144) + + * Src/zle_utils.c: ^C answer to a query printed a funny character. + From hoh@approve.se (Goran Larsson) (2144) + +Mon Sep 23 23:28:38 1996 Zoltán Hidvégi + + * Src/lex.c: array assignments stopped working after my previous fix + + * Src/exec.c: If setpgrp fails make the process a new job leader. + From Peter (2150) + + * Functions/cat: A simplified implementation of cat as a zsh function + + * Src/exec.c, Src/utils.c: Do not close coprocin/coprocout for + command/process substitutions + + * Src/builtin.c: POSIX: shift n should fail with error message if + n > $# + +Sat Sep 14 04:19:41 1996 Zoltán Hidvégi + + * Src/utils.c: metafy/unmetafy speedups + + * Src/lex.c: assignment parsing fix (e.g. 1foo=bar is not an + assignment) + + * Src/exec.c: an index bug which never caused any problems fixed. + + * Src/glob.c, Src/lex.c, Src/subst.c, Src/zle_tricky.c: setopt + extendedglob no longer affects parsing. From Peter (2123) with + and me (2127) + + * Src/params.c: shift did not work + +Fri Sep 13 03:30:51 1996 Zoltán Hidvégi + + * Src/builtin.c: read builtin simplifications and improvements + + * Src/builtin.c: the read builtin did not handle meta characters + +Sat Sep 7 15:19:40 1996 Zoltán Hidvégi + + * Src/params.c, config.h.in, configure, configure.in: + setting the USERNAME parameter executes initgroups() + + * configure, configure.in: define HAVE_NIS_PLUS only if the + nis_list function is found + +Tue Sep 3 20:33:07 1996 Zoltán Hidvégi + + * Src/builtin.c: autoload has no effect for already defined + functions & other cosmetic changes + + * Src/utils.c: control keys at a query prompt left ^ as a garbage + on the screen. Fix from hoh@approve.se (Goran Larsson) + +Sun Sep 1 22:58:11 1996 Zoltán Hidvégi + + * Etc/NEWS: more news + + * Src/mem.c: fill the freed heap with 0xff on popheap and freeheap + + * Src/zle_tricky.c: completion did not work well after + delete-char-or-list + + * Src/builtin.c: umask prints 0222 instead of 222 + +Sat Aug 31 23:43:06 1996 Zoltán Hidvégi + + * Src/builtin.c: fc -e should not change lastval + + * Src/input.c: fc -e prints the modified line of stderr instead of + stdout + + * Src/init.c: use source instead of sourcehome for sourcing $ENV + in sh/ksh mode + + * Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c: set -s and set + +A now works as in ksh + + * Src/params.c: getaparam used by shift and compctl -k did not + work with KSH_ARRAYS + + * Src/exec.c: a prefix without command is not an error. + + * Doc/zsh.texi, Doc/zshbuiltins.man, Src/builtin.c, + Src/hashtable.h: unset -f is the same as unfunction + + * Src/builtin.c: read should set variables even if EOF is read + + * Src/builtin.c: typeset -i foo should not change an already set + base for foo + + * Src/init.c, Src/loop.c, Src/signals.c: terminate zsh if an + untrapped INT signal is received while sourcing a startup script + and the privileged option is set + + * Doc/zsh.texi, Doc/zshmisc.man, Src/globals.h: NO_BG_NICE is set + in sh/ksh mode + + * Src/zle_refresh.c: xterm cut&paste fix from Geoff (2095) + +Thu Aug 29 21:07:24 1996 Zoltán Hidvégi + + * Src/lex.c, Src/zle_tricky.c: run-help always uses the alias + expanded word + + * Src/zle_refresh.c: fixes for slow refresh on some terminals from + Geoff (2091) + +Mon Aug 26 00:02:36 1996 Zoltán Hidvégi + + * Src/exec.c: save/restore underscore on execsave/execrestore + + * Src/zle_tricky.c: line was wrongly used unmetafied in getcurcmd() + +Sun Aug 25 23:06:43 1996 Zoltán Hidvégi + + * Functions/checkmail, Doc/zsh.texi, Doc/zshmisc.man, Src/cond.c, + Src/parse.c: new -N contitional test to check if the access time + of a file is not newer than its modification time. A new + checkmail function is also included to check mailpath or the + given forlers for new mails. + + * Src/builtin.c: umask error message fix from János Farkas + (2061) + + * Src/mem.c, Src/zsh.h: halloc simplification + + * Src/zsh.h: save/restore underscore on execsave/execrestore + + * Doc/zsh.texi: <> should be <->. + From hoh@approve.se (Goran Larsson) + + * Doc/zshoptions.man: a space was missing after .BR. + From Bart (2019) + + * Src/exec.c, Src/globals.h, Src/signals.c, Src/signals.h, + Src/utils.c: Some little speedups + +Fri Aug 23 19:18:43 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: compctl -X did not work + + * Functions/run-help: fixed compctl handling + + * Util/helpfiles: comment changes + + * Src/params.c: $foo[(i)...], caused invalid subscript error + +Thu Aug 22 21:57:47 1996 Zoltán Hidvégi + + * META-FAQ: ftp.uit.no now mirrors the primary site. + ftp.nis.co.jp should be used instead of shirakaba.nis.co.jp + + * Src/parse.c: if ((...)) { ... } else { ... } should work. From + Bart (2043) and me + + * Src/builtin.c: RLIMIT_TCACHE = cachedthreads on HP-UX 10.20 + + * Etc/MACHINES: better description of the OSF/1 header bug + workaround + +Thu Aug 15 17:40:38 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0.0 released + + * configure, configure.in: remove -DDEBUG from the default CFLAGS + + * Makefile.in: Automatically update zsh-doc.tar.gz and the www + manual with make release + + * Doc/zsh.texi: final version for zsh-3.0 + + * Src/zsh.h: some compilers complained the 0x80 is out of range + + * Doc/zsh.texi, Doc/zshmisc.man, Src/globals.h: undo the emulation + of the echo style of /bin/sh in sh mode. + + * Functions/run-help: new version from Bart with some modifications + + * META-FAQ: new mirror in Japan and Slovenia, META-FAQ.html + + * Src/exec.c: $(< nosuchfile) dumped core. From Peter (1985) + +Wed Aug 14 17:02:39 1996 Zoltán Hidvégi + + * Src/parse.c: ignore spaces in case foo in ( f* | b* ) ... + + * Src/exec.c: fix error messages when there is an unreadable + directory or a non-directory in the path. From Peter (1666) + + * Src/utils.c: zstrtol skips leading whitespaces. From Risto J + Laitinen + + * Src/builtin.c: fc builtin fix from Peter (1956) + + * Doc/zsh.man, Doc/zsh.texi, Doc/zshall.man, Doc/zshmisc.man, + Doc/zshoptions.man, Src/exec.c, Src/globals.h, Src/hashtable.h, + Src/zsh.h: POSIX_BUILTIN option added + +Tue Aug 13 20:36:44 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshparam.man, Src/init.c, Src/zle_misc.c: PS2 + defaults to %_> , %_ prints all shell constructs. From Peter + (1948) + + * Src/hist.c: a cast was missing in a debug test + +Mon Aug 12 18:01:08 1996 Zoltán Hidvégi + + * Src/builtin.c: limit fixes for Alpha/Linux 2.0.x from Jeff Blank + (1951) + + * META-FAQ: ftp.funet.fi mirrors zsh + + * Doc/zshmisc.man, Doc/zsh.texi, Src/globals.h, acconfig.h, + config.h.in, configure, configure.in: test for the echo style of + /bin/sh + + * Src/math.c: $[#\c] did not work for meta characters. From Heiko + Schroeder (1937) + + * Src/builtin.c: hostorical sh compatibility: set - is set +xv and + set - args is set +xv -- args. + + * Src/zle_main.c, Src/zle_refresh.c: call getiparam("BAUD") once + before each zle invocation instead of calling it on each + keystroke. + + * Src/hist.c, Src/signals.c: Zsh coredumped on auto-logout + +Sun Aug 11 19:46:50 1996 Zoltán Hidvégi + + * Src/input.c: Fix history expansion in foo + + * Src/version.h: zsh-3.0-pre6 released + + * Doc/zsh.texi, Doc/zshparam.man, Src/hashtable.h, Src/params.c: + LANG and LC_{ALL,CTYPE,COLLATE,MESSAGES,TIME} special parameters + added + + * Src/utils.c (ztrftime): use strftime() for %a, %b and %p since + it respects LC_TIME + + * Src/mem.c: zsh_mem segfaulted when the free list was empty and a + large block was freed. + + * Src/zle_tricky.c: do not complete unset special parameters + +Sat Aug 3 02:54:46 1996 Zoltán Hidvégi + + * Src/init.c, Src/builtin.c, Src/globals.h, Src/zsh.h: setopt + prints non-default options. From Wayne (1907) + + * Src/exec.c, Src/zsh.h: foo | some_function > ... closed stdout + permanemtly + + * Src/zle_utils.c: zsfree used on the non-null-terminated vibuf[*].buf + +Fri Aug 2 20:05:50 1996 Zoltán Hidvégi + + * Doc/zsh.texi: spelling fixes from Mark and added reference to + obtaining precompiled documentation, zsh-doc.tar.gz from Clive + (1858) + + * Etc/BUGS, Etc/FEATURES, Etc/NEWS: `spelling' fixes + from Zefram (1856) + + * Functions/multicomp: unset nounset (in other words set unset) in + the function + + * Src/zle_refresh.c: zsfree was used to free the + non-null-terminated lpptbuf and rpptbuf + + * Src/mem.c: fill freed memory with 0xff intead of 0 when + ZSH_MEM_DEBUG is defined + + * Src/builtin.c, Src/exec.c: parse_string does not use + pushheap/popheap. $(< file command) works + + * Src/lex.c: lexsave() saves lexstop, gettok does not do hwbegin() + when lexstop != 0 + + * Src/hist.c: strinbeg/strinend increases/decreases strin. This + fixes the here-document within command substitution bug. + +Thu Aug 1 17:56:17 1996 Zoltán Hidvégi + + * Src/lex.c: \" should remain unchanged in here documents + +Wed Jul 31 19:10:04 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0-pre5 released + + * Doc/zsh.texi: updated to zsh-3.0-pre5 + + * Src/signals.c: update shtimes for disowned and command/process + substitution processes since otherwise these would be added to + the time of the next terminating non-disowned process. From + Peter (1849) + + * Src/jobs.c: more than 100% CPU usage is meaningfull on parallel + machines. From Peter (1849) + + * Doc/Makefile.in: use $< only in implicit rules + + * Src/builtin.c, Src/jobs.c, Src/zle_misc.c, Src/zle_refresh.c, + Src/zle_tricky.c, Src/zsh.h: COLUMNS=0 caused division by zero + + * Src/zle_refresh.c: use single line scroll only if speed >= + 19200. Fix a refresh bug happenning with half-screen scrolls. + From Mason (1835) + + * Doc/zsh.texi: texinfo updates from Clive (1833, 1838) + + * Src/hashtable.h, Src/params.c, Src/zsh.h: {E,}{U,G}ID, USERNAME, + histchars, HISTCHARS, IFS are not imported + + * Doc/zshparam.man, Src/exec.c: foo=something command did not work + well when foo was a special array or integer parameter or when + foo was a read-only parameter. It's fixed but now USERNAME=name + command will not work to start a single command under a + different username. (USERNAME=name ; command) should be used + instead. + + * Src/math.c: $[foo=] and $[foo,]caused SEGV + + * Src/utils.c, Src/zsh.h: DPUTS calls dputs() to print a debug + message. This makes debugging easier since a breakpoint can be + set to dputs. + +Tue Jul 30 20:28:38 1996 Zoltán Hidvégi + + * Src/params.c, Src/utils.c: zsh -s dereferenced wordchars while + it was still NULL. Reported by Peter. + + * Src/exec.c: handle special parameter assignments before builtins + and functions + + * Doc/zshmisc.man, Src/hashtable.h: MANPATH is not special in + sh/ksh mode + +Mon Jul 29 23:44:19 1996 Zoltán Hidvégi + + * Src/mem.c: a little-bit improved ZSH_MEM_WARNING + + * Src/init.c, Src/params.c, Src/utils.c, Src/zsh.h: zsh -s + dereferenced ifs while it was still NULL. Reported by Peter. + + * Src/signals.c: unfunxtion TRAPxxx gave a bogous BUG: message. + From Peter (1823) + + * Functions/zed: save/restore TMOUT fix + + * Doc/zshzle.man: isearch case-sensitivity documentation + + * Src/globals.h: swap option leters for noclobber and + printexitvalue again + + * Src/exec.c, Src/loop.c: do fake exec in complex commands + + * Src/parse.c: zsh -c 'echo foo ; & echo bar' should give parse + error. + +Sun Jul 28 22:34:08 1996 Zoltán Hidvégi + + * Doc/zshoptions.man: SH_FILE_EXPN renamed to SH_FILE_EXPANSION, + -s works as SHIN_STDIN again in sh/ksh mode, -t is + SINGLE_COMMAND in sh/ksh mode + + * Src/globals.h, Src/subst.c, Src/zsh.h, Doc/zshexpn.man, + Doc/zshmisc.man: SH_FILE_EXPN renamed to SH_FILE_EXPANSION + + * Functions/zed: some fixes + + * Misc/compctl-examples: (un)setopt completion example now know + about no_option + + * Src/zle_tricky.c: accept-and-menu-complete did not work well + with GLOB_COMPLETE + + * Src/zle_tricky.c: an other attempt to implement proper quoting + after a failed completion + + * Src/zle_hist.c: do not use zsfree on non-null-terminated strings + + * Src/zle_hist.c, Src/zle_utils.c: isearch is case sensitive if it + has a numeric argument + + * Src/globals.h: -s is back in sh/ksh mode for SHIN_STDIN + +Sat Jul 27 20:24:36 1996 Zoltán Hidvégi + + * Src/compat.c, Src/glob.c, Src/init.c, Src/mem.c, + Src/zle_tricky.c: changes to make the upcoming gcc-2.8.0 more + silent + +Fri Jul 26 21:02:59 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0-pre4 released + + * Makefile.in: the diffs for the FAQ contains RCS header diffs + + * Doc/zshmisc.man: COMPATIBILITY section added + + * Doc/zsh.man: use %manext% instead of 1 + + * Doc/zshbuiltins.man, Src/builtin.c, Src/hashtable.h: emulate -R + added + + * Doc/zshoptions.man, Src/globals.h, Src/zsh.h: shoptionletters + added, localoptions is only set for ksh, ksh knows -t and -s is + different from zsh so ksh -s is disabled. + + * Src/init.c: sh/ksh mode does not use $ZDOTDIR. ENV is expanded + + * Src/builtin.c, Src/exec.c, Src/signals.c: final (?) trap fixes + + * Doc/Makefile.in: added rules for zsh_a4.ps, zsh_us.ps, zsh_toc.html + + * Src/hashtable.c: print { } for empty funxtion definitions. From + Peter (1778) + +Thu Jul 25 21:50:36 1996 Zoltán Hidvégi + + * Src/signals.c, Src/subst.c: old compilers do not like char [] + automatic initializers + + * Src/globals.h: ignorebraces is not set for ksh emulation + + * Etc/CONTRIBUTORS: Bart Schaefer added to 3.0 contributors + + * Src/zle_tricky.c: backed out an earlier patch of mine which + quoted the line after a failed completion. + + * Src/builtin.c, Src/exec.c, Src/init.c: some checks to prevent + buffer overflows from Bart (1760) + + * Src/params.c: do not import special array parameters like path. + + * Src/params.c, Src/subst.c: Subscripts can be used in all array + types substitutions. For example + "${${(M)${(f@)$( + + * Etc/FAQ: checked in with -k by hzoli at 1996/07/25 20:32:43 + +Wed Jul 24 15:02:42 1996 Zoltán Hidvégi + + * Etc/NEWS, Src/lex.c: disallow [[-z $foo]] again since it will + cause problems with POSIX character classes (e.g. [[:ALPHA:]]). + + * Src/zle_misc.c: deletechar works at the end of lines. + +Tue Jul 23 21:04:22 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/exec.c, Src/globals.h, Src/hashtable.c, + Src/jobs.c, Src/signals.c, Src/zsh.h: more signal trap fixes + + * Src/exec.c: add zleactive = 0; to entersubsh(). From Bart and + Peter (1735) + + * Src/zle_vi.c: vi-replace-chars repeat correctly with + vi-repeat-change. From Zefram (1696) + + * Doc/zshzle.man, Src/zle.h, Src/zle_main.c, Src/zle_misc.c, + Src/zle_utils.c, Src/zle_vi.c: vi-style named cut buffers work + in ZLE. From Zefram (1683) + + * Src/builtin.c: whence -c (and which) tells if the given command + is not found. + +Mon Jul 22 20:32:13 1996 Zoltán Hidvégi + + * Doc/zshexpn.man, Doc/zshoptions.man, Doc/zshparam.man, + Src/globals.h, Src/subst.c, Src/zsh.h: SH_FILE_EXPN option and + some other changes related to sh/ksh emulation from Zefram + (1695) + + * Doc/zshoptions.man, Src/builtin.c, Src/exec.c, Src/globals.h, + Src/zsh.h: FUNCTION_ARGZERO option from Zefram (1669) + + * Doc/zshcompctl.man: some stylistic improvements from Peter (1675) + + * Src/parse.c: case foo in (foo) echo yes;; esac fixed. From Bart + (1734) + + * Doc/zsh.texi: A couple of small fixes from Anthony Heading + & Vinnie Shelton + . Updated URL for mdb's online + documentation. Updated to include changes made to man-pages + pre2 -> pre3. FIXME: URL for ps & dvi. From Clive (1730) + +Mon Jul 22 01:26:09 1996 Zoltán Hidvégi + + * Src/exec.c, Doc/zshmisc.man: traps defined by the trap builtin + are unset in subshells + + * Src/exec.c, Src/builtin.c, Src/globals.h, Src/hashtable.c, + Src/init.c, Src/jobs.c, Src/signals.c, Src/zsh.h, + Doc/zshbuiltins.man: traps defined by the trap builtin are now + executed in the current shell environment and not as a shell + function. + + * Src/utils.c, Src/zle_hist.c, Src/zle_utils.c: add Emacs-like + case insensitive incremental search + + * Doc/zsh.man, Doc/zshall.man, Doc/zshexpn.man, Doc/zshmisc.man, + Doc/zshoptions.man, Src/builtin.c, Src/exec.c, Src/glob.c, + Src/globals.h, Src/hist.c, Src/init.c, Src/params.c, + Src/parse.c, Src/signals.c, Src/subst.c, Src/utils.c, + Src/zle_hist.c, Src/zle_main.c, Src/zle_misc.c, + Src/zle_tricky.c, Src/zle_vi.c, Src/zsh.h: second option + reorganization: setopt no_something is the same as unsetopt + something. From Zefram. + +Sat Jul 20 17:07:14 1996 Zoltán Hidvégi + + * acconfig.h, config.h.in, configure, configure.in: configure + check for working strcoll() + + * configure, configure.in: cache broken signed to unsigned char + conversion, and the path for utmp/wtmp/signals.h. Modified + cache variable names according to the GNU aucoconf standard. + From Zefram (1698) + + * config.guess: fix for dgux + + * Src/prototypes.h: strerror() prototype for SunOS from Zefram (1664) + + * Doc/zsh.man, Doc/zshall.man: modified the AUTHOR section + + * Etc/CONTRIBUTORS: Peter told me that programmable completion was + done by Sven only. + + * Src/exec.c, Src/init.c: make compilation possible on systems + withour resurce limits. From Wayne (1656) + + * Src/lex.c: cmdstack changed bugfix from Zefram (1671) + +Fri Jul 19 19:25:14 1996 Zoltán Hidvégi + + * Src/subst.c: parameter modifier fixes, better diagnostics + + * Src/subst.c: nested $((...)) substitutions now work. + + * Src/zle_refresh.c: do not put the cursor into the last screen + line if possible. From Zefram (1678) + + * Src/zle_refresh.c: a third refresh patch from Mason (1685) + + * Src/zle_refresh.c: another refresh improvement from Mason (1642) + + * Src/glob.c: a minor optimization + + * Src/builtin.c: rlimit fixes for AIX 4.2 + + * Src/parse.c: case foo in (pattern) foo=bar;; esac now works + + * Src/lex.c: allow {command} [[-z $foo]] etc. again. + + * Src/lex.c: name=(...) did not work is there was a alias for name. + + * Misc/compctl-examples: avoid a fork/exec in CVS completion. + From Bart. + + * Src/jobs.c: fix a core dump in printjob(). From Zefram (1689) + + * Src/lex.c: do not handle `<' in case patterns specially + +Thu Jul 18 23:03:59 1996 Zoltán Hidvégi + + * Src/subst.c: a little simplification + +Mon Jul 15 04:43:43 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0-pre3 released + + * Etc/CONTRIBUTORS: added major contributors to zsh-3.0 briefly + describing their work. + + * Misc/compctl-examples: CVS compctl improvements from Bart (293, 1639) + + * Src/exec.c, Src/hist.c: some compilers were noisy + + * Src/exec.c: fix problems of failed redirection in an exec'ed + command. From Peter (1526) + + * Src/zle_refresh.c: big zle patch from Geoff to improve handling + of long lines (1637) + + * Src/exec.c: redirected than interrupted builtins sometimes left + the output redirected. From Peter (1609) + + * Src/builtin.c, Src/exec.c, Src/jobs.c: jobs does not redraw the + terminal when called from a compctl. The output from jobs now + goes to stdout. From Peter (1606) + + * Src/zle_main.c: fix terminal problems when backgrounding + less. From Bart Schaefer (1546) + + * Src/builtin.c, Src/exec.c, Src/globals.h, Src/init.c: limit, + ulimt, unlimit improvements: hard limit for the children can + always be raised up to the hard limits of the shell. + Optimization: setrlimit() is only called when necessary. + +Sat Jul 13 20:26:35 1996 Zoltán Hidvégi + + * Etc/NEWS, Doc/zshmisc.man, Src/globals.h, Src/hashtable.h, + Src/hist.c, Src/lex.c, Src/parse.c, Src/utils.c, + Src/zle_tricky.c, Src/zsh.h: The lexer no longer depens on the + history code (it does not use hwget). ! [[ { } are now reserved + words. + + * Src/lex.c: parsestr() failed if the string contained a backslash + newline + +Fri Jul 12 17:19:02 1996 Zoltán Hidvégi + + * Src/zle_hist.c, Src/zle_main.c: always execute the zle command + which ended an I-search. From Wayne (1613) + + * Src/exec.c: for word in %1 should not trigger sutoresume. From + Peter (1619) + + * Src/parse.c: allow the repeat word { list } syntax without + noshortloops. If CSHJUNKIELOOPS is set accept repeat word list + end. + + * Doc/zshmisc.man: more precise definition the the syntax of + complex commands + + * Src/parse.c: the repeat word sublist syntax does not work if + NOSHORTLOOPS is set + + * Src/parse.c: The foo () sublist function definition syntax is + changed to foo () command for ksh and POSIX compatibility. This + syntax does not require NO_SHORT_LOOPS. + +Thu Jul 11 21:03:51 1996 Zoltán Hidvégi + + * Src/exec.c: handle metacharacters in here documents + + * Src/subst.c: remnulargs is unnecessary in singsub() since it is + done in prefork() + + * Doc/zsh.texi, Doc/zshmisc.man: case documentation improvements + + * Src/exec.c, Src/hist.c: remove hgets() and merge it into gethere() + + * Src/zle_tricky.c: feep when completion is tried when the current + word begins in an already accepted line. Make the code a bit + simpler and add a debug check. + + * Src/zle_tricky.c: fix completing in $(...) + +Wed Jul 10 20:52:55 1996 Zoltán Hidvégi + + * Src/glob.c, Src/subst.c, config.h.in, configure, configure.in: + use strcoll for sorting. From Andrej Borsenkow + (1599) with some modifications + + * Src/exec.c: FOO=bar function leaved FOO=bar in the environment + +Wed Jul 10 02:34:49 1996 Zoltán Hidvégi + + * Src/exec.c: FOO=bar function leaved FOO=bar in the environment + + * Src/exec.c, Src/init.c: FOO=bar function fixes from Peter (1573) + + * Src/zle_tricky.c: quoting after faild completion fixed + + * Src/utils.c, Src/zle_tricky.c: menu completion after ~/ and + $foo/ fixed + +Tue Jul 9 21:09:29 1996 Zoltán Hidvégi + + * Doc/zsh.texi, Doc/zshmisc.man, Src/parse.c: case foo in + (pattern) ... syntax documented and parsing improved + + * Doc/zsh.texi: Removed the chapter "History" as it was duplicated + as "History Expansion" in chapter "Expansion". From Clive. + + * Src/zle_tricky.c: gcc gave `ocs' might be used uninitialized warning + + * Src/init.c, Src/utils.c: bangchar is special iff + unset(NOBANGHIST) &&interactive && isset(SHINSTDIN) + + * Src/zle_tricky.c: fix completing words containing bangchar + + * Src/hist.c: prevent infinite loop when saving history + + * Src/zle_tricky.c: fix various completion bugs mostly related to + completing in multiline command structures + + * Src/lex.c: do not call exalias if errflag is true (fixes + push-line-or-edit) + +Mon Jul 8 20:37:59 1996 Zoltán Hidvégi + + * Src/init.c: set shout fully buffered + +Mon Jul 8 01:56:51 1996 Zoltán Hidvégi + + * Src/exec.c, Src/globals.h, Src/hist.c, Src/init.c, Src/input.c, + Src/lex.c, Src/parse.c, Src/zsh.h: doexpandhist() no does not + mess up the history. Here document are put into the history and + some other here document fixes. + +Sun Jul 7 16:03:48 1996 Zoltán Hidvégi + + * Src/init.c: alloc_stackp debug check fix + + * Doc/zsh.texi: Add accents to my name fix a typo and improve + ulimit documentation (Zoltan) + + * Doc/zshbuiltins.man: improve ulimit documentation + +Sun Jul 7 00:18:17 1996 Zoltán Hidvégi + + * Src/lex.c: remove warning about the new <> behaviour + +Sat Jul 6 18:17:13 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: fix completing in process and command + substitutions + +Fri Jul 5 21:58:31 1996 Zoltán Hidvégi + + * Src/zle_tricky.c, acconfig.h, config.h.in, configure, + configure.in: configure check for NIS+ and some othe related + changes. From Peter (1530) and me + + * Doc/zsh.texi: updated texinfo documentation from Clive + + * Src/system.h: RLIMIT_* fixes for HP-UX A.09.x + + * Src/signals.c: pid_d *procsubpid instead of int *. + From Wayne (1528) + + * Src/zsh.h: X was used instead of Y in DPUTS. From Wayne (1528) + + * Doc/Makefile.in, Doc/zsh.man, Doc/zshall.man, + Doc/zshoptions.man, INSTALL, configure, configure.in: + --enable-etcdir is back. The customized locations are put into + the manual + +Thu Jul 4 20:46:17 1996 Zoltán Hidvégi + + * Src/version.h: zsh-3.0-pre2 released + + * Src/zsh.h: some old compilers did not like the "foo" "bar" syntax + + * INSTALL, acconfig.h, config.h.in, configure, configure.in: + replace --enable-etcdir with --enable-{zshenv,zshrc,zlogin, + zprofile,zlogout} + + * Src/builtin.c, Src/exec.c, Src/hist.c, Src/lex.c, Src/mem.c, + Src/signals.c, Src/utils.c, Src/zle_main.c, Src/zle_misc.c, + Src/zle_tricky.c, Src/zsh.h: heapalloc()/permalloc() replaced + with HEAPALLOC/PERMALLOC. Both begin a new block which must be + terminated by LASTALLOC. LASTALLOC_RETURN must be used to + return in the middle of such a block. Example usage: + PERMALLOC { l = dupstruct(list); } LASTALLOC; + Idea from Bart and Zefram + +Thu Jul 4 13:18:11 1996 Zoltán Hidvégi + + * Doc/zshoptions.man: >| is preferred to >! + +Mon Jul 1 20:59:36 1996 Zoltán Hidvégi + + * Doc/zshmisc.man, Doc/zshoptions.man, Src/globals.h, Src/parse.c, + Src/zsh.h: CSH_JUNKIE_PAREN option removed. From Bart Schaefer + (1496) with some modifications + +Mon Jul 1 20:13:26 1996 Zoltán Hidvégi + + * Src/mem.c, acconfig.h, config.h.in, configure, configure.in: + check for brk/sbrk prototypes + + * Misc/compctl-examples: complete *.rpm files after rpm -i + + * Misc/compctl-examples: improved MH completions from Peter + (zsh-users 268) + + * Src/system.h: RLIMIT_ definitions are not hidden in HPUX 10.x + +Mon Jul 1 14:01:46 1996 Zoltán Hidvégi + + * Src/builtin.c: ulimit fixes + + * Src/builtin.c, Src/globals.h, Src/hashtable.h, Src/hist.c, + Src/init.c, Src/jobs.c, Src/params.c, Src/signals.c, + Src/utils.c, Src/zle_main.c, Src/zle_tricky.c: BAUD, + DIRSTACKSIZE, KEYTIMEOUT, LISTMAX, LOGCHECK, MAILCHECK, PERIOD, + REPORTTIME, SAVEHIST and TMOUT are no longer special parameters. + +Mon Jul 1 02:27:23 1996 Zoltán Hidvégi + + * Src/globals.h, Src/builtin.c, Src/exec.c, Src/init.c, Src/lex.c, + Src/mem.c, Src/signals.c, Src/utils.c, Src/zle_main.c, + Src/zle_misc.c, Src/zle_tricky.c, Src/zsh.h: new + heapalloc/permalloc/lastalloc macros. heapalloc/permalloc + starts with an open brace and lastalloc ends in a closing brace + so these can only be used together. lastalloc_return must be + used instead of return between heapalloc/permalloc and + lastalloc. From Bart Schaefer (1490) with some modifications + +Mon Jul 1 01:13:17 1996 Zoltán Hidvégi + + * Doc/zshbuiltins.man, Src/builtin.c, Src/exec.c, Src/hashtable.h: + limit/unlimit/ulimit changes, bash/ksh compatible ulimit + +Sun Jun 30 21:14:16 1996 Zoltán Hidvégi + + * Doc/intro.ms, Doc/zsh.man, Doc/zshall.man: + Paul Falstad's E-mail is pf@software.com + +Sun Jun 30 15:46:13 1996 Zoltán Hidvégi + + * Src/exec.c (doshfunc): do not change the value of underscore + + * Src/builtin.c, Src/utils.c: zjoin and sepjoin returns an + ncalloc'ed result (which makes them reentrant) + + * Src/zle_misc.c (undo): zsfree can only be used on null + terminated strings + + * Src/signals.c: restore the old signal mask in unqueue_signals + + * Src/exec.c: cmdoutpid and cmdoutval added to execstack + +Sun Jun 30 01:30:27 1996 Zoltán Hidvégi + + * Src/mem.c: fill freed memory with zeros if ZSH_MEM_DEBUG is defined + + * Src/exec.c, Src/globals.h, Src/jobs.c, Src/signals.c, Src/zsh.h: + cmdoutpid and cmdoutval added to execstack + +Sat Jun 29 15:24:54 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/hist.c, Src/utils.c: fix problems with quad_t + resource limits. From Geoff (1444,1471) + +Fri Jun 28 17:52:52 1996 Zoltán Hidvégi + + * Src/builtin.c: use the heap during the execution of chpwd() + +Fri Jun 28 15:00:11 1996 Zoltán Hidvégi + + * ChangeLog: zsh-3.0-pre1 released + + * Makefile.in: replace dots with _ in symbolic revision names + + * Src/subst.c: fix a silly bug I made + + * Makefile.in: make release changes + +Fri Jun 28 14:08:44 1996 Zoltán Hidvégi + + * Doc/Makefile.in: zsh.info and zsh.dvi depends on zsh.texi + + * Doc/zsh.texi: Fixed compctl -d and -e. Added ref to ***/. + HISTCHARS depreciated, use histchars. + +Fri Jun 28 13:46:02 1996 Zoltán Hidvégi + + * Src/glob.c: foo.bar(:r) did not work + +Fri Jun 28 01:27:57 1996 Zoltán Hidvégi + + * Src/zle_misc.c: alwayslastprompt fix when listing in + execute-named-command + + * Doc/zshparam.man, Src/jobs.c: %% represents % in TIMEFMT + +Thu Jun 27 23:51:19 1996 Zoltán Hidvégi + + * Etc/BUGS: I hope that all awk problems are solved by now + + * Src/subst.c: more bugfixes + + * Src/exec.c: do not dump core on ls =() + + * Src/builtin.c: fix problems with more than 63 character long + fields in bin_read + + * Src/hist.c: hungetc did not work when an originally unquoted + bang came from a history substitution (e.g. when !$ should + expand to $!) + + * Src/subst.c, Src/glob.c: fix some really rare substitution bugs + + * Src/exec.c: foo=( '' ) assigned an empty array + + * README: instructions added what to do when there are unknown + limits + + * INSTALL, acconfig.h, config.h.in, configure, configure.in: + --enable-etcdir added + +Wed Jun 26 23:19:48 1996 Zoltán Hidvégi + + * Src/hist.c, Doc/zshexpn.man: get !# work again. From Peter + (1218 and 1219) + + * Src/hashtable.h, Doc/zshbuiltins.man, Src/builtin.c: + umask -S prints the mask in symbolyc form + + * Src/init.c: do not buffer stdin if SHINSTDIN is set and not + interactive. This is because the line that comes afrer a + command line on the standard input should be the potential + standard input of the command. This means that echo -e + 'cat\nfoo' | zsh will print foo instead of command not found: + foo + + * Doc/zshbuiltins.man, Src/builtin.c: POSIX conforming kill builtin + +Wed Jun 26 08:58:31 1996 Zoltán Hidvégi + + * Doc/zsh.man, Doc/zshall.man, Doc/zshbuiltins.man, + Doc/zshcompctl.man, Doc/zshexpn.man, Doc/zshmisc.man, + Doc/zshoptions.man, Doc/zshparam.man, Doc/zshzle.man: date and + version number changed + + * Doc/zshbuiltins.man, Doc/zshmisc.man: -, command, exec and + noglob are builtins + +Tue Jun 25 23:15:04 1996 Zoltán Hidvégi + + * Src/lex.c: \c was interpreted as \c in dquote_parse() + +Tue Jun 25 21:07:59 1996 Zoltán Hidvégi + + * Etc/NEWS: AUTO_PUSHD and IFS change description + + * Etc/FAQ: New FAQ from Peter + + * Src/signals.c: queue_signals()/unqueue_signals() + increase/decreas the queueing_enabled variable and when it drops + to zero accumulated signals are processed + + * Src/mem.c: queue_signals in zfree(), malloc(), realloc() when + ZSH_MEM is used remove signal queueing from zalloc() and + zcalloc() + + * Doc/zshzle.man, Src/zle_bindings.c: reverse / and ? vi mode + keybindings (so the original behaviour is back) + + * Src/exec.c: save underscore, lastval, noeval and badcshglob in + execsave + +Tue Jun 25 19:46:34 1996 Zoltán Hidvégi + + * Doc/zshexpn.man: trailing newlines are removed in command + substitution + +Tue Jun 25 00:52:10 1996 Zoltán Hidvégi + + * Src/exec.c, Src/signals.c: new function execsave()/execrestore() + used in dotrap() + +Mon Jun 24 21:05:00 1996 Zoltán Hidvégi + + * Src/exec.c: doshfunc must use the heap + + * Src/signals.c: dotrap should not change allocation state + + * Src/watch.c: do not watch utmp entries without a login name. + From János Farkas (1432) + + * Src/utils.c: handle terminals faster than 100000 baud. From + János Farkas (1431) with modifications + + * Src/subst.c: fix nested $[$[...]] sunstitution + +Fri Jun 21 14:40:00 1996 Zoltán Hidvégi + + * Doc/zshexpn.man: <> is a redirection operator. + From Mark Borges (1390) + + * Src/glob.c (glob): untokenize bad patterns if NO_BAD_PATTERN is + set From Peter (1395) + + * Doc/Makefile.in: zsh.info* files are removed from the + distribution since these should be generated from zsh.texi. + Added targets zsh.info and zsh.dvi. + + * Doc/zsh.texi: minor corrections from Clive (1399) + + * Doc/zsh.texi: changes between 2.6-beta20 and beta21 are + documented. From Clive Messer (1372) + + * Src/glob.c: remove the undocumented [(foo)(bar)] glob feature + since it is the same as (foo|bar). + +Thu Jun 20 20:58:14 1996 Zoltán Hidvégi + + * Src/parse.c: enable < =(...) and > =(...) again + + * Src/parse.c: no special handling is necessary if test has two + arguments + + * Src/zle_tricky.c: allow tilde and equals substitution with + compctl -g + +Wed Jun 19 20:55:00 1996 Zoltán Hidvégi + + * Src/version.h: zsh-2.6-beta21 released + +Wed Jun 19 20:51:45 1996 Zoltán Hidvégi + + * Src/builtin.c: on Solaris RLIMIT_AS == RLIMIT_VMEM + + * configure, configure.in: remove -pedantic from gcc options + +Wed Jun 19 20:21:33 1996 Zoltán Hidvégi + + * Src/hashtable.c: fix printing of the command name tables and + displaying of arrays etc. From Zefram (1259) + + * Src/params.c: unset USERNAME coredump fix. Also do not reset + integer variables to zero before unsetting. From Zefram (1258) + + +Wed Jun 19 20:12:37 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/params.c, Src/subst.c, Src/utils.c: handle + the case when the first character of IFS is a meta character + +Tue Jun 18 21:05:17 1996 Zoltán Hidvégi + + * Doc/zshexpn.man: [...] glob documentation + + * Doc/zshoptions.man: SH_GLOB disables numeric globbing on the + result of parameter expansions and in some other cases. + +Tue Jun 18 19:28:12 1996 Zoltán Hidvégi + + * Src/subst.c, Src/utils.c: handle null (but not unset) IFS + + * Src/exec.c: an other implementation of IFS field splitting of + process substitutions + + * Src/glob.c: in tokenize(): <> is not a glob pattern. Do not + tokenize < if SH_GLOB is set. Tokenize only glob special + characters. in notstrcmp(): handle arbitrary big numbers if + NUMERICGLOBSORT is used. + +Mon Jun 17 18:33:44 1996 Zoltán Hidvégi + + * Src/lex.c: reset lexstop to zero after most hungetc's + +Mon Jun 17 02:14:04 1996 Zoltán Hidvégi + + * Doc/zsh.texi: a major update from Clive Messer + + + * Doc/zshparam.man, Src/builtin.c, Src/exec.c, Src/params.c, + Src/subst.c, Src/utils.c, Src/ztype.h: ksh/POSIX compatible IFS + behaviour + +Sun Jun 16 19:37:01 1996 Zoltán Hidvégi + + * Src/subst.c: ${(Oi)...} should sort case-independently in + descending order. From Thorsten Meinecke (1337) + + * Doc/zshoptions.man, Etc/NEWS, Src/globals.h: swap option leters + for noclobber and printexitvalue since according to POSIX 1003.2 + noclobber must be -C + + * Src/exec.c: make noclobber a bit more secure + +Sun Jun 16 18:50:47 1996 Zoltán Hidvégi + + * Misc/compctl-examples: compctl for the RedHat rpm utility + +Sun Jun 16 14:50:42 1996 Zoltán Hidvégi + + * Src/system.h: include if GWINSZ_IN_SYS_IOCTL is + defined. This in fact just removes an earlier experimental + patch which accicently got into the release. + +Sat Jun 15 23:37:44 1996 Zoltán Hidvégi + + * Doc/zshmisc.man, Etc/NEWS, Src/exec.c, Src/glob.c, + Src/globals.h, Src/lex.c, Src/parse.c, Src/text.c, Src/zsh.h: + <> redirection operator + + * Src/builtin.c, Src/parse.c: POSIX test builtin + + * Src/zle_tricky.c: use heapalloc() in reversemenucomplete() + +Tue Jun 11 21:03:45 1996 Zoltán Hidvégi + + * Src/exec.c, Src/glob.c, Src/globals.h, Src/lex.c, Src/parse.c, + Src/text.c, Src/zsh.h: POSIX redirection changes. Epand word + after >& or <& and decide the action after the expansion. >& + redirects both stdout and stderr only if the expansion of the + word is not -, p or a number. The &> operator is added to which + does not check the result of the expansion. This change also + incorporates the patch from Zefram in art. 1261. + + * Src/utils.c: use nicezputs for printing rm * confirmation question + + * Src/exec.c: fix autoresume and %job + + * Src/zle_tricky.c: use heapalloc() in do_menucomp() + +Mon Jun 10 20:58:16 1996 Zoltán Hidvégi + + * Src/glob.c: treat pattern/ as pattern(-/) instead of pattern(/) + + * Perform only single-word substitution in redirections if + NO_MULTIOS is set. Based on a patch from Zefram. + + * Src/parse.c: fix cmdstack empty bug when CSH_JUNKIE_PAREN is set + + * Src/zle_tricky.c: fix compctl -g if nonomatch is set + + * Src/parse.c, Src/lex.c: POSIX: allow an optional leading open + parenthesis in case patterns + + * Src/builtin.c: handle RLIMIT_AS in Linux 2.0 + +Sun Jun 9 23:30:02 1996 Zoltán Hidvégi + + * Src/builtin.c: compctl -L fixes + + * Src/zle_tricky.c: compctl -l '' foo only worked for the first + argument of foo. + +Fri Jun 7 15:24:18 1996 Zoltán Hidvégi + + * Src/version.h: zsh-2.6-beta20 + + * Etc/NEWS: There were some changes since 2.5 + + * Src/params.c, Src/subst.c: sh/ksh compatibility changes: perform + tilde and equals substitution together with other substitutions + and disable braceless colon modifiers and subscripting in + parameter expansion when zsh is invoked as sh/ksh. + + * Src/exec.c: NULLCMD and READNULLCMD did not work if set to a + builtin + + * Doc/zshparam.man, acconfig.h, config.h.in, configure.in, + configure, Src/hashtable.h, Src/params.c: Special parameter + changes: remove HOSTTYPE, and disable cdpath, fignore, fpath, + mailpath, manpath, watch, psvar and path in sh/ksh compatibility + mode. + +Thu Jun 6 20:23:23 1996 Zoltán Hidvégi + + * Src/zle_tricky.c (doexpansion): move newlinklist() after heapalloc() + + * Src/builtin.c (bin_cd): a heapalloc() was missing + + * Src/builtin.c: use zwarnnam() instead of zerrnam() in most + builtins and reset errflag to zero if necessary. + + * Src/builtin.c, Src/zle_tricky.c, Src/zsh.h: new compctl options: + -m for external commands and -w for reserved words. -cFBmwaRG + now only completes enabled commands. -d, -e documentation + fixed. + +Wed Jun 5 22:27:49 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: getcurcmd() did not use the heap when it + called the lexer. I also added some debug tests. + +Mon Jun 3 18:53:10 1996 Zoltán Hidvégi + + * Src/hashtable.c, Src/zle_hist.c, Src/zle_main.c, + Src/zle_tricky.c, Src/zle_utils.c: add some (char *) and + (unsigned char *) casts + +Mon Jun 3 16:55:44 1996 Zoltán Hidvégi + + * Src/version.h: zsh-2.6-beta20-test1 + + * Src/subst.c: multsub() did not like when prefork() resulted in + an empty list + +Mon Jun 3 03:14:06 1996 Zoltán Hidvégi + + * Src/subst.c: fix brace expansion bug + +Mon Jun 3 01:42:58 1996 Zoltán Hidvégi + + * Makefile.in: config.status depends on Src/version.h + + * Doc/zsh.man, Doc/zshall.man: remove the accents from my name + since some man pagers do not like it + + * Src/signames.awk: now this should _really_ work even with SunOS + 4 nawk + + * Src/builtin.c, Src/exec.c: do not set $0 for sourced scripts and + functions in sh/ksh mode + + * Src/zle_misc.c: use heapalloc when doing substitution with + PROMPT_SUBST set + + * configure, configure.in: add -DDEBUG to the default CFLAGS + + * Doc/zshbuiltins.man, Doc/zshoptions.man, Src/builtin.c, + Src/cond.c, Src/exec.c, Src/globals.h, Src/hashtable.h, + Src/init.c, Src/params.c, Src/utils.c, Src/zle_main.c, + Src/zle_tricky.c, Src/zle_vi.c, Src/zsh.h: reorganized option + handling from Zefram (1227) + +Sun Jun 2 23:36:36 1996 Zoltán Hidvégi + + * Src/exec.c, Src/builtin.c, Src/glob.c, Src/hashtable.h, + Src/subst.c, Src/zsh.h: reorganize execcmd() again. Glob only + the first argument before fork(). -, command, exec and noglob + are now builtins. The builtin builtin is now handled in + execcmd(). fixcline() is removed. prefork() removes null + arguments. The result of glob() does not have tokens so + untokenize() is no longer necessary after globlist(). + + * Src/lex.c: give warnings when DEBUG is defined and the lexer is + called with !useheap + + * Src/zsh.h: added some debug macros + + * Src/zle_tricky.c: use the heap in doexpansion() + + * Src/parse.c: give warnings when DEBUG is defined and the lexer + is called with !useheap + +Fri May 31 14:09:34 1996 Zoltán Hidvégi + + * Src/exec.c, Src/utils.c: nicezputs and nicechar fixes + +Thu May 30 18:20:46 1996 Zoltán Hidvégi + + * Src/exec.c: simplify makecline which also fixes a bug introcuced + by the previous patch + + * Src/exec.c, Src/hashtable.h, Src/parse.c, Src/text.c, Src/zsh.h: + execcmd() reorganization. Do globbing before fork, remove -, + exec, noglob and command from the list of reserved words. + Interpret EXEC=exec ; $EXEC something like other shells. From + Peter (1229) + +Tue May 28 20:49:53 1996 Zoltán Hidvégi + + * Src/zle_misc.c: fix gosmacs-transpose-chars bug when a line has + less than two characters + +Mon May 27 23:52:54 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: clwords initialisation after resizing clwords + was wrong. From Zefram (1173) + +Mon May 27 17:43:31 1996 Zoltán Hidvégi + + * Src/builtin.c: typeset -i2 a now works. Based on art. 1165 from + SUZUKI Hisao + + * Doc/zshparam.man, Src/utils.c: expand messages in mailpath + + * Doc/zshbuiltins.man: revised read manual entry from Peter (663) + +Sun May 26 23:14:07 1996 Zoltán Hidvégi + + * Etc/FAQ: New version from Peter + +Thu May 23 20:14:05 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: further improve handling of null at the end of + a completion word + + * Src/zle_tricky.c: fix problems when a completion ends in a null + character. From Zefram (1145) + + * Src/zle_utils.c: move the line[ll] in foredel/backdel since it + contains the null terminator character when called from + zle_tricky.c. From Zefram (1144) + + * Src/zle_tricky.c (quotename): handle the (metafied) null + character. From Zefram (1143) + +Thu May 23 13:40:50 1996 Zoltán Hidvégi + + * Src/version.h: zsh-2.6-beta19 released + + * Src/signames.awk: this version should work with all awks out + there. From Geoff (1142) and me + + * Src/glob.c, Src/subst.c, Doc/zshexpn.man: ${...:#...} + substitution now removes matching array elements + +Thu May 23 01:29:48 1996 Zoltán Hidvégi + + * Doc/zshoptions.man: an attempt was made to document SH_GLOB + + * Src/builtin.c: popd now works even if chaselinks is set. From + Anthony (1123) + +Wed May 22 23:43:01 1996 Zoltán Hidvégi + + * Src/glob.c, Src/zle_tricky.c: add some remnulargs() + + * Src/builtin.c: print -m fixed + +Wed May 22 21:00:06 1996 Zoltán Hidvégi + + * Src/glob.c, Src/globals.h, Src/init.c, Src/lex.c, Src/zsh.h: + SH_GLOB option added + +Wed May 22 20:19:13 1996 Zoltán Hidvégi + + * Src/signames.awk: revert changes made in beta18. + + * Src/cond.c (getstat): always use fstat when testing for /dev/fd/n + + * Src/exec.c (getoutputfile): open the file before zfork() + +Tue May 21 19:39:16 1996 Zoltán Hidvégi + + * Src/version.h: zsh-2.6-beta18 released + + * Etc/MACHINES: note that /dev/fd must be a link to /proc/self/fd + on Linux + + * Src/builtin.c: jobs exits with status 1 if the given job is not + found. From Peter (1069) + + * configure, configure.in: prefer curses over termcap for aix-3.2* + and not just for aix-3.2.5 + + * META-FAQ: Ftp site list changes + +Mon May 20 01:24:24 1996 Zoltán Hidvégi + + * Src/signames.awk: change #else to \#else since some nawks did + not like the former. From Johan Danielsson + (1096) + + * Src/builtin.c, Src/params.c, Src/utils.c: rename join() to zjoin + since join is used by Cray Unicos 9. From Johan Danielsson + (1096) + + * Src/utils.c (inittyptab): null is not blank and not special + + * Src/zle_tricky.c: Do a lexrestore() before returning from + get_comp_string(). + + * Src/zle_tricky.c: Undo Zefram's modifications in quotename() to + fix a bug when completing ~/foo + +Sun May 19 23:20:45 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: Reformat and add some comments. + From Zefram (1092) + + * Src/zle_tricky.c: Make completion 8-bit clean. From Zefram (1092) + + * Src/glob.c, Src/subst.c: use STOUC instead of (unsigned char) cast + + * Src/glob.c, Src/subst.c: Make substitution compatible with + (ba)sh and other little cleanups in lex.c. + + * Src/hashtable.c, Src/utils.c: Make output 8-bit clean in zerr() + and in hashtable.c. From Zefram (1093) + + * Src/glob.c, Src/lex.c, Src/subst.c, Src/utils.c, Src/zle_main.c, + Src/zle_refresh.c, Src/ztype.h: use STOUC instead of (unsigned + char) cast + + * Src/glob.c, Src/globals.h, Src/lex.c, Src/subst.c, Src/zsh.h: + Make substitution compatible with (ba)sh and other little + cleanups in lex.c. + +Fri May 17 20:23:47 1996 Zoltán Hidvégi + + * Src/version.h: 2.6-beta18-test1 + + * Src/zle.h, Src/zle_hist.c, Src/zle_main.c, Src/zle_misc.c, + Src/zle_move.c, Src/zle_tricky.c, Src/zle_vi.c, Src/zle_word.c: + Rename mult to zmult since mult caused problems on Solaris 2.5 + + * Src/zle_hist.c, Src/zle_tricky.c, Src/zle_utils.c, + Src/zle_word.c, Src/zsh.h: Remove UTOSCP and STOUCP macros + + * Etc/MACHINES: Note about GNU strip bug on OSF/1 + +Thu May 16 23:46:44 1996 Zoltán Hidvégi + + * Src/zle_hist.c, Src/zle_utils.c: Some simple cleanups in + doisearch() and hstrnstr() + + * Src/zle_hist.c: Recall the last isearch if fwd/bck-isearch + repeated on an empty search. It also fixes a rare isearch bug. + From Wayne (1084) + +Thu May 16 00:15:42 1996 Zoltán Hidvégi + + * acconfig.h, config.h.in, configure, configure.in, Src/system.h: + configure hacks against SCO bugs + +Wed May 15 01:41:33 1996 Zoltán Hidvégi + + * Src/zle_hist.c, Src/zle_misc.c: More 8-bit zle changes + + * Src/zle_hist.c: A minor optimization which also removes an + strlen() which should have been ztrlen(). From Wayne (1071) + + * Src/builtin.c: compctl fixes from Zefram (1068) + +Tue May 14 03:19:34 1996 Zoltán Hidvégi + + * Src/utils.c, Src/zle_hist.c, Src/zle_main.c, Src/zsh.h: Keep + modified history lines until the next accept* function. Make + history{beginning,}search{forward,backward} 8-bit clean. From + Wayne (1062, 1063) and me. + + * Src/exec.c: in getoutputfile() returned the ztrdupped name from + the jobtable From Peter (1061) + +Mon May 13 02:17:07 1996 Zoltán Hidvégi + + * Src/zle_tricky.c: temporary 8-bit clean patches + + * Src/utils.c, Src/zsh.h: Add META_HEAPDUP method to metafy + + * Src/builtin.c: Use #error again but do not put the # to the + first column to make the traditional cpp happy + + * Src/exec.c, Src/params.c: Do not call singsub() if parsestr() + returned an error. + + * Src/lex.c: dquote_parse() did not return error on unmatched `. + parsestr() now restores the original string on error. + + * Src/init.c: Change backquotes to normal quotes in the default + sprompt to make it work if PROMPT_SUBST is set. + + * Src/exec.c: Remove debug test for open file descriptors in closem() + + * Src/exec.c, Src/parse.c: Fix coredump when chpwd is autoloaded + + * Src/zle_hist.c: history-beginning-* fix + + * Src/builtin.c, Src/exec.c, Src/init.c, Src/params.c, + Src/utils.c: In metafy use -1 instead of zero if the len is + unknown + +Sun May 12 01:46:12 1996 Zoltán Hidvégi + + * Src/utils.c, Src/zle_hist.c, Src/zle_utils.c: + Incremental search fixes from Wayne (1051) + +Sat May 11 00:42:14 1996 Zoltán Hidvégi + + * config.guess, configure: Use autoconf-2.10 + +Fri May 10 21:01:56 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/glob.c, Src/hashtable.c, Src/utils.c, + Src/zle.h, Src/zle_hist.c, Src/zle_main.c, Src/zle_misc.c, + Src/zle_move.c, Src/zle_refresh.c, Src/zle_utils.c, + Src/zle_vi.c: Make most of ZLE 8-bit clean. From Zefram (1046) + + * Src/exec.c, Src/utils.c: More redirection fixes from Zefram (1045) + + * Src/hist.c, Src/zle.h, Src/zle_bindings.c, Src/zle_hist.c, + Src/zle_main.c, Src/zle_tricky.c, Src/zle_vi.c: Cleanup of ZLE + bindings (use enum, rename some functions). From Zefram (1015) + + * Src/exec.c, Src/utils.c: Redirection fixes from Zefram (1011) + + * Src/zle_hist.c, Src/zle_utils.c: History search improvements + from Wayne (1014) + + * Src/exec.c: Metafy was missing for autoloaded functions + +Fri May 10 12:06:23 1996 Zoltán Hidvégi + + * Makefile.in: Improve check-rcs and handle dot-files (like + Src/.indent.pro) + + * Src/zle_tricky.c: Use permanent allocation for cmdstr instead of + the heap to prevent SEGV + +Tue May 7 20:49:17 1996 Zoltán Hidvégi + + * Src/builtin.c, Src/glob.c, Src/input.c, Src/zle_misc.c, + Src/zle_tricky.c: Some changes to make Ultrix cc happy (1001) + + * Src/exec.c, Src/globals.h: Do not use negative numbers in + fdtable (996) + + * Src/exec.c: Close process substitution file descriptors in the + child process (987) + +Tue May 6 23:59:59 1996 Zoltán Hidvégi + + * zsh-2.6-beta17 released + +Mon May 6 01:37:20 1996 Zoltán Hidvégi + + * Src/signals.h: SIGNAL_HANDTYPE is RETSIGTYPE (*)_((int)) + + * Src/builtin.c: Preprocessor hacks to make the limit builtin work + correctly. + + * Makefile.in: New targets: dist-diff, release, md5sum. Rewritten + dist and dist-rcs rules. A minor change to superclean-top. + + * Src/Makefile.in: Rewitten tags target rules. + + * Src/zle_tricky.c: do tilde expansion in expand-word and + list-expand (zsh-users/200) + + * configure.in, INSTALL: added --enable-zsh-debug option + + * exec.c, init.c, utils.c, globals.h: create an fdtable array to + hold information about the file descriptors used by the shell. + Do not call close() on each fd greater than 9 only on those that + are marked in fdtable. Use /dev/fd/ if it is available for + <(...) and >(...) process substitutions. + +Fri May 3 03:38:28 1996 Zoltán Hidvégi + + * README, META-FAQ, Util/zsh-development-guide: new maintainer. + Some other changes in the README. + + * Added the helpfiles script from Peter in Util (492) + + * merged the patches from beta15-hzoli14. Here is the ChangeLog + for that: + + March/April 1995 + + * pushd/popd changes from Anthony Heading + + * fignore fixes from Sven + + * where builtin from Zefram (5901) + manual from me. + + * New glob qualifiers from Zefram (5918) + + * &| backgrounding from Zefram (5919) with some manual changes + from me + + * New option, -m to print + + * New option, -U to typeset to remove duplications from an array + + * Swap -f and -F on the command line if zsh is invoked as sh/ksh. + + * KSH_ARRAYS option + + * array subscripts can be really used without leading $ in math + + * if a parameter is used in math its value is evaluated with full + arithmetic evaluation. + + * # can be used in mathematical expressions as described in the + manual. + + * new parameter TTYIDLE containing the idle time of the current + tty in seconds + + * new parameter ZSHNAME to tell how zsh is invoked + + * lots of bugfixes in params.c + + * If SIGALRM is not trapped zsh will only exit on alarm if + TTYIDLE >= TMOUT. If TTYIDLE < TMOUT a new alarm is set to + TMOUT - TTYIDLE seconds. No change in behaviour when SIGALRM + is trapped. + + * $#foo when foo is an array returns the array length in double + quotes + + * $=foo and ${(s:...:)foo} forces splitting even in double quotes + + * New flags to paramer substitution: @, A, e, p, f, F, W + + * autoremoveslash if a slash is typed + + * fix bugs related to menu completion and expand-or-complete-prefix + + * cshjunkiequotes fixed to really emulate csh behaviour. So far + backslash newline was removed in double- and backquotes but csh + removes the backslash only. + + * the $, # and ? special parameters can bee used without the + leading $ in math + + * negative sign is printed before the base in convbase + (-2#111 instead of 2#-111) + + * > <(foo) and < >(foo) redirections are now cause parse error + + * < <(foo) fixed (it did not work so far). + + * fixed a bug when history were expanded on cat <\!foo + + * history expansion is disabled in single quotes within double + quotes: echo "`echo '!$'`" prints !$. It is not yet perfect but + not worse than in bash since history expansion is also disabled + in `echo "'!$'"`. + + * echo $(echo \!$) no longer expands history. This sometimes + caused infinite memory eating loops in earlier verions. + + * history bangchars are only escaped in the history if they were + originally escaped on the command line. + + * $((...)) math evaluation is done before fork now which makes + assignment and increment/decrement operators work. Now all + substitutions are done before fork exept globbing. To reflect + this change I removed postfork() from subst.c and replaced with + globlist(). + + * The shell behaviour is slightly changed when the globsubst + option is set. Now globsubst is really globsubst, ie. only + tidle and equals substitution and globbing is done on the + result of parameter expansion and command substitution which + makes it more sh-compatible. It means that foo='$bar' ; echo + $foo no longer prints the value of bar. It also prevents + infinite uninterruptable loops like foo='$foo' ; echo $foo. + Also globsubst no longer removes single and double quotes from + the value of parameters and a backshlash is only removed if it + followed by a glob special character or a backslash. The result + of command substitution is handled the same way. These are + really done by tokenize() in glob.c. This function must not be + used to tokenize a string before singsub(). We have to use the + lexer for that. I provided a parsestr() function for that which + parses a given string as it were a string within double quotes + (but it may contain double quotes). + + * Expansion does not starts again on each expanded parameter + which should make it a little faster. With rcexpandparam set + the part of the line following the array evaluated only + once. This makes it a little bit faster but it may cause + problems when the tail of the line has an arithmetic expression + with a side effect: $foo$[i++] increments i by one but in old + versions i was incremented by the number of array elements. If + foo is an empty array i is not changed in either versions. + + * Parsing of mathematical substitutions are now done like double + quoted strings. The body of a math substiturion is first + expanded using parameter, command and arithmetic substitution + and only the result is evaluated. This means that modifyers, + backquote substitution and ${foo##$bar} type expansions can be + used. This makes ((...)), $((...)) and $[...] completely + equivalent. + + * If $@ is empty ''$@ and $@"" and similar arguments are not + removed. The argument is only removed from the argument list if + it is written as "$@" (or if rcexpandparam is set). + + * zatol() function is removed + + * doexpandhist() (ie. magic-space) now keeps the cursor in the + right palace in all cases I hope. + + * lexer fixes to help completion and to fix parsing problems in + brace-params (things like ${foo:-()} and ${foo:-|} used to give + a parse error but ${foo:-(}) didn't.) + + * get_comp_string completely rewritten + + Wed Apr 12 1995 + + * I changed the lexer to allow `]' characters in [...] glob + list. This is to make zsh compatible with all other shells I + know. This should be documented in the manual where the + description of [a-z] syntax is also missing. I'd copy the + relevant part from an other manual page but there may be + copyright problems with that. I looked at some man pages but + they contained almost word-by-word the same so I think we can + do that as well (change some words perhaps). + + * There are some important changes in the new substitution code. + The right hand side of parameter assignments is no longer + globbed by default (note that tidle and equals substitution is + not globbing). This is compatible with sh/ksh/bash. I added an + option, GLOB_ASSIGN which can be set to restore the old + behaviour but I do not recommend the usage of this option. For + more details, see the manual. If GLOB_ASSIGN is not set, it is + guaranteed that foo=... assignments assign a scalar value. In + earlier versions foo=* or foo=$bar where bar is an array + created scalars if the result had zero or one words and an + array otherwise. + + Thu Apr 13 1995 + + * prompts are empty if the shell is not interactive from + P.Stephenson (5836) + + * pwd -r prints the real path + + * emulate builtin + + * ! and bangchar quoting fixed. + + * echo { prints { when ignorebraces is set + + * completion works correctly with COMPLETE_ALIASES + + Tue Apr 18 1995 + + * i/o not redirected to /dev/null in <(...) and >(...) (both in + redirections and in arguments). + + Wed Apr 19 1995 + + * ${$(...)...} syntax can be used + + Sat Apr 29 1995 + + * zle history expansion was buggy when a word begun with a #. + It's fixed. + + * prompt substitution is now completely functional (things like + ${...##...} or `...` are usable now in prompts) + + Fri May 5 1995 + + * USERNAME, LOGNAME, HOST, TTY and signals are no longer specials + parameters. They are initialized as before but are now writable + and unsettable. + + * make sure that vared does not go to the previous history line + with up-line-or-history. You can use vared -h to get the old + behaviour. + + Tue May 9 1995 + + * TAB always inserts itself at the beginning of a line (6126, 6146) + + Sat Jun 3 1995 + + * Leading zero no longer denotes octal. Leading 0x still means + hex and it also sets lastbase. (95) + + * getvar in math.c removed + + Fri Jun 9 1995 + + * cdmatch2 function to complete the 2nd arg. to cd/pushd + + Fri Jul 7 1995 + + * Fix :s/l/r/ modifier when l is empty (176) + + * Prefixed commands no longer trigger autoresume from + P.Stephenson (172) + + * FOO=bar function now set the FOO environment variable in the + function from P.Stephenson (103) + + * Leading . is not special for ~ exclude patterns from + P.Stephenson (98) + + * Do not exit the spelling prompt until an acceptable key is + pressed. From Wayne Davison (6138) + + * Capitalize ../configure to ../Configure from Wayne (6132) + + * After yank, mark set to the beginning of the yanked text from + Wayne (6131) + + * . file no longer sources directories. From P.Stephenson (6063) + + * Prevent infinite loops when zle expands history. + From Zefram (152) with a few hunks omitted. + + Sat Jul 8 1995 + + * executenamedcommand() now resets showinglist to zero on exit to + prevent a SEGV when a list of completion (of zle commands) was + showed. (193) + + Mon Jul 10 1995 + + * !:s//r/ gives `no previous substitution' message instead of + "no previous substitution with &". From Thorsten Meinecke (182) + + * $foo:s//r/ gives similar error message (it didn't use to give + any) (194) + + * print -c fixes from Zefram (183) + + * HIST_NO_STORE fix from Zefram (186) + + * Manual fix: export = typeset -x. From Zefram (190) + + * type/whence/which -f option ducumented. From Zefram (192) + + * whence builtin fix from Zefram (192) + + Mon Jul 17 1995 + + * A fix for Sven's old fignore fixes from Wayne (213) + + * print builtin option fixes from Zefram (214) + + * Disable list-expand zle function inside braces etc. From Zefram + (215) + + Wed Jul 19 1995 + + * Make self-insert refuse the NUL character. From Zefram (238) + + * Completion on words containing quoted char's fix (250) + + Mon Jul 24 1995 + + * Completion fixes for words beginning with ~ or =. From Zefram + (241) + + * vi mode fixes from Zefram (230) + + * Allow prefix/suffix in xor'd completion. From Zefram (254) + + * sh compatibility option: NO_MULTIOS. From Zefram (255, 260) + + * vi-forward-char beeps when it has to beep. From Zefram (258) + + * Allow more than one line long status line (or minibuffer). From + Zefram (256) + + * Minibuffer fixes: more zle commands, long search + strings... From Zefram (261) + + * vi-quoted-insert and quoted-insert in minibuffers. From Zefram + (262) + + * make sure that vi-backward-kill-word doesn't delete past the + beginning of the line. From Zerfam (263) + + * execute-named-cmd fixes from Zefram (264) + + Tue Aug 8 1995 + + * Patch from Peter to prevent writing the builtin command names + (293) + + * Removed the -fwritable-strings kludge. + + Wed Aug 16 1995 + + * a zsfree moved after an error-check in subst.c. From Thorsten (322) + + * Initialize hsubl/hsubr to NULL in globals.h (323) + + Thu Sep 21 1995 + + * input.c and here documents bugfixes (395,398) + + Sun Sep 24 1995 + + * K, M and G size glob qualifiers from Thorsten Meinecke (402) + + Mon Nov 6 1995: + + * Do not save history on exec/exit from init scripts. (538) + + Wed Jan 3 1996: + + * Whence -f is back. From Zefram (644) + + * A single ^ no longer crashes zsh. From Peter (560) + + Mon Jan 8 1996 + + * Fix echotc to work with ncurses + + Fri March 1 1996 + + * It's a bug to call lexsave with alstackind != 0 (792). + + Sun March 3 1996 + + * The first working and mostly 8-bit clean version. + + * add lexsave/lexrestore to parselstring() + + * save/restore tok with lexsave/lexrestore + + * a xored completion bugfix in zle_tricky.c + + * cd .. should not use cdpath (877) + + * get magic-space & completion work with interactivecomments + + * an fc builtin fix + + Mon March 4 1996 + + * make n and N extended completions work on words with special + characters (880) + + * Allow colon qualifiers with ^...^...^ history substitution. + From Peter (608) + + * Fix printquoted() to handle CSH_JUNKIE_QUOTES. From Zefram (713) + + * AUTO_PUSHD option documentation fix forom Anthony Heading (598) + + Wed March 6 1996 + + * Fix $PATH[1,(ws.:.)-2] type expansions (800). + + Tue March 19 1996 + + * Do not use setvbuf(stderr, NULL, _IOFBF, 0) to work around a + bug in Linux libc 5.3.6 or older. + + * Fix a little bug in compctl -l (841) + + Fri March 22 1996 + + * mypid, lastpid, ppid should be long instead of pid_t (846) + + Fri March 29 1996 + + * Set $? to 1 after wibble=$(false). + From Zefram and me (637, 855, 856) + + * Prevent infinite loops when zsh looses its controlling + tty. From Peter (862) + + Sun March 31 1996 + + * signal handling fixes from Peter (6200, 89, 91, summarized in + 826). + + * Some fixes related to quotes and completion (882) + + Sat April 27 1996 + + * Execute traps properly. From Peter (929) + + * Yet an other vi mode fix from Zefram (936) + + * \ should quote \ in here documents. + + * Workaround a bug in GNU autoconf which makes configure think + that there is no -lcourses and -lncurses if the test for + -ltermcap failed. From János Farkas + (972) + + Sun April 27 1996 + + * Call entersubshell after opening the pipe in getproc to avoid + hangs in open. This prevents hangs when a $(... <(...)) + substituion is interrupted in an unfortunate moment. (964) + +Wed May 1 03:49:31 1996 Richard Coleman + + * Zsh-2.6-beta16 released. rc. + + * read -q and read -k would mess up terminal if + non-interactive. From P.Stephenson (565). + + * Must call init_term() in putpromtpt so that %-sequences + are recognized in non-interactive shells. + From Eskandar Ensafi (791). + +Tue Apr 30 02:08:48 1996 Richard Coleman + + * fixed time printing bug in printhhmmss when time was + small. From Zoltan (793). + +Mon Apr 29 03:37:35 1996 Richard Coleman + + * fixed history from dropping last line of multi-line command + when it contains a comment. From P.Stephenson (741). + + * Change all functions in loop.c to give execlist non-zero + parameter for dont_change_job. Removed code in functions + in loop.c to remember current job number. rc. + +Fri Apr 26 20:50:40 1996 Richard Coleman + + * Small cleanup of handling of SIGCHLD signal. rc. + + * Fix vi range bug. From Zefram (936). + + * execpline and execpline2 now assume that the + sublist/pipeline passed to them is not NULL. NULL + arguments must be handled higher up. From rc. + + * Prefer curses library over termcap for certain versions + of AIX. From Mike Kazda (948). + + * Updated MACHINES entry for Linux. From Bas. + + * Rearrange function execlist. From rc. + +Thu Apr 25 01:34:02 1996 Richard Coleman + + * Merged initjob and getfreejob. From rc. + +Wed Apr 24 22:15:22 1996 Richard Coleman + + * Zsh-2.6-beta15 released. From rc. + + * Merge runlist and execlist. Add parameter to execlist + and execstring to retain current job number. Remove + function zyztem. From rc. + +Mon Apr 15 01:27:16 1996 Richard J. Coleman + + * Fixed typo in zle_tricky.c. From Samuel Tardieu (925). + + * Zsh-2.6-beta14 released. From rc. + +Sat Apr 13 01:49:07 1996 Richard J. Coleman + + * alias -L now prints `-- ' first if alias begins with + `-'. Also changes reporter to use "alias -L". Also + removed Log messages from reporter. From Zefram (712). + +Fri Apr 12 19:16:53 1996 Richard J. Coleman + + * Printing was missing glob characters. + From Zoltan (705). + + * Small rearrangement of function `source'. From rc. + + * Change zshall.x to use relative paths to other man + pages. From Zefram and others. + +Thu Apr 11 01:32:11 1996 Richard J. Coleman + + * Move code to hash whole directory into cmdnamtab + to its own function `hashdir'. From rc. + + * Unbalanced stack in math expression could cause + core dump. From Zoltan (879). + + * Tighten up security on temporary files. + From Zoltan (881). + +Tue Apr 9 02:01:09 1996 Richard J. Coleman + + * Make termbuf local rather than global. Only allocate + static termbuf if tgetent will not accept NULL termbuf + (and hence allocate its own). Add configure check for + tgetent that accepts NULL termbuf. + From Zoltan (878, 892). + +Fri Apr 5 01:23:40 1996 Richard J. Coleman + + * Lots of refresh bugs fixed. + From Mason (820,831,867,868). + +Sun Mar 31 23:34:38 1996 Richard J. Coleman + + * Update configure to version 2.9. From rc. + +Fri Mar 29 23:44:47 1996 Richard J. Coleman + + * Add emptytable and filltable methods to hash tables. Changed + fullhash and addusernames to be these methods for cmdnamtab + and nameddirtab. + From rc. + +Mon Mar 25 20:08:15 1996 Richard Coleman + + * Convert named directories table from a link list + to a hash table. From Zefram (711). + +Thu Dec 21 10:00:00 1995 Richard Coleman + + * Zsh-2.6-beta13 released. + +Mon Dec 18 23:25:34 1995 Richard Coleman + + * Make the parameters WATCHFMT, TIMEFMT, TMPPREFIX, + and FCEDIT non-special parameters. From Zoltan (271). + +Sat Dec 16 22:50:51 1995 Richard Coleman + + * Fix in trashzle, and small cleanup of do_ambiguous which + fixes a double listing problem when LIST_AMBIGUOUS is + unset. From Zefram (694). + + * Fix so that escape sequences (bold, etc...) work + in WATCHFMT strings. From P.Stephenson (695). + +Wed Dec 13 00:30:22 1995 Richard Coleman + + * Updated MACHINES files with info about OSF/1 and Solaris + from the FAQ. From rc. + + * Fix zle bug, where completion list wasn't being invalidated + after ^C. From Zefram (687). + +Mon Dec 11 00:02:44 1995 Richard Coleman + + * Addition to zshexpn.man to describe when history + expansion takes place. From P.Stephenson (624). + + * Clean up the nice* printing functions, as well + as add support for 8-bit characters. Patches were + submitted from various people { P.Stephenson, + Thorsten Meinecke, Zefram }, but I used patches + (646,647). + +Sun Dec 10 20:20:18 1995 Richard Coleman + + * Fix problem with 8-bit-cleanliness in input.c. + From various people. + + * A couple of fixes for refreshing screens with + automargin. From P.Stephenson (662). + + * Use strerror instead of sys_errlist in utils.c. + From P.Stephenson (667). + +Fri Dec 8 02:15:52 1995 Richard Coleman + + * Fix Doc subdirectory to work if building in an + alternate directory. From Scott Blachowicz. + +Mon Nov 20 23:21:45 1995 Richard Coleman + + * Zsh-2.6-beta12 released. + + * Updated to GNU autoconf 2.6. From rc. + + * Improve handling of valid termcap entries that + don't have the ability to move up. From P.Stephenson + (623). + +Sat Nov 18 23:39:16 1995 Richard Coleman + + * Updated INSTALL, configure.in, aclocal.m4, and + Makefile.in to GNU autoconf 2.5. From rc. + +Thu Nov 16 01:38:38 1995 Richard Coleman + + * BGNICE was running in parent rather than child. + From rc. + + * Fix problems with completion explanation strings. + From Zefram (240). + + * Fix bug with REC_EXACT. From Zefram (207). + + * Fix bug where when LIST_AMBIGUOUS is unset, it will + sometimes insert the unambiguous portion a second + time. From Zefram (199). + + * Remove a superfluous display of a completion list when + AUTO_LIST and ALWAYS_LAST_PROMPT are set. From + Zefram (198). + + * Clean up the way completion lists are shown. + From Zefram (165). + + * Make zle so that it will keep a completion list fully + visible on the screen if it is still valid. From + Zefram (151). + + * Reorganize the completion code so that it only works + out the completion list again when something has + actually changed. From Zefram (145). + +Wed Nov 15 22:13:17 1995 Richard Coleman + + * Several cleanups and fixes to the input, and history + mechanisms. Fixed bug where completing after command + that was an alias containing itself would expand + repeatedly. Fixed bug where aliases ending in spaces + would leave the spaces in the history line. Also removed + INP_SPACE, INP_OLDSPACE hack of adding bogus space. + From P.Stephenson (611,612,614). + +Tue Nov 14 03:33:45 1995 Richard Coleman + + * Fix substitution bug for ${FOO:-} when FOO is unset. + From Zoltan and P.Stephenson (545). + + * Did some reorganization for code in execcmd() that + determines if the shell should fork. Removed the + flag CFLAG_FAKE_EXEC since it was no longer needed. + From rc. + +Mon Nov 13 20:48:54 1995 Richard Coleman + + * Don't do FAKE_EXEC for jobs running in the + current shells. From P.Stephenson (604). + +Fri Nov 10 01:47:04 1995 Richard Coleman + + * Change mechanism by which history remembers word breaks. + Uses an array of indexes into the history event rather + than adding character HISTSPACE to remember word breaks. + Remove special parameter LITHISTSIZE. + Remove zsh option HISTLIT. + From P.Stephenson (515). + +Wed Nov 8 00:07:01 1995 Richard Coleman + + * Combine catproc, teeproc, and closemn in exec.c. Also fixes + a memory leak in multio. From rc. + + * Fix exec.c so that _exit rather than exit is used + from subshells. We now keep track of which subshells + are real and which are fake (we are doing an exec). + From P.Stephenson (562). + + * Small cleanups for man pages zsh.1, zshall.1, + zshmisc.1. From rc, Mark Borges, and Mark Hanson + (570,571) + + * Installation of man page zshall.1 will now + insert correct location of other man pages. From rc + and Zefram (566). + +Mon Nov 6 22:32:19 1995 Richard Coleman + + * Zsh 2.6-beta11 released. + +Sat Nov 4 23:49:15 1995 Richard Coleman + + * Fix whence/which/type so that commands added with + `hash foo=bar' are correctly reported. From rc. + +Thu Nov 2 03:04:09 1995 Richard Coleman + + * Delay setting up terminal and termcap in noninteractive + shells until needed. From P.Stephenson (479). + +Wed Nov 1 18:20:49 1995 Richard Coleman + + * Remove some arbitrary buffer limits in zle_tricky.c + From Zoltan (506). + + * Fix not clearing properly if more characters were + inserted than deleted. Fix not clearing the last + character in the line if rprompt was printed. + From Geoff Wing (164,273). + + * Fix core dump in `bindkey'. From P.Stephenson (514). + +Mon Oct 30 01:49:10 1995 Richard Coleman + + * Added -L option to `alias' builtin. From rc. + +Sun Oct 29 04:34:51 1995 Richard Coleman + + * Removed hack of setting sourcelevel to 32768 to suppress + errexit and trapping of SIGZERR and SIGEXIT in init scripts. + Added global noerrexit for this. From rc. + + * Added new command flag CFLAG_FAKE_EXEC. This flag is used + when we can pretend this is an `exec' since this is the + last command in a subshell, or for `zsh -c'. Rearranged code + to determine whether to do a fake exec. Fixed code so that + fake exec (typically from command substitution) doesn't trash + the history file. Also added code to save history file when + exec'ing a builtin. From rc, Zoltan, and P.Stephenson. + +Wed Oct 25 22:58:54 1995 Richard Coleman + + * Fixed hash -d foo=/usr/local/foo. Also fixed hash -d foo + so that is doesn't try to free memory from the heap. From rc. + +Thu Oct 19 19:13:33 1995 Richard Coleman + + * Documentation fix for BRACE_CCL. From P.Stephenson (173). + + * Add -Q option to compctl. From Zefram (167). + + * New version of reporter script. From Karl Vogel. + + * Add [[ str == pat ]]. From Zoltan (451). The old + syntax remains, but this should be considered the + preferred form. + + * Add code to workaround a bug in in.rshd. It is + not turned on by default. You need to add the + #define RSH_BUG_WORKAROUND to turn on this code. + + * When you disable/enable a shell function + such as TRAPsig, the trapping of the signal + `sig' will also be disabled/enabled. From rc. + +Mon Oct 9 19:34:07 1995 Richard Coleman + + * Spelling correction changes. From Zoltan. + + * Prompt code changes. From Zefram (195,265) and + Zoltan (280). + +Fri Oct 6 14:10:35 1995 Richard Coleman + + * Fix for input.c and hist.c when comparing + HISTSPACE. From P.Stephenson (421). + +Wed Oct 4 02:25:23 1995 Richard Coleman + + * gettext2 wasn't printing text for pre-commands + noglob and `-'. From Zefram. + + * Should do bitwise-or for CFLAG_DASH. From Zefram + and Zoltan. + +Mon Sep 25 00:18:08 1995 Richard Coleman + + * Rearrange things in setupvals() so that path is + set before cmdnamtable is built. From Zoltan. + + * Only tokenize commas that are inside of + brace expansion. From Zoltan (403). + + * Fix command resolution for commands (such as + typeset) that need automatic MAGIC_EQUAL_SUBST + substitution. From Zefram. + +Sun Sep 24 20:19:33 1995 Richard Coleman + + * A small fix for compctl. From Zefram. + + * Change phork to zfork. From rc. + + * Fix core dump when setting trap. Also remove + warning message about unsetting unset parameters. + From Zoltan. + +Thu Sep 21 02:10:02 1995 Richard Coleman + + * Cleanups for glob.c. From Zoltan (202). + + * Rearrange the checking of hash tables for + commands. From Zefram and rc. + +Tue Sep 19 21:23:54 1995 Richard Coleman + + * Fix to function restarthashtable so that if + restarting a table that is not re-allocated, + the memory will be re-zeroed. This fix core dumps + when PATH is changed. From rc. + + * Fix tty-opening code in init_io. + From P.Stephenson (391). + +Mon Sep 18 18:58:23 1995 Richard Coleman + + * Change Z_* pipeline flags to be or'able. This + cleans up pipeline code as well as making + `time command' work correctly in subshells. + From P.Stephenson (384). + + * Small patch to input routines for `eval'. + From P.Stephenson (385). + + * More cleanup of builtin `compctl'. From Zefram + and rc. + +Sun Sep 17 01:50:40 1995 Richard Coleman + + * Improvements and additions for the compctl's in + compctl-examples. From Zefram. + +Thu Sep 14 20:00:32 1995 Richard Coleman + + * Cleanup of printing text with special characters. + Move this printing into own function printquoted. + From Zefram (170,184). + + * Add man info for fc -i. From Zefram. + + * Fix for signal trapping bug. From P.Stephenson (119). + + * Fix bug of using spacejoin when IFS has changed. + From Zoltan (52). + +Tue Sep 12 20:56:46 1995 Richard Coleman + + * Add code for unhash -d. From Zefram. + + * Add back code for re-running autoloaded functions + that define themselves by name. Also fix bug in + running autoloaded functions with parameters. + From P.Stephenson (379). + +Sat Sep 9 00:28:02 1995 Richard Coleman + + * Corrected man page entry for hash, unhash, rehash, + function, unfunction, enable, disable, alias, + and unalias. rc + +Fri Sep 8 17:03:18 1995 Richard Coleman + + * Added zshall man page. From P.Stephenson. + + * New version of zshcompctl man page from + P.Stephenson (234). + + * Fix completion code w.r.t the separated hash tables. + Also makes the disabled/enabled flags act as + modifiers. From Zefram. + + * Moved code in execcmd to save/restore parameters + (for shell functions and buiiltins) to their own + functions. Also cleaned it up some. rc + + * Cleaned up bin_typeset some. rc + +Thu Aug 31 00:21:54 1995 Richard Coleman + + * Change configure to get right signal.h file for + Linux 1.3.x. From Thorsten Meinecke and Zoltan + (196,289). + + * Eliminate ZLE_NAMEDBUFFER. From Zefram (136). + + * Big patch to clean up base routines for history + input. From P.Stephenson (140,334). + +Mon Aug 28 21:01:03 1995 Richard Coleman + + * Add some detail to file globbing flags. Mark Borges (323). + + * Split function handling code out of bin_typeset into + bin_functions. rc + +Tue Jul 18 05:13:01 1995 Richard Coleman + + * Changed syntax of hash builtin. Use the syntax + "hash foo1=bar1 foo2=bar2" to add elements to the + cmdnam hash table. Also added the -m option which + will print out all elements of cmdnam table matching + a glob pattern. rc + +Mon Jul 17 16:42:49 1995 Richard Coleman + + * Merged bin_enable and bin_disable. rc + +Sat Jul 15 04:46:03 1995 Richard Coleman + + * Merged bin_hash and bin_rehash. Split named dir + code in bin_hash out into its own function + bin_nameddir_hash. rc + +Fri Jul 14 00:16:47 1995 Richard Coleman + + * You can enable/disable reserved words with + "enable -r", and "disable -r". You can enable/ + disable aliases with "enable -a", and + "disable -a". rc + +Mon Jul 10 20:29:37 1995 Richard Coleman + + * unhash only unhashed entries in hash table for external + commands. Use "unhash -f" to unhash shell functions. Added + option so that "unhash -a" will unhash elements of the + alias hash table. unfunction is now equivalent to "unhash -f". + unalias is now equivalent to "unhash -a". rc + + + * enable/disable now only works on builtins. You can use + "enable -f" or "disable -f" to enable/disable shell + functions. rc + + * Split hash table cmdnamtab into 3 hash tables. cmdnamtab + for external commands and hashed commands. shfunctab for + shell functions. builtintab for builtin commands. This + of course entailed lots for changes in builtin.c. rc + +Fri Jun 30 05:10:13 1995 Richard Coleman + + * Zsh 2.6-beta10 released. + + * Make HOSTTYPE, OSTYPE, MACHTYPE, VENDOR, and + ZSH_VERSION non-special parameters. From Zoltan (5827). + + * Added parameter ZSH_NAME. From Zoltan (5615). + +Wed Jun 28 17:25:23 1995 Richard Coleman + + * Build/installation parameters that are changed in the + top makefile are now passed down to recursive makefile + calls. From rc. + +Mon Jun 26 04:32:33 1995 Richard Coleman + + * Add some comments and some small cleanups of params.c. + From rc. + +Fri Jun 23 03:37:55 1995 Richard Coleman + + * Assuming sufficient privileges (typically root), you can + change the username (and uid and gid) of the shell process + by assigning to USERNAME. Also (again assuming sufficient + privileges) you can start an individual command under a + different username (and uid/gid) by: + USERNAME=username command + From rc. + + * Updated the man page entries for USERNAME, UID, GID, + EUID, EGID, and LOGNAME. From rc and Zoltan. + +Mon Jun 19 02:07:46 1995 Richard Coleman + + * Allow var[a,b]=c type string assignments when b < a. + From Zoltan (5791). + +Sun Jun 18 01:17:08 1995 Richard Coleman + + * Add a glob of comments (pun intended) to glob.c. + From P. Stephenson (101). + +Fri Jun 16 00:30:41 1995 Richard Coleman + + * Use zsh's own zstrtol instead of vendor strtol + since a lot of them are broken. + + * Fix some problems dealing with 64 bit ints. + From Zoltan (5826). + + * Add new versions of config.sub and config.guess to + distribution. Rebuilt configure with new autoconf 2.4. + +Thu Jun 15 00:25:43 1995 Richard Coleman + + * Add new builtin called "hashinfo" which will dump + stats about the various internal hash tables. You can enable + this command with the configure option --enable-zsh-hash-debug. + This will add the #define ZSH_HASH_DEBUG to config.h. + + * Add support for printing time report in HH:MM:SS + format. From Zoltan (96). + + * Changed the DEFAULT_TIMEFMT to + "%J %U user %S system %P cpu %*E total". + From rc. + + * Cleanup of code to print a condition. + From P. Stephenson (74). + + * Make errors in math evaluation in let are non-fatal. + Also fix some problems with multiple traps. From + P.Stephenson (59). + + * Fix for redirection bug. From Zefram (31). + + * Merge setmoreflags and initterm into init_io. + From P.Stephenson (64). + + * Use _exit instead of exit when in subshell and + CFLAG_EXEC. From P.Stephenson (72). + +Wed Jun 14 23:17:55 1995 Richard Coleman + + * Add support for NIS+. From Sven Wischnowsky (77). + ( No configure support yet ) + +Thu Jun 8 14:16:28 1995 Richard Coleman + + * Small fix to vicmdmode. From Zefram (86). + + * Add configure test for CLOBBERS_TYPEAHEAD. + From P. Stephenson (88). + + * Big reorganization of code dealing with the various + hash tables. From rc. + +Tue May 30 01:55:51 1995 Richard Coleman + + * Zsh 2.6-beta9 released. + + * Add some optimisations to matheval. From P. Stephenson (55). + + * Separate the I/O of zle from direct reliance on + stdin/stdout or fd's 0 and 1. From P. Stephenson (26). + +Fri May 26 00:01:52 1995 Richard Coleman + + * Merged setupparams and setparams into buildparamtab. + From Richard Coleman. + + * Split aliases and reserved words into two separate + hash tables. From Peter Stephenson (33). + +Thu May 25 00:27:55 1995 Richard Coleman + + * Tighten up permissions on temporary files and named + pipes that zsh creates. From Duncan Sinclair (5298). + +Mon May 22 23:54:52 1995 Richard Coleman + + * Use sed instead of cut in configure. From Eskandar. + +Fri May 19 00:08:52 1995 Richard Coleman + + * Add some casts to pacify noisy compilers. + From Zoltan (6123). + + * Fix for describe-key-briefly and where-is which + had problem with command lines spanning more than + one screen. From Zoltan (6127). + + * Fix core dump in bindkey. From Peter (6198). + + * Fix typo in exec.c code. From Peter (6197). + + * Fix for redisplay from Zefram (6009). + + * Small fix for missing newlines in single_line_zle + mode. (6201). + +Wed May 17 01:50:48 1995 Richard Coleman + + * Added function zrealloc to mimic POSIX realloc. + +Wed May 10 19:13:34 1995 Richard Coleman + + * Fix so that with builtin at the end of a pipeline, + the return value of pipeline is return value of + builtin. From P.Stephenson (6161). + + * Fix problem with exec. From P.Stephenson (6160). + +Tue May 9 00:35:45 1995 Richard Coleman + + * Fixes to read builtin. From Dave Sainty (6142). + + * Vi mode fix. From Zefram (6115). + +Mon May 8 23:44:00 1995 Richard Coleman + + * Patch for exec.c so that execpline will correctly invert + return values of !foo, when foo is shell function. From + P.Stephenson (6098). + +Thu May 4 00:02:51 1995 Richard Coleman + + * Zsh 2.6-beta8 released. + + * Allow globbing of words beginning with %. From + Zoltan (6002). + + * Add -T option to compctl. From Sven (6028). + + * Patch to allow array subscripts in arithmetic + evaluations without $. From Zoltan (5715). + + * Patch so that exec bit gets to execcursh by execcmd. + From P.Stephenson (6076). Now zsh -c '{ foo }' will + exec last command instead of forking. + +Wed May 3 23:56:21 1995 Richard Coleman + + * Fix bug in accept-and-menu-complete on variable + names. From Zoltan (6078). + +Tue May 2 00:17:47 1995 Richard Coleman + + * Remove redundant call to inittyptab in setupvals + in init.c. (rc) + + * Setopt PROMPTSUBST if started as sh or ksh. From + Zoltan (6070). + + * Check for /dev/fd filesystem with configure. Don't + do /dev/fd simulation in conditional expressions + unless /dev/fd is not supported. (rc) + + * Patch for job.c so that ^C-ing a job started by a + function stop the whole function. From Sven (5837). + +Mon May 1 23:50:05 1995 Richard Coleman + + * Patch so that zsh -c and subshells will exec last + command correctly. From P.Stephenson (6057). + +Sun Apr 30 04:28:57 1995 Richard Coleman + + * Fixed handling of ${foo+`echo hello`}. + From Zoltan (6019). + + * Fixed reversed arguments in difftime compatibility + function. From Wayne Davison (6050). + +Wed Apr 26 20:07:27 1995 Richard Coleman + + * Zsh 2.6-beta7 released. + +Tue Apr 25 00:56:13 1995 Richard Coleman + + * Fix some memory leaks. From Zoltan (5959). + + * Setopt NOBADPATTERN if started as sh or ksh. From + P.Stephenson (6031). + + * Big patch for zle's vi mode. From Zefram (6014). + + * Make test builtin compatible with /bin/test. + From P.Stephenson (6012). + +Mon Apr 24 21:26:44 1995 Richard Coleman + + * In arithmetic evaluation, numbers can now be entered + using C syntax (0xff and 077). From Zoltan (5780). + +Fri Apr 21 17:03:37 1995 Richard Coleman + + * Rearranged builtin.c to group things more logically. + From Zefram. + +Mon Apr 17 21:22:26 1995 Richard Coleman + + * Zsh 2.6-beta6 released. + + * lots of fixes I don't remember. + + * new zle functions describe-key-briefly and + whereis. + + * precedents fixed in math mode. + + * lots of changes to named directory code, new options -r, + and -f to hash. + + * option NO_HIST_CLOBBER removed and HIST_ALLOW_CLOBBER + added. It is not on by default. + + * most of signals.{c,h} rewritten. + + * lots of configurations changes. + + * history saved on exec and timeout. + +Wed Mar 8 23:06:16 1995 Richard Coleman + + * Reversed -f and -F (again). + +Fri Mar 3 20:48:34 1995 Richard Coleman + + * Fix a couple of memory leaks from Sven (5561). + + * Comments and minor changes to builtin.c from + Zefram (5495). + +Mon Feb 27 23:14:45 1995 Richard Coleman + + * Zsh 2.6-beta5 released. + + * Builtin.c enhancements from Zefram (5428). + + * Added ksh style autoloaded functions from + P.Stephenson (5424). + + * Job.c and exec.c fixes from Sven Wischnowsky (5417,5491) + + * New version of cdmatch from Zoltan Hidvegi (5376). + + * Comments for builtin.c from Zefram (5378). + + * New version of zed from Zoltan Hidvegi (5372) + + * KSHPRIV changed to PRIVILEGED from Zoltan Hidvegi + (5370,5420). + + * New option BSD_ECHO from Zoltan Hidvegi (5391,5474) + + * Fix core dump on ! from P.Stephenson (5410) + + * Compctl fixes from P.Stephenson (5373) + + * Enable ksh style redirection from Zoltan Hidvegi + (5374) + + * Fix partial command running on ^C from P. Stephenson + (5326) + + * History fixes from Zoltan Hidvegi (5300,5342) + + * Accept modifiers in glob patterns from Zoltan Hidvegi + (5272) + + * Bug fixes to completion code from Sven Wischnowsky and + Zoltan Hidvegi. (5263,5291,5327,5344,5352,5369,5386, + 5403,5408,5422,5468) + + * More comments for zle_tricky.c from Sven Wischnowsky + (5258). + + * Fixed problem with signals.h coming after some prototypes. + (Richard). + + * Changed funcs.h to prototypes.h. Moved a couple externs + from prototypes.h to zsh.h (Richard) + +Sun Feb 12 22:51:19 1995 Richard Coleman + + * Zsh 2.6-beta4 released. + +Sat Feb 11 00:06:51 1995 Richard Coleman + + * patch for getopts. From Peter Stephenson. + + * Add big patch of comments to zle_tricky.c from + Sven Wischnowsky. + +Thu Feb 9 22:44:26 1995 Richard Coleman + + * Add Numeric brace expansion. + + * Added rlimit kludge for HP/UX. + + * Big patch to RPROMPT stuff from Eskandar Ensafi. + + * Lots of fixes for zle_tricky.c, zle_main.c, zle_misc.c + from Zoltan Hidvegi and Sven Wischnowsky. + +Thu Feb 2 02:56:46 1995 Richard Coleman + + * Switched -f and -F options so that -f is noglob + and -F is norcs. This for greater ksh compatibility. + +Wed Feb 1 21:24:48 1995 Richard Coleman + + * Added option LOCAL_OPTIONS. From Peter Stephenson. + +Tue Jan 31 15:05:31 1995 Richard Coleman + + * Added manual entry for autoparamslash. + + * Updates to compctl code in builtin.c. From Peter Stephenson. + + * Renamed signals.awk to signames.awk. Move the signal + handling code out of jobs.c, utils.c, zsh.h into + signals.h and signals.c. + +Mon Jan 30 00:49:37 1995 Richard Coleman + + * changed GLOBAL_ZLOGOUT to be sourced after .zlogout + +Sat Jan 28 04:22:04 1995 Richard Coleman + + * added #define RLIM_T_IS_QUAD_T for real BSD4.4 systems. + +Fri Jan 27 17:45:21 1995 Richard Coleman + + * patch to exec.c for pipeline bug. From + Sven Wischnowsky. (article 5063). + +Thu Jan 26 22:00:27 1995 Richard Coleman + + * Added GLOBAL_ZLOGOUT + + * Changed configure.in so that libnsl is only linked + if needed to find getdomainname. + +Wed Jan 25 15:40:56 1995 Richard Coleman + + * Zsh version 2.6-beta3 released. + + * Added small patch for FCEDIT and POSTEDIT. From + Geoff Wing. + + * Added new version of reporter script. From + Karl Vogel. + +Tue Jan 24 00:16:20 1995 Richard Coleman + + * Added patch so that shwordsplit doesn't toggle. + From Peter Stephenson. + + * Several patches for tty settings and some cleanup of + prompting. From Eskandar Ensafi. + + * patch for builtin from Hegedus Peter. + + * patch for pipe bug. From Sven Wischnowsky. + + * patch to zle_tricky.c for small completion bug. From + Sven Wischnowsky. + + * Patch for math.c. From Peter Stephenson. + + * Added new zle_refresh.c and followup patch. From + Geoff Wing. + +Mon Jan 23 22:42:17 1995 Richard Coleman + + * patch to prevent job table from filling up. + + * Added patch for autoparamslash option. From + Sven Wischnowsky. + +Mon Dec 12 20:17:01 1994 Richard Coleman + + * Fixed buglet in CSH_JUNKIE_PAREN. From + Peter Stephenson. + +Thu Nov 17 19:57:17 1994 Richard Coleman + + * Spurious comma in configure.in. Spurious spaces on + blank lines in Makefile{.in} were causing problems + on netbsd. + +Wed Nov 16 00:24:33 1994 Richard Coleman + + * Zsh version 2.6-beta2 released. + + * New version of aclocal.m4. Borrowed from m4-1.4. + Made a few changes since we're not strict ansi yet. + +Wed Nov 9 20:29:21 1994 Richard Coleman + + * Added updated replacement for zle_refresh.c from Geoff Wing. + +Tue Nov 8 21:01:08 1994 Richard Coleman + + * initialize tty modes in non-interactive shells. + + * fixed so expand-or-complete-prefix respects + always_last_prompt option. (Sven) + + * fix for pipes in for loops. (Sven) + + * Patch from Peter Stephenson to fix <-> for case where + the file names are large. + + * Added 2 patches from Eskandar Ensafi for zle_misc.c, + watch.c,zsh.h, for cleaning up handling of termcap + strings and text attributes. + + * Added replacement for zle_refresh.c from Geoff Wing. + +Mon Nov 7 01:00 1994 Richard Coleman + + * Reorganized the directory structure and renamed some of the + directories. + + * New targets dist and dist-rcs to automatically create + zsh distributions. + +Sun Nov 6 08:10 1994 Richard Coleman + + * Finished converting to autoconf 2.1. + +Sun Oct 23 20:05 1994 Sven Wischnowsky + + * exec.c,utils.c: fix problem with commands in pipeline not + able to attach to tty under certain conditions. + +Sun Oct 23 03:25 1995 Richard Coleman + + * configure.in,jobs.c: removed configure test for sigsetjmp. + Use _POSIX_VERSION instead. + +Sun Oct 23 03:20 1994 Peter Stephenson + + * builtin.c,exec.c,globals.h: big patch to fix problems with + typeset and variable assignment. + +Mon Oct 17 18:28 1994 Martin Steed + + * signals.awk: added change so that _SIGxxx will be + recognized in sys/signal.h. + +Mon Oct 17 18:21 1994 Kunihiro Ishiguro + + * Created Makefile.in for rest of subdirectories. + +Sun Oct 16 21:00 1994 Richard Coleman + + * Zsh version 2.6-beta1 released. diff --git a/Config/.distfiles b/Config/.distfiles new file mode 100644 index 000000000..ac024c171 --- /dev/null +++ b/Config/.distfiles @@ -0,0 +1,4 @@ +DISTFILES_SRC=' + .distfiles + clean.mk config.mk defs.mk version.mk +' diff --git a/Config/clean.mk b/Config/clean.mk new file mode 100644 index 000000000..918a84ff4 --- /dev/null +++ b/Config/clean.mk @@ -0,0 +1,43 @@ +# +# Makefile fragment for cleanup +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +mostlyclean: mostlyclean-recursive mostlyclean-here +clean: clean-recursive clean-here +distclean: distclean-recursive distclean-here +realclean: realclean-recursive realclean-here + +mostlyclean-here: +clean-here: mostlyclean-here +distclean-here: clean-here +realclean-here: distclean-here + +mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive: + @subdirs='$(SUBDIRS)'; if test -n "$$subdirs"; then \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$subdirs; do \ + (cd $$subdir && $(MAKE) $(MAKEDEFS) $$target) || exit 1; \ + done; \ + fi diff --git a/Config/config.mk b/Config/config.mk new file mode 100644 index 000000000..dd91476d0 --- /dev/null +++ b/Config/config.mk @@ -0,0 +1,38 @@ +# +# Makefile fragment for building Makefiles +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +config: Makefile + @subdir='$(SUBDIRS)'; for subdir in $$subdirs; do \ + (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \ + done + +CONFIG_INCS = \ +$(dir_top)/Config/clean.mk $(dir_top)/Config/config.mk \ +$(dir_top)/Config/defs.mk $(dir_top)/Config/version.mk + +Makefile: Makefile.in $(dir_top)/config.status $(CONFIG_INCS) + cd $(dir_top) && \ + CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status diff --git a/Config/defs.mk b/Config/defs.mk new file mode 100644 index 000000000..42cad5740 --- /dev/null +++ b/Config/defs.mk @@ -0,0 +1,83 @@ +# +# Basic Makefile definitions +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +# fundamentals +SHELL = /bin/sh +@SET_MAKE@ + +# source/build directories +VPATH = @srcdir@ +sdir = @srcdir@ +sdir_top = @top_srcdir@ + +# installation directories +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +MODDIR = $(libdir)/zsh/$(VERSION) +infodir = @infodir@ +mandir = @mandir@ + +# compilation +CC = @CC@ +CPPFLAGS = @CPPFLAGS@ +DEFS = @DEFS@ +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ +DLCFLAGS = @DLCFLAGS@ +DLLDFLAGS = @DLLDFLAGS@ +LIBLDFLAGS = @LIBLDFLAGS@ +EXELDFLAGS = @EXELDFLAGS@ +LIBS = @LIBS@ +DL_EXT = @DL_EXT@ +DLLD = @DLLD@ + +# utilities +AWK = @AWK@ +YODL = @YODL@ +YODL2TXT = $(YODL)2txt +YODL2HTML = $(YODL)2html + +# install utility +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# flags passed to recursive makes in subdirectories +MAKEDEFS = \ +prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ +libdir='$(libdir)' MODDIR='$(MODDIR)' infodir='$(infodir)' mandir='$(mandir)' \ +CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' CFLAGS='$(CFLAGS)' \ +LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \ +DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \ +LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \ +LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \ +AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' + +# override built-in suffix list +.SUFFIXES: diff --git a/Config/version.mk b/Config/version.mk new file mode 100644 index 000000000..5ed093b1b --- /dev/null +++ b/Config/version.mk @@ -0,0 +1,31 @@ +# +# Makefile fragment for version numbers +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +# This must also serve as a shell script, so do not add spaces around the +# `=' signs. + +VERSION=3.1.5 +VERSION_DATE='October 29, 1998' diff --git a/Doc/.cvsignore b/Doc/.cvsignore new file mode 100644 index 000000000..11b508947 --- /dev/null +++ b/Doc/.cvsignore @@ -0,0 +1,15 @@ +Makefile +version.yo +zsh*.1 +zsh.texi +zsh.info* +zsh_*.html +zsh.aux zsh.toc +zsh.cp zsh.cps +zsh.fn zsh.fns +zsh.ky zsh.kys +zsh.pg zsh.pgs +zsh.vr zsh.vrs +zsh.log zsh.dvi +zsh.tp zsh.tps +zsh_*.ps diff --git a/Doc/.distfiles b/Doc/.distfiles new file mode 100644 index 000000000..7fd1cdcc1 --- /dev/null +++ b/Doc/.distfiles @@ -0,0 +1,16 @@ +DISTFILES_SRC=' + .cvsignore .distfiles Makefile.in + META-FAQ.yo intro.ms + version.yo zmacros.yo zman.yo ztexi.yo + zsh.yo zshbuiltins.yo zshcompctl.yo zshexpn.yo zshmisc.yo + zshmodules.yo zshoptions.yo zshparam.yo zshzle.yo + zsh.texi + zsh.1 zshbuiltins.1 zshcompctl.1 zshexpn.1 zshmisc.1 zshmodules.1 + zshoptions.1 zshparam.1 zshzle.1 zshall.1 +' + +DISTFILES_DOC=' + zsh.info zsh.info-[0-9]* + zsh_toc.html zsh_[0-9]*.html + zsh.dvi zsh_us.ps zsh_a4.ps +' diff --git a/Doc/META-FAQ.yo b/Doc/META-FAQ.yo new file mode 100644 index 000000000..019264601 --- /dev/null +++ b/Doc/META-FAQ.yo @@ -0,0 +1,44 @@ +STARTDEF() +INCLUDEFILE(zmacros.yo) + +def(startmenu)(0)(DELLINE) +def(endmenu)(0)(DELLINE) +def(menu)(1)(DELLINE) +def(texinode)(4)(DELLINE) +def(cindex)(1)(DELLINE) + +def(sect)(1)( +SECTHEAD +ARG1 +) + +def(em)(1)(ARG1) +def(bf)(1)(ARG1) +def(tt)(1)(ARG1) +def(var)(1)(ARG1) +def(nofill)(1)(ARG1) + +def(startitem)(0)(NEXTLINE DELLINE) +def(enditem)(0)(DELLINE) +def(item)(2)( + ARG1+USECHARTABLE(indent2)ARG2 DELLINE USECHARTABLE(standard)) + +def(startlist)(0)(DELLINE) +def(endlist)(0)(DELLINE) +def(list)(1)( ARG1) + +DEFINECHARTABLE(standard)( + '\n' = "\n" +) +DEFINECHARTABLE(indent2)( + '\n' = "\n " +) + +ENDDEF()\ +------------------------ +META-FAQ for the Z Shell +------------------------ + +The latest version of this META-FAQ can be found at any of the FTP sites +listed below. +INCLUDEFILE(Zsh/metafaq.yo)\ diff --git a/Doc/Makefile.in b/Doc/Makefile.in new file mode 100644 index 000000000..1883abfd1 --- /dev/null +++ b/Doc/Makefile.in @@ -0,0 +1,172 @@ +# +# Makefile for Doc subdirectory +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +subdir = Doc +dir_top = .. + +@@version.mk@@ +@@defs.mk@@ + +MAKEINFO = makeinfo +TEXI2DVI = texi2dvi +DVIPS = dvips -D 300 +TEXI2HTML = texi2html -expandinfo -split_chapter + +.SUFFIXES: .yo .1 + +# man pages to install +MAN = zsh.1 zshbuiltins.1 zshcompctl.1 \ +zshexpn.1 zshmisc.1 zshmodules.1 \ +zshoptions.1 zshparam.1 zshzle.1 zshall.1 + +# yodl documentation +YODLDOC = $(MAN) zsh.texi +YODLSRC = zmacros.yo zman.yo ztexi.yo Zsh/arith.yo Zsh/builtins.yo \ +Zsh/compat.yo Zsh/compctl.yo Zsh/cond.yo Zsh/exec.yo Zsh/expn.yo \ +Zsh/filelist.yo Zsh/files.yo Zsh/func.yo Zsh/grammar.yo Zsh/guide.yo \ +Zsh/index.yo Zsh/intro.yo Zsh/invoke.yo Zsh/jobs.yo Zsh/metafaq.yo \ +Zsh/modules.yo Zsh/mod_cap.yo \ +Zsh/mod_clone.yo Zsh/mod_comp1.yo Zsh/mod_compctl.yo Zsh/mod_deltochar.yo \ +Zsh/mod_example.yo Zsh/mod_files.yo Zsh/mod_stat.yo \ +Zsh/mod_zle.yo Zsh/options.yo \ +Zsh/params.yo Zsh/prompt.yo Zsh/redirect.yo Zsh/restricted.yo \ +Zsh/seealso.yo Zsh/zle.yo + +# ========== DEPENDENCIES FOR BUILDING ========== + +all: $(MAN) zsh.texi zsh.info ../META-FAQ + +everything: all zsh.dvi zsh_us.ps zsh_a4.ps zsh_toc.html + +zsh.dvi: zsh.texi + $(TEXI2DVI) $(sdir)/zsh.texi + +zsh.info: zsh.texi + $(MAKEINFO) $(sdir)/zsh.texi; exit 0 + +zsh.texi: zsh.yo + $(YODL) -o $(sdir)/zsh.texi -I$(sdir) -w ztexi.yo version.yo zsh.yo + test -f $(sdir)/zsh.texi + +.yo.1: + case $@ in \ + */*) target=$@ ;; \ + *) target=$(sdir)/$@ ;; \ + esac; \ + $(YODL) -o $$target -I$(sdir) -w zman.yo version.yo $< || exit 1; \ + test -f $$target + +zsh_us.ps: zsh.dvi + $(DVIPS) -t letter -o $@ zsh.dvi + +zsh_a4.ps: zsh.dvi + $(DVIPS) -t a4 -o $@ zsh.dvi + +zsh_toc.html: zsh.texi + $(TEXI2HTML) $(sdir)/zsh.texi + +zshall.1: zsh.yo + case $@ in \ + */*) target=$@ ;; \ + *) target=$(sdir)/$@ ;; \ + esac; \ + $(YODL) -o $$target -I$(sdir) -DZSHALL -w zman.yo version.yo zsh.yo || exit 1; \ + test -f $$target + +../META-FAQ: META-FAQ.yo Zsh/metafaq.yo + $(YODL) -I$(sdir) META-FAQ.yo | sed -e '/NEXTLINE/N' -e '/DELLINE/d' -e '/^SECTHEAD$$/{N;s/^SECTHEAD.//;h;s/./-/g;H;g;}' -e 's/ *$$//' > $(sdir_top)/META-FAQ + test -f $(sdir_top)/META-FAQ + +$(YODLDOC): $(YODLSRC) version.yo + +version.yo: $(sdir_top)/Config/version.mk + ( \ + echo 'STARTDEF()'; \ + echo 'def(version)(0)('$(VERSION)')'; \ + echo 'def(date)(0)('$(VERSION_DATE)')'; \ + echo 'ENDDEF()#' | tr '#' '\\'; \ + ) > $(sdir)/version.yo + +# ========== DEPENDENCIES FOR INSTALLING ========== + +# install all the documentation +install: install.man install.info + +# uninstall all the documentation +uninstall: uninstall.man uninstall.info + +# install man pages, creating install directory if necessary +install.man: $(MAN) + $(sdir_top)/mkinstalldirs $(mandir)/man1 + for file in $(MAN); do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(mandir)/man1; \ + elif test -f $(sdir)/$$file; then \ + $(INSTALL_DATA) $(sdir)/$$file $(mandir)/man1; \ + else :; \ + fi || exit 1; \ + done + +# install info pages, creating install directory if necessary +install.info: zsh.info + $(sdir_top)/mkinstalldirs $(infodir) + for file in zsh.info zsh.info-[1-9]; do \ + if test -f $$file; then \ + $(INSTALL_DATA) $$file $(infodir); \ + elif test -f $(sdir)/$$file; then \ + $(INSTALL_DATA) $(sdir)/$$file $(infodir); \ + else :; \ + fi || exit 1; \ + done + +# uninstall man pages +uninstall.man: + for file in $(MAN); do \ + rm -f $(mandir)/man1/$$file; \ + done + +# uninstall info pages +uninstall.info: + rm -f $(infodir)/zsh.info $(infodir)/zsh.info-[1-9] + +# ========== DEPENDENCIES FOR CLEANUP ========== + +@@clean.mk@@ + +clean-here: + rm -f *.html *.info* *.dvi *.ps + rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.log + rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs + +distclean-here: + rm -f Makefile + +realclean-here: + cd $(sdir) && rm -f version.yo *.1 *.texi ../META-FAQ + +# ========== DEPENDENCIES FOR MAINTENANCE ========== + +@@config.mk@@ diff --git a/Doc/Zsh/.distfiles b/Doc/Zsh/.distfiles new file mode 100644 index 000000000..42517f507 --- /dev/null +++ b/Doc/Zsh/.distfiles @@ -0,0 +1,9 @@ +DISTFILES_SRC=' + .distfiles + arith.yo builtins.yo compat.yo compctl.yo cond.yo exec.yo expn.yo + filelist.yo files.yo func.yo grammar.yo guide.yo index.yo intro.yo + invoke.yo jobs.yo metafaq.yo mod_cap.yo mod_clone.yo mod_comp1.yo + mod_compctl.yo mod_deltochar.yo mod_example.yo mod_files.yo mod_sched.yo + mod_stat.yo mod_zle.yo modules.yo options.yo params.yo prompt.yo + redirect.yo restricted.yo seealso.yo zle.yo +' diff --git a/Doc/Zsh/.lastloc b/Doc/Zsh/.lastloc new file mode 100644 index 000000000..8b1a784a8 --- /dev/null +++ b/Doc/Zsh/.lastloc @@ -0,0 +1 @@ +(("/home/user2/pws/src/zsh-3.1.5/Doc/Zsh/expn.yo" . 33735)) diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo new file mode 100644 index 000000000..1560c81d3 --- /dev/null +++ b/Doc/Zsh/arith.yo @@ -0,0 +1,73 @@ +texinode(Arithmetic Evaluation)(Conditional Expressions)(Jobs & Signals)(Top) +chapter(Arithmetic Evaluation) +ifzman(\ +sect(Arithmetic Evaluation) +)\ +cindex(arithmetic evaluation) +cindex(evaluation, arithmetic) +An ability to perform integer arithmetic is provided with the builtin tt(let). +findex(let, use of) +Evaluations are performed using em(long) arithmetic. +A leading `tt(0x)' or `tt(0X)' denotes hexadecimal. +Otherwise, numbers are of the form `[var(base)tt(#)]var(n)', +where var(base) is a decimal number between two and thirty-six +representing the arithmetic base and var(n) +is a number in that base (for example, `tt(16#ff)' is 255 in hexadecimal). +If var(base) is omitted +then base 10 is used. For backwards compatibility the form +`tt([)var(base)tt(])var(n)' is also accepted. + +cindex(arithmetic operators) +cindex(operators, arithmetic) +An arithmetic expression uses nearly the same syntax, precedence, and +associativity of expressions in C. +The following operators are supported (listed in decreasing order +of precedence): + +startsitem() +sitem(tt(PLUS() - ! ~ PLUS()PLUS() --))(unary plus/minus, logical NOT, complement, {pre,post}{in,de}crement) +sitem(tt(<< >>))(bitwise shift left, right) +sitem(tt(&))(bitwise AND) +sitem(tt(^))(bitwise XOR) +sitem(tt(|))(bitwise OR) +sitem(tt(**))(exponentiation) +sitem(tt(* / %))(multiplication, division, modulus (remainder)) +sitem(tt(PLUS() -))(addition, subtraction) +sitem(tt(< > <= >=))(comparison) +sitem(tt(== !=))(equality and inequality) +sitem(tt(&&))(logical AND) +sitem(tt(|| ^^))(logical OR, XOR) +sitem(tt(? :))(ternary operator) +sitem(tt(= PLUS()= -= *= /= %= &= ^= |= <<= >>= &&= ||= ^^= **=))(assignment) +sitem(tt(,))(comma operator) +endsitem() + +The operators `tt(&&)', `tt(||)', `tt(&&=)', and `tt(||=)' are short-circuiting, +and only one of the latter two expressions in a ternary operator +is evaluated. Note the precedence of the bitwise AND, OR, +and XOR operators. + +An expression of the form `tt(#\)var(x)' where var(x) is any character +gives the ascii value of this character and an expression of the form +`tt(#)var(foo)' gives the ascii value of the first character of the value +of the parameter var(foo). + +Named parameters and subscripted arrays can be referenced by name within an +arithmetic expression without using the parameter substitution syntax. + +An internal integer representation of a named parameter +can be specified with the tt(integer) builtin. +cindex(parameters, integer) +cindex(integer parameters) +findex(integer, use of) +Arithmetic evaluation is performed on the value of each +assignment to a named parameter declared integer +in this manner. + +Since many of the arithmetic operators require +quoting, an alternative form of the tt(let) command is provided. +For any command which begins with a tt(LPAR()LPAR()), +all the characters until a matching tt(RPAR()RPAR()) +are treated as a quoted expression. +More precisely, `tt(LPAR()LPAR()) ... tt(RPAR()RPAR())' +is equivalent to `tt(let ")...tt(")'. diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo new file mode 100644 index 000000000..8959543c5 --- /dev/null +++ b/Doc/Zsh/builtins.yo @@ -0,0 +1,1184 @@ +texinode(Shell Builtin Commands)(Zsh Line Editor)(Options)(Top) +chapter(Shell Builtin Commands) +ifzman(\ +sect(Shell Builtin Commands) +)\ +cindex(builtin commands) +cindex(commands, builtin) +def(prefix)(1)(\ +findex(ARG1) +item(tt(ARG1) var(simple command))( +See noderef(Precommand Modifiers). +)\ +)\ +def(alias)(2)(\ +findex(ARG1) +item(tt(ARG1))( +Same as tt(ARG2). +)\ +)\ +startitem() +prefix(-) +findex(.) +item(tt(.) var(file) [ var(arg) ... ])( +Read commands from var(file) and execute them in the current shell +environment. +If var(file) does not contain a slash, or if tt(PATH_DIRS) +is set, the shell looks in the components of tt($path) to find the +directory containing var(file). +Files in the current directory are not read unless `tt(.)' appears +somewhere in tt($path). + +If any arguments var(arg) are given, +they become the positional parameters; the old positional +parameters are restored when the var(file) is done executing. +The exit status is the exit status of the last command executed. +) +findex(NOTRANS(:)) +cindex(expanding parameters) +cindex(parameters, expanding) +cindex(doing nothing) +item(tt(:) [ var(arg) ... ])( +This command only expands parameters. A zero exit code is returned. +) +findex(alias) +cindex(aliases, defining) +cindex(aliases, listing) +item(tt(alias) [ tt(-gmrL) ] [ var(name)[tt(=)var(value)] ... ])( +For each var(name) with a corresponding var(value), define an alias +with that value. A trailing space in var(value) causes the next word +to be checked for alias substitution. If the tt(-g) flag is present, +define a global alias; global aliases are expanded even if they do not +occur in command position. + +For each var(name) with no var(value), +print the value of var(name), if any. With no arguments, print all +currently defined aliases. If the tt(-m) flag is given the arguments +are taken as patterns (they should be quoted to preserve them from being +interpreted as glob patterns), and the aliases matching these patterns +are printed. When printing aliases and the tt(-g) or tt(-r) flags +are present, then restrict the printing to global or regular +aliases, respectively. + +If the tt(-L) flag is present, then print each +alias in a manner suitable for putting in a startup script. The exit +status is nonzero if a var(name) (with no var(value)) is given for +which no alias has been defined. +) +findex(autoload) +cindex(functions, autoloading) +cindex(autoloading functions) +alias(autoload)(functions -u) +findex(bg) +cindex(jobs, backgrounding) +xitem(tt(bg) [ var(job) ... ]) +item(var(job) ... tt(&))( +Put each specified var(job) in the background, +or the current job if none is specified. +) +findex(break) +cindex(exiting loops) +cindex(loops, exiting) +item(tt(break) [ var(n) ])( +Exit from an enclosing tt(for), tt(while), +tt(until), tt(select) or tt(repeat) loop. If var(n) +is specified, then break var(n) levels instead of just one. +) +findex(builtin) +item(tt(builtin) var(name) [ var(args) ... ])( +Executes the builtin var(name), with the given var(args). +) +alias(bye)(exit) +findex(cd) +cindex(directories, changing) +xitem(tt(cd) [ tt(-sLP) ] [ var(arg) ]) +xitem(tt(cd) [ tt(-sLP) ] var(old) var(new)) +item(tt(cd) [ tt(-sLP) ] {tt(PLUS())|tt(-)}var(n))( +Change the current directory. In the first form, change the +current directory to var(arg), or to the value of tt($HOME) if +var(arg) is not specified. If var(arg) is `tt(-)', change to the +value of tt($OLDPWD), the previous directory. +If a directory named var(arg) is not found in the current directory +and var(arg) does not begin with a slash, +search each component of the shell parameter tt(cdpath). +If the option tt(CDABLE_VARS) is set, and a parameter named var(arg) +exists whose value begins with a slash, treat its value as +the directory. + +The second form of tt(cd) substitutes the string var(new) +for the string var(old) in the name of the current directory, +and tries to change to this new directory. + +The third form of tt(cd) extracts an entry from the directory +stack, and changes to that directory. An argument of the form +`tt(PLUS())var(n)' identifies a stack entry by counting from the left +of the list shown by the tt(dirs) command, starting with zero. +An argument of the form `tt(-)var(n)' counts from the right. +If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' +and `tt(-)' in this context are swapped. + +If the tt(-s) option is specified, tt(cd) refuses to change the current +directory if the given pathname contains symlinks. If the tt(-P) option +is given or the tt(CHASE_LINKS) option is set, symbolic links are resolved +to their true values. If the tt(-L) option is given symbolic links are +followed regardless of the state of the tt(CHASE_LINKS) option. +) +alias(chdir)(cd) +prefix(command) +findex(continue) +cindex(loops, continuing) +cindex(continuing loops) +item(tt(continue) [ var(n) ])( +Resume the next iteration of the enclosing +tt(for), tt(while), tt(until), tt(select) or +tt(repeat) loop. If var(n) is specified, break out of +var(n)-1 loops and resume at the var(n)th enclosing loop. +) +alias(declare)(typeset) +findex(dirs) +cindex(directory stack, printing) +item(tt(dirs) [ tt(-v) ] [ var(arg) ... ])( +With no arguments, print the contents of the directory stack. +If the tt(-v) option is given, number the directories +in the stack when printing. +Directories are added to this stack with the tt(pushd) command, +and removed with the tt(cd) or tt(popd) commands. +If arguments are specified, load them onto the directory stack, +replacing anything that was there, and push the current directory +onto the stack. +) +findex(disable) +cindex(disabling commands) +cindex(commands, disabling) +item(tt(disable) [ tt(-afmr) ] var(name) ...)( +Temporarily disable the var(name)d hash table elements. The default +is to disable builtin commands. This allows you to use an external +command with the same name as a builtin command. The tt(-a) option +causes tt(disable) to act on aliases. The tt(-f) option causes +tt(disable) to act on shell functions. The tt(-r) options causes +tt(disable) to act on reserved words. Without arguments all disabled +hash table elements from the corresponding hash table are printed. +With the tt(-m) flag the arguments are taken as patterns (should be +quoted to preserve them from being taken as glob patterns), and all hash +table elements from the corresponding hash table matching these patterns +are disabled. Disabled objects can be enabled with the tt(enable) +command. +) +findex(disown) +cindex(jobs, disowning) +xitem(tt(disown) [ var(job) ... ]) +xitem(var(job) ... tt(&|)) +item(var(job) ... tt(&!))( +Remove the specified var(job)s from the job table; the shell will +no longer report their status, and will not complain if you +try to exit an interactive shell with them running or stopped. +If no var(job) is specified, disown the current job. +) +findex(echo) +item(tt(echo) [ tt(-neE) ] [ var(arg) ... ])( +Write each var(arg) on the standard output, with a space separating +each one. +If the tt(-n) flag is not present, print a newline at the end. +tt(echo) recognizes the following escape sequences: + +startsitem() +sitem(tt(\a))(bell character) +sitem(tt(\b))(backspace) +sitem(tt(\c))(suppress final newline) +sitem(tt(\e))(escape) +sitem(tt(\f))(form feed) +sitem(tt(\n))(linefeed (newline)) +sitem(tt(\r))(carriage return) +sitem(tt(\t))(horizontal tab) +sitem(tt(\v))(vertical tab) +sitem(tt(\\))(backslash) +sitem(tt(\0)var(NNN))(character code in octal) +sitem(tt(\x)var(NN))(character code in hexadecimal) +endsitem() + +pindex(BSD_ECHO, use of) +The tt(-E) flag, or the tt(BSD_ECHO) option, can be used to disable +these escape sequences. In the latter case, tt(-e) flag can be used to +enable them. +) +findex(echotc) +cindex(termcap string, printing) +item(tt(echotc) var(cap) [ var(arg) ... ])( +Output the termcap string corresponding to the capability +var(cap), with optional arguments. +) +findex(emulate) +cindex(compatibility, sh) +cindex(compatibility, ksh) +cindex(compatibility, csh) +cindex(sh, compatibility) +cindex(ksh, compatibility) +cindex(csh, compatibility) +item(tt(emulate) [ tt(-R) ] {tt(zsh)|tt(sh)|tt(ksh)|tt(csh)})( +Set up zsh options to emulate the specified shell as much as possible. +bf(csh) will never be fully emulated. +If the argument is not one of the shells listed above, tt(zsh) +will be used as a default. If the tt(-R) option is given, all options +are reset to their default value corresponding to the specified emulation +mode. +) +findex(enable) +cindex(enabling commands) +cindex(commands, enabling) +item(tt(enable) [ tt(-afmr) ] var(name) ...)( +Enable the var(name)d hash table elements, presumably disabled +earlier with tt(disable). The default is to enable builtin commands. +The tt(-a) option causes tt(enable) to act on aliases. The tt(-f) +option causes tt(enable) to act on shell functions. The tt(-r) +option causes tt(enable) to act on reserved words. Without arguments +all enabled hash table elements from the corresponding hash table are +printed. With the tt(-m) flag the arguments are taken as patterns +(should be quoted) and all hash table elements from the corresponding +hash table matching these patterns are enabled. Enabled objects can be +disabled with the tt(disable) builtin command. +) +findex(eval) +cindex(evaluating arguments as commands) +item(tt(eval) [ var(arg) ... ])( +Read the arguments as input to the shell and execute the resulting +command in the current shell process. +) +prefix(exec) +findex(exit) +item(tt(exit) [ var(n) ])( +Exit the shell with the exit code specified by var(n); if none +is specified, use the exit code from the last command executed. +pindex(IGNORE_EOF, use of) +An EOF condition will also cause the shell to exit, unless +the tt(IGNORE_EOF) option is set. +) +findex(export) +item(tt(export) [ var(name)[tt(=)var(value)] ... ])( +The specified var(name)s are marked for automatic export +to the environment of subsequently executed commands. +Equivalent to tt(typeset -x), except that no parameter will be created +to hide an existing one in an outer scope. +If a parameter specified does not +already exist, it is created in the global scope. +) +findex(false) +cindex(doing nothing, unsuccessfully) +item(tt(false) [ var(arg) ... ])( +Do nothing and return an exit code of 1. +) +findex(fc) +cindex(history, editing) +cindex(editing history) +xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-nlrdDfEim) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ]) +item(tt(fc) tt(-ARWI) [ var(filename) ])( +Select a range of commands from var(first) to var(last) from the +history list. +The arguments var(first) and var(last) may be specified as a +number or as a string. A negative number is used as an offset +to the current history event number. +A string specifies the most recent event beginning with the given string. +All substitutions var(old)tt(=)var(new), if any, are then performed +on the commands. + +If the tt(-l) flag is given, the resulting commands are listed on +standard output. +If the tt(-m) flag is also given the first argument is taken as a +pattern (should be quoted) and only the history events matching this +pattern will be shown. +Otherwise the editor program var(ename) is invoked on a file containing +these history events. If var(ename) is not given, the value +of the parameter tt(FCEDIT) is used. If var(ename) is `tt(-)', +no editor is invoked. When editing is complete, the edited +command is executed. + +If var(first) is not specified, it will be set to -1 (the most recent +event), or to -16 if the tt(-l) flag is given. +If var(last) is not specified, it will be set to var(first), +or to -1 if the tt(-l) flag is given. + +The flag tt(-r) reverses the order of the commands and the +flag tt(-n) suppresses command numbers when listing. +Also when listing, tt(-d) prints timestamps for each command, and +tt(-f) prints full time-date stamps. Adding the tt(-E) flag +causes the dates to be printed as `var(dd)tt(.)var(mm)tt(.)var(yyyy)', +instead of the default `var(mm)tt(/)var(dd)tt(/)var(yyyy)'. +Adding the tt(-i) flag causes the dates to be printed in ISO8601 +`var(yyyy)tt(-)var(mm)tt(-)var(dd)' format. +With the tt(-D) flag, tt(fc) prints elapsed times. + +cindex(history, file) +cindex(file, history) +tt(fc -R) reads the history from the given file, +tt(fc -W) writes the history out to the given file, +and tt(fc -A) appends the history out to the given file. +If the tt(-I) option is added, only those +events that are new since last incremental append (write) to +the history file are appended (written). +In any case the file will have no more than tt($SAVEHIST) +entries. +) +findex(fg) +cindex(jobs, foregrounding) +cindex(jobs, resuming) +xitem(tt(fg) [ var(job) ... ]) +item(var(job) ...)( +Bring each specified var(job) in turn to the foreground. +If no var(job) is specified, resume the current job. +) +findex(functions) +item(tt(functions) [ {tt(PLUS())|tt(-)}tt(tum) ] [ var(name) ... ])( +Equivalent to tt(typeset -f). +) +findex(getln) +cindex(line, reading) +cindex(reading a line) +item(tt(getln) [ tt(-AclneE) ] var(name) ...)( +Read the top value from the buffer stack and put it in +the shell parameter tt(name). Equivalent to +tt(read -zr). +) +findex(getopts) +cindex(options, processing) +item(tt(getopts) var(optstring) var(name) [ var(arg) ... ])( +Checks the var(arg)s for legal options. If the var(arg)s are omitted, +use the positional parameters. A valid option argument +begins with a `tt(PLUS())' or a `tt(-)'. An argument not beginning with +a `tt(PLUS())' or a `tt(-)', or the argument `tt(--)', ends the options. +var(optstring) contains the letters that tt(getopts) +recognizes. If a letter is followed by a `tt(:)', that option +is expected to have an argument. The options can be +separated from the argument by blanks. + +Each time it is invoked, tt(getopts) places the option letter it finds +in the shell parameter var(name), prepended with a `tt(PLUS())' when +var(arg) begins with a `tt(PLUS())'. The index of the next var(arg) +is stored in tt(OPTIND). The option argument, if any, +is stored in tt(OPTARG). +vindex(OPTIND, use of) +vindex(OPTARG, use of) + +A leading `tt(:)' in var(optstring) causes tt(getopts) to store the +letter of the invalid option in tt(OPTARG), and to set var(name) +to `tt(?)' for an unknown option and to `tt(:)' when a required option +is missing. Otherwise, tt(getopts) prints an error +message. The exit status is nonzero when there are no more options. +) +findex(hash) +item(tt(hash) [ tt(-dfmrv) ] [ var(name)[tt(=)var(value)] ] ...)( +tt(hash) can be used to directly modify the contents of the command +hash table, and the named directory hash table. Normally one would +modify these tables by modifying one's tt(PATH) +(for the command hash table) or by creating appropriate shell parameters +(for the named directory hash table). +The choice of hash table to work on is determined by the tt(-d) option; +without the option the command hash table is used, and with the option the +named directory hash table is used. + +Given no arguments, and neither the tt(-r) or tt(-f) options, +the selected hash table will be listed in full. + +The tt(-r) option causes the selected hash table to be emptied. +It will be subsequently rebuilt in the normal fashion. +The tt(-f) option causes the selected hash table to be fully +rebuilt immediately. For the command hash table this hashes +all the absolute directories in the tt(PATH), +and for the named directory hash table this adds all users' home directories. +These two options cannot be used with any arguments. + +The tt(-m) option causes the arguments to be taken as patterns +(they should be quoted) and the elements of the hash table +matching those patterns are printed. This is the only way to display +a limited selection of hash table elements. + +For each var(name) with a corresponding var(value), put `var(name)' in +the selected hash table, associating it with the pathname `var(value)'. +In the command hash table, this means that +whenever `var(name)' is used as a command argument, the shell will try +to execute the file given by `var(value)'. +In the named directory hash table, this means +that `var(value)' may be referred to as `tt(~)var(name)'. + +For each var(name) with no +corresponding var(value), attempt to add var(name) to the hash table, +checking what the appropriate tt(value) is in the normal manner for +that hash table. If an appropriate tt(value) can't be found, then +the hash table will be unchanged. + +The tt(-v) option causes hash table entries to be listed as they are +added by explicit specification. If has no effect if used with tt(-f). +) +alias(history)(fc -l) +findex(integer) +item(tt(integer) [ {tt(PLUS())|tt(-)}tt(lrtux) ] [ var(name)[tt(=)var(value)] ... ])( +Equivalent to tt(typeset -i), except that options irrelevant to +integers are not permitted. +) +findex(jobs) +xitem(tt(jobs) [ tt(-dlprs) ] [ var(job) ... ]) +item(tt(jobs -Z) var(string))( +Lists information about each given job, or all jobs +if var(job) is omitted. The tt(-l) flag lists process +IDs, and the tt(-p) flag lists process groups. +If the tt(-r) flag is specified only running jobs will be listed +and if the tt(-s) flag is given only stopped jobs are shown. +If the tt(-d) flag is given, the directory from which the job was +started (which may not be the current directory of the job) will also +be shown. + +The tt(-Z) option replaces the shell's argument and environment space with +the given string, truncated if necessary to fit. This will normally be +visible in tt(ps) (manref(ps)(1)) listings. This feature is typically +used by daemons, to indicate their state. +) +findex(kill) +cindex(killing jobs) +cindex(jobs, killing) +xitem(tt(kill) [ tt(-s) var(signal_name) ] var(job) ...) +xitem(tt(kill) [ tt(-)var(sig) ] var(job) ...) +item(tt(kill) tt(-l) [ var(sig) ... ])( +Sends either tt(SIGTERM) or the specified signal to the given +jobs or processes. +Signals are given by number or by names, without the `tt(SIG)' prefix. +If the signal being sent is not `tt(KILL)' or `tt(CONT)', then the job +will be sent a `tt(CONT)' signal if it is stopped. +The argument var(job) can be the process ID of a job +not in the job list. +In the third form, tt(kill -l), if var(sig) is not +specified the signal names are listed. Otherwise, for each +var(sig) that is a name, the corresponding signal number is +listed. For each var(sig) that is a signal number or a number +representing the exit status of a process which was terminated or +stopped by a signal the name of the signal is printed. +) +findex(let) +item(tt(let) var(arg) ...)( +Evaluate each var(arg) as an arithmetic expression. +See noderef(Arithmetic Evaluation) for a description +of arithmetic expressions. The exit status is 0 if the +value of the last expression is nonzero, and 1 otherwise. +) +findex(limit) +cindex(resource limits) +cindex(limits, resource) +item(tt(limit) [ tt(-hs) ] [ var(resource) [ var(limit) ] ] ...)( +Set or display resource limits. Unless the tt(-s) flag is given, +the limit applies only the children of the shell. If tt(-s) is +given without other arguments, the resource limits of the current +shell is set to the previously set resource limits of the children. + +If var(limit) is not specified, print the current limit placed +on var(resource), otherwise +set the limit to the specified value. If the tt(-h) flag +is given, use hard limits instead of soft limits. +If no var(resource) is given, print all limits. + +var(resource) can be one of: + +startsitem() +sitem(tt(memorylocked))(Maximum amount of memory locked in RAM.) +sitem(tt(resident))(Maximum resident set size.) +sitem(tt(vmemorysize))(Maximum amount of virtual memory.) +sitem(tt(descriptors))(Maximum value for a file descriptor.) +sitem(tt(coredumpsize))(Maximum size of a core dump.) +sitem(tt(stacksize))(Maximum stack size for each process.) +sitem(tt(datasize))(Maximum data size (including stack) for each process.) +sitem(tt(filesize))(Largest single file allowed.) +sitem(tt(cputime))(Maximum CPU seconds per process.) +sitem(tt(maxproc))(Maximum number of processes.) +sitem(tt(addressspace))(Maximum amount of address space used.) +sitem(tt(cachedthreads))(Maximum number of cached threads.) +endsitem() + +Which of these resource limits are available depends on the system. +var(resource) can be abbreviated to any unambiguous prefix. + +var(limit) is a number, with an optional scaling factor, as follows: + +startsitem() +sitem(var(n)tt(h))(hours) +sitem(var(n)tt(k))(kilobytes (default)) +sitem(var(n)tt(m))(megabytes or minutes) +sitem([var(mm)tt(:)]var(ss))(minutes and seconds) +endsitem() +) +findex(local) +item(tt(local) [ {tt(PLUS())|tt(-)}tt(LRZilrtu) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)( +Same as tt(typeset), except that the options tt(-x) and +tt(-f) are not permitted. +) +findex(log) +vindex(watch, use of) +cindex(watching users) +cindex(users, watching) +item(tt(log))( +List all users currently logged in who are affected by +the current setting of the tt(watch) parameter. +) +findex(logout) +item(tt(logout) [ var(n) ])( +Same as tt(exit), except that it only works in a login shell. +) +prefix(noglob) +findex(popd) +item(tt(popd) [ {tt(PLUS())|tt(-)}var(n) ])( +Removes a entry from the directory stack, and perform a tt(cd) to +the new top directory. With no argument, the current top entry is +removed. An argument of the form `tt(PLUS())var(n)' identifies a stack +entry by counting from the left of the list shown by the tt(dirs) command, +starting with zero. An argument of the form tt(-n) counts from the right. +pindex(PUSHD_MINUS, use of) +If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' and +`tt(-)' in this context are swapped. +) +findex(print) +item(tt(print) [ tt(-nrslzpNDPoOicm) ] [ tt(-u)var(n) ] [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])( +With no flags or with flag `tt(-)', the arguments are printed on +the standard output as described by tt(echo), with the following differences: +the escape sequence `tt(\M-)var(x)' metafies the character +var(x) (sets the highest bit), +`tt(\C-)var(x)' produces a control character (`tt(\C-@)' and `tt(\C-?)' give the +characters NUL and delete), and `tt(\E)' is a synonym for `tt(\e)'. +Finally, if not in an escape +sequence, `tt(\)' escapes the following character and is not printed. + +startitem() +item(tt(-r))( +Ignore the escape conventions of tt(echo). +) +item(tt(-R))( +Emulate the BSD tt(echo) command, which does not process escape sequences +unless the tt(-e) flag is given. The tt(-n) flag suppresses the trailing +newline. Only the tt(-e) and tt(-n) flags are recognized after +tt(-R); all other arguments and options are printed. +) +item(tt(-m))( +Take the first argument as a pattern (should be quoted), and remove +it from the argument list together with subsequent arguments that +do not match this pattern. +) +item(tt(-s))( +Place the results in the history list instead of on the standard output. +) +item(tt(-n))( +Do not add a newline to the output. +) +item(tt(-l))( +Print the arguments separated by newlines instead of spaces. +) +item(tt(-N))( +Print the arguments separated and terminated by nulls. +) +item(tt(-o))( +Print the arguments sorted in ascending order. +) +item(tt(-O))( +Print the arguments sorted in descending order. +) +item(tt(-i))( +If given together with tt(-o) or tt(-O), makes them work case +independently. +) +item(tt(-c))( +Print the arguments in columns. +) +item(tt(-u)var(n))( +Print the arguments to file descriptor var(n). +) +item(tt(-p))( +Print the arguments to the input of the coprocess. +) +item(tt(-z))( +Push the arguments onto the editing buffer stack, separated by spaces; +no escape sequences are recognized. +) +item(tt(-D))( +Treat the arguments as directory names, replacing prefixes with tt(~) +expressions, as appropriate. +) +item(tt(-P))( +Perform prompt expansion (see noderef(Prompt Expansion)). +) +enditem() +) +findex(pushd) +pindex(PUSHD_TO_HOME, use of) +pindex(PUSHD_MINUS, use of) +pindex(CDABLE_VARS, use of) +pindex(PUSHD_SILENT, use of) +xitem(tt(pushd) [ var(arg) ]) +xitem(tt(pushd) var(old) var(new)) +item(tt(pushd) {tt(PLUS())|tt(-)}var(n))( +Change the current directory, and push the old current directory +onto the directory stack. In the first form, change the +current directory to var(arg). +If var(arg) is not specified, change to the second directory +on the stack (that is, exchange the top two entries), or +change to tt($HOME) if the tt(PUSHD_TO_HOME) +option is set or if there is only one entry on the stack. + +If var(arg) is `tt(-)', change to tt($OLDPWD), the previous directory. +If a directory named var(arg) is not found in the current directory +and var(arg) does not contain a slash, +search each component of the shell parameter tt(cdpath). +If the option tt(CDABLE_VARS) is set, and a parameter named var(arg) +exists whose value begins with a slash, treat its value as +the directory. + +If the option tt(PUSHD_SILENT) is not set, the directory +stack will be printed after a tt(pushd) is performed. + +The second form of tt(pushd) substitutes the string var(new) +for the string var(old) in the name of the current directory, +and tries to change to this new directory. + +The third form of tt(pushd) changes directory by rotating the +directory list. An argument of the form `tt(PLUS())var(n)' identifies a stack +entry by counting from the left of the list shown by the tt(dirs) +command, starting with zero. An argument of the form `tt(-)var(n)' counts +from the right. If the tt(PUSHD_MINUS) option is set, the meanings +of `tt(PLUS())' and `tt(-)' in this context are swapped. +) +findex(pushln) +item(tt(pushln) [ var(arg) ... ])( +Equivalent to tt(print -nz). +) +findex(pwd) +pindex(CHASE_LINKS, use of) +item(tt(pwd) [ tt(-rLP) ])( +Print the absolute pathname of the current working directory. +If the tt(-r) or the tt(-P) flag is specified, or the tt(CHASE_LINKS) +option is set and the tt(-L) flag is not given, the printed path will not +contain symbolic links. +) +alias(r)(fc -e -) +findex(read) +vindex(IFS, use of) +item(tt(read) [ tt(-rzpqAclneE) ] [ tt(-k) [ var(num) ] ] \ +[ tt(-u)var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])( +Read one line and break it into fields using the characters +in tt($IFS) as separators, except as noted below. +The first field is assigned to the first var(name), the second field +to the second var(name), etc., with leftover +fields assigned to the last var(name). + +startitem() +item(tt(-r))( +Raw mode: a `tt(\)' at the end of a line does not signify line +continuation. +) +item(tt(-q))( +Read only one character from the terminal and set var(name) to +`tt(y)' if this character was `tt(y)' or `tt(Y)' and to `tt(n)' otherwise. +With this flag set the return value is zero only if the character was +`tt(y)' or `tt(Y)'. Note that this always reads from the terminal, even +if used with the tt(-p) or tt(-u) or tt(-z) flags or with redirected input. +) +item(tt(-k) [ var(num) ])( +Read only one (or var(num)) characters. All are assigned to the first +var(name), without word splitting. This flag is ignored when tt(-q) is +present. Input is read from the terminal unless one of tt(-u) or tt(-p) +is present. +) +item(tt(-z))( +Read one entry from the editor buffer stack and assign it to the first +var(name), without word splitting. Text is pushed onto the stack with +`tt(print -z)' or with tt(push-line) from the line editor (see +ifzman(zmanref(zshzle))\ +ifnzman(noderef(Zsh Line Editor))\ +). This flag is ignored when the tt(-k) or tt(-q) flags are present. +) +xitem(tt(-e)) +item(tt(-E))( +The input read is printed (echoed) to the standard output. If the tt(-e) +flag is used, no input is assigned to the parameters. +) +item(tt(-A))( +The first var(name) is taken as the name of an array and all words are +assigned to it. +) +xitem(tt(-c)) +item(tt(-l))( +These flags are allowed only if called inside a +function used for completion (specified with the tt(-K) flag to +tt(compctl)). If the tt(-c) flag is given, the words of the +current command are read. If the tt(-l) flag is given, the whole +line is assigned as a scalar. If both flags are present, tt(-l) +is used and tt(-c) is ignored. If var(name) is omitted then +tt(REPLY) is used for scalars and tt(reply) for arrays. +) +item(tt(-n))( +Together with tt(-c), the number of the word the cursor is on is +read. With tt(-l), the index of the character the cursor is on is +read. Note that the command name is word number 1, not word 0, +and that when the cursor is at the end of the line, its character +index is the length of the line plus one. +) +item(tt(-u)var(n))( +Input is read from file descriptor var(n). +) +item(tt(-p))( +Input is read from the coprocess. +) +enditem() + +If the first argument contains a `tt(?)', the remainder of this +word is used as a var(prompt) on standard error when the shell +is interactive. + +The value (exit status) of tt(read) is 1 when an end-of-file is +encountered, or when tt(-c) or tt(-l) is present and the command is +not called from a tt(compctl) function. Otherwise the value is 0. + +The behavior of some combinations of the tt(-k), tt(-p), tt(-q), tt(-u) +and tt(-z) flags is undefined. Presently tt(-q) cancels all the others, +tt(-p) cancels tt(-u), tt(-k) cancels tt(-z), and otherwise tt(-z) +cancels both tt(-p) and tt(-u). + +The tt(-c) or tt(-l) flags cancel any and all of tt(-kpquz). +) +cindex(parameters, marking readonly) +alias(readonly)(typeset -r) +alias(rehash)(hash -r) +findex(return) +cindex(functions, returning from) +item(tt(return) [ var(n) ])( +Causes a shell function or tt(.) script to return to +the invoking script with the return status specified by var(n). If var(n) +is omitted, the return status is that of the last command +executed. + +If tt(return) was executed from a trap in a tt(TRAP)var(NAL) function, +the effect is different for zero and non-zero return status. With zero +status (or after an implicit return at the end of the trap), the shell +will return to whatever it was previously processing; with a non-zero +status, the shell will behave as interrupted except that the return +status of the trap is retained. Note that the signal which caused the +trap is passed as the first argument, so the statement `tt(return +$((128PLUS()$1)))' will return the same status as if the signal had not +been trapped. +) +findex(set) +cindex(parameters, listing) +cindex(parameters, positional) +cindex(parameters, setting array) +cindex(array parameters, setting) +item(tt(set) [ {tt(PLUS())|tt(-)}var(options) | {tt(PLUS())|tt(-)}tt(o) var(option_name) ] ... [ {tt(PLUS())|tt(-)}tt(A) [ var(name) ] ] [ var(arg) ... ])( +Set the options for the shell and/or set the positional parameters, or +declare and set an array. If the tt(-s) option is given, it causes the +specified arguments to be sorted before assigning them to the positional +parameters (or to the array var(name) if tt(-A) is used). With tt(PLUS()s) +sort arguments in descending order. For the meaning of the other flags, see +ifzman(zmanref(zshoptions))\ +ifnzman(noderef(Options))\ +. Flags may be specified by name using the tt(-o) option. + +If the tt(-A) flag is specified, var(name) is +set to an array containing the given var(arg)s. if tt(PLUS()A) is used and +var(name) is an array, the given arguments will replace the initial +elements of that array; if no var(name) is specified, all arrays are +printed. Otherwise the positional parameters are set. If no arguments are +given, then the names and values of all parameters are printed on the +standard output. If the only argument is `tt(PLUS())', +the names of all parameters are printed. +) +findex(setopt) +cindex(options, setting) +item(tt(setopt) [ {tt(PLUS())|tt(-)}var(options) | \ +{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])( +Set the options for the shell. All options specified either +with flags or by name are set. If no arguments are supplied, +the names of all options currently set are printed. +If the tt(-m) flag is given the arguments are taken as patterns +(which should be quoted to preserve them from being interpreted as glob +patterns), and all options with names matching these patterns are set. +) +findex(shift) +cindex(parameters, positional) +item(tt(shift) [ var(n) ] [ var(name) ... ])( +The positional parameters tt(${)var(n)PLUS()1tt(}) ... are renamed +to tt($1) ..., where var(n) is an arithmetic expression that +defaults to 1. +If any var(name)s are given then the arrays with these names are +shifted instead of the positional parameters. +) +findex(source) +item(tt(source) var(file) [ var(arg) ... ])( +Same as tt(.), except that the current directory is always searched and +is always searched first, before directories in tt($path). +) +findex(suspend) +cindex(shell, suspending) +cindex(suspending the shell) +item(tt(suspend) [ tt(-f) ])( +Suspend the execution of the shell (send it a tt(SIGTSTP)) +until it receives a tt(SIGCONT). +Unless the tt(-f) option is given, this will refuse to suspend a login shell. +) +findex(test) +xitem(tt(test) [ var(arg) ... ]) +item(tt([) [ var(arg) ... ] tt(]))( +Like the system version of tt(test). Added for compatibility; +use conditional expressions instead (see noderef(Conditional Expressions)). +) +findex(times) +cindex(shell, timing) +cindex(timing the shell) +item(tt(times))( +Print the accumulated user and system times for the shell +and for processes run from the shell. +) +findex(trap) +cindex(signals, trapping) +cindex(trapping signals) +item(tt(trap) [ var(arg) [ var(sig) ... ] ])( +var(arg) is a command to be read and executed when the shell +receives var(sig). Each var(sig) can be given as a number +or as the name of a signal. +If var(arg) is `tt(-)', then all traps var(sig) are reset to their +default values. If var(arg) is the null string, then this signal +is ignored by the shell and by the commands it invokes. + +If var(sig) is tt(ZERR) then var(arg) will be executed +after each command with a nonzero exit status. +If var(sig) is tt(DEBUG) then var(arg) will be executed +after each command. +If var(sig) is tt(0) or tt(EXIT) +and the tt(trap) statement is executed inside the body of a function, +then the command var(arg) is executed after the function completes. +If var(sig) is tt(0) or tt(EXIT) +and the tt(trap) statement is not executed inside the body of a function, +then the command var(arg) is executed when the shell terminates. + +The tt(trap) command with no arguments prints a list of commands +associated with each signal. +) +findex(true) +cindex(doing nothing, successfully) +item(tt(true) [ var(arg) ... ])( +Do nothing and return an exit code of 0. +) +findex(ttyctl) +cindex(tty, freezing) +item(tt(ttyctl) tt(-fu))( +The tt(-f) option freezes the tty, and tt(-u) unfreezes it. +When the tty is frozen, no changes made to the tty settings by +external programs will be honored by the shell, except for changes in the +size of the screen; the shell will +simply reset the settings to their previous values as soon as each +command exits or is suspended. Thus, tt(stty) and similar programs have +no effect when the tty is frozen. Without options it reports whether the +terminal is frozen or not. +) +findex(type) +item(tt(type) [ tt(-wfpams) ] var(name) ...)( +Equivalent to tt(whence -v). +) +findex(typeset) +cindex(parameters, setting) +cindex(parameters, declaring) +item(tt(typeset) [ {tt(PLUS())|tt(-)}tt(LRUZfilrtuxm) [var(n)]] [ var(name)[tt(=)var(value)] ... ])( +Set attributes and values for shell parameters. +When invoked inside a function a new parameter is created which will be +unset when the function completes. The new parameter will not be +exported unless tt(ALL_EXPORT) is set, in which case the parameter will be +exported provided no parameter of that name already exists. +The following attributes are valid: + +startitem() +item(tt(-L))( +Left justify and remove leading blanks from var(value). +If var(n) is nonzero, it defines the width of the field; +otherwise it is determined by the width of the value of the first +assignment. +When the parameter is printed, it is filled on the right with +blanks or truncated if necessary to fit the field. +Leading zeros are removed if the tt(-Z) flag is also set. +) +item(tt(-R))( +Right justify and fill with leading blanks. If var(n) is nonzero +if defines the width of the field; +otherwise it is determined by the width of the value of the first +assignment. +When the parameter is printed, the field is left filled with +blanks or truncated from the end. +) +item(tt(-U))( +For arrays keep only the first element of each duplications. It can also be +set for colon separated special parameters like tt(PATH) or tt(FIGNORE), +etc. +) +item(tt(-Z))( +Right justify and fill with leading zeros if the first non-blank +character is a digit and the tt(-L) flag has not been set. +If var(n) is nonzero it defines the width of the field; +otherwise it is determined by the width of the value of the +first assignment. +) +item(tt(-f))( +The names refer to functions rather than parameters. No assignments +can be made, and the only other valid flags are tt(-t) +and tt(-u). The flag tt(-t) turns on execution tracing for this +function. The flag tt(-u) causes this function to be marked +for autoloading. The tt(fpath) parameter will be searched to find the +function definition when the function is first referenced; see +noderef(Functions). +) +item(tt(-i))( +Use an internal integer representation. If var(n) is nonzero +it defines the output arithmetic base, otherwise it is determined by the first +assignment. +) +item(tt(-l))( +Convert to lower case. +) +item(tt(-r))( +The given var(name)s are marked readonly. +) +item(tt(-t))( +Tags the named parameters. Tags have no special meaning to the shell. +) +item(tt(-u))( +Convert to upper case. +) +item(tt(-x))( +Mark for automatic export to the environment of subsequently +executed commands. +) +enditem() + +Using `tt(PLUS())' rather than `tt(-)' causes these flags to be turned off. +If no arguments are given but flags are specified, +a list of named parameters which have these flags set is printed. +Using `tt(PLUS())' instead of `tt(-)' keeps their values from being printed. +If no arguments or options are given, the names and attributes +of all parameters are printed. If only the tt(-m) flag is given the +arguments are taken as patterns (should be quoted) and all parameters +or functions (with the tt(-f) flag) with matching names are printed. +) +findex(ulimit) +cindex(resource limits) +cindex(limits, resource) +item(tt(ulimit) [ tt(-SHacdflmnpstv) [ tt(limit) ] ... ])( +Set or display resource limits of the shell and the processes started by +the shell. The value of var(limit) can be a number in the unit specified +below or the value `tt(unlimited)'. If the tt(-H) flag is given use +hard limits instead of soft limits. If the tt(-S) flag is given +together with the tt(-H) flag set both hard and soft limits. If no +options are used, the file size limit (tt(-f)) is assumed. If +var(limit) is omitted the current value of the specified resources are +printed. When more than one resource values are printed the limit name and +unit is printed before each value. + +startsitem() +sitem(tt(-a))(Lists all of the current resource limits.) +sitem(tt(-c))(512-byte blocks on the size of core dumps.) +sitem(tt(-d))(K-bytes on the size of the data segment.) +sitem(tt(-f))(512-byte blocks on the size of files written.) +sitem(tt(-l))(K-bytes on the size of locked-in memory.) +sitem(tt(-m))(K-bytes on the size of physical memory.) +sitem(tt(-n))(open file descriptors.) +sitem(tt(-s))(K-bytes on the size of the stack.) +sitem(tt(-t))(CPU seconds to be used.) +sitem(tt(-u))(processes available to the user.) +sitem(tt(-v))(K-bytes on the size of virtual memory.) +endsitem() +) +findex(umask) +cindex(umask) +item(tt(umask) [ tt(-S) ] [ var(mask) ])( +The umask is set to var(mask). var(mask) can be either +an octal number or a symbolic value as described in manref(chmod)(1). +If var(mask) is omitted, the current value is printed. The tt(-S) +option causes the mask to be printed as a symbolic value. Otherwise, +the mask is printed as an octal number. Note that in +the symbolic form the permissions you specify are those which are to be +allowed (not denied) to the users specified. +) +cindex(aliases, removing) +alias(unalias)(unhash -a) +cindex(functions, removing) +alias(unfunction)(unhash -f) +findex(unhash) +item(tt(unhash) [ tt(-adfm) ] var(name) ...)( +Remove the element named var(name) from an internal hash table. The +default is remove elements from the command hash table. The tt(-a) +option causes tt(unhash) to remove aliases. The tt(-f) option causes +tt(unhash) to remove shell functions. The tt(-d) options causes +tt(unhash) to remove named directories. If the tt(-m) flag is given +the arguments are taken as patterns (should be quoted) and all elements +of the corresponding hash table with matching names will be removed. +) +findex(unlimit) +cindex(resource limits) +cindex(limits, resource) +item(tt(unlimit) [ tt(-hs) ] var(resource) ...)( +The resource limit for each var(resource) is set to the hard limit. +If the tt(-h) flag is given and the shell has appropriate privileges, +the hard resource limit for each var(resource) is removed. +The resources of the shell process are only changed if the tt(-s) +flag is given. +) +findex(unset) +cindex(parameters, unsetting) +item(tt(unset) [ tt(-fm) ] var(name) ...)( +Each named parameter is unset. +Local parameters remain local even if unset; they appear unset within scope, +but the previous value will still reappear when the scope ends. + +If the tt(-m) flag is specified the +arguments are taken as patterns (should be quoted) and all parameters +with matching names are unset. tt(unset -f) is equivalent to +tt(unfunction). +) +findex(unsetopt) +cindex(options, unsetting) +item(tt(unsetopt) [ {tt(PLUS())|tt(-)}var(options) | \ +{tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])( +Unset the options for the shell. All options specified either +with flags or by name are unset. If no arguments are supplied, +the names of all options currently unset are printed. +If the tt(-m) flag is given the arguments are taken as patterns +(which should be quoted to preserve them from being interpreted as glob +patterns), and all options with names matching these patterns are unset. +) +findex(wait) +cindex(waiting for jobs) +cindex(jobs, waiting for) +item(tt(wait) [ var(job) ... ])( +Wait for the specified jobs or processes. If var(job) is not given +then all currently active child processes are waited for. +Each var(job) can be either a job specification or the process ID +of a job in the job table. +The exit status from this command is that of the job waited for. +) +findex(whence) +item(tt(whence) [ tt(-vcwfpams) ] var(name) ...)( +For each name, indicate how it would be interpreted if used as a +command name. + +startitem() +item(tt(-v))( +Produce a more verbose report. +) +item(tt(-c))( +Print the results in a bf(csh)-like format. +This takes precedence over tt(-v). +) +item(tt(-w))( +For each var(name), print `var(name)tt(:) var(word)' where var(word) +is one of tt(alias), tt(builtin), tt(command), tt(function), +tt(hashed), tt(reserved) or tt(none), according as var(name) +corresponds to an alias, a built-in command, an external command, a +shell function, a command defined with the tt(hash) builtin, a +reserved word, or is not recognised. This takes precedence over +tt(-v) and tt(-c). +) +item(tt(-f))( +Causes the contents of a shell function to be +displayed, which would otherwise not happen unless the tt(-c) +flag were used. +) +item(tt(-p))( +Do a path search for var(name) +even if it is an alias, reserved word, shell function or builtin. +) +item(tt(-a))( +Do a search for all occurrences of var(name) +throughout the command path. +Normally only the first occurrence is printed. +) +item(tt(-m))( +The arguments are taken as patterns (should be +quoted), and the information is displayed for each command matching one +of these patterns. +) +item(tt(-s))( +If a pathname contains symlinks, print the symlink-free pathname as well. +) +enditem() +) +findex(where) +item(tt(where) [ tt(-wpms) ] var(name) ...)( +Equivalent to tt(whence -ca). +) +findex(which) +item(tt(which) [ tt(-wpams) ] var(name) ...)( +Equivalent to tt(whence -c). +) +findex(zmodload) +cindex(modules, loading) +cindex(loading modules) +xitem(tt(zmodload) [ tt(-iL) ] [ var(name) ... ]) +xitem(tt(zmodload) tt(-u) [ tt(-i) ] var(name) ...) +xitem(tt(zmodload) tt(-d) [ tt(-L) ] [ var(name) [ var(dep) ... ] ]) +xitem(tt(zmodload) tt(-du) var(name) [ var(dep) ... ]) +xitem(tt(zmodload) tt(-a) [ tt(-iL) ] [ var(name) [ var(builtin) ... ] ]) +item(tt(zmodload) tt(-au) [ tt(-i) ] var(builtin) ...)( +tt(zmodload) performs operations relating to zsh's loadable modules. +This feature is not available on all operating systems, +or on all installations on a particular operating system. + +In the simplest case, +tt(zmodload) loads a binary module. The module must be in a file with a +name consisting of the specified var(name) followed by a standard suffix, +usually `tt(.so)'. If this can't be found, the var(name) is tried without +the suffix. +If the module to be loaded is already loaded and the tt(-i) +option is given, the duplicate module is ignored. Otherwise +tt(zmodload) prints an error message. + +The var(name)d module is searched for in the same way a command is, using +tt($module_path) instead of tt($path). If var(name) contains a `tt(/)', +it will be used as-is, and a path search will be performed otherwise. +This behaviour can be modified by the tt(PATH_DIRS) option. +cindex(PATH_DIRS, use of) + +With tt(-u), tt(zmodload) unloads modules. The same var(name) +must be given that was given when the module was loaded, but it is not +necessary for the module to exist in the filesystem. +The tt(-i) option suppresses the error if the module is already +unloaded (or was never loaded). + +Each module has a boot and a cleanup function. The module +will not be loaded if its boot function fails. Similarly a module +can only be unloaded if its cleanup function runs successfully. + +Without arguments all currently loaded binary modules are printed. +The tt(-L) option causes this list to be in the form of a series of +tt(zmodload) commands. + +The tt(-d) option can be used to specify module dependencies. +This operation is idempotent regardless of the tt(-i) option. +The modules named in the second and subsequent arguments will be +loaded before the module named in the first argument. + +With tt(-d) and one +argument, all dependencies for that module are listed. With tt(-d) and no +arguments, all module dependencies are listed. +This listing is by default in a Makefile-like format. +The tt(-L) option changes this format to a list of +tt(zmodload -d) commands. + +If tt(-d) and tt(-u) are both used, dependencies are removed. +This operation is idempotent regardless of the tt(-i) option. +If only one argument is given, all dependencies for that module are removed. + +The tt(-a) option defines autoloaded builtins. It defines the +specified var(builtin)s. When any of those builtins is called, the module +specified in the first argument is loaded. If only one argument is given, +one builtin is defined, with the same name as the module. +tt(-i) suppresses the error if the builtin is already defined or +autoloaded, regardless of which module it came from. + +With tt(-a) and no arguments, all +autoloaded builtins are listed, with the module name (if different) +shown in parentheses after the builtin name. The tt(-L) option changes +this format to a list of tt(zmodload -a) commands. + +If tt(-a) is used +together with the tt(-u) option it removes builtins defined with +tt(zmodload -a). This is only possible if the builtin is not yet +loaded. tt(-i) suppresses the error if the builtin is already +removed (or never existed). +) +enditem() diff --git a/Doc/Zsh/compat.yo b/Doc/Zsh/compat.yo new file mode 100644 index 000000000..529bd4557 --- /dev/null +++ b/Doc/Zsh/compat.yo @@ -0,0 +1,69 @@ +texinode(Compatibility)(Prompt Expansion)(Conditional Expressions)(Top) +chapter(Compatibility) +ifzman(\ +sect(Compatibility) +)\ +cindex(compatibility) +cindex(sh, compatibility) +cindex(ksh, compatibility) +Zsh tries to emulate bf(sh) or bf(ksh) when it is invoked as +tt(sh) or tt(ksh) respectively. In this mode the following +parameters are not special and not initialized by the shell: +tt(ARGC), +tt(argv), +tt(cdpath), +tt(fignore), +tt(fpath), +tt(HISTCHARS), +tt(mailpath), +tt(MANPATH), +tt(manpath), +tt(path), +tt(prompt), +tt(PROMPT), +tt(PROMPT2), +tt(PROMPT3), +tt(PROMPT4), +tt(psvar), +tt(status), +tt(watch). + +The usual zsh startup/shutdown scripts are not executed. Login shells +source tt(/etc/profile) followed by tt($HOME/.profile). If the +tt(ENV) environment variable is set on invocation, tt($ENV) is sourced +after the profile scripts. The value of tt(ENV) is subjected to +parameter expansion, command substitution, and arithmetic expansion before +being interpreted as a pathname. Note that the tt(PRIVILEGED) option +also affects the execution of startup files. + +The following options are set if the shell is invoked as tt(sh) or +tt(ksh): +tt(NO_BAD_PATTERN), +tt(NO_BANG_HIST), +tt(NO_BG_NICE), +tt(NO_EQUALS), +tt(NO_FUNCTION_ARGZERO), +tt(GLOB_SUBST), +tt(NO_HUP), +tt(INTERACTIVE_COMMENTS), +tt(KSH_ARRAYS), +tt(NO_MULTIOS), +tt(NO_NOMATCH), +tt(NO_NOTIFY), +tt(POSIX_BUILTINS), +tt(NO_PROMPT_PERCENT), +tt(RM_STAR_SILENT), +tt(SH_FILE_EXPANSION), +tt(SH_GLOB), +tt(SH_OPTION_LETTERS), +tt(SH_WORD_SPLIT). +Additionally the tt(BSD_ECHO) and tt(IGNORE_BRACES) +options are set if zsh is invoked as tt(sh). +Also, the +tt(KSH_OPTION_PRINT), +tt(LOCAL_OPTIONS), +tt(PROMPT_BANG), +tt(PROMPT_SUBST) +and +tt(SINGLE_LINE_ZLE) +options are set if zsh is invoked as tt(ksh). diff --git a/Doc/Zsh/compctl.yo b/Doc/Zsh/compctl.yo new file mode 100644 index 000000000..a78a18fa9 --- /dev/null +++ b/Doc/Zsh/compctl.yo @@ -0,0 +1,526 @@ +texinode(Programmable Completion)(Zsh Modules)(Zsh Line Editor)(Top) +chapter(Programmable Completion) +cindex(completion, programmable) +cindex(completion, controlling) +findex(compctl) +sect(Description) +startlist() +list(tt(compctl) [ tt(-CDT) ] var(options) [ var(command) ... ]) +list(tt(compctl) [ tt(-CDT) ] var(options) \ + [ tt(-x) var(pattern) var(options) tt(-) ... tt(--) ] \ + [ tt(PLUS()) var(options) [ tt(-x) ... tt(--) ] ... [tt(PLUS())] ] \ + [ var(command) ... ]) +list(tt(compctl) tt(-L) [ tt(-CDT) ] [ var(command) ... ]) +list(tt(compctl) tt(PLUS()) var(command) ...) +endlist() + +Control the editor's completion behavior according to the supplied set +of var(options). Various editing commands, notably +tt(expand-or-complete-word), usually bound to tab, will +attempt to complete a word typed by the user, while others, notably +tt(delete-char-or-list), usually bound to ^D in EMACS editing +mode, list the possibilities; tt(compctl) controls what those +possibilities are. They may for example be filenames (the most common +case, and hence the default), shell variables, or words from a +user-specified list. +startmenu() +menu(Command Flags) +menu(Option Flags) +menu(Alternative Completion) +menu(Extended Completion) +menu(Example) +endmenu() +texinode(Command Flags)(Option Flags)()(Programmable Completion) +sect(Command Flags) +Completion of the arguments of a command may be different for each +command or may use the default. The behavior when completing the +command word itself may also be separately specified. These +correspond to the following flags and arguments, all of which (except +for tt(-L)) may be combined with any combination of the +var(options) described subsequently in noderef(Option Flags): + +startitem() +item(var(command) ...)( +controls completion for the named commands, which must be listed last +on the command line. If completion is attempted for a command with a +pathname containing slashes and no completion definition is found, the +search is retried with the last pathname component. Note that aliases +are expanded before the command name is determined unless the +tt(COMPLETE_ALIASES) option is set. Commands should not be combined +with the tt(-C), tt(-D) or tt(-T) flags. +) +item(tt(-C))( +controls completion when the command word itself is being completed. +If no tt(compctl -C) command has been issued, the names of any +executable command (whether in the path or specific to the shell, such +as aliases or functions) are completed. +) +item(tt(-D))( +controls default completion behavior for the arguments of commands not +assigned any special behavior. If no tt(compctl -D) command has +been issued, filenames are completed. +) +item(tt(-T))( +supplies completion flags to be used before any other processing is +done, even those given to specific commands with other compctl +definitions. This is only useful when combined with extended +completion (the tt(-x) flag, see noderef(Extended Completion) below). +Using this flag you can define default behavior +which will apply to all commands without exception, or you can alter +the standard behavior for all commands. For example, if your access +to the user database is too slow and/or it contains too many users (so +that completion after `tt(~)' is too slow to be usable), you can use + +nofill(tt(compctl -Tx 'C[0,*/*]' -f - 's[~]' -k friends -S/)) + +to complete the strings in the array tt(friends) after a `tt(~)'. +The first argument is necessary so that this form of ~-completion is +not tried after the directory name is finished. +) +item(tt(-L))( +lists the existing completion behavior in a manner suitable for +putting into a start-up script; the existing behavior is not changed. +Any combination of the above forms may be specified, otherwise all +defined completions are listed. Any other flags supplied +are ignored. +) +item(em(no argument))( +If no argument is given, tt(compctl) lists all defined completions +in an abbreviated form; with a list of var(options), all completions +with those flags set (not counting extended completion) are listed. +) +endlist() + +If the tt(PLUS()) flag is alone and followed immediately by the var(command) +list, the completion behavior for all the commands in the list is reset to +the default. In other words, completion will subsequently use the +options specified by the tt(-D) flag. +texinode(Option Flags)(Alternative Completion)(Command Flags)(Programmable Completion) +sect(Option Flags) +startlist() +list([ tt(-fcFBdeaRGovNAIOPZEnbjrzu/) ]) +list([ tt(-k) var(array) ] [ tt(-g) var(globstring) ] \ + [ tt(-s) var(subststring) ]) +list([ tt(-K) var(function) ] [ tt(-H) var(num pattern) ]) +list([ tt(-Q) ] [ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ]) +list([ tt(-W) var(file-prefix) ]) +list([ tt(-q) ] [ tt(-X) var(explanation) ] [ tt(-Y) var(explanation) ]) +list([ tt(-y) var(func-or-var) ] [ tt(-l) var(cmd) ] [ tt(-U) ]) +endlist() + +The remaining var(options) specify the type of command arguments +to look for during completion. Any combination of these flags may be +specified; the result is a sorted list of all the possibilities. The +options are as follows. +startmenu() +menu(Simple Flags) +menu(Flags with Arguments) +menu(Control Flags) +endmenu() +texinode(Simple Flags)(Flags with Arguments)()(Option Flags) +subsect(Simple Flags) +These produce completion lists made up by the shell itself: + +startitem() +item(tt(-f))( +Filenames and filesystem paths. +) +item(tt(-/))( +Just filesystem paths. +) +item(tt(-c))( +Command names, including aliases, shell functions, builtins +and reserved words. +) +item(tt(-F))( +Function names. +) +item(tt(-B))( +Names of builtin commands. +) +item(tt(-m))( +Names of external commands. +) +item(tt(-w))( +Reserved words. +) +item(tt(-a))( +Alias names. +) +item(tt(-R))( +Names of regular (non-global) aliases. +) +item(tt(-G))( +Names of global aliases. +) +item(tt(-d))( +This can be combined with tt(-F), tt(-B), tt(-w), +tt(-a), tt(-R) and tt(-G) to get names of disabled +functions, builtins, reserved words or aliases. +) +item(tt(-e))( +This option (to show enabled commands) is in effect by default, but +may be combined with tt(-d); tt(-de) in combination with +tt(-F), tt(-B), tt(-w), tt(-a), tt(-R) and tt(-G) +will complete names of functions, builtins, reserved words or aliases +whether or not they are disabled. +) +item(tt(-o))( +Names of shell options (see +ifzman(zmanref(zshoptions))\ +ifnzman(noderef(Options))\ +). +) +item(tt(-v))( +Names of any variable defined in the shell. +) +item(tt(-N))( +Names of scalar (non-array) parameters. +) +item(tt(-A))( +Array names. +) +item(tt(-I))( +Names of integer variables. +) +item(tt(-O))( +Names of read-only variables. +) +item(tt(-p))( +Names of parameters used by the shell (including special parameters). +) +item(tt(-Z))( +Names of shell special parameters. +) +item(tt(-E))( +Names of environment variables. +) +item(tt(-n))( +Named directories. +) +item(tt(-b))( +Key binding names. +) +item(tt(-j))( +Job names: the first word of the job leader's command line. This is useful +with the tt(kill) builtin. +) +item(tt(-r))( +Names of running jobs. +) +item(tt(-z))( +Names of suspended jobs. +) +item(tt(-u))( +User names. +) +enditem() +texinode(Flags with Arguments)(Control Flags)(Simple Flags)(Option Flags) +subsect(Flags with Arguments) +These have user supplied arguments to determine how the list of +completions is to be made up: + +startitem() +item(tt(-k) var(array))( +Names taken from the elements of tt($)var(array) (note that the `tt($)' +does not appear on the command line). +Alternatively, the argument var(array) itself may be a set +of space- or comma-separated values in parentheses, in which any +delimiter may be escaped with a backslash; in this case the argument +should be quoted. For example, + +nofill(tt(compctl -k "(cputime filesize datasize stacksize + coredumpsize resident descriptors)" limit)) +) +item(tt(-g) var(globstring))( +The var(globstring) is expanded using filename globbing; it should be +quoted to protect it from immediate expansion. The resulting +filenames are taken as the possible completions. Use `tt(*(/))' instead of +`tt(*/)' for directories. The tt(fignore) special parameter is not +applied to the resulting files. More than one pattern may be given +separated by blanks. (Note that brace expansion is em(not) part of +globbing. Use the syntax `tt((either|or))' to match alternatives.) +) +item(tt(-s) var(subststring))( +The var(subststring) is split into words and these words are than +expanded using all shell expansion mechanisms (see +ifzman(zmanref(zshexpn))\ +ifnzman(noderef(Expansion))\ +). The resulting words are taken as possible +completions. The tt(fignore) special parameter is not applied to the +resulting files. Note that tt(-g) is faster for filenames. +) +item(tt(-K) var(function))( +Call the given function to get the completions. The function is +passed two arguments: the prefix and the suffix of the word on which +completion is to be attempted, in other words those characters before +the cursor position, and those from the cursor position onwards. The +whole command line can be accessed with the tt(-c) and tt(-l) flags +of the tt(read) builtin. The +function should set the variable tt(reply) to an array containing +the completions (one completion per element); note that tt(reply) +should not be made local to the function. From such a function the +command line can be accessed with the tt(-c) and tt(-l) flags to +the tt(read) builtin. For example, + +nofill(tt(function whoson { reply=(`users`); } +compctl -K whoson talk)) + +completes only logged-on users after `tt(talk)'. Note that `tt(whoson)' must +return an array, so `tt(reply=`users`)' would be incorrect. +) +item(tt(-H) var(num pattern))( +The possible completions are taken from the last var(num) history +lines. Only words matching var(pattern) are taken. If var(num) is +zero or negative the whole history is searched and if var(pattern) is +the empty string all words are taken (as with `tt(*)'). A typical +use is + +nofill(tt(compctl -D -f PLUS() -H 0 '')) + +which forces completion to look back in the history list for a word if +no filename matches. +) +enditem() +texinode(Control Flags)()(Flags with Arguments)(Option Flags) +subsect(Control Flags) +These do not directly specify types of name to be completed, but +manipulate the options that do: + +startitem() +item(tt(-Q))( +This instructs the shell not to quote any metacharacters in the possible +completions. Normally the results of a completion are inserted into +the command line with any metacharacters quoted so that they are +interpreted as normal characters. This is appropriate for filenames +and ordinary strings. However, for special effects, such as inserting +a backquoted expression from a completion array (tt(-k)) so that +the expression will not be evaluated until the complete line is +executed, this option must be used. +) +item(tt(-P) var(prefix))( +The var(prefix) is inserted just before the completed string; any +initial part already typed will be completed and the whole var(prefix) +ignored for completion purposes. For example, + +nofill(tt(compctl -j -P "%" kill)) + +inserts a `%' after the kill command and then completes job names. +) +item(tt(-S) var(suffix))( +When a completion is found the var(suffix) is inserted after +the completed string. In the case of menu completion the suffix is +inserted immediately, but it is still possible to cycle through the +list of completions by repeatedly hitting the same key. +) +item(tt(-W) var(file-prefix))( +With directory var(file-prefix): for command, file, directory and +globbing completion (options tt(-c), tt(-f), tt(-/), tt(-g)), the file +prefix is implicitly added in front of the completion. For example, + +nofill(tt(compctl -/ -W ~/Mail maildirs)) + +completes any subdirectories to any depth beneath the directory +tt(~/Mail), although that prefix does not appear on the command line. +) +item(tt(-q))( +If used with a suffix as specified by the tt(-S) option, this +causes the suffix to be removed if the next character typed is a blank +or does not insert anything (the same rule as used for the +tt(AUTO_REMOVE_SLASH) option). The option is most useful for list +separators (comma, colon, etc.). +) +item(tt(-l) var(cmd))( +This option cannot be combined with any other. It restricts the range +of command line words that are considered to be arguments. If +combined with one of the extended completion patterns `tt(p[)...tt(])', +`tt(r[)...tt(])', or `tt(R[)...tt(])' (see noderef(Extended Completion) +below) the range is restricted to the range of arguments +specified in the brackets. Completion is then performed as if these +had been given as arguments to the var(cmd) supplied with the +option. If the var(cmd) string is empty the first word in the range +is instead taken as the command name, and command name completion +performed on the first word in the range. For example, + +nofill(tt(compctl -x 'r[-exec,;]' -l '' -- find)) + +completes arguments between `tt(-exec)' and the following `tt(;)' (or the end +of the command line if there is no such string) as if they were +a separate command line. +) +item(tt(-U))( +Use the whole list of possible completions, whether or not they +actually match the word on the command line. The word typed so far +will be deleted. This is most useful with a function (given by the +tt(-K) option) which can examine the word components passed to it +(or via the tt(read) builtin's tt(-c) and tt(-l) flags) and +use its own criteria to decide what matches. If there is no +completion, the original word is retained. +) +item(tt(-y) var(func-or-var))( +The list provided by var(func-or-var) is displayed instead of the list +of completions whenever a listing is required; the actual completions +to be inserted are not affected. It can be provided in two +ways. Firstly, if var(func-or-var) begins with a tt($) it defines a +variable, or if it begins with a left parenthesis a literal +array, which contains the list. A variable may have been set by a +call to a function using the tt(-K) option. Otherwise it contains the +name of a function which will be executed to create the list. The +function will be passed as an argument list all matching completions, +including prefixes and suffixes expanded in full, and should set the +array var(reply) to the result. In both cases, the display list will +only be retrieved after a complete list of matches has been created. + +Note that the returned list does not have to correspond, even in +length, to the original set of matches, and may be passed as a scalar +instead of an array. No special formatting of characters is +performed on the output in this case; in particular, newlines are +printed literally and if they appear output in columns is suppressed. +) +item(tt(-X) var(explanation))( +Print var(explanation) when trying completion on the current set of +options. A `tt(%n)' in this string is replaced by the number of matches. +The explanation only appears if completion was tried and there was +no unique match, or when listing completions. +) +item(tt(-Y) var(explanation))( +Identical to tt(-X), except that the var(explanation) first undergoes +expansion following the usual rules for strings in double quotes. +The expansion will be carried out after any functions are called for +the tt(-K) or tt(-y) options, allowing them to set variables. +) +enditem() +texinode(Alternative Completion)(Extended Completion)(Option Flags)(Programmable Completion) +sect(Alternative Completion) +startlist() +list(tt(compctl) [ tt(-CDT) ] var(options) tt(PLUS()) var(options) [ tt(PLUS()) ... ] \ +[ tt(PLUS()) ] var(command) ...) +endlist() + +The form with `tt(PLUS())' specifies alternative options. Completion is +tried with the options before the first `tt(PLUS())'. If this produces no +matches completion is tried with the flags after the `tt(PLUS())' and so on. If +there are no flags after the last `tt(PLUS())' and a match has not been found +up to that point, default completion is tried. +texinode(Extended Completion)(Example)(Alternative Completion)(Programmable Completion) +sect(Extended Completion) +startlist() +list(tt(compctl) [ tt(-CDT) ] var(options) \ +tt(-x) var(pattern) var(options) tt(-) ... tt(--) \ +[ var(command) ... ]) +list(tt(compctl) [ tt(-CDT) ] var(options) \ +[ tt(-x) var(pattern) var(options) tt(-) ... tt(--) ] \ +[ tt(PLUS()) var(options) [ tt(-x) ... tt(--) ] ... [tt(PLUS())] ] \ +[ var(command) ... ]) +endlist() + +The form with `tt(-x)' specifies extended completion for the +commands given; as shown, it may be combined with alternative +completion using `tt(PLUS())'. Each var(pattern) is examined in turn; when a +match is found, the corresponding var(options), as described in +noderef(Option Flags) above, are used to generate possible +completions. If no var(pattern) matches, the var(options) given +before the tt(-x) are used. + +Note that each pattern should be supplied as a single argument and +should be quoted to prevent expansion of metacharacters by the +shell. + +A var(pattern) is built of sub-patterns separated by commas; it +matches if at least one of these sub-patterns matches (they are +`or'ed). These sub-patterns are in turn composed of other +sub-patterns separated by white spaces which match if all of the +sub-patterns match (they are `and'ed). An element of the +sub-patterns is of the form `var(c)tt([)...tt(][)...tt(])', where the pairs of +brackets may be repeated as often as necessary, and matches if any of +the sets of brackets match (an `or'). The example below makes this +clearer. + +The elements may be any of the following: + +startitem() +item(tt(s[)var(string)tt(])...)( +Matches if the current word on the command line starts with +one of the strings given in brackets. The var(string) is not removed +and is not part of the completion. +) +item(tt(S[)var(string)tt(])...)( +Like tt(s[)var(string)tt(]) except that the var(string) is part of the +completion. +) +item(tt(p[)var(from)tt(,)var(to)tt(])...)( +Matches if the number of the current word is between one of +the var(from) and var(to) pairs inclusive. The comma and var(to) +are optional; var(to) defaults to the same value as var(from). The +numbers may be negative: tt(-)var(n) refers to the var(n)'th last word +on the line. +) +item(tt(c[)var(offset)tt(,)var(string)tt(])...)( +Matches if the var(string) matches the word offset by +var(offset) from the current word position. Usually var(offset) +will be negative. +) +item(tt(C[)var(offset)tt(,)var(pattern)tt(])...)( +Like tt(c) but using pattern matching instead. +) +item(tt(w[)var(index)tt(,)var(string)tt(])...)( +Matches if the word in position var(index) is equal +to the corresponding var(string). Note that the word count is made +after any alias expansion. +) +item(tt(W[)var(index)tt(,)var(pattern)tt(])...)( +Like tt(w) but using pattern matching instead. +) +item(tt(n[)var(index)tt(,)var(string)tt(])...)( +Matches if the current word contains var(string). Anything up to and +including the var(index)th occurrence of this string will not be +considered part of the completion, but the rest will. var(index) may +be negative to count from the end: in most cases, var(index) will be +1 or -1. For example, + +nofill(tt(compctl -s '`users`' -x 'n[1,@]' -k hosts -- talk)) + +will usually complete usernames, but if you insert an tt(@) after the +name, names from the array var(hosts) (assumed to contain hostnames, +though you must make the array yourself) will be completed. Other +commands such as tt(rcp) can be handled similarly. +) +item(tt(N[)var(index)tt(,)var(string)tt(])...)( +Like tt(n) except that the string will be +taken as a character class. Anything up to and including the +var(index)th occurrence of any of the characters in var(string) +will not be considered part of the completion. +) +item(tt(m[)var(min)tt(,)var(max)tt(])...)( +Matches if the total number of words lies between var(min) and +var(max) inclusive. +) +item(tt(r[)var(str1)tt(,)var(str2)tt(])...)( +Matches if the cursor is after a word with prefix var(str1). If there +is also a word with prefix var(str2) on the command line it matches +only if the cursor is before this word. +) +item(tt(R[)var(str1)tt(,)var(str2)tt(])...)( +Like tt(r) but using pattern matching instead. +) +enditem() +texinode(Example)()(Extended Completion)(Programmable Completion) +sect(Example) +nofill(tt(compctl -u -x 's[tt(PLUS())] c[-1,-f],s[-f+PLUS()]' -g '~/Mail/*(:t)' \ + - 's[-f],c[-1,-f]' -f -- mail)) + +This is to be interpreted as follows: + +If the current command is tt(mail), then + +indent( +if ((the current word begins with tt(PLUS()) and the previous word is tt(-f)) +or (the current word begins with tt(-f+PLUS()))), then complete the +non-directory part (the `tt(:t)' glob modifier) of files in the directory +tt(~/Mail); else + +if the current word begins with tt(-f) or the previous word was tt(-f), then +complete any file; else + +complete user names. +) diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo new file mode 100644 index 000000000..0ff49b187 --- /dev/null +++ b/Doc/Zsh/cond.yo @@ -0,0 +1,158 @@ +texinode(Conditional Expressions)(Compatibility)(Arithmetic Evaluation)(Top) +chapter(Conditional Expressions) +ifzman(\ +sect(Conditional Expressions) +)\ +cindex(conditional expressions) +cindex(expressions, conditional) +A em(conditional expression) is used with the tt([[) +compound command to test attributes of files and to compare strings. +Each expression can be constructed from one or more +of the following unary or binary expressions: + +startitem() +item(tt(-a) var(file))( +true if var(file) exists. +) +item(tt(-b) var(file))( +true if var(file) exists and is a block special file. +) +item(tt(-c) var(file))( +true if var(file) exists and is a character special file. +) +item(tt(-d) var(file))( +true if var(file) exists and is a directory. +) +item(tt(-e) var(file))( +true if var(file) exists. +) +item(tt(-f) var(file))( +true if var(file) exists and is a regular file. +) +item(tt(-g) var(file))( +true if var(file) exists and has its setgid bit set. +) +item(tt(-h) var(file))( +true if var(file) exists and is a symbolic link. +) +item(tt(-k) var(file))( +true if var(file) exists and has its sticky bit set. +) +item(tt(-n) var(string))( +true if length of var(string) is non-zero. +) +item(tt(-o) var(option))( +true if option named var(option) is on. var(option) +may be a single character, in which case it is a single letter option name. +(See noderef(Specifying Options).) +) +item(tt(-p) var(file))( +true if var(file) exists and is a FIFO special file (named pipe). +) +item(tt(-r) var(file))( +true if var(file) exists and is readable by current process. +) +item(tt(-s) var(file))( +true if var(file) exists and has size greater than zero. +) +item(tt(-t) var(fd))( +true if file descriptor number var(fd) +is open and associated with a terminal device. +(note: var(fd) is not optional) +) +item(tt(-u) var(file))( +true if var(file) exists and has its setuid bit set. +) +item(tt(-w) var(file))( +true if var(file) exists and is writable by current process. +) +item(tt(-x) var(file))( +true if var(file) exists and is executable by current process. +If var(file) exists and is a directory, then the current process +has permission to search in the directory. +) +item(tt(-z) var(string))( +true if length of var(string) is zero. +) +item(tt(-L) var(file))( +true if var(file) exists and is a symbolic link. +) +item(tt(-O) var(file))( +true if var(file) exists and is owned by the effective user ID of this process. +) +item(tt(-G) var(file))( +true if var(file) exists and its group matches +the effective group ID of this process. +) +item(tt(-S) var(file))( +true if var(file) exists and is a socket. +) +item(tt(-N) var(file))( +true if var(file) exists and its access time is +not newer than its modification time. +) +item(var(file1) tt(-nt) var(file2))( +true if var(file1) exists and is newer than var(file2). +) +item(var(file1) tt(-ot) var(file2))( +true if var(file1) exists and is older than var(file2). +) +item(var(file1) tt(-ef) var(file2))( +true if var(file1) and var(file2) exist and refer to the same file. +) +xitem(var(string) tt(=) var(pattern)) +item(var(string) tt(==) var(pattern))( +true if var(string) matches var(pattern). +The `tt(==)' form is the preferred one. The `tt(=)' form is for +backward compatibility and should be considered obsolete. +) +item(var(string) tt(!=) var(pattern))( +true if var(string) does not match var(pattern). +) +item(var(string1) tt(<) var(string2))( +true if var(string1) comes before var(string2) +based on ASCII value of their characters. +) +item(var(string1) tt(>) var(string2))( +true if var(string1) comes after var(string2) +based on ASCII value of their characters. +) +item(var(exp1) tt(-eq) var(exp2))( +true if var(exp1) is numerically equal to var(exp2). +) +item(var(exp1) tt(-ne) var(exp2))( +true if var(exp1) is numerically not equal to var(exp2). +) +item(var(exp1) tt(-lt) var(exp2))( +true if var(exp1) is numerically less than var(exp2). +) +item(var(exp1) tt(-gt) var(exp2))( +true if var(exp1) is numerically greater than var(exp2). +) +item(var(exp1) tt(-le) var(exp2))( +true if var(exp1) is numerically less than or equal to var(exp2). +) +item(var(exp1) tt(-ge) var(exp2))( +true if var(exp1) is numerically greater than or equal to var(exp2). +) +item(tt(LPAR()) var(exp) tt(RPAR()))( +true if var(exp) is true. +) +item(tt(!) var(exp))( +true if var(exp) is false. +) +item(var(exp1) tt(&&) var(exp2))( +true if var(exp1) and var(exp2) are both true. +) +item(var(exp1) tt(||) var(exp2))( +true if either var(exp1) or var(exp2) is true. +) +enditem() + +In each of the above expressions, if +var(file) is of the form `tt(/dev/fd/)var(n)', +where var(n) is an integer, +then the test applied to the open file whose +descriptor number is var(n), +even if the underlying system does not support +the tt(/dev/fd) directory. diff --git a/Doc/Zsh/exec.yo b/Doc/Zsh/exec.yo new file mode 100644 index 000000000..0d53b14b8 --- /dev/null +++ b/Doc/Zsh/exec.yo @@ -0,0 +1,25 @@ +texinode(Command Execution)(Functions)(Redirection)(Top) +chapter(Command Execution) +ifzman(\ +sect(Command Execution) +)\ +cindex(command execution) +cindex(execution, of commands) +If a command name contains no slashes, the shell attempts to locate +it. If there exists a shell function by that name, the function +is invoked as described in noderef(Functions). If there exists +a shell builtin by that name, the builtin is invoked. + +vindex(path, use of) +Otherwise, the shell searches each element of tt($path) for a +directory containing an executable file by that name. If the +search is unsuccessful, the shell prints an error message and returns +a nonzero exit status. + +If execution fails because the file is not in executable format, +and the file is not a directory, it is assumed to be a shell +script. tt(/bin/sh) is spawned to execute it. If the program +is a file beginning with `tt(#!)', the remainder of the first line +specifies an interpreter for the program. The shell will +execute the specified interpreter on operating systems that do +not handle this executable format in the kernel. diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo new file mode 100644 index 000000000..99844b42a --- /dev/null +++ b/Doc/Zsh/expn.yo @@ -0,0 +1,1052 @@ +texinode(Expansion)(Parameters)(Restricted Shell)(Top) +chapter(Expansion) +cindex(expansion) +sect(Description) +The types of expansions performed are + +startlist() +list(em(history expansion)) +list(em(alias expansion)) +list(em(process substitution)) +list(em(parameter expansion)) +list(em(command substitution)) +list(em(arithmetic expansion)) +list(em(brace expansion)) +list(em(filename expansion)) +list(em(filename generation)) +endlist() + +Expansion is done in the above specified order in five steps. The +first is em(history expansion), which is only performed in +interactive shells. The next step is em(alias expansion), which is +done right before the command line is parsed. They are followed by +em(process substitution), em(parameter expansion), em(command +substitution), em(arithmetic expansion) and em(brace expansion) +which are performed in one step in left-to-right fashion. After +these expansions, all unquoted occurrences of the characters `tt(\)', +`tt(')' and `tt(")' are removed, and the result is subjected to +em(filename expansion) followed by em(filename generation). + +If the tt(SH_FILE_EXPANSION) option is set, the order of expansion is modified +for compatibility with bf(sh) and bf(ksh). em(Filename expansion) +is performed immediately after em(alias substitution), +preceding the set of five substitutions mentioned above. +startmenu() +menu(History Expansion) +menu(Process Substitution) +menu(Parameter Expansion) +menu(Command Substitution) +menu(Arithmetic Expansion) +menu(Brace Expansion) +menu(Filename Expansion) +menu(Filename Generation) +endmenu() +texinode(History Expansion)(Process Substitution)()(Expansion) +sect(History Expansion) +cindex(history) +cindex(history expansion) +cindex(expansion, history) +History expansion allows you to use words from previous command +lines in the command line you are typing. This simplifies spelling +corrections and the repetition of complicated commands or arguments. +Command lines are saved in the history list, the size of which +is controlled by the tt(HISTSIZE) +vindex(HISTSIZE, use of) +variable. The most recent command is retained in any case. +A history expansion begins with the first character of the +tt(histchars) parameter which is `tt(!)' +by default and may occur anywhere on the command line; history +expansions do not nest. The `tt(!)' can be escaped with `tt(\)' +or can be enclosed between a pair of single quotes (tt('')) to suppress +its special meaning. Double quotes will em(not) work for this. + +Input lines containing history expansions are echoed on the +terminal after being expanded, but before any other +expansions take place or the command gets executed. +startmenu() +menu(Event Designators) +menu(Word Designators) +menu(Modifiers) +endmenu() +texinode(Event Designators)(Word Designators)()(History Expansion) +subsect(Event Designators) +cindex(history event designators) +cindex(event designators, history) +An event designator is a reference to a command-line entry in +the history list. + +startitem() +item(tt(!))( +Start a history expansion, except when followed by a blank, newline, +`tt(=)' or `tt(LPAR())'. +) +item(tt(!!))( +Refer to the previous command. +By itself, this expansion +repeats the previous command. +) +item(tt(!)var(n))( +Refer to command-line var(n). +) +item(tt(!-)var(n))( +Refer to the current command-line minus var(n). +) +item(tt(!)var(str))( +Refer to the most recent command starting with var(str). +) +item(tt(!?)var(str)[tt(?)])( +Refer to the most recent command containing var(str). +) +item(tt(!#))( +Refer to the current command line typed in so far. The line is +treated as if it were complete up to and including the word before the +one with the `tt(!#)' reference. +) +item(tt(!{)...tt(}))( +Insulate a history reference from adjacent characters (if necessary). +) +enditem() +texinode(Word Designators)(Modifiers)(Event Designators)(History Expansion) +subsect(Word Designators) +cindex(history word designators) +cindex(word designators, history) +A word designator indicates which word or words of a given command line will +be included in a history reference. A `tt(:)' +separates the event specification from the word designator. +It can be omitted if the word designator begins with a +`tt(^)', `tt($)', `tt(*)', `tt(-)' or `tt(%)'. +Word designators include: + +startsitem() +sitem(tt(0))(The first input word (command).) +sitem(var(n))(The var(n)th argument.) +sitem(tt(^))(The first argument. That is, tt(1).) +sitem(tt($))(The last argument.) +sitem(tt(%))(The word matched by (the most recent) tt(?)var(str) search.) +sitem(var(x)tt(-)var(y))(A range of words; var(x) defaults to tt(0).) +sitem(tt(*))(All the arguments, or a null value if there are none.) +sitem(var(x)tt(*))(Abbreviates `var(x)tt(-$)'.) +sitem(var(x)tt(-))(Like `var(x)tt(*)' but omitting word tt($).) +endsitem() + +Note that a `tt(%)' word designator will only work when used as +`tt(!%)', `tt(!:%)' or `tt(!?)var(str)tt(?:%)', +and only when used after a tt(!?) expansion. Anything else will result +in an error, although the error may not be the most obvious one. +texinode(Modifiers)()(Word Designators)(History Expansion) +subsect(Modifiers) +cindex(modifiers, history) +cindex(history modifiers) +After the optional word designator, you can add +a sequence of one or more of the following modifiers, +each preceded by a `tt(:)'. These modifiers also work on the result +of em(filename generation) and em(parameter expansion), except where +noted. + +startitem() +item(tt(h))( +Remove a trailing pathname component, leaving the head. +) +item(tt(r))( +Remove a trailing suffix of the form `tt(.)var(xxx)', leaving the basename. +) +item(tt(e))( +Remove all but the suffix. +) +item(tt(t))( +Remove all leading pathname components, leaving the tail. +) +item(tt(p))( +Print the new command but do not execute it. Only works with history +expansion. +) +item(tt(q))( +Quote the substituted words, escaping further substitutions. Only +works with history expansion. +) +item(tt(x))( +Like tt(q), but break into words at each blank. +) +item(tt(l))( +Convert the words to all lowercase. +) +item(tt(u))( +Convert the words to all uppercase. +) +item(tt(f))( +(This and the following +tt(F), tt(w) and tt(W) modifier only work with parameter and +filename expansion.) +Repeats the immediately (without a colon) following modifier until the +resulting word doesn't change any more. +) +item(tt(F:)var(expr)tt(:))( +Like tt(f), but repeats only var(n) times if the expression +var(expr) evaluates to var(n). Any character can be used instead of +the `tt(:)', if any of `tt(LPAR())', `tt([)', or `tt({)' +is used as the opening delimiter +the second one has to be 'tt(RPAR())', `tt(])', or `tt(})' respectively. +) +item(tt(w))( +Makes the immediately following modifier work on each word in the +string. +) +item(tt(W:)var(sep)tt(:))( +Like tt(w) but words are considered to be the parts of the string +that are separated by var(sep). Any character can be used instead of +the `tt(:)'; opening parentheses are handled specially, see above. +) +item(tt(s/)var(l)tt(/)var(r)[tt(/)])( +Substitute var(r) for var(l) as described below. +Unless preceded immediately by a tt(g), with no colon between, +the substitution is done only for the +first string that matches var(l). For arrays and filename +expansion, this applies to each word of the expanded text. +) +item(tt(&))( +Repeat the previous tt(s) substitution. Like tt(s), may be preceded +immediately by a tt(g). In variable expansion the tt(&) must appear +inside braces, and in filename expansion it must be quoted with a +backslash. +) +enditem() + +The tt(s/l/r/) substitution works as follows. The left-hand side of +substitutions are not regular expressions, but character strings. Any +character can be used as the delimiter in place of `tt(/)'. A +backslash quotes the delimiter character. The character `tt(&)', in +the right-hand-side var(r), is replaced by the text from the +left-hand-side var(l). The `tt(&)' can be quoted with a backslash. A +null var(l) uses the previous string either from the previous var(l) +or from the contextual scan string var(s) from `tt(!?)var(s)'. You can +omit the rightmost delimiter if a newline immediately follows var(r); +the rightmost `tt(?)' in a context scan can similarly be omitted. +Note the same record of the last var(l) and var(r) is maintained +across all forms of expansion. + +By default, a history reference with no event specification refers to the same +line as the last history reference on that command line, unless it is the +first history reference in a command. In that case, a history reference +with no event specification always refers to the previous command. However, +if the option tt(CSH_JUNKIE_HISTORY) is set, +pindex(CSH_JUNKIE_HISTORY, use of) +then history reference with no +event specification will em(always) refer to the previous command. + +For example, `tt(!!:1)' +will always refer to the first word of the previous command, and `tt(!!$)' +will always refer to the last word of the previous command. And with +tt(CSH_JUNKIE_HISTORY) set, then `tt(!:1)' and `tt(!$)' +will function in the same manner as `tt(!!:1)' and `tt(!!$)', +respectively. However, if tt(CSH_JUNKIE_HISTORY) is unset, then +`tt(!:1)' and `tt(!$)' +will refer to the first and last words respectively, of the last command +referenced on the current command line. However, if they are the first history +reference on the command line, then they refer to the previous command. + +The character sequence `tt(^)var(foo)tt(^)var(bar)' +repeats the last command, replacing the string var(foo) with var(bar). + +If the shell encounters the character sequence `tt(!")' +in the input, the history mechanism is temporarily disabled until +the current list is fully parsed. The `tt(!")' +is removed from the input, and any subsequent `tt(!)' +characters have no special significance. + +A less convenient but more comprehensible +form of command history support +is provided by the tt(fc) builtin. +findex(fc, use of) +texinode(Process Substitution)(Parameter Expansion)(History Expansion)(Expansion) +sect(Process Substitution) +cindex(process substitution) +cindex(substitution, process) +Each command argument of the form +`tt(LPAR())var(list)tt(RPAR())' or +`tt(=LPAR())var(list)tt(RPAR())' +is subject to process substitution. +In the case of the tt(<) or tt(>) forms, the shell will run process +var(list) asynchronously, connected to a named pipe (FIFO). +The name of this pipe will become the argument to the command. +If the form with tt(>) +is selected then writing on this file will provide input for var(list). +If tt(<) is used, then the file passed as an argument will +be a named pipe connected to the output of the var(list) process. +For example, + +nofill(tt(paste LPAR())var(process1)tt(RPAR() >LPAR())var(process2)tt(RPAR() >/dev/null)) + +cuts fields 1 and 3 from the files var(file1) and var(file2) respectively, +pastes the results together, and sends it to the processes +var(process1) and var(process2). +Note that the file, which is passed as an argument to the command, +is a system pipe, so programs that expect to lseek (see manref(lseek)(2)) +on the file will not work. +Also note that the previous example can be more compactly and +efficiently written as: + +nofill(tt(paste >LPAR())var(process1)tt(RPAR() > >LPAR())var(process2)tt(RPAR())) + +The shell uses pipes instead of FIFOs to implement the latter +two process substitutions in the above example. + +If tt(=) is used, +then the file passed as an argument will be the name +of a temporary file containing the output of the var(list) +process. This may be used instead of the tt(<) +form for a program that expects to lseek (see manref(lseek)(2)) +on the input file. +texinode(Parameter Expansion)(Command Substitution)(Process Substitution)(Expansion) +sect(Parameter Expansion) +cindex(parameter expansion) +cindex(expansion, parameter) +The character `tt($)' is used to introduce parameter expansions. +See +ifzman(\ +zmanref(zshparam) +)\ +ifnzman(\ +noderef(Parameters) +)\ +for a description of parameters. +In the expansions discussed below that require a pattern, the form of +the pattern is the same as that used for filename generation; +see noderef(Filename Generation). In addition to the following +operations, the file modifiers described in +noderef(Modifiers) in noderef(History Expansion) can be +applied: for example, tt(${i:s/foo/bar/}) performs string +substitution on the value of parameter tt($i). + +startitem() +item(tt(${)var(name)tt(}))( +The value, if any, of the parameter var(name) is substituted. +The braces are required if var(name) is followed by +a letter, digit, or underscore that is not to be interpreted +as part of its name. + +If var(name) is an array parameter, then the values of each +element of var(name) is substituted, one element per word. +Otherwise, the expansion results in one word only; no field +splitting is done on the result unless the tt(SH_WORD_SPLIT) +option is set. +) +item(tt(${PLUS())var(name)tt(}))( +If var(name) is the name of a set parameter `tt(1)' is substituted, +otherwise `tt(0)' is substituted. +) +item(tt(${)var(name)tt(:-)var(word)tt(}))( +If var(name) is set and is non-null then substitute its +value; otherwise substitute var(word). If var(name) is +missing, substitute var(word). +) +item(tt(${)var(name)tt(:=)var(word)tt(}))( +If var(name) is unset or is null then +set it to var(word); the value of the parameter is then +substituted. +) +item(tt(${)var(name)tt(:?)var(word)tt(}))( +If var(name) is set and is non-null, then substitute +its value; otherwise, print var(word) and exit from the shell. +If var(word) is omitted, then a standard message is printed. +) +item(tt(${)var(name)tt(:PLUS())var(word)tt(}))( +If var(name) is set and is non-null then substitute +var(word); otherwise substitute nothing. +) +enditem() + +If the colon is omitted from one of the above expressions +containing a colon, then the shell only checks whether +var(name) is set or not, not whether it is null. + +startitem() +item(tt(${)var(name)tt(::=)var(word)tt(}))( +Set var(name) to var(word); the value of the parameter is then +substituted. +) +xitem(tt(${)var(name)tt(#)var(pattern)tt(})) +item(tt(${)var(name)tt(##)var(pattern)tt(}))( +If the var(pattern) matches the beginning of the value of +var(name), then substitute the value of var(name) with +the matched portion deleted; otherwise, just +substitute the value of var(name). In the first +form, the smallest matching pattern is preferred; +in the second form, the largest matching pattern is +preferred. If var(name) is an array and the substitution +is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax +is used, matching is performed on each array elements separately. +) +xitem(tt(${)var(name)tt(%)var(pattern)tt(})) +item(tt(${)var(name)tt(%%)var(pattern)tt(}))( +If the var(pattern) matches the end of the value of +var(name), then substitute the value of var(name) with +the matched portion deleted; otherwise, just +substitute the value of var(name). In the first +form, the smallest matching pattern is preferred; +in the second form, the largest matching pattern is +preferred. If var(name) is an array and the substitution +is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax +is used, matching is performed on each array elements separately. +) +item(tt(${)var(name)tt(:#)var(pattern)tt(}))( +If the var(pattern) matches the value of var(name), then substitute +the empty string; otherwise, just substitute the value of var(name). +If var(name) is an array and the substitution +is not quoted or the tt((@)) flag or the `var(name)tt([@])' syntax +is used, matching is performed on each array elements separately, and +the matched array elements are removed (use the tt((M)) flag to +remove the non-matched elements). +) +item(tt(${#)var(spec)tt(}))( +If var(spec) is one of the above substitutions, substitute +the length in characters of the result instead of +the result itself. If var(spec) is an array expression, +substitute the number of elements of the result. +) +item(tt(${^)var(spec)tt(}))( +pindex(RC_EXPAND_PARAM, use of) +cindex(array expansion style, rc) +cindex(rc, array expansion style) +Turn on the tt(RC_EXPAND_PARAM) option for the +evaluation of var(spec); if the `tt(^)' is doubled, turn it off. +When this option is set, array expansions of the form +`var(foo)tt(${)var(xx)tt(})var(bar)', +where the parameter var(xx) +is set to tt(LPAR())var(a b c)tt(RPAR()), are substituted with +`var(fooabar foobbar foocbar)' instead of the default +`var(fooa b cbar)'. + +Internally, each such expansion is converted into the +equivalent list for brace expansion. E.g., tt(${^var}) becomes +tt({$var[1],$var[2],)...tt(}), and is processed as described in +noderef(Brace Expansion) above. +If word splitting is also in effect the +tt($var[)var(N)tt(]) may themselves be split into different list +elements. +) +item(tt(${=)var(spec)tt(}))( +pindex(SH_WORD_SPLIT, use of) +cindex(field splitting, sh style) +cindex(sh, field splitting style) +Turn on the tt(SH_WORD_SPLIT) option for the +evaluation of var(spec); if the `tt(=)' is doubled, turn it off. +vindex(IFS, use of) +When this option is set, parameter values are split into +separate words using tt(IFS) as a delimiter +before substitution. +This is done by default in most other shells. +) +item(tt(${~)var(spec)tt(}))( +pindex(GLOB_SUBST) +Turn on the tt(GLOB_SUBST) option for the evaluation of +var(spec); if the `tt(~)' is doubled, turn it off. When this option is +set, any pattern characters resulting +from the substitution become eligible for file expansion and filename +generation. +) +enditem() + +If a tt(${)...tt(}) type parameter expression or a +tt($LPAR())...tt(RPAR()) type command substitution is used in place of +var(name) above, it is substituted first and the result is used as if +it were the value of var(name). Thus it is +possible to perform nested operations: tt(${${foo#head}%tail}) +substitues the value of tt($foo) with both tt(head) and tt(tail) +deleted. The form with tt($LPAR())...tt(RPAR()) is often useful in +combination with the flags described next; see the example below. +subsect(Parameter Expansion Flags) +cindex(parameter expansion flags) +cindex(flags, parameter expansion) +cindex(expansion, parameter, flags) +If the opening brace is directly followed by an opening parenthesis, +the string up to the matching closing parenthesis will be taken as a +list of flags. Where arguments are valid, any character, or the +matching pairs `tt(LPAR())...tt(RPAR())', `tt({)...tt(})', +`tt([)...tt(])', or `tt(<)...tt(>)', may be used +in place of the colon as delimiters. The following flags are supported: + +startitem() +item(tt(A))( +Create an array parameter with +tt(${)...tt(:=)...tt(}) or tt(${)...tt(::=)...tt(}). +Assignment is made before sorting or padding. +) +item(tt(@))( +In double quotes, array elements are put into separate words. +E.g., `tt("${(@)foo}")' is equivalent to `tt("${foo[@]}")' and +`tt("${(@)foo[1,2]}")' is the same as `tt("$foo[1]" "$foo[2]")'. +) +item(tt(e))( +Perform em(parameter expansion), em(command substitution) and +em(arithmetic expansion) on the result. Such expansions can be +nested but too deep recursion may have unpredictable effects. +) +item(tt(o))( +Sort the resulting words in ascending order. +) +item(tt(O))( +Sort the resulting words in descending order. +) +item(tt(i))( +With tt(o) or tt(O), sort case-independently. +) +item(tt(L))( +Convert all letters in the result to lower case. +) +item(tt(U))( +Convert all letters in the result to upper case. +) +item(tt(C))( +Capitalize the resulting words. +) +item(tt(c))( +With tt(${#)var(name)tt(}), count the total number of characters in an array, +as if the elements were concatenated with spaces between them. +) +item(tt(w))( +With tt(${#)var(name)tt(}), count words in arrays or strings; the tt(s) +flag may be used to set a word delimiter. +) +item(tt(W))( +Similar to tt(w) with the difference that empty words between +repeated delimiters are also counted. +) +item(tt(p))( +Recognize the same escape sequences as the tt(print) builtin +in string arguments to subsequent flags. +) +item(tt(l:)var(expr)tt(::)var(string1)tt(::)var(string2)tt(:))( +Pad the resulting words on the left. Each word will be truncated if +required and placed in a field var(expr) characters wide. The space +to the left will be filled with var(string1) (concatenated as often +as needed) or spaces if var(string1) is not given. If both +var(string1) and var(string2) are given, this string will be placed +exactly once directly to the left of the resulting word. +) +item(tt(r:)var(expr)tt(::)var(string1)tt(::)var(string2)tt(:))( +As tt(l), but pad the words on the right. +) +item(tt(j:)var(string)tt(:))( +Join the words of arrays together using var(string) as a separator. +pindex(SH_WORD_SPLIT, use of) +Note that this occurs before field splitting by the tt(SH_WORD_SPLIT) +option. +) +item(tt(F))( +Join the words of arrays together using newline as a separator. +This is a shorthand for `tt(pj:\n:)'. +) +item(tt(s:)var(string)tt(:))( +Force field splitting (see the option tt(SH_WORD_SPLIT)) at the +separator var(string). Splitting only occurs in places where an +array value is valid. +) +item(tt(f))( +Split the result of the expansion to lines. This is a shorthand +for `tt(ps:\n:)'. +) +item(tt(S))( +(This and all remaining flags are used with the tt(${)...tt(#)...tt(}) or +tt(${)...tt(%)...tt(}) forms.) +Search substrings as well as beginnings or ends. +) +item(tt(I:)var(expr)tt(:))( +Search the var(expr)th match (where var(expr) evaluates to a number). +) +item(tt(M))( +Include the matched portion in the result. +) +item(tt(R))( +Include the unmatched portion in the result (the em(R)est). +) +item(tt(B))( +Include the index of the beginning of the match in the result. +) +item(tt(E))( +Include the index of the end of the match in the result. +) +item(tt(N))( +Include the length of the match in the result. +) +enditem() +subsect(Example) +The flag tt(f) is useful to split a double-quoted substitution line by +line. For example, `tt("${(f)$LPAR()<)var(file)tt(RPAR()}")' +will substitue the contents of var(file) divided so that one line is +supplied per argument to var(cmd). Compare this with the effect of +`tt($)tt(LPAR()<)var(file)tt(RPAR())' alone, which divides the file +up by words, or the same inside double quotes, where the entire +contents of the file are passed as a single argument. +texinode(Command Substitution)(Arithmetic Expansion)(Parameter Expansion)(Expansion) +sect(Command Substitution) +cindex(command substitution) +cindex(substitution, command) +A command enclosed in parentheses +preceded by a dollar sign, like `tt($LPAR())...tt(RPAR())', or quoted with grave +accents, like `tt(`)...tt(`)', is replaced with its standard output, with any +trailing newlines deleted. +If the substitution is not enclosed in double quotes, the +output is broken into words using the tt(IFS) parameter. +vindex(IFS, use of) +The substitution `tt($LPAR()cat) var(foo)tt(RPAR())' may be replaced +by the equivalent but faster `tt($LPAR()<)var(foo)tt(RPAR())'. +In either case, if the option tt(GLOB_SUBST) is set, +the output is eligible for filename generation. +texinode(Arithmetic Expansion)(Brace Expansion)(Command Substitution)(Expansion) +sect(Arithmetic Expansion) +cindex(arithmetic expansion) +cindex(expansion, arithmetic) +A string of the form `tt($[)var(exp)tt(])' or +`tt($LPAR()LPAR())var(exp)tt(RPAR()RPAR())' is substituted +with the value of the arithmetic expression var(exp). var(exp) is +subjected to em(parameter expansion), em(command substitution) +and em(arithmetic expansion) before it is evaluated. +See noderef(Arithmetic Evaluation). +texinode(Brace Expansion)(Filename Expansion)(Arithmetic Expansion)(Expansion) +sect(Brace Expansion) +cindex(brace expansion) +cindex(expansion, brace) +A string of the form +`var(foo)tt({)var(xx)tt(,)var(yy)tt(,)var(zz)tt(})var(bar)' +is expanded to the individual words +`var(fooxxbar)', `var(fooyybar)' and `var(foozzbar)'. +Left-to-right order is preserved. This construct +may be nested. Commas may be quoted in order to +include them literally in a word. + +An expression of the form `tt({)var(n1)tt(..)var(n2)tt(})', +where var(n1) and var(n2) are integers, +is expanded to every number between +var(n1) and var(n2) inclusive. If either number begins with a +zero, all the resulting numbers will be padded with leading zeroes to +that minimum width. If the numbers are in decreasing order the +resulting sequence will also be in decreasing order. + +If a brace expression matches none of the above forms, it is left +unchanged, unless the tt(BRACE_CCL) option is set. +pindex(BRACE_CCL, use of) +In that case, it is expanded to a sorted list of the individual +characters between the braces, in the manner of a search set. +`tt(-)' is treated specially as in a search set, but `tt(^)' or `tt(!)' as +the first character is treated normally. +texinode(Filename Expansion)(Filename Generation)(Brace Expansion)(Expansion) +sect(Filename Expansion) +cindex(filename expansion) +cindex(expansion, filename) +Each word is checked to see if it begins with an unquoted `tt(~)'. +If it does, then the word up to a `tt(/)', +or the end of the word if there is no `tt(/)', +is checked to see if it can be substituted in one of the ways +described here. If so, then the `tt(~)' and the checked portion are +replaced with the appropriate substitute value. + +A `tt(~)' by itself is replaced by the value of tt($HOME). +A `tt(~)' followed by a `tt(PLUS())' or a `tt(-)' is replaced by the value of +tt($PWD) or tt($OLDPWD), respectively. + +A `tt(~)' followed by a number is replaced by the directory at that +position in the directory stack. +`tt(~0)' is equivalent to `tt(~PLUS())', +and `tt(~1)' is the top of the stack. +`tt(~PLUS())' followed by a number is replaced by the directory at that +position in the directory stack. +`tt(~PLUS()0)' is equivalent to `tt(~PLUS())', +and `tt(~PLUS()1)' is the top of the stack. +`tt(~-)' followed by a number is replaced by the directory that +many positions from the bottom of the stack. +`tt(~-0)' is the bottom of the stack. +pindex(PUSHD_MINUS, use of) +The tt(PUSHD_MINUS) +option exchanges the effects of `tt(~PLUS())' and `tt(~-)' where they are +followed by a number. + +cindex(directories, named) +cindex(named directories) +A `tt(~)' followed by anything not already covered is looked up as a +named directory, and replaced by the value of that named directory if found. +Named directories are typically home directories for users on the system. +They may also be defined if the text after the `tt(~)' is the name +of a string shell parameter whose value begins with a `tt(/)'. +It is also possible to define directory names using the tt(-d) option to the +tt(hash) builtin. + +In certain circumstances (in prompts, for instance), when the shell +prints a path, the path is checked to see if it has a named +directory as its prefix. If so, then the prefix portion +is replaced with a `tt(~)' followed by the name of the directory. +The shortest way of referring to the directory is used, +with ties broken in favour of using a named directory, +except when the directory is tt(/) itself. + +If a word begins with an unquoted `tt(=)' +and the tt(EQUALS) option is set, +the remainder of the word is taken as the +name of a command or alias. If a command +exists by that name, the word is replaced +by the full pathname of the command. +If an alias exists by that name, the word +is replaced with the text of the alias. + +Filename expansion is performed on the right hand side of a parameter +assignment, including those appearing after commands of the +tt(typeset) family. In this case, the right hand side will be treated +as a colon-separated list in the manner of the tt(PATH) parameter, +so that a `tt(~)' or an `tt(=)' following a `tt(:)' is eligible for expansion. +All such behaviour can be +disabled by quoting the `tt(~)', the `tt(=)', or the whole expression (but not +simply the colon); the tt(EQUALS) option is also respected. + +If the option tt(MAGIC_EQUAL_SUBST) is set, any unquoted shell +argument in the form `var(identifier)tt(=)var(expression)' becomes eligible +for file expansion as described in the previous paragraph. Quoting the +first `tt(=)' also inhibits this. +texinode(Filename Generation)()(Filename Expansion)(Expansion) +sect(Filename Generation) +cindex(filename generation) +cindex(globbing) +If a word contains an unquoted instance of one of the characters +`tt(*)', `tt(LPAR())', `tt(|)', `tt(<)', `tt([)', or `tt(?)', it is regarded +as a pattern for filename generation, unless the tt(GLOB) option is unset. +pindex(GLOB, use of) +If the tt(EXTENDED_GLOB) option is set, +pindex(EXTENDED_GLOB, use of) +the `tt(^)' and `tt(#)' characters also denote a pattern; otherwise +they are not treated specially by the shell. + +The word is replaced with a list of sorted filenames that match +the pattern. If no matching pattern is found, the shell gives +an error message, unless the tt(NULL_GLOB) option is set, +pindex(NULL_GLOB, use of) +in which case the word is deleted; or unless the tt(NOMATCH) +option is unset, in which case the word is left unchanged. +pindex(NOMATCH, use of) + +In filename generation, +the character `tt(/)' must be matched explicitly; +also, a `tt(.)' must be matched +explicitly at the beginning of a pattern or after a `tt(/)', unless the +tt(GLOB_DOTS) option is set. +pindex(GLOB_DOTS, use of) +No filename generation pattern +matches the files `tt(.)' or `tt(..)'. In other instances of pattern +matching, the `tt(/)' and `tt(.)' are not treated specially. +subsect(Glob Operators) +startitem() +item(tt(*))( +Matches any string, including the null string. +) +item(tt(?))( +Matches any character. +) +item(tt([)...tt(]))( +Matches any of the enclosed characters. Ranges of characters +can be specified by separating two characters by a `tt(-)'. +A `tt(-)' or `tt(])' may be matched by including it as the +first character in the list. +There are also several named classes of characters, in the form +`tt([:)var(name)(tt:])' with the following meanings: `tt([:alnum:])' +alphanumeric, `tt([:alpha:])' alphabetic, +`tt([:blank:])' space or tab, +`tt([:cntrl:])' control character, `tt([:digit:])' decimal +digit, `tt([:graph:])' printable character except whitespace, +`tt([:lower:])' lowercase letter, `tt([:print:])' printable character, +`tt([:punct:])' printable character neither alphanumeric nor whitespace, +`tt([:space:])' whitespace character, `tt([:upper:])' uppercase letter, +`tt([:xdigit:])' hexadecimal digit. These use the macros provided by +the operating system to test for the given character combinations, +including any modifications due to local language settings: see +manref(ctype)(3). Note that the square brackets are additional +to those enclosing the whole set of characters, so to test for a +single alphanumeric character you need `tt([[:alnum:]])'. Named +character sets can be used alongside other types, +e.g. `tt([[:alpha:]0-9])'. +) +xitem(tt([^)...tt(])) +item(tt([!)...tt(]))( +Like tt([)...tt(]), except that it matches any character which is +not in the given set. +) +item(tt(<)[var(x)]tt(-)[var(y)]tt(>))( +Matches any number in the range var(x) to var(y), inclusive. +Either of the numbers may be omitted to make the range open-ended; +hence `tt(<->)' matches any number. +) +item(tt(LPAR())...tt(RPAR()))( +Matches the enclosed pattern. This is used for grouping. +If the tt(KSH_GLOB) option is set, then a +`tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)' immediately preceding +the `tt(LPAR())' is treated specially, as detailed below. +) +item(var(x)tt(|)var(y))( +Matches either var(x) or var(y). +This operator has lower precedence than any other. +The `tt(|)' character +must be within parentheses, to avoid interpretation as a pipeline. +) +item(tt(^)var(x))( +(Requires tt(EXTENDED_GLOB) to be set.) +Matches anything except the pattern var(x). +This has a higher precedence than `tt(/)', so `tt(^foo/bar)' +will search directories in `tt(.)' except `tt(./foo)' +for a file named `tt(bar)'. +) +item(var(x)tt(~)var(y))( +(Requires tt(EXTENDED_GLOB) to be set.) +Match anything that matches the pattern var(x) but does not match var(y). +This has lower precedence than any operator except `tt(|)', so +`tt(*/*~foo/bar)' will search for all files in all directories in `tt(.)' +and then exclude `tt(foo/bar)' if there was such a match. +It groups left-to-right, so multiple patterns can be excluded by +`var(foo)tt(~)var(bar)tt(~)var(baz)'. +In the exclusion pattern (var(y)), `tt(/)' and `tt(.)' are not treated +specially the way they usually are in globbing. +) +item(var(x)tt(#))( +(Requires tt(EXTENDED_GLOB) to be set.) +Matches zero or more occurrences of the pattern var(x). +This operator has high precedence; `tt(12#)' is equivalent to `tt(1(2#))', +rather than `tt((12)#)'. +) +item(var(x)tt(##))( +(Requires tt(EXTENDED_GLOB) to be set.) +Matches one or more occurrences of the pattern var(x). +This operator has high precedence; `tt(12##)' is equivalent to `tt(1(2##))', +rather than `tt((12)##)'. +) +enditem() +subsect(ksh-like Glob Operators) +pindex(KSH_GLOB, use of) +If the tt(KSH_GLOB) option is set, the effects of parentheses can be +modified by a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'. +This character need not be unquoted to have special effects, +but the `tt(LPAR())' must be. + +startitem() +item(tt(@LPAR())...tt(RPAR()))( +Match the pattern in the parentheses. (Like `tt(LPAR())...tt(RPAR())'.) +) +item(tt(*LPAR())...tt(RPAR()))( +Match any number of occurrences. (Like `tt(LPAR())...tt(RPAR()#)'.) +) +item(tt(PLUS()LPAR())...tt(RPAR()))( +Match at least one occurrence. (Like `tt(LPAR())...tt(RPAR()##)'.) +) +item(tt(?LPAR())...tt(RPAR()))( +Match zero or one occurrence. (Like `tt(LPAR()|)...tt(RPAR())'.) +) +item(tt(!LPAR())...tt(RPAR()))( +Match anything but the expression in parentheses. +(Like `tt(LPAR()^LPAR())...tt(RPAR()RPAR())'.) +) +enditem() +subsect(Recursive Globbing) +A pathname component of the form `tt(LPAR())var(foo)tt(/RPAR()#)' +matches a path consisting of zero or more directories +matching the pattern var(foo). +As a shorthand, `tt(**/)' is equivalent to `tt((*/)#)'. +Thus: + +nofill(tt(ls (*/)#bar)) + +or + +nofill(tt(ls **/bar)) + +does a recursive directory search for files named `tt(bar)', not following +symbolic links. To follow links, use `tt(***/)'. +subsect(Glob Qualifiers) +cindex(globbing, qualifiers) +cindex(qualifiers, globbing) +Patterns used for filename generation may end in a +list of qualifiers enclosed in parentheses. +The qualifiers specify which filenames that otherwise match the given pattern +will be inserted in the argument list. + +pindex(BARE_GLOB_QUAL, use of) +If the option tt(BARE_GLOB_QUAL) is set, then a trailing set of parentheses +containing no `tt(|)' or `tt(LPAR())' characters (or `tt(~)' if it is special) +is taken as a set of +glob qualifiers. A glob subexpression that would normally be taken as glob +qualifiers, for example `tt((^x))', can be forced to be treated as part of +the glob pattern by doubling the parentheses, for example `tt(((^x)))'. + +A qualifier may be any one of the following: + +startitem() +item(tt(/))( +directories +) +item(tt(.))( +plain files +) +item(tt(@))( +symbolic links +) +item(tt(=))( +sockets +) +item(tt(p))( +named pipes (FIFOs) +) +item(tt(*))( +executable plain files (0100) +) +item(tt(%))( +device files (character or block special) +) +item(tt(%b))( +block special files +) +item(tt(%c))( +character special files +) +item(tt(r))( +owner-readable files (0400) +) +item(tt(w))( +owner-writable files (0200) +) +item(tt(x))( +owner-executable files (0100) +) +item(tt(A))( +group-readable files (0040) +) +item(tt(I))( +group-writable files (0020) +) +item(tt(E))( +group-executable files (0010) +) +item(tt(R))( +world-readable files (0004) +) +item(tt(W))( +world-writable files (0002) +) +item(tt(X))( +world-executable files (0001) +) +item(tt(s))( +setuid files (04000) +) +item(tt(S))( +setgid files (02000) +) +item(tt(t))( +files with the sticky bit (01000) +) +item(tt(d)var(dev))( +files on the device var(dev) +) +item(tt(l)[tt(-)|tt(PLUS())]var(ct))( +files having a link count less than var(ct) (tt(-)), greater than +var(ct) (tt(PLUS())), or is equal to var(ct) +) +item(tt(U))( +files owned by the effective user ID +) +item(tt(G))( +files owned by the effective group ID +) +item(tt(u)var(id))( +files owned by user ID var(id) if it is a number, if not, than the +character after the `tt(u)' will be used as a separator and the string +between it and the next matching separator +(`tt(LPAR())', `tt([)', `tt({)', and `tt(<)' +match `tt(RPAR())', `tt(])', `tt(})', and `tt(>)' respectively, +any other character matches +itself) will be taken as a user name, and the user ID of this user will +be taken (e.g. `tt(u:foo:)' or `tt(u[foo])' for user `tt(foo)') +) +item(tt(g)var(id))( +like tt(u)var(id) but with group IDs or names +) +item(tt(a)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))( +files accessed exactly var(n) days ago. Files accessed within the +last var(n) days are selected using a negative value for var(n) +(tt(-)var(n)). Files accessed more than var(n) days ago are selected by a +positive var(n) value (tt(PLUS())var(n)). Optional unit specifiers `tt(M)', +`tt(w)', `tt(h)' or `tt(m)' (e.g. `tt(ah5)') cause the check to be +performed with months (of 30 days), weeks, hours, or minutes instead of +days, respectively. For instance, `tt(echo *(ah-5))' would echo files +accessed within the last five hours. +) +item(tt(m)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))( +like the file access qualifier, except that it uses the file modification +time. +) +item(tt(c)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))( +like the file access qualifier, except that it uses the file inode change +time. +) +item(tt(L)[tt(PLUS())|tt(-)]var(n))( +files less than var(n) bytes (tt(-)), more than var(n) bytes (tt(PLUS())), or +exactly var(n) bytes in length. If this flag is directly followed by a `tt(k)' +(`tt(K)'), `tt(m)' (`tt(M)'), or `tt(p)' (`tt(P)') (e.g. `tt(Lk-50)') +the check is performed with kilobytes, megabytes, or blocks (of 512 bytes) +instead. +) +item(tt(^))( +negates all qualifiers following it +) +item(tt(-))( +toggles between making the qualifiers work on symbolic links (the +default) and the files they point to +) +item(tt(M))( +sets the tt(MARK_DIRS) option for the current pattern +pindex(MARK_DIRS, setting in pattern) +) +item(tt(T))( +appends a trailing qualifier mark to the file names, analogous to the +tt(LIST_TYPES) option, for the current pattern (overrides tt(M)) +) +item(tt(N))( +sets the tt(NULL_GLOB) option for the current pattern +pindex(NULL_GLOB, setting in pattern) +) +item(tt(D))( +sets the tt(GLOB_DOTS) option for the current pattern +pindex(GLOB_DOTS, setting in pattern) +) +enditem() + +More than one of these lists can be combined, separated by commas. The +whole list matches if at least one of the sublists matches (they are +`or'ed, the qualifiers in the sublists are `and'ed). + +If a `tt(:)' appears in a qualifier list, the remainder of the expression in +parenthesis is interpreted as a modifier (see noderef(Modifiers) +in noderef(History Expansion)). Note that +each modifier must be introduced by a separate `tt(:)'. Note also that the +result after modification does not have to be an existing file. The +name of any existing file can be followed by a modifier of the form +`tt((:..))' even if no actual filename generation is performed. +Thus: + +nofill(tt(ls *(-/))) + +lists all directories and symbolic links that point to directories, +and + +nofill(tt(ls *(%W))) + +lists all world-writable device files in the current directory, and + +nofill(tt(ls *(W,X))) + +lists all files in the current directory that are +world-writable or world-executable, and + +nofill(tt(echo /tmp/foo*(u0^@:t))) + +outputs the basename of all root-owned files beginning with the string +`tt(foo)' in tt(/tmp), ignoring symlinks, and + +nofill(tt(ls *.*~(lex|parse).[ch](^D^l1))) + +lists all files having a link count of one whose names contain a dot +(but not those starting with a dot, since tt(GLOB_DOTS) is explicitly +switched off) except for tt(lex.c), tt(lex.h), tt(parse.c) and tt(parse.h). diff --git a/Doc/Zsh/filelist.yo b/Doc/Zsh/filelist.yo new file mode 100644 index 000000000..298eff074 --- /dev/null +++ b/Doc/Zsh/filelist.yo @@ -0,0 +1,15 @@ +sect(Files) +cindex(files used) +startlist() +list(tt($ZDOTDIR/.zshenv)) +list(tt($ZDOTDIR/.zprofile)) +list(tt($ZDOTDIR/.zshrc)) +list(tt($ZDOTDIR/.zlogin)) +list(tt($ZDOTDIR/.zlogout)) +list(tt(${TMPPREFIX}*) (default is /tmp/zsh*)) +list(tt(/etc/zshenv)) +list(tt(/etc/zprofile)) +list(tt(/etc/zshrc)) +list(tt(/etc/zlogin)) +list(tt(/etc/zlogout) (installation-specific - tt(/etc) is the default)) +endlist() diff --git a/Doc/Zsh/files.yo b/Doc/Zsh/files.yo new file mode 100644 index 000000000..0d775a14f --- /dev/null +++ b/Doc/Zsh/files.yo @@ -0,0 +1,26 @@ +texinode(Files)(Shell Grammar)(Invocation)(Top) +chapter(Files) +sect(Startup/Shutdown Files) +cindex(files, startup) +cindex(startup files) +cindex(files, shutdown) +cindex(shutdown files) +pindex(NO_RCS, use of) +Commands are first read from tt(/etc/zshenv). +If the tt(RCS) option is unset +within tt(/etc/zshenv), all other +initialization files are skipped. +Otherwise, commands are read +from tt($ZDOTDIR/.zshenv). +pindex(LOGIN, use of) +If the shell is a login shell, commands +are read from tt(/etc/zprofile) and then tt($ZDOTDIR/.zprofile). +Then, if the shell is interactive, +commands are read from tt(/etc/zshrc) and then tt($ZDOTDIR/.zshrc). +Finally, if the shell is a login shell, tt(/etc/zlogin) and +tt($ZDOTDIR/.zlogin) are read. + +If tt(ZDOTDIR) is unset, tt(HOME) is used instead. +Those files listed above as being in tt(/etc) may be in another +directory, depending on the installation. +ifnzman(includefile(Zsh/filelist.yo)) diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo new file mode 100644 index 000000000..c2fc71d55 --- /dev/null +++ b/Doc/Zsh/func.yo @@ -0,0 +1,107 @@ +texinode(Functions)(Jobs & Signals)(Command Execution)(Top) +chapter(Functions) +ifzman(\ +sect(Functions) +)\ +cindex(functions) +findex(function) +The tt(function) reserved word is used to define shell functions. +Shell functions are read in and stored internally. +Alias names are resolved when the function is read. +Functions are executed like commands with the arguments +passed as positional parameters. +(See noderef(Command Execution).) + +Functions execute in the same process as the caller and +share all files +and present working directory with the +caller. A trap on tt(EXIT) set inside a function +is executed after the function completes in the environment +of the caller. + +findex(return, use of) +The tt(return) builtin is used to return from function calls. + +findex(functions, use of) +Function identifiers can be listed with the tt(functions) builtin. +findex(unfunction, use of) +Functions can be undefined with the tt(unfunction) builtin. +sect(Autoloading Functions) +findex(autoload, use of) +cindex(autoloading functions) +cindex(functions, autoloading) +A function can be marked as em(undefined) using the tt(autoload) builtin +(or `tt(functions -u)' or `tt(typeset -fu)'). Such a function has no +body. When the function is first executed, the tt(fpath) +variable will be searched for a file with the same name as the +function. + +pindex(KSH_AUTOLOAD, use of) +If the tt(KSH_AUTOLOAD) option is set, or the file contains only a simple +definition of the function, the file's contents will be +executed. It would normally define the function in question, but may +also perform initialisation. +It is executed in the context of the function +execution, and may therefore define local parameters. + +Otherwise, the function is defined such that its body is the +complete contents of the file. This form allows the file to be +used directly as an executable shell script. +Initialisation code can be executed, but only as part of the first +function execution, so the function would have to redefine itself to +avoid reinitialising on the next execution. + +If this processing of the file results in the function being +fully defined, the function itself is then executed. +sect(Special Functions) +The following functions, if defined, have special meaning to +the shell: + +startitem() +findex(chpwd) +item(tt(chpwd))( +Executed whenever the current working directory is changed. +) +findex(periodic) +item(tt(periodic))( +vindex(PERIOD) +If the parameter tt(PERIOD) +is set, this function is executed every tt($PERIOD) +seconds, just before a prompt. +) +findex(precmd) +item(tt(precmd))( +Executed before each prompt. +) +findex(preexec) +item(tt(preexec))( +Executed just after a command has been read and is about to be +executed. If the history mechanism is active, the string to be +executed is passed as an argument. +) +item(tt(TRAP)var(NAL))( +cindex(signals, trapping) +cindex(trapping signals) +If defined and non-null, +this function will be executed whenever the shell +catches a signal tt(SIG)var(NAL), where var(NAL) is a signal +name as specified for the tt(kill) builtin. +The signal number will be passed as the first parameter to the function. + +If a function of this form is defined and null, +the shell and processes spawned by it will ignore tt(SIG)var(NAL). +) +findex(TRAPDEBUG) +item(tt(TRAPDEBUG))( +Executed after each command. +) +findex(TRAPEXIT) +item(tt(TRAPEXIT))( +Executed when the shell exits, +or when the current function exits if defined inside a function. +) +findex(TRAPZERR) +item(tt(TRAPZERR))( +Executed whenever a command has a non-zero exit status. +) +enditem() diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo new file mode 100644 index 000000000..c78aed4b4 --- /dev/null +++ b/Doc/Zsh/grammar.yo @@ -0,0 +1,335 @@ +texinode(Shell Grammar)(Redirection)(Files)(Top) +chapter(Shell Grammar) +cindex(shell grammar) +cindex(grammar, shell) +startmenu() +menu(Simple Commands & Pipelines) +menu(Precommand Modifiers) +menu(Complex Commands) +menu(Alternate Forms For Complex Commands) +menu(Reserved Words) +menu(Comments) +menu(Aliasing) +menu(Quoting) +endmenu() +texinode(Simple Commands & Pipelines)(Precommand Modifiers)()(Shell Grammar) +sect(Simple Commands & Pipelines) +cindex(simple commands) +cindex(commands, simple) +A em(simple command) is a sequence of optional parameter +assignments followed by blank-separated words, +with optional redirections interspersed. +The first word is the command to be executed, and the remaining +words, if any, are arguments to the command. +If a command name is given, the parameter assignments modify +the environment of the command when it is executed. +The value of a simple command is its exit status, +or 128 plus the signal number if terminated by a signal. + +cindex(pipeline) +A em(pipeline) is either a simple command, or a sequence of two or more +simple commands where each command is separated from the next by `tt(|)' +or `tt(|&)'. Where commands are separated by `tt(|)', the standard +output of the first command is connected to the +standard input of the next. `tt(|&)' is shorthand for `tt(2>&1 |)', which +connects both the standard output and the standard error of the +command to the standard input of the next. The value of a pipeline +is the value of the last command, unless the pipeline is preceded by +`tt(!)' in which case the value is the logical inverse of the value of the +last command. + +findex(coproc) +cindex(coprocess) +If a pipeline is preceded by `tt(coproc)', it is executed as a coprocess; +a two-way pipe is established between it and the parent shell. The +shell can read from or write to the coprocess by means of the `tt(>&p)' +and `tt(<&p)' redirection operators or with `tt(print -p)' and `tt(read -p)'. +A pipeline cannot be preceded by both `tt(coproc)' and `tt(!)'. + +cindex(sublist) +A em(sublist) is either a single pipeline, or a sequence of two or more +pipelines separated by `tt(&&)' or `tt(||)'. If two pipelines are separated +by `tt(&&)', the second pipeline is executed only if the first succeeds +(returns a zero value). If two pipelines are separated by `tt(||)', the +second is executed only if the first fails (returns a nonzero value). +Both operators have equal precedence and are left associative. +The value of the sublist is the value of the last pipeline executed. + +cindex(list) +A em(list) is a sequence of zero or more sublists, in which each sublist +is terminated by `tt(;)', `tt(&)', `tt(&|)', `tt(&!)', or a newline. +This terminator +may optionally be omitted from the last sublist in the list when the +list appears as a complex command inside `tt(LPAR())...tt(RPAR())' +or `tt({)...tt(})'. When a +sublist is terminated by `tt(;)' or newline, the shell waits for it to +finish before executing the next sublist. If a sublist is terminated +by a `tt(&)', `tt(&|)', or `tt(&!)', +the shell executes it in the background, and +does not wait for it to finish. +A backgrounded sublist returns a status of zero. +texinode(Precommand Modifiers)(Complex Commands)(Simple Commands & Pipelines)(Shell Grammar) +sect(Precommand Modifiers) +cindex(precommand modifiers) +cindex(modifiers, precommand) +A simple command may be preceded by a em(precommand modifier), +which will alter how the command is interpreted. These modifiers are +shell builtin commands with the exception of tt(nocorrect) which is +a reserved word. + +startitem() +item(tt(-))( +The command is executed with a `tt(-)' prepended to its +tt(argv[0]) string. +) +item(tt(noglob))( +Filename generation (globbing) is not performed on any of +the words. +) +item(tt(nocorrect))( +Spelling correction is not done on any of the words. +) +item(tt(exec))( +The command is executed in the parent shell without forking. +) +item(tt(command))( +The command word is taken to be the name of an external command, +rather than a shell function or builtin. +) +item(tt(builtin))( +The command word is taken to be the name of a builtin command, +rather than a shell function or external command. +) +enditem() +texinode(Complex Commands)(Alternate Forms For Complex Commands)(Precommand Modifiers)(Shell Grammar) +sect(Complex Commands) +cindex(complex commands) +cindex(commands, complex) +A em(complex command) in zsh is one of the following: + +startitem() +findex(if) +cindex(if construct) +item(tt(if) var(list) tt(then) var(list) [ tt(elif) var(list) tt(then) var(list) ] ... [ tt(else) var(list) ] tt(fi))( +The tt(if) var(list) is executed, and if it returns a zero exit status, +the tt(then) var(list) is executed. +Otherwise, the tt(elif) var(list) is executed and if its value is zero, +the tt(then) var(list) is executed. +If each tt(elif) var(list) returns nonzero, the tt(else) var(list) is executed. +) +findex(for) +cindex(for loops) +cindex(loops, for) +item(tt(for) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))( +where var(term) is at least one newline or tt(;). +Expand the list of var(word)s, and set the parameter +var(name) to each of them in turn, executing +var(list) each time. If the tt(in) var(word) is omitted, +use the positional parameters instead of the var(word)s. +) +item(tt(for LPAR()LPAR()) [var(expr1)] tt(;) [var(expr2)] tt(;) [var(expr3)] tt(RPAR()RPAR() do) var(list) tt(done))( +The arithmetic expression var(expr1) is evaluated first (see +noderef(Arithmetic Evaluation)). The arithmetic expression +var(expr2) is repeatedly evaluated until it evaluates to zero and +when non-zero, var(list) is executed and the arithmetic expression +var(expr3) evaluated. If any expression is omitted, then it behaves +as if it evaluated to 1. +) +findex(while) +cindex(while loops) +cindex(loops, while) +item(tt(while) var(list) tt(do) var(list) tt(done))( +Execute the tt(do) var(list) as long as the tt(while) var(list) +returns a zero exit status. +) +findex(until) +cindex(until loops) +cindex(loops, until) +item(tt(until) var(list) tt(do) var(list) tt(done))( +Execute the tt(do) var(list) as long as tt(until) var(list) +returns a nonzero exit status. +) +findex(repeat) +cindex(repeat loops) +cindex(loops, repeat) +item(tt(repeat) var(word) tt(do) var(list) tt(done))( +var(word) is expanded and treated as an arithmetic expression, +which must evaluate to a number var(n). +var(list) is then executed var(n) times. +) +findex(case) +cindex(case selection) +cindex(selection, case) +item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(esac))( +Execute the var(list) associated with the first var(pattern) +that matches var(word), if any. The form of the patterns +is the same as that used for filename generation. See +noderef(Filename Generation). +If the var(list) that is executed is terminated with tt(;&) rather than +tt(;;), the following list is also executed. This continues until either +a list is terminated with tt(;;) or the tt(esac) is reached. +) +findex(select) +cindex(user selection) +cindex(selection, user) +item(tt(select) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))( +where var(term) is one ore more newline or tt(;). +Print the set of var(word)s, each preceded by a number. +If the tt(in) var(word) is omitted, use the positional parameters. +The tt(PROMPT3) prompt is printed and a line is read from standard +input. If this line consists of the number of one of the listed +var(word)s, then the parameter var(name) +is set to the var(word) corresponding to this number. +If this line is empty, the selection list is printed again. +Otherwise, the value of the parameter var(name) is set to null. +The contents of the line read from standard input is saved +in the parameter tt(REPLY). var(list) is executed +for each selection until a break or end-of-file is encountered. +) +cindex(subshells) +item(tt(LPAR()) var(list) tt(RPAR()))( +Execute var(list) in a subshell. Traps set by the tt(trap) builtin +are reset to their default values while executing var(list). +) +item(tt({) var(list) tt(}))( +Execute var(list). +) +xitem(tt(function) var(word) ... [ tt(()) ] [ var(term) ] tt({) var(list) tt(})) +xitem(var(word) ... tt(()) [ var(term) ] tt({) var(list) tt(})) +item(var(word) ... tt(()) [ var(term) ] var(command))( +where var(term) is one or more newline or tt(;). +Define a function which is referenced by any one of var(word). +Normally, only one var(word) is provided; multiple var(word)s +are usually only useful for setting traps. +The body of the function is the var(list) between +the tt({) and tt(}). See noderef(Functions). +) +cindex(timing) +item(tt(time) [ var(pipeline) ])( +The var(pipeline) is executed, and timing statistics are +reported on the standard error in the form specified +by the tt(TIMEFMT) parameter. +If var(pipeline) is omitted, print statistics about the +shell process and its children. +) +cindex(testing conditional expression) +item(tt([[) var(exp) tt(]]))( +Evaluates the conditional expression var(exp) +and return a zero exit status if it is true. +See noderef(Conditional Expressions) +for a description of var(exp). +) +enditem() +texinode(Alternate Forms For Complex Commands)(Reserved Words)(Complex Commands)(Shell Grammar) +sect(Alternate Forms For Complex Commands) +cindex(alternate forms for complex commands) +cindex(commands, alternate forms for complex) +Many of zsh's complex commands have alternate forms. These particular +versions of complex commands should be considered deprecated and may be +removed in the future. The versions in the previous section should be +preferred instead. The short versions below only work if var(sublist) +is of the form `tt({) var(list) tt(})' or if the tt(SHORT_LOOPS) +option is set. + +startitem() +item(tt(if) var(list) tt({) var(list) tt(}) [ tt(elif) var(list) tt({) var(list) tt(}) ] ... [ tt(else {) var(list) tt(}) ])( +An alternate form of tt(if). +) +item(tt(if) var(list) var(sublist))( +A short form of the alternate `if'. +) +item(tt(for) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(sublist))( +A short form of tt(for). +) +item(tt(for) var(name) [ tt(in) var(word) ... var(term) ] var(sublist))( +where var(term) is at least one newline or tt(;). +Another short form of tt(for). +) +item(tt(for LPAR()LPAR()) [var(expr1)] tt(;) [var(expr2)] tt(;) [var(expr3)] tt(RPAR()RPAR()) var(sublist))( +A short form of the arithmetic tt(for) command. +) +item(tt(foreach) var(name) tt(LPAR()) var(word) ... tt(RPAR()) var(list) tt(end))( +Another form of tt(for). +) +item(tt(while) var(list) tt({) var(list) tt(}))( +An alternative form of tt(while). +) +item(tt(until) var(list) tt({) var(list) tt(}))( +An alternative form of tt(until). +) +item(tt(repeat) var(word) var(sublist))( +This is a short form of tt(repeat). +) +item(tt(case) var(word) tt({) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(}))( +An alternative form of tt(case). +) +item(tt(select) var(name) [ tt(in) var(word) var(term) ] var(sublist))( +where var(term) is at least one newline or tt(;). +A short form of tt(select). +) +enditem() +texinode(Reserved Words)(Comments)(Alternate Forms For Complex Commands)(Shell Grammar) +sect(Reserved Words) +cindex(reserved words) +findex(disable, use of) +The following words are recognized as reserved words when used as the first +word of a command unless quoted or disabled using tt(disable -r): + +tt(do done esac then elif else fi for case +if while function repeat time until +select coproc nocorrect foreach end ! [[ { }) + +Additionally, `tt(})' is recognized in any position if the tt(IGNORE_BRACES) option +is not set. +texinode(Comments)(Aliasing)(Reserved Words)(Shell Grammar) +sect(Comments) +cindex(comments) +pindex(INTERACTIVE_COMMENTS, use of) +vindex(histchars, use of) +In noninteractive shells, or in interactive shells with the +tt(INTERACTIVE_COMMENTS) option set, a word beginning +with the third character of the tt(histchars) parameter +(`tt(#)' by default) causes that word and all the following +characters up to a newline to be ignored. +texinode(Aliasing)(Quoting)(Comments)(Shell Grammar) +sect(Aliasing) +cindex(aliasing) +Every token in the shell input is checked to see if there +is an alias defined for it. +If so, it is replaced by the text of the alias if it is in command +position (if it could be the first word of a simple command), +or if the alias is global. +If the text ends with a space, the next word in the shell input +is treated as though it were in command position for purposes of alias +expansion. +findex(alias, use of) +cindex(aliases, global) +An alias is defined using the tt(alias) builtin; global aliases +may be defined using the tt(-g) option to that builtin. + +Alias substitution is done on the shell input before any +other substitution except history substitution. Therefore, +if an alias is defined for the word tt(foo), alias substitution +may be avoided by quoting part of the word, e.g. tt(\foo). +But there is nothing to prevent an alias being defined +for tt(\foo) as well. +texinode(Quoting)()(Aliasing)(Shell Grammar) +sect(Quoting) +cindex(quoting) +A character may be var(quoted) (that is, made +to stand for itself) by preceding it with a `tt(\)'. +`tt(\)' followed by a newline is ignored. + +A string enclosed between `tt($')' and `tt(')' is +processed the same way as the string arguments of the +tt(print) builtin, and the resulting string is considered to be +entirely quoted. A literal `tt(')' character can be included in the +string by using the `tt(\')' escape. + +All characters enclosed between a pair of single quotes (tt('')) that +is not preceded by a `tt($)' are quoted. A single quote cannot appear +within single quotes. + +Inside double quotes (tt("")), parameter and +command substitution occurs, and `tt(\)' quotes the characters +`tt(\)', `tt(`)', `tt(")', and `tt($)'. diff --git a/Doc/Zsh/guide.yo b/Doc/Zsh/guide.yo new file mode 100644 index 000000000..d38a0d308 --- /dev/null +++ b/Doc/Zsh/guide.yo @@ -0,0 +1,149 @@ +texiifinfo(\ +texinode(Top)(The Z Shell Guide)((dir))((dir)) +texitop(The Z Shell Guide) +This Info file documents Zsh, a freely available UNIX command interpreter +(shell), which of the standard shells most closely resembles the Korn shell +(ksh), although it is not completely compatible. + +Version version(), last updated date(). +)\ + +startmenu() +menu(The Z Shell Guide) +menu(Introduction) +menu(Invocation) +menu(Files) +menu(Shell Grammar) +menu(Redirection) +menu(Command Execution) +menu(Functions) +menu(Jobs & Signals) +menu(Arithmetic Evaluation) +menu(Conditional Expressions) +menu(Compatibility) +menu(Prompt Expansion) +menu(Restricted Shell) +menu(Expansion) +menu(Parameters) +menu(Options) +menu(Shell Builtin Commands) +menu(Zsh Line Editor) +menu(Programmable Completion) +menu(Zsh Modules) + + --- Indices --- + +menu(Concept Index) +menu(Variables Index) +menu(Options Index) +menu(Functions Index) +menu(Editor Functions Index) +menu(Keystroke Index) + + --- The Detailed Node Listing --- + +Introduction + +menu(Author) +menu(Availability) +menu(Mailing Lists) +menu(The Zsh FAQ) +menu(The Zsh Web Page) +menu(See Also) + +Shell Grammar + +menu(Simple Commands & Pipelines) +menu(Precommand Modifiers) +menu(Complex Commands) +menu(Alternate Forms For Complex Commands) +menu(Reserved Words) +menu(Comments) +menu(Aliasing) +menu(Quoting) + +Expansion + +menu(History Expansion) +menu(Process Substitution) +menu(Parameter Expansion) +menu(Command Substitution) +menu(Arithmetic Expansion) +menu(Brace Expansion) +menu(Filename Expansion) +menu(Filename Generation) + +Parameters + +menu(Local Parameters) +menu(Array Parameters) +menu(Positional Parameters) +menu(Parameters Set By The Shell) +menu(Parameters Used By The Shell) + +Options + +menu(Description of Options) +menu(Single Letter Options) + +Zsh Line Editor + +menu(Movement) +menu(History Control) +menu(Modifying Text) +menu(Arguments) +menu(Completion) +menu(Miscellaneous) + +Programmable Completion + +menu(Command Flags) +menu(Option Flags) +menu(Alternative Completion) +menu(Extended Completion) +menu(Example) + +Zsh Modules + +menu(The cap Module) +menu(The clone Module) +menu(The comp1 Module) +menu(The compctl Module) +menu(The deltochar Module) +menu(The example Module) +menu(The files Module) +menu(The sched Module) +menu(The stat Module) +menu(The zle Module) +endmenu() +texinode(The Z Shell Guide)(Introduction)(Top)(Top) +chapter(The Z Shell Guide) +This document has been produced from the texinfo file tt(zsh.texi), +included in the tt(Doc) sub-directory of the Zsh distribution. +sect(Producing documentation from zsh.texi) +The texinfo source may be converted into several formats: + +startitem() +item(The Info guide)( +The Info format allows searching for topics, commands, functions, etc. +from the many Indices. The command `tt(makeinfo zsh.texi)' is used to +produce the Info documentation. +) +item(The printed guide)( +The command `tt(texi2dvi zsh.texi)' will output tt(zsh.dvi) which can +then be processed with bf(dvips) and optionally bf(gs) (Ghostscript) to +produce a nicely formatted printed guide. +) +item(The HTML guide)( +Mark Borges, tt(). +Zsh is now maintained by the members of the zsh-workers mailing +list tt(). The development is currently +coordinated by Andrew Main (Zefram) tt(). The coordinator +can be contacted at tt(), but matters relating to +the code should generally go to the mailing list. +texinode(Availability)(Mailing Lists)(Author)(Introduction) +sect(Availability) +Zsh is available from the following anonymous FTP sites. These mirror +sites are kept frequently up to date. The sites marked with em((G)) +may be mirroring tt(ftp.math.gatech.edu) instead of the primary site. +The sites marked with em((H)) may be mirroring tt(ftp.cs.elte.hu) +instead of the primary site. + +startitem() +item(Primary site)( +nofill(tt(ftp://ftp.zsh.org/pub/zsh/) +tt(http://www.zsh.org/pub/zsh/)) +) +item(Australia)( +nofill(tt(ftp://ftp.zsh.org/pub/zsh/) +tt(http://www.zsh.org/pub/zsh/) +tt(ftp://ftp.ips.oz.au/pub/packages/zsh/) em((G)) em((H))) +) +item(Denmark)( +nofill(tt(ftp://sunsite.auc.dk/pub/unix/shells/zsh/)) +) +item(Finland)( +nofill(tt(ftp://ftp.funet.fi/pub/unix/shells/zsh/) em((H))) +) +item(France)( +nofill(tt(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/)) +) +item(Germany)( +nofill(tt(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/) em((H)) +tt(ftp://ftp.gmd.de/packages/zsh/) em((H)) +tt(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/) em((H))) +) +item(Hungary)( +nofill(tt(ftp://ftp.cs.elte.hu/pub/zsh/) +tt(http://www.cs.elte.hu/pub/zsh/) +tt(ftp://ftp.kfki.hu/pub/packages/zsh/) em((H))) +) +item(Israel)( +nofill(tt(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/) +tt(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)) +) +item(Japan)( +nofill(tt(ftp://ftp.tohoku.ac.jp/mirror/zsh/) em((H)) +tt(ftp://ftp.nis.co.jp/pub/shells/zsh/) em((H))) +) +item(Norway)( +nofill(tt(ftp://ftp.uit.no/pub/unix/shells/zsh/) em((H))) +) +item(Romania)( +nofill(tt(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/)) +) +item(Slovenia)( +nofill(tt(ftp://ftp.siol.net/pub/unix/shells/zsh/) em((H))) +) +item(Sweden)( +nofill(tt(ftp://ftp.lysator.liu.se/pub/unix/zsh/) em((H))) +) +item(UK)( +nofill(tt(ftp://ftp.net.lut.ac.uk/zsh/) em((H)) +tt(ftp://sunsite.doc.ic.ac.uk/packages/unix/shells/zsh/) em((G))) +) +item(USA)( +nofill(tt(ftp://ftp.math.gatech.edu/pub/zsh/) +tt(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/) +tt(ftp://ftp.sterling.com/zsh/) em((G)) em((H)) +tt(ftp://ftp.rge.com/pub/shells/zsh/) em((G)) em((H)) +tt(ftp://foad.org/pub/zsh/) +tt(http://foad.org/zsh/)) +) +enditem() +texinode(Mailing Lists)(The Zsh FAQ)(Availability)(Introduction) +sect(Mailing Lists) +cindex(mailing lists) +Zsh has 3 mailing lists: + +startitem() +item(tt())( +Announcements about releases, major changes in the shell and the +monthly posting of the Zsh FAQ. (moderated) +) +item(tt())( +User discussions. +) +item(tt())( +Hacking, development, bug reports and patches. +) +enditem() + +To subscribe, send mail with the SUBJECT `tt(subscribe) var()' +to the associated administrative address for the mailing list. + +startlist() +list(tt()) +list(tt()) +list(tt()) +endlist() + +Unsubscribing is done similarly. + +YOU ONLY NEED TO JOIN ONE OF THE MAILING LISTS AS THEY ARE NESTED. +All submissions to bf(zsh-announce) are automatically forwarded to +bf(zsh-users). All submissions to bf(zsh-users) are automatically +forwarded to bf(zsh-workers). + +If you have problems subscribing/unsubscribing to any of the mailing +lists, send mail to tt(). The mailing lists are +maintained by Richard Coleman tt(). + +The mailing lists are archived; the archives can be accessed via the +administrative addresses listed above. There is also a hypertext +archive, maintained by Geoff Wing tt(), available at +tt(http://www.zsh.org/mla/). +texinode(The Zsh FAQ)(The Zsh Web Page)(Mailing Lists)(Introduction) +sect(The Zsh FAQ) +Zsh has a list of Frequently Asked Questions (FAQ), maintained by +Peter Stephenson tt(). It is regularly posted to the +newsgroup bf(comp.unix.shell) and the bf(zsh-announce) mailing list. +The latest version can be found at any of the Zsh FTP sites, or at +tt(http://www.zsh.org/FAQ/). The contact address for FAQ-related matters +is tt(). +texinode(The Zsh Web Page)(See Also)(The Zsh FAQ)(Introduction) +sect(The Zsh Web Page) +Zsh has a web page which is located at tt(http://www.zsh.org/). This is +maintained by Karsten Thygesen tt(), of SunSITE Denmark. +The contact address for web-related matters is tt(). diff --git a/Doc/Zsh/mod_cap.yo b/Doc/Zsh/mod_cap.yo new file mode 100644 index 000000000..f6513b314 --- /dev/null +++ b/Doc/Zsh/mod_cap.yo @@ -0,0 +1,28 @@ +texinode(The cap Module)(The clone Module)()(Zsh Modules) +sect(The cap Module) +The tt(cap) module is used for manipulating POSIX.1e (POSIX.6) capability +sets. If the operating system does not support this interface, the +builtins defined by this module will do nothing. +The builtins in this module are: + +startitem() +findex(cap) +cindex(capabilities, setting) +item(tt(cap) [ var(capabilities) ])( +Change the shell's process capability sets to the specified var(capabilities), +otherwise display the shell's current capabilities. +) +findex(getcap) +cindex(capabilities, getting from files) +item(tt(getcap) var(filename) ...)( +This is a built-in implementation of the POSIX standard utility. It displays +the capability sets on each specified var(filename). +) +findex(setcap) +cindex(capabilities, setting on files) +item(tt(setcap) var(capabilities) var(filename) ...)( +This is a built-in implementation of the POSIX standard utility. It sets +the capability sets on each specified var(filename) to the specified +var(capabilities). +) +enditem() diff --git a/Doc/Zsh/mod_clone.yo b/Doc/Zsh/mod_clone.yo new file mode 100644 index 000000000..9bb7dc255 --- /dev/null +++ b/Doc/Zsh/mod_clone.yo @@ -0,0 +1,19 @@ +texinode(The clone Module)(The comp1 Module)(The cap Module)(Zsh Modules) +sect(The clone Module) +The tt(clone) module makes available one builtin command: + +startitem() +findex(clone) +cindex(shell, cloning) +cindex(cloning the shell) +cindex(terminal) +item(tt(clone) var(tty))( +Creates a forked instance of the current shell, attached to the specified +var(tty). In the new shell, the tt(PID), tt(PPID) and tt(TTY) special +parameters are changed appropriately. tt($!) is set to zero in the new +shell, and to the new shell's PID in the original shell. + +The return value of the builtin is zero in both shells if successful, +and non-zero on error. +) +enditem() diff --git a/Doc/Zsh/mod_comp1.yo b/Doc/Zsh/mod_comp1.yo new file mode 100644 index 000000000..879b6d927 --- /dev/null +++ b/Doc/Zsh/mod_comp1.yo @@ -0,0 +1,11 @@ +texinode(The comp1 Module)(The compctl Module)(The clone Module)(Zsh Modules) +sect(The comp1 Module) +The tt(comp1) module does nothing that is visible to the user. +Its purpose is to provide the internal basis of the programmable +completion mechanism. + +This module must be loaded before any module that +provides a means of controlling completion (such as the tt(compctl) +module), or that uses completions (such as the tt(zle) module). +This is done automatically for modules distributed with zsh, and +for other modules can be effected by the use of tt(zmodload -d). diff --git a/Doc/Zsh/mod_compctl.yo b/Doc/Zsh/mod_compctl.yo new file mode 100644 index 000000000..b7adf8fa6 --- /dev/null +++ b/Doc/Zsh/mod_compctl.yo @@ -0,0 +1,7 @@ +texinode(The compctl Module)(The deltochar Module)(The comp1 Module)(Zsh Modules) +sect(The compctl Module) +The tt(compctl) module makes available one builtin command, tt(compctl), +which is the standard way to control completions for ZLE. See +ifzman(zmanref(zshcompctl))\ +ifnzman(noderef(Programmable Completion))\ +. diff --git a/Doc/Zsh/mod_deltochar.yo b/Doc/Zsh/mod_deltochar.yo new file mode 100644 index 000000000..f92a3da0d --- /dev/null +++ b/Doc/Zsh/mod_deltochar.yo @@ -0,0 +1,12 @@ +texinode(The deltochar Module)(The example Module)(The compctl Module)(Zsh Modules) +sect(The deltochar Module) +The tt(deltochar) module makes available one ZLE function: + +startitem() +tindex(delete-to-char) +item(tt(delete-to-char))( +Read a character from the keyboard, and +delete from the cursor position up to and including the next +(or, with repeat count var(n), the var(n)th) instance of that character. +) +enditem() diff --git a/Doc/Zsh/mod_example.yo b/Doc/Zsh/mod_example.yo new file mode 100644 index 000000000..5339253d9 --- /dev/null +++ b/Doc/Zsh/mod_example.yo @@ -0,0 +1,16 @@ +texinode(The example Module)(The files Module)(The deltochar Module)(Zsh Modules) +sect(The example Module) +The tt(example) module makes available one builtin command: + +startitem() +findex(example) +cindex(modules, example) +cindex(modules, writing) +cindex(writing modules) +item(tt(example) [ tt(-flags) ] [ var(args) ... ])( +Displays the flags and arguments it is invoked with. +) +enditem() + +The purpose of the module is to serve as an example of how to write a +module. diff --git a/Doc/Zsh/mod_files.yo b/Doc/Zsh/mod_files.yo new file mode 100644 index 000000000..541ebb4a9 --- /dev/null +++ b/Doc/Zsh/mod_files.yo @@ -0,0 +1,100 @@ +texinode(The files Module)(The sched Module)(The example Module)(Zsh Modules) +sect(The files Module) +cindex(files, manipulating) +The tt(files) module makes some standard commands available as builtins: + +startitem() +findex(ln) +xitem(tt(ln) [ tt(-dfis) ] var(filename) var(dest)) +item(tt(ln) [ tt(-dfis) ] var(filename) ... var(dir))( +Creates hard (or, with tt(-s), symbolic) links. In the first form, the +specified var(dest)ination is created, as a link to the specified +var(filename). In the second form, each of the var(filename)s is +taken in turn, and linked to a pathname in the specified var(dir)ectory +that has the same last pathname component. + +Normally, tt(ln) will not attempt to create hard links to +directories. This check can be overridden using the tt(-d) option. +Typically only the super-user can actually succeed in creating +hard links to directories. +This does not apply to symbolic links in any case. + +By default, existing files cannot be replaced by links. +The tt(-i) option causes the user to be queried about replacing +existing files. The tt(-f) option causes existing files to be +silently deleted, without querying. tt(-f) takes precedence. +) +findex(mkdir) +item(tt(mkdir) [ tt(-p) ] [ tt(-m) var(mode) ] var(dir) ...)( +Creates directories. With the tt(-p) option, non-existing parent +directories are first created if necessary, and there will be +no complaint if the directory already exists. +The tt(-m) option can be used to specify (in octal) a set of file permissions +for the created directories, otherwise mode 777 modified by the current +tt(umask) (see manref(umask)(2)) is used. +) +findex(mv) +xitem(tt(mv) [ tt(-fi) ] var(filename) var(dest)) +item(tt(mv) [ tt(-fi) ] var(filename) ... var(dir))( +Moves files. In the first form, the specified var(filename) is moved +to the specified var(dest)ination. In the second form, each of the +var(filename)s is +taken in turn, and moved to a pathname in the specified var(dir)ectory +that has the same last pathname component. + +By default, the user will be queried before replacing any file +that the user cannot write to, but writable files will be silently +removed. +The tt(-i) option causes the user to be queried about replacing +any existing files. The tt(-f) option causes any existing files to be +silently deleted, without querying. tt(-f) takes precedence. + +Note that this tt(mv) will not move files across devices. +Historical versions of tt(mv), when actual renaming is impossible, +fall back on copying and removing files; if this behaviour is desired, +use tt(cp) and tt(rm) manually. This may change in a future version. +) +findex(rm) +item(tt(rm) [ tt(-dfirs) ] var(filename) ...)( +Removes files and directories specified. + +Normally, tt(rm) will not remove directories (except with the tt(-r) +option). The tt(-d) option causes tt(rm) to try removing directories +with tt(unlink) (see manref(unlink)(2)), the same method used for files. +Typically only the super-user can actually succeed in unlinking +directories in this way. +tt(-d) takes precedence over tt(-r). + +By default, the user will be queried before removing any file +that the user cannot write to, but writable files will be silently +removed. +The tt(-i) option causes the user to be queried about removing +any files. The tt(-f) option causes files to be +silently deleted, without querying, and suppresses all error indications. +tt(-f) takes precedence. + +The tt(-r) option causes tt(rm) to recursively descend into directories, +deleting all files in the directory before removing the directory with +the tt(rmdir) system call (see manref(rmdir)(2)). + +The tt(-s) option is a zsh extension to tt(rm) functionality. It enables +paranoid behaviour, intended to avoid common security problems involving +a root-run tt(rm) being tricked into removing files other than the ones +intended. It will refuse to follow symbolic links, so that (for example) +``tt(rm /tmp/foo/passwd)'' can't accidentally remove tt(/etc/passwd) +if tt(/tmp/foo) happens to be a link to tt(/etc). It will also check +where it is after leaving directories, so that a recursive removal of +a deep directory tree can't end up recursively removing tt(/usr) as +a result of directories being moved up the tree. +) +findex(rmdir) +item(tt(rmdir) var(dir) ...)( +Removes empty directories specified. +) +findex(sync) +item(tt(sync))( +Calls the system call of the same name (see manref(sync)(2)), which +flushes dirty buffers to disk. It might return before the I/O has +actually been completed. +) +enditem() diff --git a/Doc/Zsh/mod_sched.yo b/Doc/Zsh/mod_sched.yo new file mode 100644 index 000000000..1be550a79 --- /dev/null +++ b/Doc/Zsh/mod_sched.yo @@ -0,0 +1,17 @@ +texinode(The sched Module)(The stat Module)(The files Module)(Zsh Modules) +sect(The sched Module) +The tt(sched) module makes available one builtin command: + +startitem() +findex(sched) +cindex(timed execution) +cindex(execution, timed) +xitem(tt(sched) [tt(PLUS())]var(hh)tt(:)var(mm) var(command) ...) +item(tt(sched) [ tt(-)var(item) ])( +Make an entry in the scheduled list of commands to execute. +The time may be specified in either absolute or relative time. +With no arguments, prints the list of scheduled commands. +With the argument `tt(-)var(item)', removes the given item +from the list. +) +enditem() diff --git a/Doc/Zsh/mod_stat.yo b/Doc/Zsh/mod_stat.yo new file mode 100644 index 000000000..22fbe2a73 --- /dev/null +++ b/Doc/Zsh/mod_stat.yo @@ -0,0 +1,145 @@ +texinode(The stat Module)(The zle Module)(The sched Module)(Zsh Modules) +sect(The stat Module) +The tt(stat) module makes available one builtin command: + +startitem() +findex(stat) +cindex(files, listing) +cindex(files, examining) +item(tt(stat) [ tt(-gnNlLtTrs) ] [ tt(-f) var(fd) ] [ tt(-A) var(array) ] \ + [ tt(-F) var(fmt) ] [ tt(PLUS())var(element) ] [ var(file) ... ])( +The command acts as a front end to the tt(stat) system call (see +manref(stat)(2)). +If the tt(stat) call fails, the appropriate system error message +printed and status 1 is returned. +The fields of tt(struct stat) give information about +the files provided as arguments to the command. In addition to those +available from the tt(stat) call, an extra element `tt(link)' is provided. +These elements are: + +startitem() +item(tt(device))( +The number of the device on which the file resides. +) +item(tt(inode))( +The unique number of the file on this device (`em(inode)' number). +) +item(tt(mode))( +The mode of the file; that is, the file's type and access permissions. +With the tt(-s) option, this will +be returned as a string corresponding to the first column in the +display of the tt(ls -l) command. +) +item(tt(nlink))( +The number of hard links to the file. +) +item(tt(uid))( +The user ID of the owner of the file. With the tt(-s) +option, this is displayed as a user name. +) +item(tt(gid))( +The group ID of the file. With the tt(-s) option, this +is displayed as a group name. +) +item(tt(rdev))( +The raw device number. This is only useful for special devices. +) +item(tt(size))( +The size of the file in bytes. +) +xitem(tt(atime)) +xitem(tt(mtime)) +item(tt(ctime))( +The last access, modification and inode change times +of the file, respectively, as the number of seconds since +midnight GMT on 1st January, 1970. With the tt(-s) option, +these are printed as strings for the local time zone; the format +can be altered with the tt(-F) option, and with the tt(-g) +option the times are in GMT. +) +item(tt(blksize))( +The number of bytes in one allocation block on the +device on which the file resides. +) +item(tt(block))( +The number of disk blocks used by the file. +) +item(tt(link))( +If the file is a link and the tt(-L) option is in +effect, this contains the name of the file linked to, otherwise +it is empty. Note that if this element is selected (``tt(stat PLUS()link)'') +then the tt(-L) option is automatically used. +) +enditem() + +A particular element may be selected by including its name +preceded by a `tt(PLUS())' in the option list; only one element is allowed. +The element may be shortened to any unique set of leading +characters. Otherwise, all elements will be shown for all files. + +Options: + +startitem() +item(tt(-A) var(array))( +Instead of displaying the results on standard +output, assign them to an var(array), one tt(struct stat) element per array +element for each file in order. In this case neither the name +of the element nor the name of the files is provided unless the +tt(-t) or tt(-n) options are provided, respectively. In the +former case the element name appears as a prefix to the +appropriate array element and in the latter case the file name +appears as a separate array element preceding all the others. +Other formatting options are respected. +) +item(tt(-f) var(fd))( +Use the file on file descriptor var(fd) instead of +named files; no list of file names is allowed in this case. +) +item(tt(-F) var(fmt))( +Supplies a tt(strftime) (see manref(strftime)(3)) string for the +formatting of the time elements. The tt(-s) option is implied. +) +item(tt(-g))( +Show the time elements in the GMT time zone. The +tt(-s) option is implied. +) +item(tt(-l))( +List the names of the type elements (to standard +output or an array as appropriate) and return immediately; +options other than tt(-A) and arguments are ignored. +) +item(tt(-L))( +Perform an tt(lstat) (see manref(lstat)(2)) rather than a tt(stat) +system call. In this case, if the file is a link, information +about the link itself rather than the target file is returned. +This option is required to make the tt(link) element useful. +) +item(tt(-n))( +Always show the names of files. Usually these are +only shown when output is to standard output and there is more +than one file in the list. +) +item(tt(-N))( +Never show the names of files. +) +item(tt(-r))( +Print raw data (the default format) alongside string +data (the tt(-s) format); the string data appears in parentheses +after the raw data. +) +item(tt(-s))( +Print tt(mode), tt(uid), tt(gid) and the three time +elements as strings instead of numbers. In each case the format +is like that of tt(ls -l). +) +item(tt(-t))( +Always show the type names for the elements of +tt(struct stat). Usually these are only shown when output is to +standard output and no individual element has been selected. +) +item(tt(-T))( +Never show the type names of the tt(struct stat) elements. +) +enditem() +) +enditem() diff --git a/Doc/Zsh/mod_zftp.yo b/Doc/Zsh/mod_zftp.yo new file mode 100644 index 000000000..a15be60d6 --- /dev/null +++ b/Doc/Zsh/mod_zftp.yo @@ -0,0 +1,421 @@ +texinode(The zftp Module)(The zle Module)(The stat Module)(Zsh Modules) +sect(The zftp Module) +The tt(zftp) module makes available one builtin command: + +startitem() +findex(zftp) +cindex(FTP) +cindex(files, transferring) +item(tt(zftp) var(subcommand) [ var(args) ])( +The tt(zftp) module is a client for FTP (file transfer protocol). It +is implemented as a builtin to allow full use of shell command line +editing, file I/O, and job control mechanisms. Often, users will +access it via shell functions providing higher level abilities such as +username and password lookup. However, it is entirely usable in its +own right. + +All commands consist of the command name tt(zftp) followed by the name +of a subcommand. These are listed below. The return status of each +subcommand is supposed to reflect the success or failure of the remote +operation. See a description of the variable tt(ZFTP_VERBOSE) for +more information on how responses from the server may be printed. +) +enditem() + +subsect(Subcommands) +cindex(zftp, subcommands) + +startitem() +cindex(FTP, starting a session) +item(tt(open) var(host) [ var(user) [ var(password) [ var(account) ] ] ])( +Open a new FTP session to var(host), which may be the name of a TCP/IP +connected host or an IP number in the standard dot notation. +Remaining arguments are passed to the tt(login) subcommand. Note that +if no arguments beyond var(host) are supplied, tt(open) will em(not) +automatically call tt(login). If no arguments at all are supplied, +tt(open) will use the parameters set by the tt(params) subcommand. + +After a successful open, the shell variables tt(ZFTP_HOST), +tt(ZFTP_IP) and tt(ZFTP_SYSTEM) are available; see `Variables' +below. +) +xitem(tt(login) [ var(name) [ var(password) [ var(account) ] ] ]) +item(tt(user) [ var(name) [ var(password) [ var(account) ] ] ])( +Login the user var(name) with parameters var(password) and var(account). +Any of the parameters can be omitted, and will be read from standard +input if needed (var(name) is always needed). If +standard input is a terminal, a prompt for each one will be printed on +standard error and var(password) will not be echoed. If any of the +parameters are not used, a warning message is printed. + +After a successful login, the shell variables tt(ZFTP_USER), +tt(ZFTP_ACCOUNT) and tt(ZFTP_PWD) are available; see `Variables' +below. + +This command may be re-issued when a user is already logged in, and +the server will first be reinitialized for a new user. +) +xitem(tt(params) [ var(host) [ var(user) [ var(password) \ +[ var(account) ] ] ] ]) +item(tt(params) tt(-))( +Store the given parameters for a later tt(open) command with no +arguments. Only those given on the command line will be remembered. +Any of the parameters may, however, be specified as a `tt(?)', which +may need to be quoted to protect it from shell expansion: in this case, +the appropriate parameter will be read from stdin as with the +tt(login) subcommand, including special handling of var(password). + +If no arguments are given, the parameters currently set are printed, +although the password will appear as a line of stars. + +If instead a single `tt(-)' is given, the existing parameters, if any, +are deleted. In that case, calling tt(open) with no arguments will +cause an error. + +The list of parameters is not deleted after a tt(close), however it +will be deleted if the tt(zftp) module is unloaded. + +For example, + +nofill(tt(zftp params ftp.elsewhere.xx juser '?')) + +will store the host tt(ftp.elsewhere.xx) and the user tt(juser) and +then prompt the user for the corresponding password. + +This command may also be used to set up a transfer which then takes +place completely in the background, freeing tt(zftp) for concurrent +foreground use. For example, + +nofill(tt(zftp params ftp.soreeyes.ca bubble squeak)) +nofill(tt(LPAR()zftp open; zftp get foo >bar; zftp close)tt(RPAR() &)) + +--- here, the connection is restricted to a background subshell and +you are free to open a simultaneous connection in the foreground. +) +item(tt(cd) var(directory))( +Change the remote directory to var(directory). Also alters the shell +variable tt(ZFTP_PWD). +) +item(tt(cdup))( +Change the remote directory to the one higher in the directory tree. +Note that tt(cd ..) will also work correctly on non-UNIX systems. +) +item(tt(dir) [ var(args...) ])( +Give a (verbose) listing of the remote directory. The var(args) are +passed directly to the server. The command's behaviour is implementation +dependent, but a UNIX server will typically interpret var(args) as +arguments to the tt(ls) command and with no arguments return the +result of `tt(ls -l)'. The directory is listed to standard output. +) +item(tt(ls) [ var(args) ])( +Give a (short) listing of the remote directory. With no var(args), +produces a raw list of the files in the directory, one per line. +Otherwise, up to vagaries of the server implementation, behaves +similar to tt(dir). +) +item(tt(type) [ var(type) ])( +Change the type for transfer to var(type), or print the current type +if var(type) is absent. The allowed values are `tt(A)' (ASCII), +`tt(I)' (Image, i.e. binary), or `tt(B)' (a synonym for `tt(I)'). + +The FTP default for a transfer is ASCII. However, if tt(zftp) finds +that the remote host is a UNIX machine with 8-bit byes, it will +automatically switch to using binary for file transfers upon +tt(open). This can subsequently be overridden. + +The transfer type is only passed to the remote host when a data +connection is established; this command involves no network overhead. +) +item(tt(ascii))( +The same as tt(type A). +) +item(tt(binary))( +The same as tt(type I). +) +item(tt(mode) [ tt(S) | tt(B) ])( +Set the mode type to stream (tt(S)) or block (tt(B)). Stream mode is +the default; block mode is not widely supported. +) +xitem(tt(remote) var(files...)) +item(tt(local) [ var(files...) ])( +Print the size and last modification time of the remote or local +files. If there is more than one item on the list, the name of the +file is printed first. The first number is the file size, the second +is the last modification time of the file in the format +tt(CCYYMMDDhhmmSS) consisting of year, month, date, hour, minutes and +seconds in GMT. Note that this format, including the length, is +guaranteed, so that time strings can be directly compared via the +tt([[) builtin's tt(<) and tt(>) operators, even if they are too long +to be represented as integers. + +Not all servers support the commands for retrieving this information. +In that case, the tt(remote) command will print nothing and return +status 2, compared with status 1 for a file not found. + +The tt(local) command (but not tt(remote)) may be used with no +arguments, in which case the information comes from examining file +descriptor zero. This is the same file as seen by a tt(put) command +with no further redirection. +) +item(tt(get) var(file) [...])( +Retrieve all var(file)s from the server, concatenating them +and sending them to standard output. +) +item(tt(put) var(file) [...])( +For each var(file), read a file from standard input and send that to +the remote host with the given name. +) +item(tt(append) var(file) [...])( +As tt(put), but if the remote var(file) already exists, data is +appended to it instead of overwriting it. +) +xitem(tt(getat) var(file) var(point)) +xitem(tt(putat) var(file) var(point)) +item(tt(appendat) var(file) var(point))( +Versions of tt(get), tt(put) and tt(append) which will start the +transfer at the given var(point) in the remote var(file). This is +useful for appending to an incomplete local file. However, note that +this ability is not universally supported by servers (and is not quite +the behaviour specified by the standard). +) +item(tt(delete) var(file) [...])( +Delete the list of files on the server. +) +item(tt(mkdir) var(directory))( +Create a new directory var(directory) on the server. +) +item(tt(rmdir) var(directory))( +Delete the diretory var(directory) on the server. +) +item(tt(rename) var(old-name) var(new-name))( +Rename file var(old-name) to var(new-name) on the server. +) +item(tt(site) var(args...))( +Send a host-specific command to the server. You will probably +only need this if instructed by the server to use it. +) +item(tt(quote) var(args...))( +Send the raw FTP command sequence to the server. You should be +familiar with the FTP command set as defined in RFC959 before doing +this. Useful comands may include tt(STAT) and tt(HELP). Note also +the mechanism for returning messages as described for the variable +tt(ZFTP_VERBOSE) below, in particular that all messages from the +control connection are sent to standard error. +) +xitem(tt(close)) +item(tt(quit))( +Close the current data connection. This unsets the shell parameters +tt(ZFTP_HOST), tt(ZFTP_IP), tt(ZFTP_SYSTEM), tt(ZFTP_USER), +tt(ZFTP_ACCOUNT) and tt(ZFTP_PWD). +) +enditem() + +subsect(Parameters) +cindex(zftp, parameters) +The following shell parameters are used by tt(zftp). Currently none +of them are special. + +startitem() +item(tt(ZFTP_TMOUT))( +Integer. The time in seconds to wait for a network operation to +complete before returning an error. If this is not set when the +module is loaded, it will be given the default value 60. A value of +zero turns off timeouts. If a timeout occurs on the control +connection it will be closed. Use a larger value if this occurs too +frequently. +) +vindex(ZFTP_IP) +item(tt(ZFTP_IP))( +Readonly. The IP address of the current connection in dot notation. +) +vindex(ZFTP_HOST) +item(tt(ZFTP_HOST))( +Readonly. The hostname of the current remote server. If the host was +opened as an IP number, tt(ZFTP_HOST) contains that instead; this +saves the overhead for a name lookup, as IP numbers are most commonly +used when a nameserver is unavailable. +) +vindex(ZFTP_SYSTEM) +item(tt(ZFTP_SYSTEM))( +Readonly. The system type string returned by the server in response +to an FTP tt(SYST) request. The most interesting case is a string +beginning tt("UNIX Type: L8"), which ensures maximum compatibility +with a local UNIX host. +) +vindex(ZFTP_TYPE) +item(tt(ZFTP_TYPE))( +Readonly. The type to be used for data transfers , either `tt(A)' or +`tt(I)'. Use the tt(type) subcommand to change this. +) +vindex(ZFTP_USER) +item(tt(ZFTP_USER))( +Readonly. The username currently logged in, if any. +) +vindex(ZFTP_ACCT) +item(tt(ZFTP_ACCT))( +Readonly. The account name of the current user, if any. Most servers +do not require an account name. +) +vindex(ZFTP_PWD) +item(tt(ZFTP_PWD))( +Readonly. The current directory on the server. +) +vindex(ZFTP_CODE) +item(tt(ZFTP_CODE))( +Readonly. The three digit code of the last FTP reply from the server +as a string. This can still be read after the connection is closed. +) +vindex(ZFTP_REPLY) +item(tt(ZFTP_REPLY))( +Readonly. The last line of the last reply sent by the server. This +can still be read after the connection is closed. +) +vindex(ZFTP_PREFS) +item(tt(ZFTP_PREFS))( +A string of preferences for altering aspects of tt(zftp)'s behaviour. +Each preference is a single character. The following are defined: + +startitem() +item(tt(P))( +Passive: attempt to make the remote server initiate data transfers. +This is slightly more efficient than sendport mode. If the letter +tt(S) occurs later in the string, tt(zftp) will use sendport mode if +passive mode is not available. +) +item(tt(S))( +Sendport: initiate transfers by the FTP tt(PORT) command. If this +occurs before any tt(P) in the string, passive mode will never be +attempted. +) +item(tt(D))( +Dumb: use only the bare minimum of FTP commands. This prevents +the variables tt(ZFTP_SYSTEM) and tt(ZFTP_PWD) from being set, and +will mean all connections default to ASCII type. It may prevent +tt(ZFTP_SIZE) from being set during a transfer if the server +does not send it anyway (many servers do). +) +enditem() + +If tt(ZFTP_PREFS) is not set when tt(zftp) is loaded, it will be set to a +default of `tt(PS)', i.e. use passive mode if available, otherwise +fall back to sendport mode. +) +vindex(ZFTP_VERBOSE) +item(tt(ZFTP_VERBOSE))( +A string of digits between 0 and 5 inclusive, specifying which +responses from the server should be printed. All responses go to +standard error. If any of the numbers 1 to 5 appear in the string, +raw responses from the server with reply codes beginning with that +digit will be printed to standard error. The first digit of the three +digit reply code is defined by RFC959 to correspond to: + +startitem() +item(1.)( +A positive prelimnary reply. +) +item(2.)( +A positive completion reply. +) +item(3.)( +A positive intermediate reply. +) +item(4.)( +A transient negative completion reply. +) +item(5.)( +A permanent negative completion reply. +) +enditem() + +It should be noted that, for unknown reasons, the reply `Service not +available', which forces termination of a connection, is classified as +421, i.e. `transient negative', an interesting interpretation of the word +`transient'. + +The code 0 is special: it indicates that all but the last line of +multiline replies read from the server will be printed to standard +error in a processed format. By convention, servers use this +mechanism for sending information for the user to read. The +appropriate reply code, if it matches the same response, takes +priority. + +If tt(ZFTP_VERBOSE) is not set when tt(zftp) is loaded, it will be +set to the default value tt(450), i.e., messages destined for the user +and all errors will be printed. A null string is valid and +specifies that no messages should be printed. +) +enditem() + +subsect(Functions) +cindex(zftp, functions) + +startitem() +findex(zftp_chpwd) +item(tt(zftp_chpwd))( +If this function is set by the user, it is called every time the +directory changes on the server, including when a user is logged +in, or when a connection is closed. In the last case, tt($ZFTP_PWD) +will be unset; otherwise it will reflect the new directory. +) +findex(zftp_progress) +item(tt(zftp_progress))( +If this function is set by the user, it will be called during +a tt(get), tt(put) or tt(append) operation each time sufficient data +has been received from the host. During a tt(get), the data is sent +to standard output, so it is vital that this function should write +to standard error or directly to the terminal, em(not) to standard +output. + +When it is called with a transfer in progress, the following +additional shell parameters are set: + +startitem() +vindex(ZFTP_FILE) +item(tt(ZFTP_FILE))( +The name of the remote file being transferred from or to. +) +vindex(ZFTP_TRANSFER) +item(tt(ZFTP_TRANSFER))( +A tt(G) for a tt(get) operation and a tt(P) for a tt(put) operation. +) +vindex(ZFTP_SIZE) +item(tt(ZFTP_SIZE))( +The total size of the complete file being transferred: +the same as the first value provided by the +tt(remote) and tt(local) subcommands for a particular file. +If the server cannot supply this value for a remote file being +retrieved, it will not be set. If input is from a pipe the value may +be incorrect and correspond simply to a full pipe buffer. +) +vindex(ZFTP_COUNT) +item(tt(ZFTP_COUNT))( +The amount of data so far transferred; a number between zero and +tt($ZFTP_SIZE), if that is set. This number is always available. +) +enditem() + +The function is initially called with tt(ZFTP_TRANSFER) set +appropriately and tt(ZFTP_COUNT) set to zero. After the transfer is +finished, the function will be called one more time with +tt(ZFTP_TRANSFER) set to tt(GF) or tt(PF), in case it wishes to tidy +up. It is otherwise never called twice with the same value of +tt(ZFTP_COUNT). + +Sometimes the progress meter may cause disruption. It is up to the +user to decide whether the function should be defined and to use +tt(unfunction) when necessary. +) + +subsect(Problems) +cindex(zftp, problems) + +With the exception noted for the tt(params) subcommand, a connection +may not be opened in the left hand side of a pipe as this occurs in a +subshell and the file information is not updated in the main shell. +In the case of type or mode changes or closing the connection in a +subshell, the information is returned but variables are not updated +until the next call to tt(zftp). Other status changes in subshells +will not be reflected by changes to the variables (but should +be otherwise harmless). + +enditem() diff --git a/Doc/Zsh/mod_zle.yo b/Doc/Zsh/mod_zle.yo new file mode 100644 index 000000000..9aa03f7f8 --- /dev/null +++ b/Doc/Zsh/mod_zle.yo @@ -0,0 +1,193 @@ +texinode(The zle Module)()(The stat Module)(Zsh Modules) +sect(The zle Module) +The tt(zle) module contains the Zsh Line Editor. See +ifzman(zmanref(zshzle))\ +ifnzman(noderef(Zsh Line Editor))\ +. It also contains three related builtin commands: + +startitem() +findex(bindkey) +cindex(keys, rebinding) +cindex(rebinding keys) +cindex(keys, binding) +cindex(binding keys) +cindex(keymaps) +xitem(tt(bindkey) [ var(options) ] tt(-l)) +xitem(tt(bindkey) [ var(options) ] tt(-d)) +xitem(tt(bindkey) [ var(options) ] tt(-D) var(keymap) ...) +xitem(tt(bindkey) [ var(options) ] tt(-A) var(old-keymap new-keymap)) +xitem(tt(bindkey) [ var(options) ] tt(-N) var(new-keymap) [ var(old-keymap) ]) +xitem(tt(bindkey) [ var(options) ] tt(-m)) +xitem(tt(bindkey) [ var(options) ] tt(-r) var(in-string) ...) +xitem(tt(bindkey) [ var(options) ] tt(-s) var(in-string out-string) ...) +xitem(tt(bindkey) [ var(options) ] var(in-string command) ...) +item(tt(bindkey) [ var(options) ] [ var(in-string) ])( +tt(bindkey)'s options can be divided into three categories: keymap selection, +operation selection, and others. The keymap selection options are: + +startitem() +item(tt(-e))( +Selects keymap `tt(emacs)', and also links it to `tt(main)'. +) +item(tt(-v))( +Selects keymap `tt(viins)', and also links it to `tt(main)'. +) +item(tt(-a))( +Selects keymap `tt(vicmd)'. +) +item(tt(-M))( +The first non-option argument is used as a keymap name, +and does not otherwise count as an argument. +) +enditem() + +Some operations do not permit a keymap to be selected. +If a keymap selection is required and none of the options above are used, the +`tt(main)' keymap is used. These operations do not permit a keymap to be +selected: + +startitem() +item(tt(-l))( +List all existing keymap names. If the tt(-L) +option is used, list in the form of tt(bindkey) +commands to create the keymaps. +) +item(tt(-d))( +Delete all existing keymaps and reset to the default state. +) +item(tt(-D) var(keymap) ...)( +Delete the named var(keymap)s. +) +item(tt(-A) var(old-keymap new-keymap))( +Make the var(new-keymap) name an alias for var(old-keymap), so that +both names refer to the same keymap. The names have equal standing; +if either is deleted, the other remains. If there is already a keymap +with the var(new-keymap) name, it is deleted. +) +item(tt(-N) var(new-keymap) [ var(old-keymap) ])( +Create a new keymap, named var(new-keymap). If a keymap already has that +name, it is deleted. If an var(old-keymap) name is given, the new keymap +is initialised to be a duplicate of it, otherwise the new keymap will +be empty. +) +enditem() + +The following operations require a keymap to be selected: + +startitem() +item(tt(-m))( +Add the built-in set of meta-key bindings to the selected keymap. +Only keys that are unbound or bound to tt(self-insert) are affected. +) +item(tt(-r) var(in-string) ...)( +Unbind the specified var(in-string)s in the selected keymap. +This is exactly equivalent to binding the strings to tt(undefined-key). +) +item(tt(-s) var(in-string out-string) ...)( +Bind each var(in-string) to each var(out-string). +When var(in-string) is typed, var(out-string) will be +pushed back and treated as input to the line editor. +) +item(var(in-string command) ...)( +Bind each var(in-string) to each var(command). +) +item([ var(in-string) ])( +List key bindings. If an var(in-string) is specified, the binding of +that string in the selected keymap is displayed. Otherwise, all key +bindings in the selected keymap are displayed. As an exception, +if the tt(-e) or tt(-v) options are used alone, the keymap is em(not) +displayed - the implicit linking of keymaps is the only thing that happens. +) +enditem() + +In the binding operations, if the tt(-R) option is used, the var(in-string)s +are interpreted as ranges, instead of plain strings. A valid range +consists of two characters, with an optional `tt(-)' +between them. All characters between the two specified, inclusive, +are bound as specified. + +For either var(in-string) or var(out-string), the following +escape sequences are recognised: + +startsitem() +sitem(tt(\a))(bell character) +sitem(tt(\b))(backspace) +sitem(tt(\e), tt(\E))(escape) +sitem(tt(\f))(form feed) +sitem(tt(\n))(linefeed (newline)) +sitem(tt(\r))(carriage return) +sitem(tt(\t))(horizontal tab) +sitem(tt(\v))(vertical tab) +sitem(tt(\)var(NNN))(character code in octal) +sitem(tt(\x)var(NN))(character code in hexadecimal) +sitem(tt(\M)[tt(-)]var(X))(character with meta bit set) +sitem(tt(\C)[tt(-)]var(X))(control character) +sitem(tt(^)var(X))(control character) +endsitem() + +In all other cases, `tt(\)' escapes the following character. Delete is +written as `tt(^?)'. Note that `tt(\M^?)' and `tt(^\M?)' are not the same. +) +findex(vared) +cindex(parameters, editing) +cindex(editing parameters) +item(tt(vared) [ tt(-ch) ] [ tt(-p) var(prompt) ] [ tt(-r) var(rprompt) ] var(name))( +The value of the parameter var(name) is loaded into the edit +buffer, and the line editor is invoked. When the editor exits, +var(name) is set to the string value returned by the editor. +If the tt(-c) flag is given, the parameter is created if it doesn't +already exist. +If the tt(-p) flag is given, the following string will be taken as +the prompt to display at the left. If the tt(-r) flag is given, +the following string gives the prompt to display at the right. If the +tt(-h) flag is specified, the history can be accessed from ZLE. +) +findex(zle) +cindex(widgets, rebinding) +cindex(rebinding widgets) +cindex(widgets, binding) +cindex(binding widgets) +cindex(widgets, invoking) +cindex(invoking widgets) +cindex(widgets, calling) +cindex(calling widgets) +cindex(widgets, defining) +cindex(defining widgets) +xitem(tt(zle) tt(-l) [ tt(-L) ]) +xitem(tt(zle) tt(-D) var(widget) ...) +xitem(tt(zle) tt(-A) var(old-widget) var(new-widget)) +xitem(tt(zle) tt(-N) var(widget) [ var(function) ]) +item(tt(zle) var(widget))( +The tt(zle) builtin performs a number of different actions concerning +ZLE. Which operation it performs depends on its options: + +startitem() +item(tt(-l) [ tt(-L) ])( +List all existing user-defined widgets. If the tt(-L) +option is used, list in the form of tt(zle) +commands to create the widgets. +Built-in widgets are not listed. +) +item(tt(-D) var(widget) ...)( +Delete the named var(widget)s. +) +item(tt(-A) var(old-widget) var(new-widget))( +Make the var(new-widget) name an alias for var(old-widget), so that +both names refer to the same widget. The names have equal standing; +if either is deleted, the other remains. If there is already a widget +with the var(new-widget) name, it is deleted. +) +item(tt(-N) var(widget) [ var(function) ])( +Create a user-defined widget. If there is already a widget with the +specified name, it is overwritten. When the new +widget is invoked from within the editor, the specified shell var(function) +is called. If no function name is specified, it defaults to +the same name as the widget. +) +item(var(widget))( +Invoke the specified widget. This can only be done when ZLE is +active; normally this will be within a user-defined widget. +) +enditem() +) +enditem() diff --git a/Doc/Zsh/modules.yo b/Doc/Zsh/modules.yo new file mode 100644 index 000000000..b44b00e6b --- /dev/null +++ b/Doc/Zsh/modules.yo @@ -0,0 +1,64 @@ +texinode(Zsh Modules)()(Programmable Completion)(Top) +chapter(Zsh Modules) +cindex(modules) +sect(Description) +Some optional parts of zsh are in modules, separate from the core +of the shell. Each of these modules may be linked in to the +shell at build time, +or can be dynamically linked while the shell is running +if the installation supports this feature. The modules available are: + +startitem() +item(tt(cap))( +Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets. +) +item(tt(clone))( +A builtin that can clone a running shell onto another terminal. +) +item(tt(comp1))( +Base of the completion system. Used by the tt(compctl) and tt(zle) modules. +) +item(tt(compctl))( +The tt(compctl) builtin for controlling completion. +) +item(tt(deltochar))( +A ZLE function duplicating EMACS' tt(zap-to-char). +) +item(tt(example))( +An example of how to write a module. +) +item(tt(files))( +Some basic file manipulation commands as builtins. +) +item(tt(sched))( +A builtin that provides a timed execution facility within the shell. +) +item(tt(stat))( +A builtin command interface to the tt(stat) system call. +) +item(tt(zle))( +The Zsh Line Editor, including the tt(bindkey) and tt(vared) builtins. +) +enditem() +startmenu() +menu(The cap Module) +menu(The clone Module) +menu(The comp1 Module) +menu(The compctl Module) +menu(The deltochar Module) +menu(The example Module) +menu(The files Module) +menu(The sched Module) +menu(The stat Module) +menu(The zle Module) +endmenu() +includefile(Zsh/mod_cap.yo) +includefile(Zsh/mod_clone.yo) +includefile(Zsh/mod_comp1.yo) +includefile(Zsh/mod_compctl.yo) +includefile(Zsh/mod_deltochar.yo) +includefile(Zsh/mod_example.yo) +includefile(Zsh/mod_files.yo) +includefile(Zsh/mod_sched.yo) +includefile(Zsh/mod_stat.yo) +includefile(Zsh/mod_zle.yo) diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo new file mode 100644 index 000000000..0fdf78e8a --- /dev/null +++ b/Doc/Zsh/options.yo @@ -0,0 +1,1039 @@ +texinode(Options)(Shell Builtin Commands)(Parameters)(Top) +chapter(Options) +cindex(options) +startmenu() +menu(Specifying Options) +menu(Description of Options) +menu(Option Aliases) +menu(Single Letter Options) +endmenu() +texinode(Specifying Options)(Description of Options)()(Options) +sect(Specifying Options) +cindex(options, specifying) +Options are primarily referred to by name. +These names are case insensitive and underscores are ignored. +For example, `tt(allexport)' is equivalent to `tt(A__lleXP_ort)'. + +The sense of an option name may be inverted by preceding it with +`tt(no)', so `tt(setopt No_Beep)' is equivalent to `tt(unsetopt beep)'. +This inversion can only be done once, so `tt(nonobeep)' is em(not) +a synonym for `tt(beep)'. Similarly, `tt(tify)' is not a synonym for +`tt(nonotify)' (the inversion of `tt(notify)'). + +Some options also have one or more single letter names. +There are two sets of single letter options: one used by default, +and another used to emulate bf(sh)/bf(ksh) (used when the +tt(SH_OPTION_LETTERS) option is set). +The single letter options can be used on the shell command line, +or with the tt(set), tt(setopt) and tt(unsetopt) +builtins, as normal Unix options preceded by `tt(-)'. + +The sense of the single letter options may be inverted by using +`tt(PLUS())' instead of `tt(-)'. +Some of the single letter option names refer to an option being off, +in which case the inversion of that name refers to the option being on. +For example, `tt(PLUS()n)' is the short name of `tt(exec)', and +`tt(-n)' is the short name of its inversion, `tt(noexec)'. +texinode(Description of Options)(Option Aliases)(Specifying Options)(Options) +sect(Description of Options) +cindex(options, description) +startitem() +pindex(ALL_EXPORT) +cindex(export, automatic) +item(tt(ALL_EXPORT) (tt(-a), ksh: tt(-a)))( +All parameters subsequently defined are automatically exported. +) +pindex(ALWAYS_LAST_PROMPT) +item(tt(ALWAYS_LAST_PROMPT))( +If unset, key functions that list completions try to return to the last +prompt if given a numeric argument. If set these functions try to +return to the last prompt if given em(no) numeric argument. +) +pindex(ALWAYS_TO_END) +item(tt(ALWAYS_TO_END))( +If a completion is performed with the cursor within a word, and a +full completion is inserted, the cursor is moved to the end of the +word. That is, the cursor is moved to the end of the word if either +a single match is inserted or menu completion is performed. +) +pindex(APPEND_HISTORY) +cindex(history, appending to a file) +item(tt(APPEND_HISTORY))( +If this is set, zsh sessions will append their history list to +the history file, rather than overwrite it. Thus, multiple parallel +zsh sessions will all have their history lists added to the +history file, in the order they are killed. +) +pindex(AUTO_CD) +cindex(cd, automatic) +item(tt(AUTO_CD) (tt(-J)))( +If a command is issued that can't be executed as a normal command, +and the command is the name of a directory, perform the tt(cd) +command to that directory. +) +pindex(AUTO_LIST) +cindex(completion, listing choices) +item(tt(AUTO_LIST) (tt(-9)))( +Automatically list choices on an ambiguous completion. +) +pindex(AUTO_MENU) +cindex(completion, menu) +item(tt(AUTO_MENU))( +Automatically use menu completion after the second consecutive request for +completion, for example by pressing the tab key repeatedly. This option +is overridden by tt(MENU_COMPLETE). +) +pindex(AUTO_NAME_DIRS) +cindex(directories, named) +item(tt(AUTO_NAME_DIRS))( +Any parameter that is set to the absolute name of a directory +immediately becomes a name for that directory, that will be used +by the `tt(%~)' +and related prompt sequences, and will be available when completion +is performed on a word starting with `tt(~)'. +(Otherwise, the parameter must be used in the form `tt(~)var(param)' first.) +) +pindex(AUTO_PARAM_KEYS) +item(tt(AUTO_PARAM_KEYS))( +If a parameter name was completed and a following character +(normally a space) automatically +inserted, and the next character typed is one +of those that have to come directly after the name (like `tt(})', `tt(:)', +etc.), the automatically added character is deleted, so that the character +typed comes immediately after the parameter name. +Completion in a brace expansion is affected similarly: the added character +is a `tt(,)', which will be removed if `tt(})' is typed next. +) +pindex(AUTO_PARAM_SLASH) +item(tt(AUTO_PARAM_SLASH))( +If a parameter is completed whose content is the name of a directory, +then add a trailing slash instead of a space. +) +pindex(AUTO_PUSHD) +cindex(cd, behaving like pushd) +cindex(pushd, making cd behave like) +item(tt(AUTO_PUSHD) (tt(-N)))( +Make tt(cd) push the old directory onto the directory stack. +) +pindex(AUTO_REMOVE_SLASH) +cindex(slash, removing trailing) +item(tt(AUTO_REMOVE_SLASH))( +When the last character resulting from a completion is a slash and the next +character typed is a word delimiter or a slash, remove the slash. +) +pindex(AUTO_RESUME) +cindex(jobs, resuming automatically) +cindex(resuming jobs automatically) +item(tt(AUTO_RESUME) (tt(-W)))( +Treat single word simple commands without redirection +as candidates for resumption of an existing job. +) +pindex(BAD_PATTERN) +cindex(globbing, bad pattern) +cindex(filename generation, bad pattern) +item(tt(BAD_PATTERN) (tt(PLUS()2)))( +If a pattern for filename generation is badly formed, print an error message. +(If this option is unset, the pattern will be left unchanged.) +) +pindex(BANG_HIST) +cindex(history, enable substitution) +cindex(enable history substitution) +item(tt(BANG_HIST) (tt(PLUS()K)))( +Perform textual history substitution, bf(csh)-style, +treating the character `tt(!)' specially. +) +pindex(BARE_GLOB_QUAL) +cindex(globbing qualifiers, enable) +cindex(enable globbing qualifiers) +item(tt(BARE_GLOB_QUAL))( +In a glob pattern, treat a trailing set of parentheses as a qualifier +list, if it contains no `tt(|)', `tt(LPAR())' or (if special) `tt(~)' +characters. See noderef(Filename Generation). +) +pindex(BEEP) +cindex(beep, enabling) +cindex(enabling the beep) +item(tt(BEEP) (tt(PLUS()B)))( +Beep on error in ZLE. +) +pindex(BG_NICE) +cindex(jobs, background priority) +cindex(background jobs, priority of) +cindex(priority of background jobs) +item(tt(BG_NICE) (tt(-6)))( +Run all background jobs at a lower priority. This option +is set by default. +) +pindex(BRACE_CCL) +cindex(brace expansion, extending) +cindex(expansion, brace, extending) +item(tt(BRACE_CCL))( +Expand expressions in braces which would not otherwise undergo brace +expansion to a lexically ordered list of all the characters. See +noderef(Brace Expansion). +) +pindex(BSD_ECHO) +cindex(echo, BSD compatible) +item(tt(BSD_ECHO))( +Make the tt(echo) builtin compatible with the BSD manref(echo)(1) command. +This disables backslashed escape sequences in echo strings unless the +tt(-e) option is specified. +) +pindex(CDABLE_VARS) +cindex(cd, to parameter) +item(tt(CDABLE_VARS) (tt(-T)))( +If the argument to a tt(cd) command (or an implied tt(cd) with the +tt(AUTO_CD) option set) is not a directory, and does not begin with a +slash, try to expand the expression as if it were preceded by a `tt(~)' (see +noderef(Filename Expansion)). +) +pindex(CHASE_LINKS) +cindex(links, symbolic) +cindex(symbolic links) +item(tt(CHASE_LINKS) (tt(-w)))( +Resolve symbolic links to their true values when changing directory. +) +pindex(CLOBBER) +cindex(clobbering, of files) +cindex(file clobbering, allowing) +item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)))( +Allows `tt(>)' redirection to truncate existing files, +and `tt(>>)' to create files. +Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file, +and `tt(>>!)' or `tt(>>|)' to create a file. +) +pindex(COMPLETE_ALIASES) +cindex(aliases, completion of) +item(tt(COMPLETE_ALIASES))( +Prevents aliases on the command line from being internally substituted +before completion is attempted. The effect is to make the alias a +distinct command for completion purposes. +) +pindex(COMPLETE_IN_WORD) +item(tt(COMPLETE_IN_WORD))( +If unset, the cursor is set to the end of the word if completion is +started. Otherwise it stays there and completion is done from both ends. +) +pindex(CORRECT) +cindex(correction, spelling) +cindex(spelling correction) +item(tt(CORRECT) (tt(-0)))( +Try to correct the spelling of commands. +) +pindex(CORRECT_ALL) +item(tt(CORRECT_ALL) (tt(-O)))( +Try to correct the spelling of all arguments in a line. +) +pindex(CSH_JUNKIE_HISTORY) +cindex(csh, history style) +cindex(history style, csh) +item(tt(CSH_JUNKIE_HISTORY))( +A history reference without an event specifier will always refer to the +previous command. Without this option, such a history reference refers +to the same event as the previous history reference, defaulting to the +previous command. +) +pindex(CSH_JUNKIE_LOOPS) +cindex(csh, loop style) +cindex(loop style, csh) +item(tt(CSH_JUNKIE_LOOPS))( +Allow loop bodies to take the form `var(list); tt(end)' instead of +`tt(do) var(list); tt(done)'. +) +pindex(CSH_JUNKIE_QUOTES) +cindex(csh, quoting style) +cindex(quoting style, csh) +item(tt(CSH_JUNKIE_QUOTES))( +Changes the rules for single- and double-quoted text to match that of +bf(csh). These require that embedded newlines be preceded by a backslash; +unescaped newlines will cause an error message. +In double-quoted strings, it is made impossible to escape `tt($)', `tt(`)' +or `tt(")' (and `tt(\)' itself no longer needs escaping). +Command substitutions are only expanded once, and cannot be nested. +) +pindex(CSH_NULL_GLOB) +cindex(csh, null globbing style) +cindex(null globbing style, csh) +cindex(globbing, null, style, csh) +item(tt(CSH_NULL_GLOB))( +If a pattern for filename generation has no matches, +delete the pattern from the argument list; +do not report an error unless all the patterns +in a command have no matches. +Overrides tt(NULL_GLOB). +) +pindex(EQUALS) +cindex(filename substitution, =) +item(tt(EQUALS))( +Perform tt(=) filename substitution. +(See noderef(Filename Expansion).) +) +pindex(ERR_EXIT) +cindex(exit status, trapping) +item(tt(ERR_EXIT) (tt(-e), ksh: tt(-e)))( +If a command has a non-zero exit status, execute the tt(ZERR) +trap, if set, and exit. This is disabled while running initialization +scripts. +) +pindex(EXEC) +cindex(command execution, enabling) +item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)))( +Do execute commands. Without this option, commands are +read and checked for syntax errors, but not executed. +) +pindex(EXTENDED_GLOB) +cindex(globbing, extended) +item(tt(EXTENDED_GLOB))( +Treat the `tt(#)', `tt(~)' and `tt(^)' characters as part of patterns +for filename generation, etc. (An initial unquoted `tt(~)' +always produces named directory expansion.) +) +pindex(EXTENDED_HISTORY) +cindex(history, timestamping) +item(tt(EXTENDED_HISTORY))( +Save beginning and ending timestamps to the history file. +The format of these timestamps is +`tt(:)var()tt(:)var()tt(:)var()'. +) +pindex(FLOW_CONTROL) +cindex(flow control) +item(tt(FLOW_CONTROL))( +If this option is unset, +output flow control via start/stop characters (usually assigned to +^S/^Q) is disabled in the shell's editor. +) +pindex(FUNCTION_ARGZERO) +cindex($0, setting) +item(tt(FUNCTION_ARGZERO))( +When executing a shell function or sourcing a script, set tt($0) +temporarily to the name of the function/script. +) +pindex(GLOB) +cindex(globbing, enabling) +cindex(enabling globbing) +item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)))( +Perform filename generation (globbing). +(See noderef(Filename Generation).) +) +pindex(GLOB_ASSIGN) +item(tt(GLOB_ASSIGN))( +If this option is set, filename generation (globbing) is +performed on the right hand side of scalar parameter assignments of +the form `var(name)tt(=)var(pattern) (e.g. `tt(foo=*)'). +If the result has more than one word the parameter will become an array +with those words as arguments. This option is provided for backwards +compatibility only: globbing is always performed on the right hand side +of array assignments of the form `var(name)tt(=LPAR())var(value)tt(RPAR())' +(e.g. `tt(foo=(*))') and this form is recommended for clarity; +with this option set, it is not possible to predict whether the result +will be an array or a scalar. +) +pindex(GLOB_COMPLETE) +item(tt(GLOB_COMPLETE))( +When the current word has a glob pattern, do not insert all the words +resulting from the expansion but cycle through them like +tt(MENU_COMPLETE). If no matches are found, a `tt(*)' is added to the end of the +word or inserted at the cursor if tt(COMPLETE_IN_WORD) is set, and expansion +is attempted again. Using patterns works not only for files but for all +completions, such as options, user names, etc. +) +pindex(GLOB_DOTS) +cindex(globbing, of . files) +item(tt(GLOB_DOTS) (tt(-4)))( +Do not require a leading `tt(.)' in a filename to be matched explicitly. +) +pindex(GLOB_SUBST) +item(tt(GLOB_SUBST))( +Treat any characters resulting from parameter substitution as being +eligible for file expansion and filename generation, and any +characters resulting from command substitution as being eligible for +filename generation. +) +pindex(HASH_CMDS) +cindex(hashing, of commands) +cindex(command hashing) +item(tt(HASH_CMDS))( +Note the location of each command the first time it is executed. +Subsequent invocations of the same command will use the +saved location, avoiding a path search. +If this option is unset, no path hashing will be done at all. +) +pindex(HASH_DIRS) +cindex(hashing, of directories) +cindex(directories, hashing) +item(tt(HASH_DIRS))( +Whenever a command is executed, hash the directory containing it, +as well as all directories that occur earlier in the path. +Has no effect if tt(HASH_CMDS) is unset. +) +pindex(HASH_LIST_ALL) +item(tt(HASH_LIST_ALL))( +Whenever a command completion is attempted, make sure the entire +command path is hashed first. This makes the first completion slower. +) +pindex(HIST_ALLOW_CLOBBER) +item(tt(HIST_ALLOW_CLOBBER))( +Add `tt(|)' to output redirections in the history. This allows history +references to clobber files even when tt(CLOBBER) is unset. +) +pindex(HIST_BEEP) +cindex(history beeping) +cindex(beep, history) +item(tt(HIST_BEEP))( +Beep when an attempt is made to access a history entry which +isn't there. +) +pindex(HIST_IGNORE_DUPS) +cindex(history, ignoring duplicates) +item(tt(HIST_IGNORE_DUPS) (tt(-h)))( +Do not enter command lines into the history list +if they are duplicates of the previous event. +) +pindex(HIST_IGNORE_SPACE) +cindex(history, ignoring spaces) +item(tt(HIST_IGNORE_SPACE) (tt(-g)))( +Do not enter command lines into the history list +if any command on the line begins with a blank. +) +pindex(HIST_NO_FUNCTIONS) +item(tt(HIST_NO_FUNCTIONS))( +Do not store function definitions in the history list. +) +pindex(HIST_NO_STORE) +item(tt(HIST_NO_STORE))( +Remove the tt(history) (tt(fc -l)) command from +the history when invoked. +) +pindex(HIST_REDUCE_BLANKS) +item(tt(HIST_REDUCE_BLANKS))( +Remove superfluous blanks from each command line +being added to the history list. +) +pindex(HIST_VERIFY) +cindex(history, verifying substitution) +item(tt(HIST_VERIFY))( +Whenever the user enters a line with history substitution, +don't execute the line directly; instead, perform +history substitution and reload the line into the editing buffer. +) +pindex(HUP) +cindex(jobs, HUP) +item(tt(HUP))( +Send the tt(HUP) signal to running jobs when the +shell exits. +) +pindex(IGNORE_BRACES) +cindex(disabling brace expansion) +cindex(brace expansion, disabling) +cindex(expansion, brace, disabling) +item(tt(IGNORE_BRACES) (tt(-I)))( +Do not perform brace expansion. +) +pindex(IGNORE_EOF) +cindex(EOF, ignoring) +item(tt(IGNORE_EOF) (tt(-7)))( +Do not exit on end-of-file. Require the use +of tt(exit) or tt(logout) instead. +However, ten consecutive EOFs will cause the shell to exit anyway, +to avoid the shell hanging if its tty goes away. +) +pindex(INTERACTIVE) +item(tt(INTERACTIVE) (tt(-i), ksh: tt(-i)))( +This is an interactive shell. This option is set upon initialisation if +the standard input is a tty and commands are being read from standard input. +(See the discussion of tt(SHIN_STDIN).) +This heuristic may be overridden by specifying a state for this option +on the command line. +The value of this option cannot be changed anywhere other than the command line. +) +pindex(INTERACTIVE_COMMENTS) +cindex(comments, in interactive shells) +item(tt(INTERACTIVE_COMMENTS) (tt(-k)))( +Allow comments even in interactive shells. +) +pindex(KSH_ARRAYS) +cindex(arrays, ksh style) +cindex(array style, ksh) +cindex(ksh, array style) +item(tt(KSH_ARRAYS))( +Emulate bf(ksh) array handling as closely as possible. If this option +is set, array elements are numbered from zero, an array parameter +without subscript refers to the first element instead of the whole array, +and braces are required to delimit a subscript (`tt(${path[2]})' rather +than just `tt($path[2])'). +) +pindex(KSH_AUTOLOAD) +item(tt(KSH_AUTOLOAD))( +Emulate bf(ksh) function autoloading. This means that when a function is +autoloaded, the corresponding file is merely executed, and must define +the function itself. (By default, the function is defined to the contents +of the file. However, the most common bf(ksh)-style case - of the file +containing only a simple definition of the function - is always handled +in the bf(ksh)-compatible manner.) +) +pindex(KSH_GLOB) +item(tt(KSH_GLOB))( +In pattern matching, the interpretation of parentheses is affected by +a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'. +See noderef(Filename Generation). +) +pindex(KSH_OPTION_PRINT) +cindex(option printing, ksh style) +cindex(option printing style, ksh) +cindex(ksh, option printing style) +item(tt(KSH_OPTION_PRINT))( +Alters the way options settings are printed. +) +pindex(LIST_AMBIGUOUS) +cindex(ambiguous completion) +cindex(completion, ambiguous) +item(tt(LIST_AMBIGUOUS))( +If this option is set, completions are shown only if the completions +don't have a unambiguous prefix or suffix that could be inserted in +the command line. +) +pindex(LIST_BEEP) +cindex(beep, ambiguous completion) +cindex(completion, beep on ambiguous) +item(tt(LIST_BEEP))( +Beep on an ambiguous completion. +) +pindex(LIST_TYPES) +cindex(marking file types) +cindex(files, marking type of) +item(tt(LIST_TYPES) (tt(-X)))( +When listing files that are possible completions, show the +type of each file with a trailing identifying mark. +) +pindex(LOCAL_OPTIONS) +item(tt(LOCAL_OPTIONS))( +If this option is set at the point of return from a shell function, +all the options (including this one) which were in force upon entry to +the function are restored. Otherwise, only this option and the +tt(XTRACE) and tt(PRINT_EXIT_VALUE) options are restored. Hence +if this is explicitly unset by a shell function the other options in +force at the point of return will remain so. +A shell function can also guarantee itself a known shell configuration +with a formulation like `tt(emulate zsh; setopt localoptions)'. +) +pindex(LOGIN) +item(tt(LOGIN) (tt(-l), ksh: tt(-l)))( +This is a login shell. +If this option is not explicitly set, the shell is a login shell if +the first character of the tt(argv[0]) passed to the shell is a `tt(-)'. +) +pindex(LONG_LIST_JOBS) +cindex(jobs, list format) +item(tt(LONG_LIST_JOBS) (tt(-R)))( +List jobs in the long format by default. +) +pindex(MAGIC_EQUAL_SUBST) +item(tt(MAGIC_EQUAL_SUBST))( +All unquoted arguments of the form `var(identifier)tt(=)var(expression)' +appearing after the command name have filename expansion (that is, +where var(expression) has a leading `tt(~)' or `tt(=)') performed on +var(expression) as if it were a parameter assignment. The argument is +not otherwise treated specially; it is passed to the command as a single +argument, and not used as an actual parameter assignment. +) +pindex(MAIL_WARNING) +cindex(mail, warning of reading) +item(tt(MAIL_WARNING) (tt(-U)))( +Print a warning message if a mail file has been +accessed since the shell last checked. +) +pindex(MARK_DIRS) +cindex(directories, marking) +cindex(marking directories) +item(tt(MARK_DIRS) (tt(-8), ksh: tt(-X)))( +Append a trailing `tt(/)' to all directory +names resulting from filename generation (globbing). +) +pindex(MENU_COMPLETE) +cindex(completion, menu) +item(tt(MENU_COMPLETE) (tt(-Y)))( +On an ambiguous completion, instead of listing possibilities or beeping, +insert the first match immediately. Then when completion is requested +again, remove the first match and insert the second match, etc. +When there are no more matches, go back to the first one again. +tt(reverse-menu-complete) may be used to loop through the list +in the other direction. This option overrides tt(AUTO_MENU). +) +pindex(MONITOR) +cindex(job control, allowing) +item(tt(MONITOR) (tt(-m), ksh: tt(-m)))( +Allow job control. Set by default in interactive shells. +) +pindex(MULTIOS) +item(tt(MULTIOS))( +Perform implicit bf(tee)s or bf(cat)s when multiple +redirections are attempted (see noderef(Redirection)). +) +pindex(NOMATCH) +cindex(globbing, no matches) +item(tt(NOMATCH) (tt(PLUS()3)))( +If a pattern for filename generation has no matches, +print an error, instead of +leaving it unchanged in the argument list. +This also applies to file expansion +of an initial `tt(~)' or `tt(=)'. +) +pindex(NOTIFY) +cindex(background jobs, notification) +cindex(notification of background jobs) +item(tt(NOTIFY) (tt(-5), ksh: tt(-b)))( +Report the status of background jobs immediately, rather than +waiting until just before printing a prompt. +) +pindex(NULL_GLOB) +cindex(globbing, no matches) +item(tt(NULL_GLOB) (tt(-G)))( +If a pattern for filename generation has no matches, +delete the pattern from the argument list instead +of reporting an error. Overrides tt(NOMATCH). +) +pindex(NUMERIC_GLOB_SORT) +cindex(globbing, sorting numerically) +item(tt(NUMERIC_GLOB_SORT))( +If numeric filenames are matched by a filename generation pattern, +sort the filenames numerically rather than lexicographically. +) +pindex(OVERSTRIKE) +cindex(editor, overstrike mode) +cindex(overstrike mode, of editor) +item(tt(OVERSTRIKE))( +Start up the line editor in overstrike mode. +) +pindex(PATH_DIRS) +cindex(path search, extended) +item(tt(PATH_DIRS) (tt(-Q)))( +Perform a path search even on command names with slashes in them. +Thus if `tt(/usr/local/bin)' is in the user's path, and he types +`tt(X11/xinit)', the command `tt(/usr/local/bin/X11/xinit)' will be executed +(assuming it exists). +Commands explicitly beginning with `tt(/)', `tt(./)' or `tt(../)' +are not subject to the path search. +This also applies to the tt(.) builtin, +and searches for modules performed by the tt(zmodload) builtin. +) +pindex(POSIX_BUILTINS) +item(tt(POSIX_BUILTINS))( +When this option is set the tt(command) builtin can be used to execute +shell builtin commands. Parameter assignments specified before shell +functions and special builtins are kept after the command completes unless +the special builtin is prefixed with the tt(command) builtin. Special +builtins are +tt(.), +tt(:), +tt(break), +tt(continue), +tt(declare), +tt(eval), +tt(exit), +tt(export), +tt(integer), +tt(local), +tt(readonly), +tt(return), +tt(set), +tt(shift), +tt(source), +tt(times), +tt(trap) and +tt(unset). +) +pindex(PRINT_EIGHT_BIT) +cindex(exit status, printing) +item(tt(PRINT_EIGHT_BIT))( +Print eight bit characters literally in completion lists, etc. +This option is not necessary if your system correctly returns the +printability of eight bit characters (see manref(ctype)(3)). +) +pindex(PRINT_EXIT_VALUE) +cindex(exit status, printing) +item(tt(PRINT_EXIT_VALUE) (tt(-1)))( +Print the exit value of programs with non-zero exit status. +) +pindex(PRIVILEGED) +cindex(privileged mode) +cindex(mode, privileged) +item(tt(PRIVILEGED) (tt(-p), ksh: tt(-p)))( +Turn on privileged mode. This is enabled automatically on startup if the +effective user (group) ID is not equal to the real user (group) ID. Turning +this option off causes the effective user and group IDs to be set to the +real user and group IDs. This option disables sourcing user startup files. +If zsh is invoked as `tt(sh)' or `tt(ksh)' with this option set, +tt(/etc/suid_profile) is sourced (after tt(/etc/profile) on interactive +shells). Sourcing tt(~/.profile) is disabled and the contents of the +tt(ENV) variable is ignored. This option cannot be changed using the +tt(-m) option of tt(setopt) and tt(unsetopt), and changing it inside a +function always changes it globally regardless of the tt(LOCAL_OPTIONS) +option. +) +pindex(PROMPT_BANG) +cindex(prompt, ! expansion) +item(tt(PROMPT_BANG))( +If set, `tt(!)' is treated specially in prompt expansion. +See noderef(Prompt Expansion). +) +pindex(PROMPT_CR) +cindex(prompt, with CR) +item(tt(PROMPT_CR) (tt(PLUS()V)))( +Print a carriage return just before printing +a prompt in the line editor. +) +pindex(PROMPT_PERCENT) +cindex(prompt, % expansion) +item(tt(PROMPT_PERCENT))( +If set, `tt(%)' is treated specially in prompt expansion. +See noderef(Prompt Expansion). +) +pindex(PROMPT_SUBST) +cindex(prompt, parameter expansion) +item(tt(PROMPT_SUBST))( +If set, em(parameter expansion), em(command substitution) and +em(arithmetic expansion) are performed in prompts. +) +pindex(PUSHD_IGNORE_DUPS) +cindex(directory stack, ignoring duplicates) +item(tt(PUSHD_IGNORE_DUPS))( +Don't push multiple copies of the same directory onto the directory stack. +) +pindex(PUSHD_MINUS) +cindex(directory stack, controlling syntax) +item(tt(PUSHD_MINUS))( +Exchanges the meanings of `tt(PLUS())' and `tt(-)' +when used with a number to specify a directory in the stack. +) +pindex(PUSHD_SILENT) +cindex(directory stack, silencing) +item(tt(PUSHD_SILENT) (tt(-E)))( +Do not print the directory stack after tt(pushd) or tt(popd). +) +pindex(PUSHD_TO_HOME) +cindex(pushd, to home) +item(tt(PUSHD_TO_HOME) (tt(-D)))( +Have tt(pushd) with no arguments act like `tt(pushd $HOME)'. +) +pindex(RC_EXPAND_PARAM) +cindex(rc, parameter expansion style) +cindex(parameter expansion style, rc) +item(tt(RC_EXPAND_PARAM) (tt(-P)))( +Array expansions of the form +`var(foo)tt(${)var(xx)tt(})var(bar)', where the parameter +var(xx) is set to tt(LPAR())var(a b c)tt(RPAR()), are substituted with +`var(fooabar foobbar foocbar)' instead of the default +`var(fooa b cbar)'. +) +pindex(RC_QUOTES) +cindex(rc, quoting style) +cindex(quoting style, rc) +item(tt(RC_QUOTES))( +Allow the character sequence `tt('')' to signify a single quote +within singly quoted strings. +) +pindex(RCS) +cindex(startup files, sourcing) +item(tt(RCS) (tt(PLUS()f)))( +After tt(/etc/zshenv) is sourced on startup, source the +tt(.zshenv), tt(/etc/zprofile), tt(.zprofile), +tt(/etc/zshrc), tt(.zshrc), tt(/etc/zlogin), tt(.zlogin), and tt(.zlogout) +files, as described in noderef(Files). +If this option is unset, only the tt(/etc/zshenv) file is sourced. +) +pindex(REC_EXACT) +cindex(completion, exact matches) +item(tt(REC_EXACT) (tt(-S)))( +In completion, recognize exact matches even +if they are ambiguous. +) +pindex(RESTRICTED) +cindex(restricted shell) +item(tt(RESTRICTED) (tt(-r)))( +Enables restricted mode. This option cannot be changed using +tt(unsetopt), and setting it inside a function always changes it +globally regardless of the tt(LOCAL_OPTIONS) option. See +noderef(Restricted Shell). +) +pindex(RM_STAR_SILENT) +cindex(rm *, querying before) +cindex(querying before rm *) +item(tt(RM_STAR_SILENT) (tt(-H)))( +Do not query the user before executing `tt(rm *)' or `tt(rm path/*)'. +) +pindex(RM_STAR_WAIT) +cindex(rm *, waiting before) +cindex(waiting before rm *) +item(tt(RM_STAR_WAIT))( +If querying the user before executing `tt(rm *)' or `tt(rm path/*)', +first wait ten seconds and ignore anything typed in that time. +This avoids the problem of reflexively answering `yes' to the query +when one didn't really mean it. The wait and query can always be +avoided by expanding the `tt(*)' in ZLE (with tab). +) +pindex(SH_FILE_EXPANSION) +cindex(sh, expansion style) +cindex(expansion style, sh) +item(tt(SH_FILE_EXPANSION))( +Perform filename expansion (e.g., ~ expansion) em(before) +parameter expansion, command substitution, arithmetic expansion +and brace expansion. +If this option is unset, it is performed em(after) +brace expansion, so things like `tt(~$USERNAME)' and +`tt(~{pfalstad,rc})' will work. +) +pindex(SH_GLOB) +cindex(sh, globbing style) +cindex(globbing style, sh) +item(tt(SH_GLOB))( +Disables the special meaning of `tt(LPAR())', `tt(|)', `tt(RPAR())' +and 'tt(<)' for globbing the result of parameter and command substitutions, +and in some other places where +the shell accepts patterns. This option is set by default if zsh is +invoked as tt(sh) or tt(ksh). +) +pindex(SHIN_STDIN) +item(tt(SHIN_STDIN) (tt(-s), ksh: tt(-s)))( +Commands are being read from the standard input. +Commands are read from standard input if no command is specified with +tt(-c) and no file of commands is specified. If tt(SHIN_STDIN) +is set explicitly on the command line, +any argument that would otherwise have been +taken as a file to run will instead be treated as a normal positional +parameter. +Note that setting or unsetting this option on the command line does not +necessarily affect the state the option will have while the shell is +running - that is purely an indicator of whether on not commands are +em(actually) being read from standard input. +The value of this option cannot be changed anywhere other than the command line. +) +pindex(SH_OPTION_LETTERS) +cindex(sh, single letter options style) +cindex(ksh, single letter options style) +cindex(single letter options, ksh style) +cindex(options, single letter, ksh style) +item(tt(SH_OPTION_LETTERS))( +If this option is set the shell tries to interpret single letter options +(which are used with tt(set) and tt(setopt)) like bf(ksh) does. +This also affects the value of the tt(-) special parameter. +) +pindex(SHORT_LOOPS) +item(tt(SHORT_LOOPS))( +Allow the short forms of tt(for), tt(select), +tt(if), and tt(function) constructs. +) +pindex(SH_WORD_SPLIT) +cindex(field splitting, sh style) +cindex(sh, field splitting style) +item(tt(SH_WORD_SPLIT) (tt(-y)))( +Causes field splitting to be performed on unquoted parameter expansions. +Note that this option has nothing to do with word splitting. +(See noderef(Parameter Expansion).) +) +pindex(SINGLE_COMMAND) +cindex(single command) +pindex(INTERACTIVE, use of) +item(tt(SINGLE_COMMAND) (tt(-t), ksh: tt(-t)))( +If the shell is reading from standard input, it exits after a single command +has been executed. This also makes the shell non-interactive, unless the +tt(INTERACTIVE) option is explicitly set on the command line. +The value of this option cannot be changed anywhere other than the command line. +) +pindex(SINGLE_LINE_ZLE) +cindex(editor, single line mode) +item(tt(SINGLE_LINE_ZLE) (tt(-M)))( +Use single-line command line editing instead of multi-line. +) +pindex(SUN_KEYBOARD_HACK) +cindex(sun keyboard, annoying) +cindex(annoying keyboard, sun) +item(tt(SUN_KEYBOARD_HACK) (tt(-L)))( +If a line ends with a backquote, and there are an odd number +of backquotes on the line, ignore the trailing backquote. +This is useful on some keyboards where the return key is +too small, and the backquote key lies annoyingly close to it. +) +pindex(UNSET) +cindex(parameters, substituting unset) +cindex(unset parameters, substituting) +item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)))( +Treat unset parameters as if they were empty when substituting. +Otherwise they are treated as an error. +) +pindex(VERBOSE) +cindex(tracing, of input lines) +cindex(input, tracing) +item(tt(VERBOSE) (tt(-v), ksh: tt(-v)))( +Print shell input lines as they are read. +) +pindex(XTRACE) +cindex(tracing, of commands) +cindex(commands, tracing) +item(tt(XTRACE) (tt(-x), ksh: tt(-x)))( +Print commands and their arguments as they are executed. +) +pindex(ZLE) +cindex(editor, enabling) +cindex(enabling the editor) +item(tt(ZLE) (tt(-Z)))( +Use the zsh line editor. +) +enditem() +texinode(Option Aliases)(Single Letter Options)(Description of Options)(Options) +sect(Option Aliases) +cindex(options, aliases) +Some options have alternative names. These aliases are never used for +output, but can be used just like normal option names when specifying +options to the shell. + +startitem() +pindex(BRACE_EXPAND) +item(tt(BRACE_EXPAND))( +em(NO_)tt(IGNORE_BRACES) +(ksh and bash compatibility) +) +pindex(DOT_GLOB) +item(tt(DOT_GLOB))( +tt(GLOB_DOTS) +(bash compatibility) +) +pindex(HASH_ALL) +item(tt(HASH_ALL))( +tt(HASH_CMDS) +(bash compatibility) +) +pindex(HIST_APPEND) +item(tt(HIST_APPEND))( +tt(APPEND_HISTORY) +(bash compatibility) +) +pindex(HIST_EXPAND) +item(tt(HIST_EXPAND))( +tt(BANG_HIST) +(bash compatibility) +) +pindex(LOG) +item(tt(LOG))( +em(NO_)tt(HIST_NO_FUNCTIONS) +(ksh compatibility) +) +pindex(MAIL_WARN) +item(tt(MAIL_WARN))( +tt(MAIL_WARNING) +(bash compatibility) +) +pindex(ONE_CMD) +item(tt(ONE_CMD))( +tt(SINGLE_COMMAND) +(bash compatibility) +) +pindex(PHYSICAL) +item(tt(PHYSICAL))( +tt(CHASE_LINKS) +(ksh and bash compatibility) +) +pindex(PROMPT_VARS) +item(tt(PROMPT_VARS))( +tt(PROMPT_SUBST) +(bash compatibility) +) +pindex(STDIN) +item(tt(STDIN))( +tt(SHIN_STDIN) +(ksh compatibility) +) +pindex(TRACK_ALL) +item(tt(TRACK_ALL))( +tt(HASH_CMDS) +(ksh compatibility) +) +enditem() +texinode(Single Letter Options)()(Option Aliases)(Options) +sect(Single Letter Options) +cindex(options, single letter) +cindex(single letter options) +subsect(Default set) +startsitem() +sitem(tt(-0))(CORRECT) +sitem(tt(-1))(PRINT_EXIT_VALUE) +sitem(tt(-2))(em(NO_)BAD_PATTERN) +sitem(tt(-3))(em(NO_)NOMATCH) +sitem(tt(-4))(GLOB_DOTS) +sitem(tt(-5))(NOTIFY) +sitem(tt(-6))(BG_NICE) +sitem(tt(-7))(IGNORE_EOF) +sitem(tt(-8))(MARK_DIRS) +sitem(tt(-9))(AUTO_LIST) +sitem(tt(-B))(em(NO_)BEEP) +sitem(tt(-C))(em(NO_)CLOBBER) +sitem(tt(-D))(PUSHD_TO_HOME) +sitem(tt(-E))(PUSHD_SILENT) +sitem(tt(-F))(em(NO_)GLOB) +sitem(tt(-G))(NULL_GLOB) +sitem(tt(-H))(RM_STAR_SILENT) +sitem(tt(-I))(IGNORE_BRACES) +sitem(tt(-J))(AUTO_CD) +sitem(tt(-K))(em(NO_)BANG_HIST) +sitem(tt(-L))(SUN_KEYBOARD_HACK) +sitem(tt(-M))(SINGLE_LINE_ZLE) +sitem(tt(-N))(AUTO_PUSHD) +sitem(tt(-O))(CORRECT_ALL) +sitem(tt(-P))(RC_EXPAND_PARAM) +sitem(tt(-Q))(PATH_DIRS) +sitem(tt(-R))(LONG_LIST_JOBS) +sitem(tt(-S))(REC_EXACT) +sitem(tt(-T))(CDABLE_VARS) +sitem(tt(-U))(MAIL_WARNING) +sitem(tt(-V))(em(NO_)PROMPT_CR) +sitem(tt(-W))(AUTO_RESUME) +sitem(tt(-X))(LIST_TYPES) +sitem(tt(-Y))(MENU_COMPLETE) +sitem(tt(-Z))(ZLE) +sitem(tt(-a))(ALL_EXPORT) +sitem(tt(-e))(ERR_EXIT) +sitem(tt(-f))(em(NO_)RCS) +sitem(tt(-g))(HIST_IGNORE_SPACE) +sitem(tt(-h))(HIST_IGNORE_DUPS) +sitem(tt(-i))(INTERACTIVE) +sitem(tt(-k))(INTERACTIVE_COMMENTS) +sitem(tt(-l))(LOGIN) +sitem(tt(-m))(MONITOR) +sitem(tt(-n))(em(NO_)EXEC) +sitem(tt(-p))(PRIVILEGED) +sitem(tt(-r))(RESTRICTED) +sitem(tt(-s))(SHIN_STDIN) +sitem(tt(-t))(SINGLE_COMMAND) +sitem(tt(-u))(em(NO_)UNSET) +sitem(tt(-v))(VERBOSE) +sitem(tt(-w))(CHASE_LINKS) +sitem(tt(-x))(XTRACE) +sitem(tt(-y))(SH_WORD_SPLIT) +endsitem() +subsect(sh/ksh emulation set) +startsitem() +sitem(tt(-C))(em(NO_)CLOBBER) +sitem(tt(-X))(MARK_DIRS) +sitem(tt(-a))(ALL_EXPORT) +sitem(tt(-b))(NOTIFY) +sitem(tt(-e))(ERR_EXIT) +sitem(tt(-f))(em(NO_)GLOB) +sitem(tt(-i))(INTERACTIVE) +sitem(tt(-l))(LOGIN) +sitem(tt(-m))(MONITOR) +sitem(tt(-n))(em(NO_)EXEC) +sitem(tt(-p))(PRIVILEGED) +sitem(tt(-r))(RESTRICTED) +sitem(tt(-s))(SHIN_STDIN) +sitem(tt(-t))(SINGLE_COMMAND) +sitem(tt(-u))(em(NO_)UNSET) +sitem(tt(-v))(VERBOSE) +sitem(tt(-x))(XTRACE) +endsitem() +subsect(Also note) +startsitem() +sitem(tt(-A))(Used by tt(set) for setting arrays) +sitem(tt(-c))(Used on the command line to specify a single command) +sitem(tt(-m))(Used by tt(setopt) for pattern-matching option setting) +sitem(tt(-o))(Used in all places to allow use of long option names) +sitem(tt(-s))(Used by tt(set) to sort positional parameters) +endsitem() diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo new file mode 100644 index 000000000..4c25a18ef --- /dev/null +++ b/Doc/Zsh/params.yo @@ -0,0 +1,812 @@ +texinode(Parameters)(Options)(Expansion)(Top) +chapter(Parameters) +cindex(parameters) +sect(Description) +A parameter has a name, a value, and a number of attributes. +A name may be any sequence of alphanumeric +characters and underscores, or the single characters +`tt(*)', `tt(@)', `tt(#)', `tt(?)', `tt(-)', `tt($)', or `tt(!)'. +The value may be a em(scalar) (a string), +an integer, or an array. +To assign a scalar or integer value to a parameter, +use the tt(typeset) builtin. +findex(typeset, use of) +To assign an array value, use `tt(set -A) var(name) var(value) ...'. +findex(set, use of) +The value of a parameter may also be assigned by writing: + +nofill(var(name)tt(=)var(value)) + +If the integer attribute, tt(-i), is set for var(name), +the var(value) is subject to arithmetic evaluation. + +In the parameter lists, the mark `' indicates that the parameter is special. +Special parameters cannot have their type changed, and they stay special even +if unset. `' indicates that the parameter does not exist when the shell +initialises in tt(sh) or tt(ksh) emulation mode. +startmenu() +menu(Local Parameters) +menu(Array Parameters) +menu(Positional Parameters) +menu(Parameters Set By The Shell) +menu(Parameters Used By The Shell) +endmenu() +texinode(Local Parameters)(Array Parameters)()(Parameters) +sect(Local Parameters) +Shell function executions delimit scopes for shell parameters. +(Parameters are dynamically scoped.) The tt(typeset) builtin, and its +alternative forms tt(declare), tt(integer), tt(local) and tt(readonly) +(but not tt(export)), can be used to declare a parameter as being local +to the innermost scope. + +When a parameter is read or assigned to, the +innermost existing parameter of that name is used. (That is, the +local parameter hides any less-local parameter.) However, assigning +to a non-existent parameter, or declaring a new parameter with tt(export), +causes it to be created in the em(outer)most scope. + +Local parameters disappear when their scope ends. +tt(unset) can be used to delete a parameter while it is still in scope; this +will reveal the next outer parameter of the same name. However, em(special) +parameters are still special when unset. +texinode(Array Parameters)(Positional Parameters)(Local Parameters)(Parameters) +sect(Array Parameters) +The value of an array parameter may be assigned by writing: + +nofill(var(name)tt(=LPAR())var(value) ...tt(RPAR())) + +Individual elements of an array may be selected using a +subscript. A subscript of the form `tt([)var(exp)tt(])' +selects the single element var(exp), where var(exp) is +an arithmetic expression which will be subject to arithmetic +expansion as if it were surrounded by `tt($LPAR()LPAR())...tt(RPAR()RPAR())'. +The elements are numbered beginning with 1 unless the +tt(KSH_ARRAYS) option is set when they are numbered from zero. +pindex(KSH_ARRAYS, use of) + +A subscript of the form `tt([*])' or `tt([@])' evaluates to all +elements of an array; there is no difference between the two +except when they appear within double quotes. +`tt("$foo[*]")' evaluates to `tt("$foo[1] $foo[2] )...tt(")', while +`tt("$foo[@]")' evaluates to `tt("$foo[1]" "$foo[2]")', etc. + +A subscript of the form `tt([)var(exp1)tt(,)var(exp2)tt(])' +selects all elements in the range var(exp1) to var(exp2), +inclusive. +If one of the subscripts evaluates to a negative number, +say tt(-)var(n), then the var(n)th element from the end +of the array is used. Thus `tt($foo[-3])' is the third element +from the end of the array tt(foo), and +`tt($foo[1,-1])' is the same as `tt($foo[*])'. + +Subscripting may also be performed on non-array values, in which +case the subscripts specify a substring to be extracted. +For example, if tt(FOO) is set to `tt(foobar)', then +`tt(echo $FOO[2,5])' prints `tt(ooba)'. + +Subscripts may be used inside braces used to delimit a parameter name, thus +`tt(${foo[2]})' is equivalent to `tt($foo[2])'. If the tt(KSH_ARRAYS) +option is set, the braced form is the only one that will +work, the subscript otherwise not being treated specially. + +If a subscript is used on the left side of an assignment the selected +range is replaced by the expression on the right side. + +If the opening bracket or the comma is directly followed by an opening +parentheses the string up to the matching closing one is considered to +be a list of flags. The flags currently understood are: + +startitem() +item(tt(e))( +this option has no effect and retained for backward compatibility only. +) +item(tt(w))( +if the parameter subscripted is a scalar than this flag makes +subscription work on a per-word basis instead of characters. +) +item(tt(s:)var(string)tt(:))( +this gives the var(string) that separates words (for use with the +tt(w) flag). +) +item(tt(p))( +Recognize the same escape sequences as the tt(print) builtin in +the string argument of a subsequent `tt(s)' flag. +) +item(tt(f))( +if the parameter subscripted is a scalar than this flag makes +subscription work on a per-line basis instead of characters. +This is a shorthand for `tt(pws:\n:)'. +) +item(tt(r))( +if this flag is given the var(exp) is taken as a pattern and the +result is the first matching array element, substring or word (if the +parameter is an array, if it is a scalar, or if it is a scalar and the +`tt(w)' flag is given, respectively); note that this is like giving a +number: `tt($foo[(r))var(??)tt(,3])' and `tt($foo[(r))var(??)tt(,(r)f*])' work. +) +item(tt(R))( +like `tt(r)', but gives the last match. +) +item(tt(i))( +like `tt(r)', but gives the index of the match instead; this may not +be combined with a second argument. +) +item(tt(I))( +like `tt(i), but gives the index of the last match. +) +item(tt(n:)var(expr)tt(:))( +if combined with `tt(r)', `tt(R)', `tt(i)' or `tt(I)', makes them give +the var(n)th or var(n)th last match (if var(expr) evaluates to +var(n)). +) +enditem() +texinode(Positional Parameters)(Parameters Set By The Shell)(Array Parameters)(Parameters) +sect(Positional Parameters) +Positional parameters are set by the shell on invocation, +by the tt(set) builtin, or by direct assignment. +The parameter var(n), where var(n) is a number, +is the var(n)th positional parameter. +The parameters tt(*), tt(@) and tt(argv) are +arrays containing all the positional parameters; +thus `tt($argv[)var(n)tt(])', etc., is equivalent to simply `tt($)var(n)'. + +texinode(Parameters Set By The Shell)(Parameters Used By The Shell)(Positional Parameters)(Parameters) +sect(Parameters Set By The Shell) +The following parameters are automatically set by the shell: + +startitem() +vindex(!) +item(tt(!) )( +The process ID of the last background command invoked. +) +vindex(#) +item(tt(#) )( +The number of positional parameters in decimal. +) +vindex(ARGC) +item(tt(ARGC) )( +Same as tt(#). +) +vindex($) +item(tt($) )( +The process ID of this shell. +) +vindex(-) +item(tt(-) )( +Flags supplied to the shell on invocation or by the tt(set) +or tt(setopt) commands. +) +vindex(*) +item(tt(*) )( +An array containing the positional parameters. +) +vindex(argv) +item(tt(argv) )( +Same as tt(*). +) +vindex(@) +item(tt(@) )( +Same as tt(argv[@]). +) +vindex(?) +item(tt(?) )( +The exit value returned by the last command. +) +vindex(0) +item(tt(0) )( +The name used to invoke the current shell. If the tt(FUNCTION_ARGZERO) option +is set, this is set temporarily within a shell function to the name of the +function, and within a sourced script to the name of the script. +) +vindex(status) +item(tt(status) )( +Same as tt(?). +) +vindex(_) +item(tt(_) )( +The last argument of the previous command. +Also, this parameter is set in the environment of every command +executed to the full pathname of the command. +) +vindex(EGID) +item(tt(EGID) )( +The effective group ID of the shell process. If you have sufficient +privileges, you may change the effective group ID of the shell +process by assigning to this parameter. Also (assuming sufficient +privileges), you may start a single command with a different +effective group ID by `tt(LPAR()EGID=)var(gid)tt(; command+RPAR())' +) +vindex(EUID) +item(tt(EUID) )( +The effective user ID of the shell process. If you have sufficient +privileges, you may change the effective user ID of the shell process +by assigning to this parameter. Also (assuming sufficient privileges), +you may start a single command with a different +effective user ID by `tt(LPAR()EUID=)var(uid)tt(; command+RPAR())' +) +vindex(ERRNO) +item(tt(ERRNO) )( +The value of errno (see manref(errno)(3)) +as set by the most recently failed system call. +This value is system dependent and is intended for debugging +purposes. +) +vindex(GID) +item(tt(GID) )( +The real group ID of the shell process. If you have sufficient privileges, +you may change the group ID of the shell process by assigning to this +parameter. Also (assuming sufficient privileges), you may start a single +command under a different +group ID by `tt(LPAR()GID=)var(gid)tt(; command+RPAR())' +) +vindex(HOST) +item(tt(HOST))( +The current hostname. +) +vindex(LINENO) +item(tt(LINENO) )( +The line number of the current line within the current script +being executed. +) +vindex(LOGNAME) +item(tt(LOGNAME))( +If the corresponding variable is not set in the environment of the +shell, it is initialized to the login name corresponding to the +current login session. This parameter is exported by default but +this can be disabled using the tt(typeset) builtin. +) +vindex(MACHTYPE) +item(tt(MACHTYPE))( +The machine type (microprocessor class or machine model), +as determined at compile time. +) +vindex(OLDPWD) +item(tt(OLDPWD))( +The previous working directory. This is set when the shell initialises +and whenever the directory changes. +) +vindex(OPTARG) +item(tt(OPTARG) )( +The value of the last option argument processed by the tt(getopts) +command. +) +vindex(OPTIND) +item(tt(OPTIND) )( +The index of the last option argument processed by the tt(getopts) +command. +) +vindex(OSTYPE) +item(tt(OSTYPE))( +The operating system, as determined at compile time. +) +vindex(PPID) +item(tt(PPID) )( +The process ID of the parent of the shell. +) +vindex(PWD) +item(tt(PWD))( +The present working directory. This is set when the shell initialises +and whenever the directory changes. +) +vindex(RANDOM) +item(tt(RANDOM) )( +A random integer from 0 to 32767, newly generated each time +this parameter is referenced. The random number generator +can be seeded by assigning a numeric value to tt(RANDOM). +) +vindex(SECONDS) +item(tt(SECONDS) )( +The number of seconds since shell invocation. If this parameter +is assigned a value, then the value returned upon reference +will be the value that was assigned plus the number of seconds +since the assignment. +) +vindex(SHLVL) +item(tt(SHLVL) )( +Incremented by one each time a new shell is started. +) +vindex(signals) +item(tt(signals))( +An array containing the names of the signals. +) +vindex(TTY) +item(tt(TTY))( +The name of the tty associated with the shell, if any. +) +vindex(TTYIDLE) +item(tt(TTYIDLE) )( +The idle time of the tty associated with the shell in seconds or -1 if there +is no such tty. +) +vindex(UID) +item(tt(UID) )( +The real user ID of the shell process. If you have sufficient privileges, +you may change the user ID of the shell by assigning to this parameter. +Also (assuming sufficient privileges), you may start a single command +under a different +user ID by `tt(LPAR()UID=)var(uid)tt(; command+RPAR())' +) +vindex(USERNAME) +item(tt(USERNAME) )( +The username corresponding to the real user ID of the shell process. If you +have sufficient privileges, you may change the username (and also the +user ID and group ID) of the shell by assigning to this parameter. +Also (assuming sufficient privileges), you may start a single command +under a different username (and user ID and group ID) +by `tt(LPAR()USERNAME=)var(username)tt(; command+RPAR())' +) +vindex(VENDOR) +item(tt(VENDOR))( +The vendor, as determined at compile time. +) +vindex(ZSH_NAME) +item(tt(ZSH_NAME))( +Expands to the basename of the command used to invoke this instance +of zsh. +) +vindex(ZSH_VERSION) +item(tt(ZSH_VERSION))( +The version number of this zsh. +) +enditem() +texinode(Parameters Used By The Shell)()(Parameters Set By The Shell)(Parameters) +sect(Parameters Used By The Shell) +The following parameters are used by the shell: + +startitem() +vindex(ARGV0) +item(tt(ARGV0))( +If exported, its value is used as tt(argv[0]) of external commands. +Usually used in constructs like `tt(ARGV0=emacs nethack)'. +) +vindex(BAUD) +item(tt(BAUD))( +The baud rate of the current connection. Used by the line editor +update mechanism to compensate for a slow terminal by delaying +updates until necessary. This may be profitably set to a lower value +in some circumstances, e.g. +for slow modems dialing into a communications server which is connected +to a host via a fast link; in this case, this variable +would be set by default to the speed of the fast link, and not +the modem. +This parameter should be set to the baud +rate of the slowest part of the link for best performance. The compensation +mechanism can be turned off by setting the variable to zero. +) +vindex(cdpath) +vindex(CDPATH) +item(tt(cdpath) (tt(CDPATH) ))( +An array (colon-separated list) +of directories specifying the search path for the tt(cd) command. +) +vindex(COLUMNS) +item(tt(COLUMNS) )( +The number of columns for this terminal session. +Used for printing select lists and for the line editor. +) +vindex(DIRSTACKSIZE) +item(tt(DIRSTACKSIZE))( +The maximum size of the directory stack. If the +stack gets larger than this, it will be truncated automatically. +This is useful with the tt(AUTO_PUSHD) option. +pindex(AUTO_PUSHD, use of) +) +vindex(FCEDIT) +item(tt(FCEDIT))( +The default editor for the tt(fc) builtin. +) +vindex(fignore) +vindex(FIGNORE) +item(tt(fignore) (tt(FIGNORE) ))( +An array (colon separated list) +containing the suffixes of files to be ignored +during filename completion. However, if the completion generates only files +which would match if this variable would be ignored, than these files are +completed anyway. +) +vindex(fpath) +vindex(FPATH) +item(tt(fpath) (tt(FPATH) ))( +An array (colon separated list) +of directories specifying the search path for +function definitions. This path is searched when a function +with the tt(-u) attribute is referenced. If an executable +file is found, then it is read and executed in the current environment. +) +vindex(histchars) +item(tt(histchars) )( +Three characters used by the shell's history and lexical analysis +mechanism. The first character signals the start of a history +substitution (default `tt(!)'). The second character signals the +start of a quick history substitution (default `tt(^)'). The third +character is the comment character (default `tt(#)'). +) +vindex(HISTCHARS) +item(tt(HISTCHARS) )( +Same as tt(histchars). (Deprecated.) +) +vindex(HISTFILE) +item(tt(HISTFILE))( +The file to save the history in when an interactive shell exits. +If unset, the history is not saved. +) +vindex(HISTSIZE) +item(tt(HISTSIZE) )( +The maximum size of the history list. +) +vindex(HOME) +item(tt(HOME) )( +The default argument for the tt(cd) command. +) +vindex(IFS) +item(tt(IFS) )( +Internal field separators (by default space, tab, newline and NUL), that +are used to separate words which result from +command or parameter substitution and words read by +the tt(read) builtin. Any characters from the set space, tab and +newline that appear in the IFS are called em(IFS white space). +One or more IFS white space characters or one non-IFS white space +character together with any adjacent IFS white space character delimit +a field. If an IFS white space character appears twice consecutively +in the IFS, this character is treated as if it were not an IFS white +space character. +) +vindex(KEYTIMEOUT) +item(tt(KEYTIMEOUT))( +The time the shell waits, in hundredths of seconds, for another key to +be pressed when reading bound multi-character sequences. +) +vindex(LANG) +item(tt(LANG) )( +This variable determines the locale category for any category not +specifically selected via a variable starting with `tt(LC_)'. +) +vindex(LC_ALL) +item(tt(LC_ALL) )( +This variable overrides the value of the `tt(LANG)' variable and the value +of any of the other variables starting with `tt(LC_)'. +) +vindex(LC_COLLATE) +item(tt(LC_COLLATE) )( +This variable determines the locale category for character collation +information within ranges in glob brackets and for sorting. +) +vindex(LC_CTYPE) +item(tt(LC_CTYPE) )( +This variable determines the locale category for character handling +functions. +) +vindex(LC_MESSAGES) +item(tt(LC_MESSAGES) )( +This variable determines the language in which messages should be +written. Note that zsh does not use message catalogs. +) +vindex(LC_TIME) +item(tt(LC_TIME) )( +This variable determines the locale category for date and time +formatting in prompt escape sequences. +) +vindex(LINES) +item(tt(LINES) )( +The number of lines for this terminal session. +Used for printing select lists and for the line editor. +) +vindex(LISTMAX) +item(tt(LISTMAX))( +In the line editor, the number of filenames to list without asking first. +If set to zero, the shell asks only if the top of the listing would scroll +off the screen. +) +vindex(LOGCHECK) +item(tt(LOGCHECK))( +The interval in seconds between checks for login/logout activity +using the tt(watch) parameter. +) +vindex(MAIL) +item(tt(MAIL))( +If this parameter is set and tt(mailpath) is not set, +the shell looks for mail in the specified file. +) +vindex(MAILCHECK) +item(tt(MAILCHECK))( +The interval in seconds between checks for new mail. +) +vindex(mailpath) +vindex(MAILPATH) +item(tt(mailpath) (tt(MAILPATH) ))( +An array (colon-separated list) of filenames to check for +new mail. Each filename can be followed by a `tt(?)' and a +message that will be printed. The message will undergo +parameter expansion, command substitution and arithmetic +substitution with the variable tt($_) defined as the name +of the file that has changed. The default message is +`tt(You have new mail)'. If an element is a directory +instead of a file the shell will recursively check every +file in every subdirectory of the element. +) +vindex(manpath) +vindex(MANPATH) +item(tt(manpath) (tt(MANPATH) ))( +An array (colon-separated list) +whose value is not used by the shell. The tt(manpath) +array can be useful, however, since setting it also sets +tt(MANPATH), and vice versa. +) +vindex(module_path) +vindex(MODULE_PATH) +item(tt(module_path) (tt(MODULE_PATH) ))( +An array (colon-separated list) +of directories that tt(zmodload) +searches for dynamically loadable modules. +This is initialised to a standard pathname, +usually `tt(/usr/local/lib/zsh/$ZSH_VERSION)'. +(The `tt(/usr/local/lib)' part varies from installation to installation.) +For security reasons, any value set in the environment when the shell +is started will be ignored. + +These parameters only exist if the installation supports dynamic +module loading. +) +vindex(NULLCMD) +cindex(null command style) +cindex(csh, null command style) +cindex(ksh, null command style) +item(tt(NULLCMD) )( +The command name to assume if a redirection is specified +with no command. Defaults to tt(cat). For bf(sh)/bf(ksh) +behavior, change this to tt(:). For bf(csh)-like +behavior, unset this parameter; the shell will print an +error message if null commands are entered. +) +vindex(path) +vindex(PATH) +item(tt(path) (tt(PATH) ))( +An array (colon-separated list) +of directories to search for commands. +When this parameter is set, each directory is scanned +and all files found are put in a hash table. +) +vindex(POSTEDIT) +item(tt(POSTEDIT) )( +This string is output whenever the line editor exits. +It usually contains termcap strings to reset the terminal. +) +vindex(PS1) +item(tt(PS1) )( +The primary prompt string, printed before a command is read. +the default is `tt(%m%# )'. It undergoes a special form of expansion +before being displayed; see noderef(Prompt Expansion). +) +vindex(PS2) +item(tt(PS2) )( +The secondary prompt, printed when the shell needs more information +to complete a command. +It is expanded in the same way as tt(PS1). +The default is `tt(%_> )', which displays any shell constructs or quotation +marks which are currently being processed. +) +vindex(PS3) +item(tt(PS3) )( +Selection prompt used within a tt(select) loop. +It is expanded in the same way as tt(PS1). +The default is `tt(?# )'. +) +vindex(PS4) +item(tt(PS4) )( +The execution trace prompt. Default is `tt(PLUS() )'. +) +vindex(PROMPT) +xitem(tt(PROMPT) ) +vindex(PROMPT2) +xitem(tt(PROMPT2) ) +vindex(PROMPT3) +xitem(tt(PROMPT3) ) +vindex(PROMPT4) +item(tt(PROMPT4) )( +Same as tt(PS1), tt(PS2), tt(PS3) and tt(PS4), +respectively. +) +vindex(psvar) +vindex(PSVAR) +item(tt(psvar) (tt(PSVAR) ))( +An array (colon-separated list) whose first nine values can be used in +tt(PROMPT) strings. Setting tt(psvar) also sets tt(PSVAR), and +vice versa. +) +vindex(prompt) +item(tt(prompt) )( +Same as tt(PS1). +) +vindex(READNULLCMD) +item(tt(READNULLCMD) )( +The command name to assume if a single input redirection +is specified with no command. Defaults to tt(more). +) +vindex(REPORTTIME) +item(tt(REPORTTIME))( +If nonnegative, commands whose combined user and system execution times +(measured in seconds) are greater than this value have timing +statistics printed for them. +) +vindex(RPROMPT) +xitem(tt(RPROMPT) ) +vindex(RPS1) +item(tt(RPS1) )( +This prompt is displayed on the right-hand side of the screen +when the primary prompt is being displayed on the left. +This does not work if the tt(SINGLELINEZLE) option is set. +It is expanded in the same way as tt(PS1). +) +vindex(SAVEHIST) +item(tt(SAVEHIST))( +The maximum number of history events to save in the history file. +) +vindex(SPROMPT) +item(tt(SPROMPT) )( +The prompt used for spelling correction. The sequence +`tt(%R)' expands to the string which presumably needs spelling +correction, and `tt(%r)' expands to the proposed correction. +All other prompt escapes are also allowed. +) +vindex(STTY) +item(tt(STTY))( +If this parameter is set in a command's environment, the shell runs the +tt(stty) command with the value of this parameter as arguments in order to +set up the terminal before executing the command. The modes apply only to the +command, and are reset when it finishes or is suspended. If the command is +suspended and continued later with the tt(fg) or tt(wait) builtins it will +see the modes specified by tt(STTY), as if it were not suspended. This +(intentionally) does not apply if the command is continued via `tt(kill -CONT)'. +tt(STTY) is ignored if the command is run in the background, or if it is in the +environment of the shell but not explicitly assigned to in the input line. This +avoids running stty at every external command by accidentally exporting it. +Also note that tt(STTY) should not be used for window size specifications; these +will not be local to the command. +) +vindex(TERM) +item(tt(TERM) )( +The type of terminal in use. This is used when looking up termcap sequences. +) +vindex(TIMEFMT) +item(tt(TIMEFMT))( +The format of process time reports with the tt(time) keyword. +The default is `tt(%E real %U user %S system %P %J)'. +Recognizes the following escape sequences: + +startsitem() +sitem(tt(%%))(A `tt(%)'.) +sitem(tt(%U))(CPU seconds spent in user mode.) +sitem(tt(%S))(CPU seconds spent in kernel mode.) +sitem(tt(%E))(Elapsed time in seconds.) +sitem(tt(%P))(The CPU percentage, computed as (tt(%U)PLUS()tt(%S))/tt(%E).) +sitem(tt(%J))(The name of this job.) +endsitem() + +A star may be inserted between the percent sign and flags printing time. +This cause the time to be printed in +`var(hh)tt(:)var(mm)tt(:)var(ss)tt(.)var(ttt)' +format (hours and minutes are only printed if they are not zero). +) +vindex(TMOUT) +item(tt(TMOUT))( +If this parameter is nonzero, the shell will receive an tt(ALRM) +signal if a command is not entered within the specified number of +seconds after issuing a prompt. If there is a trap on tt(SIGALRM), it +will be executed and a new alarm is scheduled using the value of the +tt(TMOUT) parameter after executing the trap. If no trap is set, and +the idle time of the terminal is not less than the value of the +tt(TMOUT) parameter, zsh terminates. Otherwise a new alarm is +scheduled to tt(TMOUT) seconds after the last keypress. +) +vindex(TMPPREFIX) +item(tt(TMPPREFIX))( +A pathname prefix which the shell will use for all temporary files. +Note that this should include an initial part for the file name as +well as any directory names. The default is `tt(/tmp/zsh)'. +) +vindex(watch) +vindex(WATCH) +item(tt(watch) (tt(WATCH) ))( +An array (colon-separated list) of login/logout events to report. +If it contains the single word `tt(all)', then all login/logout events +are reported. If it contains the single word `tt(notme)', then all +events are reported as with `tt(all)' except tt($USERNAME). +An entry in this list may consist of a username, +an `tt(@)' followed by a remote hostname, +and a `tt(%)' followed by a line (tty). +Any or all of these components may be present in an entry; +if a login/logout event matches all of them, +it is reported. +) +vindex(WATCHFMT) +item(tt(WATCHFMT))( +The format of login/logout reports if the tt(watch) parameter is set. +Default is `tt(%n has %a %l from %m)'. +Recognizes the following escape sequences: + +startitem() +item(tt(%n))( +The name of the user that logged in/out. +) +item(tt(%a))( +The observed action, i.e. "logged on" or "logged off". +) +item(tt(%l))( +The line (tty) the user is logged in on. +) +item(tt(%M))( +The full hostname of the remote host. +) +item(tt(%m))( +The hostname up to the first `tt(.)'. If only the +IP address is available or the utmp field contains +the name of an X-windows display, the whole name is printed. + +em(NOTE:) +The `tt(%m)' and `tt(%M)' escapes will work only if there is a host name +field in the utmp on your machine. Otherwise they are +treated as ordinary strings. +) +item(tt(%S) LPAR()tt(%s)RPAR())( +Start (stop) standout mode. +) +item(tt(%U) LPAR()tt(%u)RPAR())( +Start (stop) underline mode. +) +item(tt(%B) LPAR()tt(%b)RPAR())( +Start (stop) boldface mode. +) +xitem(tt(%t)) +item(tt(%@))( +The time, in 12-hour, am/pm format. +) +item(tt(%T))( +The time, in 24-hour format. +) +item(tt(%w))( +The date in `var(day)tt(-)var(dd)' format. +) +item(tt(%W))( +The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format. +) +item(tt(%D))( +The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format. +) +item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))( +Specifies a ternary expression. +The character following the var(x) is +arbitrary; the same character is used to separate the text +for the "true" result from that for the "false" result. +Both the separator and the right parenthesis may be escaped +with a backslash. +Ternary expressions may be nested. + +The test character var(x) may be any one of `tt(l)', `tt(n)', `tt(m)' +or `tt(M)', which indicate a `true' result if the corresponding +escape sequence would return a non-empty value; or it may be `tt(a)', +which indicates a `true' result if the watched user has logged in, +or `false' if he has logged out. +Other characters evaluate to neither true nor false; the entire +expression is omitted in this case. + +If the result is `true', then the var(true-text) +is formatted according to the rules above and printed, +and the var(false-text) is skipped. +If `false', the var(true-text) is skipped and the var(false-text) +is formatted and printed. +Either or both of the branches may be empty, but +both separators must be present in any case. +) +enditem() +) +vindex(WORDCHARS) +item(tt(WORDCHARS) )( +A list of non-alphanumeric characters considered part of a word +by the line editor. +) +vindex(ZDOTDIR) +item(tt(ZDOTDIR))( +The directory to search for shell startup files (.zshrc, etc), +if not tt($HOME). +) +enditem() diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo new file mode 100644 index 000000000..e1628da86 --- /dev/null +++ b/Doc/Zsh/prompt.yo @@ -0,0 +1,209 @@ +texinode(Prompt Expansion)(Restricted Shell)(Compatibility)(Top) +chapter(Prompt Expansion) +ifzman(\ +sect(Prompt Expansion) +)\ +Prompt sequences undergo a special form of expansion. This type of expansion +is also available using the tt(-P) option to the tt(print) builtin. + +pindex(PROMPT_SUBST, use of) +If the tt(PROMPT_SUBST) option is set, the prompt string is first subjected to +em(parameter expansion), +em(command substitution) and +em(arithmetic expansion). +See +ifzman(\ +zmanref(zshexpn). +)\ +ifnzman(\ +noderef(Expansion). +)\ + +Certain escape sequences may be recognised in the prompt string. + +pindex(PROMPT_BANG, use of) +If the tt(PROMPT_BANG) option is set, a `tt(!)' in the prompt is replaced +by the current history event number. A literal `tt(!)' may then be +represented as `tt(!!)'. + +pindex(PROMPT_PERCENT, use of) +If the tt(PROMPT_PERCENT) option is set, certain escape sequences that +start with `tt(%)' are expanded. +Some escapes take an optional integer argument, which +should appear between the `tt(%)' and the next character of the +sequence. The following escape sequences are recognized: + +startitem() +item(tt(%%))( +A `tt(%)'. +) +item(tt(%RPAR()))( +A `tt(RPAR())'. +) +xitem(tt(%d)) +item(tt(%/))( +Present working directory (tt($PWD)). +) +item(tt(%~))( +tt($PWD). +If it has a named directory as its prefix, that part is replaced +by a `tt(~)' followed by the name of the directory. +If it starts with tt($HOME), that part is +replaced by a `tt(~)'. +) +xitem(tt(%c)) +xitem(tt(%.)) +item(tt(%C))( +Trailing component of tt($PWD). +An integer may follow the `tt(%)' to get more than one component. +Unless `tt(%C)' is used, tilde contraction is performed first. +) +xitem(tt(%h)) +item(tt(%!))( +Current history event number. +) +item(tt(%L))( +The current value of tt($SHLVL). +) +item(tt(%M))( +The full machine hostname. +) +item(tt(%m))( +The hostname up to the first `tt(.)'. +An integer may follow the `tt(%)' to specify +how many components of the hostname are desired. +) +item(tt(%S) LPAR()tt(%s)RPAR())( +Start (stop) standout mode. +) +item(tt(%U) LPAR()tt(%u)RPAR())( +Start (stop) underline mode. +) +item(tt(%B) LPAR()tt(%b)RPAR())( +Start (stop) boldface mode. +) +xitem(tt(%t)) +item(tt(%@))( +Current time of day, in 12-hour, am/pm format. +) +item(tt(%T))( +Current time of day, in 24-hour format. +) +item(tt(%*))( +Current time of day in 24-hour format, with seconds. +) +item(tt(%n))( +tt($USERNAME). +) +item(tt(%w))( +The date in var(day)tt(-)var(dd) format. +) +item(tt(%W))( +The date in var(mm)tt(/)var(dd)tt(/)var(yy) format. +) +item(tt(%D))( +The date in var(yy)tt(-)var(mm)tt(-)var(dd) format. +) +item(tt(%D{)var(string)tt(}))( +var(string) is formatted using the tt(strftime) function. +See manref(strftime)(3) for more details. Three additional codes are +available: tt(%f) prints the day of the month, like tt(%e) but +without any preceding space if the day is a single digit, and +tt(%K)/tt(%L) correspond to tt(%k)/tt(%l) for the hour of the day +(24/12 hour clock) in the same way. +) +item(tt(%l))( +The line (tty) the user is logged in on. +) +item(tt(%?))( +The return code of the last command executed just before the prompt. +) +item(tt(%_))( +The status of the parser, i.e. the shell constructs (like `tt(if)' and +`tt(for)') that have been started on the command line. If given an integer +number that many strings will be printed; zero or no integer means +print as many as there are. +) +item(tt(%E))( +Clears to end of line. +) +item(tt(%#))( +A `tt(#)' if the shell is running with privileges, a `tt(%)' if not. +Equivalent to `tt(%(!.#.%%))'. +The definition of `privileged', for these purposes, is that either the +effective user ID is zero, or, if POSIX.1e capabilities are supported, that +at least one capability is raised in either the Effective or Inheritable +capability vectors. +) +item(tt(%v))( +vindex(psvar, use of) +The value of the first element of the tt(psvar) array parameter. Following +the `tt(%)' with an integer gives that element of the array. +) +item(tt(%{)...tt(%}))( +Include a string as a literal escape sequence. +The string within the braces should not change the cursor +position. Brace pairs can nest. +) +item(tt(%LPAR())var(x.true-text.false-text)tt(RPAR()))( +Specifies a ternary expression. The character following the var(x) is +arbitrary; the same character is used to separate the text for the +`true' result from that for the `false' result. +This separator may not appear in the var(true-text), except as part of a +%-escape +sequence. A `tt(RPAR())' may appear in the var(false-text) as `tt(%RPAR())'. +var(true-text) +and var(false-text) may both contain arbitrarily-nested escape +sequences, including further ternary expressions. + +The left +parenthesis may be preceded or followed by a positive integer var(n), +which defaults to zero. The test character var(x) may be any of the +following: + +startsitem() +sxitem(tt(c)) +sxitem(tt(.)) +sitem(tt(~))(True if the current path, with prefix replacement, has at least var(n) elements.) +sxitem(tt(/)) +sitem(tt(C))(True if the current absolute path has at least var(n) elements.) +sitem(tt(t))(True if the time in minutes is equal to var(n).) +sitem(tt(T))(True if the time in hours is equal to var(n).) +sitem(tt(d))(True if the day of the month is equal to var(n).) +sitem(tt(D))(True if the month is equal to var(n) (January = 0).) +sitem(tt(w))(True if the day of the week is equal to var(n) (Sunday = 0).) +sitem(tt(?))(True if the exit status of the last command was var(n).) +sitem(tt(#))(True if the effective uid of the current process is var(n).) +sitem(tt(g))(True if the effective gid of the current process is var(n).) +sitem(tt(L))(True if the tt(SHLVL) parameter is at least var(n).) +sitem(tt(S))(True if the tt(SECONDS) parameter is at least var(n).) +sitem(tt(v))(True if the array tt(psvar) has at least var(n) elements.) +sitem(tt(_))(True if at least var(n) shell constructs were started.) +sitem(tt(!))(True if the shell is running with privileges.) +endsitem() +) +xitem(tt(%<)var(string)tt(<)) +xitem(tt(%>)var(string)tt(>)) +item(tt(%[)var(xstring)tt(]))( +Specifies truncation behaviour. +The third, deprecated, form is equivalent to `tt(%)var(xstringx)', +i.e. var(x) may be `tt(<)' or `tt(>)'. +The numeric argument, which in the third form may appear immediately +after the `tt([)', specifies the maximum permitted length of +the various strings that can be displayed in the prompt. If this +integer is zero, or missing, truncation is disabled. Truncation is +initially disabled. +The var(string) will be displayed in +place of the truncated portion of any string. + +The forms with `tt(<)' truncate at the left of the string, +and the forms with `tt(>)' truncate at the right of the string. +For example, if the current directory is `tt(/home/pike)', +the prompt `tt(%8<..<%/)' will expand to `tt(..e/pike)'. +In this string, the terminating character (`tt(<)', `tt(>)' or `tt(])'), +or in fact any character, may be quoted by a preceding `tt(\)'. +% escapes are em(not) recognised. +If the var(string) is longer than the specified truncation length, +it will appear in full, completely replacing the truncated string. +) +enditem() diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo new file mode 100644 index 000000000..8955e67ac --- /dev/null +++ b/Doc/Zsh/redirect.yo @@ -0,0 +1,183 @@ +texinode(Redirection)(Command Execution)(Shell Grammar)(Top) +chapter(Redirection) +cindex(redirection) +ifzman(\ +sect(Redirection) +)\ +cindex(file descriptors) +cindex(descriptors, file) +If a command is followed by tt(&) +and job control is not active, +then the default standard input +for the command is the empty file tt(/dev/null). +Otherwise, the environment for the execution of a command contains the +file descriptors of the invoking shell as modified by +input/output specifications. + +The following may appear anywhere in a simple command +or may precede or follow a complex command. +Substitution occurs before var(word) or var(digit) +is used except as noted below. +If the result of substitution on var(word) +produces more than one filename, +redirection occurs for each +separate filename in turn. + +startitem() +item(tt(<) var(word))( +Open file var(word) for reading as standard input. +) +item(tt(<>) var(word))( +Open file var(word) for reading and writing as standard input. +If the file does not exist then it is created. +) +item(tt(>) var(word))( +Open file var(word) for writing as standard output. +If the file does not exist then it is created. +If the file exists, and the tt(CLOBBER) option is unset, +this causes an error; +otherwise, it is truncated to zero length. +) +xitem(tt(>|) var(word)) +item(tt(>!) var(word))( +Same as tt(>), except that the file is truncated to zero length +if it exists, even if tt(CLOBBER) is unset. +) +item(tt(>>) var(word))( +Open file var(word) for writing in append mode as standard output. +If the file does not exist, and the tt(CLOBBER) +option is unset, this causes an error; +otherwise, the file is created. +) +xitem(tt(>>|) var(word)) +item(tt(>>!) var(word))( +Same as tt(>>), except that the file is created if it does not +exist, even if tt(CLOBBER) is unset. +) +item(tt(<<)[tt(-)] var(word))( +The shell input is read up to a line that is the same as +var(word), or to an end-of-file. +No parameter substitution, command substitution or +filename generation is performed on var(word). +The resulting document, called a +em(here-document), becomes the standard input. + +If any character of var(word) is quoted with +single or double quotes or a `tt(\)', +no interpretation is placed upon the characters of the document. +Otherwise, parameter and command substitution +occurs, `tt(\)' followed by a newline is removed, +and `tt(\)' must be used to quote the characters +`tt(\)', `tt($)', `tt(`)' and the first character of var(word). + +If tt(<<-) is used, then all leading +tabs are stripped from var(word) and from the document. +) +item(tt(<<<) var(word))( +Perform shell expansion on var(word) and pass the result +to standard input. This is known as a em(here-string). +) +xitem(tt(<&) var(digit)) +item(tt(>&) var(digit))( +The standard input/output is duplicated from file descriptor +var(digit) (see manref(dup)(2)). +) +xitem(tt(<& -)) +item(tt(>& -))( +Close the standard input/output. +) +xitem(tt(<& p)) +item(tt(>& p))( +The input/output from/to the coprocess is moved to the standard input/output. +) +item(tt(>&) var(word))( +Same as `tt(>) var(word) tt(2>&1)'. +) +item(tt(>>&) var(word))( +Same as `tt(>>) var(word) tt(2>&1)'. +) +enditem() + +If one of the above is preceded by a digit, then the file +descriptor referred to is that specified by the digit +instead of the default 0 or 1. +The order in which redirections are specified is significant. +The shell evaluates each redirection in terms of the +(em(file descriptor), em(file)) +association at the time of evaluation. +For example: + +nofill(... tt(1>)var(fname) tt(2>&1)) + +first associates file descriptor 1 with file var(fname). +It then associates file descriptor 2 with the file associated with file +descriptor 1 (that is, var(fname)). +If the order of redirections were reversed, +file descriptor 2 would be associated +with the terminal (assuming file descriptor 1 had been) +and then file descriptor 1 would be associated with file var(fname). +sect(Multios) +pindex(MULTIOS, use of) +If the user tries to open a file descriptor for writing more than once, +the shell opens the file descriptor as a pipe to a process that copies +its input to all the specified outputs, similar to bf(tee), +provided the tt(MULTIOS) option is set. Thus: + +nofill(tt(date >foo >bar)) + +writes the date to two files, named `tt(foo)' and `tt(bar)'. +Note that a pipe is an implicit redirection; thus + +nofill(tt(date >foo | cat)) + +writes the date to the file `tt(foo)', and also pipes it to cat. + +If the tt(MULTIOS) +option is set, the word after a redirection operator is also subjected +to filename generation (globbing). Thus + +nofill(tt(: > *)) + +will truncate all files in the current directory, +assuming there's at least one. (Without the tt(MULTIOS) +option, it would create an empty file called `tt(*)'.) +Similarly, you can do + +nofill(tt(echo exit 0 >> *.sh)) + +If the user tries to open a file descriptor for reading more than once, +the shell opens the file descriptor as a pipe to a process that copies +all the specified inputs to its output in the order +specified, similar to bf(cat), +provided the tt(MULTIOS) option is set. Thus + +nofill(tt(sort bar > baz)) + +when tt(MULTIOS) is unset will truncate bar, and write `tt(foo)' into baz. + +If a simple command consists of one or more redirection operators +and zero or more parameter assignments, but no command name, +the command named in the shell variable tt(READNULLCMD) is assumed. +(If tt(READNULLCMD) is empty or not set, `tt(cat)' is used.) Thus + +nofill(tt(< file)) + +prints the contents of tt(file). diff --git a/Doc/Zsh/restricted.yo b/Doc/Zsh/restricted.yo new file mode 100644 index 000000000..a61fd4955 --- /dev/null +++ b/Doc/Zsh/restricted.yo @@ -0,0 +1,44 @@ +texinode(Restricted Shell)(Expansion)(Prompt Expansion)(Top) +chapter(Restricted Shell) +ifzman(\ +sect(Restricted Shell) +)\ +cindex(restricted shell) +pindex(RESTRICTED) +When the basename of the command used to invoke zsh starts with the letter +`tt(r)' or the `tt(-r)' command line option is supplied at invocation, the +shell becomes restricted. Emulation mode is determined after stripping the +letter `tt(r)' from the invocation name. The following are disabled in +restricted mode: + +startitemize() +itemiz(changing directories with the tt(cd) builtin) +itemiz(changing or unsetting the tt(PATH), tt(path), tt(MODULE_PATH), +tt(module_path), tt(SHELL), tt(HISTFILE), tt(HISTSIZE), tt(GID), tt(EGID), +tt(UID), tt(EUID), tt(USERNAME), tt(LD_LIBRARY_PATH), +tt(LD_AOUT_LIBRARY_PATH), tt(LD_PRELOAD) and tt(LD_AOUT_PRELOAD) +parameters) +itemiz(specifying command names containing tt(/)) +itemiz(specifying command pathnames using tt(hash)) +itemiz(redirecting output to files) +itemiz(using the tt(exec) builtin command to replace the shell with another +command) +itemiz(using tt(jobs -Z) to overwrite the shell process' argument and +environment space) +itemiz(using the tt(ARGV0) parameter to override tt(argv[0]) for external +commands) +itemiz(turning off restricted mode with tt(set +r) or tt(unsetopt +RESTRICTED)) +itemiz(specifying modules to be loaded with an explicitly given +pathname containing slashes) +enditemize() + +These restrictions are enforced after processing the startup files. The +startup files should set up tt(PATH) to point to a directory of commands +which can be safely invoked in the restricted environment. They may also +add further restrictions by disabling selected builtins. + +Restricted mode can also be activated any time by setting the +tt(RESTRICTED) option. This immediately enables all the restrictions +described above even if the shell still have not processed all startup +files. diff --git a/Doc/Zsh/seealso.yo b/Doc/Zsh/seealso.yo new file mode 100644 index 000000000..8289e6628 --- /dev/null +++ b/Doc/Zsh/seealso.yo @@ -0,0 +1,25 @@ +texinode(See Also)()(The Zsh Web Page)(Introduction) +sect(See Also) +manref(sh)(1), +manref(csh)(1), +manref(tcsh)(1), +manref(rc)(1), +manref(bash)(1), +manref(ksh)(1)\ +ifzshone(\ +, +zmanref(zshbuiltins), +zmanref(zshcompctl), +zmanref(zshexpn), +zmanref(zshmisc), +zmanref(zshmodules), +zmanref(zshoptions), +zmanref(zshparam), +zmanref(zshzle)\ +)\ + + +bf(IEEE Standard for information Technology - +Portable Operating System Interface (POSIX) - +Part 2: Shell and Utilities), +IEEE Inc, 1993, ISBN 1-55937-255-9. diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo new file mode 100644 index 000000000..fccf538bd --- /dev/null +++ b/Doc/Zsh/zle.yo @@ -0,0 +1,1076 @@ +texinode(Zsh Line Editor)(Programmable Completion)(Shell Builtin Commands)(Top) +chapter(Zsh Line Editor) +cindex(line editor) +cindex(editor, line) +sect(Description) +pindex(ZLE, use of) +If the tt(ZLE) option is set (it is by default) +and the shell input is attached to the terminal, the user +is allowed to edit command lines. + +There are two display modes. The first, multiline mode, is the +default. It only works if the tt(TERM) parameter is set to a valid +terminal type that can move the cursor up. The second, single line +mode, is used if tt(TERM) is invalid or incapable of moving the +cursor up, or if the tt(SINGLE_LINE_ZLE) option is set. +pindex(SINGLE_LINE_ZLE, use of) +cindex(ksh, editor mode) +cindex(editor ksh style) +This mode +is similar to bf(ksh), and uses no termcap sequences. If tt(TERM) is +"emacs", the tt(ZLE) option will be unset by default. +sect(Keymaps) +cindex(keymaps) +cindex(key bindings) +cindex(bindings, key) +A keymap in ZLE contains a set of bindings between key sequences +and ZLE commands. The empty key sequence cannot be bound. + +There can be any number of keymaps at any time, and each keymap has one +or more names. If all of a keymap's names are deleted, it disappears. +findex(bindkey, use of) +tt(bindkey) can be used to manipulate keymap names. + +Initially, there are four keymaps: + +startsitem() +sitem(tt(emacs))(EMACS emulation) +sitem(tt(viins))(vi emulation - insert mode) +sitem(tt(vicmd))(vi emulation - command mode) +sitem(tt(.safe))(fallback keymap) +endsitem() + +The `tt(.safe)' keymap is special. It can never be altered, and the name +can never be removed. However, it can be linked to other names, which can +be removed. In the future other special keymaps may be added; users should +avoid using names beginning with `tt(.)' for their own keymaps. + +vindex(VISUAL) +vindex(EDITOR) +In addition to these four names, either `tt(emacs)' or `tt(viins)' is +also linked to the name `tt(main)'. If one of the tt(VISUAL) or +tt(EDITOR) environment variables contain the string `tt(vi)' when the shell +starts up then it will be `tt(viins)', otherwise it will be `tt(emacs)'. +tt(bindkey)'s tt(-e) and tt(-v) +options provide a convenient way to override this default choice. + +When the editor starts up, it will select the `tt(main)' keymap. +If that keymap doesn't exist, it will use `tt(.safe)' instead. + +In the `tt(.safe)' keymap, each single key is bound to tt(self-insert), +except for ^J (line feed) and ^M (return) which are bound to tt(accept-line). +This is deliberately not pleasant to use; if you are using it, it +means you deleted the main keymap, and you should put it back. +subsect(Reading Commands) +When ZLE is reading a command from the terminal, it may read a sequence +that is bound to some command and is also a prefix of a longer bound string. +In this case ZLE will wait a certain time to see if more characters +are typed, and if not (or they don't match any longer string) it will +execute the binding. This timeout is defined by the tt(KEYTIMEOUT) parameter; +its default is 0.4 sec. No timeout is done if the prefix string is not bound. + +As well as ZLE commands, key sequences can be bound to other strings, by using +`tt(bindkey -s)'. +When such a sequence is read, the replacement string is pushed back as input, +and the command reading process starts again using these fake keystrokes. +This input can itself invoke further replacement strings, but in order to +detect loops the process will be stopped if there are twenty such replacements +without a real command being read. +sect(Widgets) +cindex(widgets) +All actions in the editor are performed by `widgets'. A widget's job is +simply to perform some small action. The ZLE commands that key sequences +in keymaps are bound to are in fact widgets. Widgets can be user-defined +or built in. + +There are 162 standard widgets built in to ZLE (see sectref(Standard Widgets)). +Other built-in widgets can be defined by other modules (see +ifzman(zmanref(zshmodules))\ +ifnzman(noderef(Zsh Modules))\ +). Each built-in widget has two names: its normal canonical name, and the +same name preceded by a `tt(.)'. The `tt(.)' name is special: it can't be +rebound to a different widget. This makes the widget available even when +its usual name has been redefined. + +User-defined widgets are defined using `tt(zle -N)', and implemented +as shell functions. When the widget is executed, the corresponding +shell function is executed, and can perform editing (or other) actions. +It is recommended that user-defined widgets should not have names +starting with `tt(.)'. +sect(User-Defined Widgets) +cindex(widgets, user-defined) +User-defined widgets, being implemented as shell functions, +can execute any normal shell command. They can also run other widgets +(whether built-in or user-defined) using the tt(zle) builtin command. +Finally, they can examine and edit the ZLE buffer being edited by +reading and setting the special parameters described below. + +cindex(parameters, editor) +cindex(parameters, zle) +These special parameters are always available in widget functions, but +are not in any way special outside ZLE. If they have some normal value +outside ZLE, that value is temporarily inaccessible, but will return +when the widget function exits. These special parameters in fact have +local scope, like parameters created in a function using tt(local). + +startitem() +vindex(BUFFER) +item(tt(BUFFER) (scalar))( +The entire contents of the edit buffer. If it is written to, the +cursor remains at the same offset, unless that would put it outside the +buffer. +) +vindex(CURSOR) +item(tt(CURSOR) (integer))( +The offset of the cursor, within the edit buffer. This is in the range +0 to tt($#BUFFER), and is by definition equal to tt($#LBUFFER). +Attempts to move the cursor outside the buffer will result in the +cursor being moved to the appropriate end of the buffer. +) +vindex(LBUFFER) +item(tt(LBUFFER) (scalar))( +The part of the buffer that lies to the left of the cursor position. +If it is assigned to, only that part of the buffer is replaced, and the +cursor remains between the new tt($LBUFFER) and the old tt($RBUFFER). +) +vindex(RBUFFER) +item(tt(RBUFFER) (scalar))( +The part of the buffer that lies to the right of the cursor position. +If it is assigned to, only that part of the buffer is replaced, and the +cursor remains between the old tt($LBUFFER) and the new tt($RBUFFER). +) +enditem() +sect(Standard Widgets) +cindex(widgets, standard) +The following is a list of all the standard widgets, +and their default bindings in emacs mode, +vi command mode and vi insert mode +(the `tt(emacs)', `tt(vicmd)' and `tt(viins)' keymaps, respectively). +startmenu() +menu(Movement) +menu(History Control) +menu(Modifying Text) +menu(Arguments) +menu(Completion) +menu(Miscellaneous) +endmenu() +texinode(Movement)(History Control)()(Zsh Line Editor) +subsect(Movement) +startitem() +tindex(vi-backward-blank-word) +item(tt(vi-backward-blank-word) (unbound) (B) (unbound))( +Move backward one word, where a word is defined as a series of +non-blank characters. +) +tindex(backward-char) +item(tt(backward-char) (^B ESC-[D) (unbound) (unbound))( +Move backward one character. +) +tindex(vi-backward-char) +item(tt(vi-backward-char) (unbound) (^H h ^?) (unbound))( +Move backward one character, without changing lines. +) +tindex(backward-word) +item(tt(backward-word) (ESC-B ESC-b) (unbound) (unbound))( +Move to the beginning of the previous word. +) +tindex(emacs-backward-word) +item(tt(emacs-backward-word))( +Move to the beginning of the previous word. +) +tindex(vi-backward-word) +item(tt(vi-backward-word) (unbound) (b) (unbound))( +Move to the beginning of the previous word, vi-style. +) +tindex(beginning-of-line) +item(tt(beginning-of-line) (^A) (unbound) (unbound))( +Move to the beginning of the line. If already at the beginning +of the line, move to the beginning of the previous line, if any. +) +tindex(vi-beginning-of-line) +item(tt(vi-beginning-of-line))( +Move to the beginning of the line, without changing lines. +) +tindex(end-of-line) +item(tt(end-of-line) (^E) (unbound) (unbound))( +Move to the end of the line. If already at the end +of the line, move to the end of the next line, if any. +) +tindex(vi-end-of-line) +item(tt(vi-end-of-line) (unbound) ($) (unbound))( +Move to the end of the line. +If an argument is given to this command, the cursor will be moved to +the end of the line (argument - 1) lines down. +) +tindex(vi-forward-blank-word) +item(tt(vi-forward-blank-word) (unbound) (W) (unbound))( +Move forward one word, where a word is defined as a series of +non-blank characters. +) +tindex(vi-forward-blank-word-end) +item(tt(vi-forward-blank-word-end) (unbound) (E) (unbound))( +Move to the end of the current word, or, if at the end of the current word, +to the end of the next word, +where a word is defined as a series of non-blank characters. +) +tindex(forward-char) +item(tt(forward-char) (^F ESC-[C) (unbound) (unbound))( +Move forward one character. +) +tindex(vi-forward-char) +item(tt(vi-forward-char) (unbound) (space l) (unbound))( +Move forward one character. +) +tindex(vi-find-next-char) +item(tt(vi-find-next-char) (^X^F) (f) (unbound))( +Read a character from the keyboard, and move to +the next occurrence of it in the line. +) +tindex(vi-find-next-char-skip) +item(tt(vi-find-next-char-skip) (unbound) (t) (unbound))( +Read a character from the keyboard, and move to +the position just before the next occurrence of it in the line. +) +tindex(vi-find-prev-char) +item(tt(vi-find-prev-char) (unbound) (F) (unbound))( +Read a character from the keyboard, and move to +the previous occurrence of it in the line. +) +tindex(vi-find-prev-char-skip) +item(tt(vi-find-prev-char-skip) (unbound) (T) (unbound))( +Read a character from the keyboard, and move to +the position just after the previous occurrence of it in the line. +) +tindex(vi-first-non-blank) +item(tt(vi-first-non-blank) (unbound) (^) (unbound))( +Move to the first non-blank character in the line. +) +tindex(vi-forward-word) +item(tt(vi-forward-word) (unbound) (w) (unbound))( +Move forward one word, vi-style. +) +tindex(forward-word) +item(tt(forward-word) (ESC-F ESC-f) (unbound) (unbound))( +Move to the beginning of the next word. +The editor's idea of a word is specified with the tt(WORDCHARS) +parameter. +) +tindex(emacs-forward-word) +item(tt(emacs-forward-word))( +Move to the end of the next word. +) +tindex(vi-forward-word-end) +item(tt(vi-forward-word-end) (unbound) (e) (unbound))( +Move to the end of the next word. +) +tindex(vi-goto-column) +item(tt(vi-goto-column) (ESC-|) (|) (unbound))( +Move to the column specified by the numeric argument. +) +tindex(vi-goto-mark) +item(tt(vi-goto-mark) (unbound) (`) (unbound))( +Move to the specified mark. +) +tindex(vi-goto-mark-line) +item(tt(vi-goto-mark-line) (unbound) (') (unbound))( +Move to beginning of the line containing the specified mark. +) +tindex(vi-repeat-find) +item(tt(vi-repeat-find) (unbound) (;) (unbound))( +Repeat the last tt(vi-find) command. +) +tindex(vi-rev-repeat-find) +item(tt(vi-rev-repeat-find) (unbound) (,) (unbound))( +Repeat the last tt(vi-find) command in the opposite direction. +) +enditem() +texinode(History Control)(Modifying Text)(Movement)(Zsh Line Editor) +subsect(History Control) +startitem() +tindex(beginning-of-buffer-or-history) +item(tt(beginning-of-buffer-or-history) (ESC-<) (unbound) (unbound))( +Move to the beginning of the buffer, or if already there, +move to the first event in the history list. +) +tindex(beginning-of-line-hist) +item(tt(beginning-of-line-hist))( +Move to the beginning of the line. If already at the +beginning of the buffer, move to the previous history line. +) +tindex(beginning-of-history) +item(tt(beginning-of-history))( +Move to the first event in the history list. +) +tindex(down-line-or-history) +item(tt(down-line-or-history) (^N ESC-[B) (j) (unbound))( +Move down a line in the buffer, or if already at the bottom line, +move to the next event in the history list. +) +tindex(vi-down-line-or-history) +item(tt(vi-down-line-or-history) (unbound) (PLUS()) (unbound))( +Move down a line in the buffer, or if already at the bottom line, +move to the next event in the history list. +Then move to the first non-blank character on the line. +) +tindex(down-line-or-search) +item(tt(down-line-or-search))( +Move down a line in the buffer, or if already at the bottom line, +search forward in the history for a line beginning with the first +word in the buffer. +) +tindex(down-history) +item(tt(down-history) (unbound) (^N) (unbound))( +Move to the next event in the history list. +) +tindex(history-beginning-search-backward) +item(tt(history-beginning-search-backward))( +Search backward in the history for a line beginning with the current +line up to the cursor. +This leaves the cursor in its original position. +) +tindex(end-of-buffer-or-history) +item(tt(end-of-buffer-or-history) (ESC->) (unbound) (unbound))( +Move to the end of the buffer, or if already there, +move to the last event in the history list. +) +tindex(end-of-line-hist) +item(tt(end-of-line-hist))( +Move to the end of the line. If already at the end of +the buffer, move to the next history line. +) +tindex(end-of-history) +item(tt(end-of-history))( +Move to the last event in the history list. +) +tindex(vi-fetch-history) +item(tt(vi-fetch-history) (unbound) (G) (unbound))( +Fetch the history line specified by the numeric argument. +This defaults to the current history line +(i.e. the one that isn't history yet). +) +tindex(history-incremental-search-backward) +item(tt(history-incremental-search-backward) (^R ^Xr) (unbound) (unbound))( +Search backward incrementally for a specified string. The search is +case-insensitive if the search string does not have uppercase letters and no +numeric argument was given. The string may begin with `tt(^)' to anchor the +search to the beginning of the line. + +A restricted set of editing functions +is available in the mini-buffer. An interrupt signal, as defined by the stty +setting, will stop the search and go back to the original line. An undefined +key will have the same effect. The supported functions are: +tt(backward-delete-char), +tt(vi-backward-delete-char), +tt(clear-screen), +tt(redisplay), +tt(quoted-insert), +tt(vi-quoted-insert), +tt(accept-and-hold), +tt(accept-and-infer-next-history), +tt(accept-line) and +tt(accept-line-and-down-history). + +tt(magic-space) just inserts a space. +tt(vi-cmd-mode) toggles between the `tt(main)' and `tt(vicmd)' keymaps; +the `tt(main)' keymap (insert mode) will be selected initially. +tt(history-incremental-search-backward) will get the +next occurrence of the contents of the mini-buffer. +tt(history-incremental-search-forward) inverts the sense of the search. +tt(vi-repeat-search) and tt(vi-rev-repeat-search) are similarly supported. +The direction of the search is indicated in the mini-buffer. + +Any multi-character string +that is not bound to one of the above functions will beep and interrupt the +search, leaving the last found line in the buffer. Any single character that +is not bound to one of the above functions, or tt(self-insert) or +tt(self-insert-unmeta), will have the same effect but the function will be +executed. +) +tindex(history-incremental-search-forward) +item(tt(history-incremental-search-forward) (^S ^Xs) (unbound) (unbound))( +Search forward incrementally for a specified string. The search is +case-insensitive if the search string does not have uppercase letters and no +numeric argument was given. The string may begin with `tt(^)' to anchor the +search to the beginning of the line. The functions available in the +mini-buffer are the same as for tt(history-incremental-search-backward). +) +tindex(history-search-backward) +item(tt(history-search-backward) (ESC-P ESC-p) (unbound) (unbound))( +Search backward in the history for a line beginning with the first +word in the buffer. +) +tindex(vi-history-search-backward) +item(tt(vi-history-search-backward) (unbound) (/) (unbound))( +Search backward in the history for a specified string. +The string may begin with `tt(^)' to anchor the search to the +beginning of the line. + +A restricted set of editing functions is available in +the mini-buffer. An interrupt signal, as defined by the stty setting, will +stop the search. +The functions available in the mini-buffer are: +tt(accept-line), +tt(backward-delete-char), +tt(vi-backward-delete-char), +tt(backward-kill-word), +tt(vi-backward-kill-word), +tt(clear-screen), +tt(redisplay), +tt(quoted-insert) +and +tt(vi-quoted-insert). + +tt(vi-cmd-mode) is treated the same as accept-line, and +tt(magic-space) is treated as a space. +Any other character that is not bound to self-insert or +self-insert-unmeta will beep and be ignored. If the function is called from vi +command mode, the bindings of the current insert mode will be used. +) +tindex(history-search-forward) +item(tt(history-search-forward) (ESC-N ESC-n) (unbound) (unbound))( +Search forward in the history for a line beginning with the first +word in the buffer. +) +tindex(vi-history-search-forward) +item(tt(vi-history-search-forward) (unbound) (?) (unbound))( +Search forward in the history for a specified string. +The string may begin with `tt(^)' to anchor the search to the +beginning of the line. The functions available in the mini-buffer are the same +as for tt(vi-history-search-backward). +) +tindex(infer-next-history) +item(tt(infer-next-history) (^X^N) (unbound) (unbound))( +Search in the history list for a line matching the current one and +fetch the event following it. +) +tindex(insert-last-word) +item(tt(insert-last-word) (ESC-_ ESC-.) (unbound) (unbound))( +Insert the last word from the previous history event at the +cursor position. If a positive numeric argument is given, +insert that word from the end of the previous history event. +If the argument is zero or negative insert that word from the +left (zero inserts the previous command word). +) +tindex(vi-repeat-search) +item(tt(vi-repeat-search) (unbound) (n) (unbound))( +Repeat the last vi history search. +) +tindex(vi-rev-repeat-search) +item(tt(vi-rev-repeat-search) (unbound) (N) (unbound))( +Repeat the last vi history search, but in reverse. +) +tindex(up-line-or-history) +item(tt(up-line-or-history) (^P ESC-[A) (k) (unbound))( +Move up a line in the buffer, or if already at the top line, +move to the previous event in the history list. +) +tindex(vi-up-line-or-history) +item(tt(vi-up-line-or-history) (unbound) (-) (unbound))( +Move up a line in the buffer, or if already at the top line, +move to the previous event in the history list. +Then move to the first non-blank character on the line. +) +tindex(up-line-or-search) +item(tt(up-line-or-search))( +Move up a line in the buffer, or if already at the top line, +search backward in the history for a line beginning with the +first word in the buffer. +) +tindex(up-history) +item(tt(up-history) (unbound) (^P) (unbound))( +Move to the previous event in the history list. +) +tindex(history-beginning-search-forward) +item(tt(history-beginning-search-forward))( +Search forward in the history for a line beginning with the current +line up to the cursor. +This leaves the cursor in its original position. +) +enditem() +texinode(Modifying Text)(Arguments)(History Control)(Zsh Line Editor) +subsect(Modifying Text) +startitem() +tindex(vi-add-eol) +item(tt(vi-add-eol) (unbound) (A) (unbound))( +Move to the end of the line and enter insert mode. +) +tindex(vi-add-next) +item(tt(vi-add-next) (unbound) (a) (unbound))( +Enter insert mode after the current cursor position, without changing lines. +) +tindex(backward-delete-char) +item(tt(backward-delete-char) (^H ^?) (unbound) (unbound))( +Delete the character behind the cursor. +) +tindex(vi-backward-delete-char) +item(tt(vi-backward-delete-char) (unbound) (X) (^H))( +Delete the character behind the cursor, without changing lines. +If in insert mode, this won't delete past the point where insert mode was +last entered. +) +tindex(backward-delete-word) +item(tt(backward-delete-word))( +Delete the word behind the cursor. +) +tindex(backward-kill-line) +item(tt(backward-kill-line))( +Kill from the beginning of the line to the cursor position. +) +tindex(backward-kill-word) +item(tt(backward-kill-word) (^W ESC-^H ESC-^?) (unbound) (unbound))( +Kill the word behind the cursor. +) +tindex(vi-backward-kill-word) +item(tt(vi-backward-kill-word) (unbound) (unbound) (^W))( +Kill the word behind the cursor, without going past the point where insert +mode was last entered. +) +tindex(capitalize-word) +item(tt(capitalize-word) (ESC-C ESC-c) (unbound) (unbound))( +Capitalize the current word and move past it. +) +tindex(vi-change) +item(tt(vi-change) (unbound) (c) (unbound))( +Read a movement command from the keyboard, and kill +from the cursor position to the endpoint of the movement. +Then enter insert mode. +If the command is tt(vi-change), change the current line. +) +tindex(vi-change-eol) +item(tt(vi-change-eol) (unbound) (C) (unbound))( +Kill to the end of the line and enter insert mode. +) +tindex(vi-change-whole-line) +item(tt(vi-change-whole-line) (unbound) (S) (unbound))( +Kill the current line and enter insert mode. +) +tindex(copy-region-as-kill) +item(tt(copy-region-as-kill) (ESC-W ESC-w) (unbound) (unbound))( +Copy the area from the cursor to the mark to the kill buffer. +) +tindex(copy-prev-word) +item(tt(copy-prev-word) (ESC-^_) (unbound) (unbound))( +Duplicate the word behind the cursor. +) +tindex(vi-delete) +item(tt(vi-delete) (unbound) (d) (unbound))( +Read a movement command from the keyboard, and kill +from the cursor position to the endpoint of the movement. +If the command is tt(vi-delete), kill the current line. +) +tindex(delete-char) +item(tt(delete-char))( +Delete the character under the cursor. +) +tindex(vi-delete-char) +item(tt(vi-delete-char) (unbound) (x) (unbound))( +Delete the character under the cursor, +without going past the end of the line. +) +tindex(delete-word) +item(tt(delete-word))( +Delete the current word. +) +tindex(down-case-word) +item(tt(down-case-word) (ESC-L ESC-l) (unbound) (unbound))( +Convert the current word to all lowercase and move past it. +) +tindex(kill-word) +item(tt(kill-word) (ESC-D ESC-d) (unbound) (unbound))( +Kill the current word. +) +tindex(gosmacs-transpose-chars) +item(tt(gosmacs-transpose-chars))( +Exchange the two characters behind the cursor. +) +tindex(vi-indent) +item(tt(vi-indent) (unbound) (>) (unbound))( +Indent a number of lines. +) +tindex(vi-insert) +item(tt(vi-insert) (unbound) (i) (unbound))( +Enter insert mode. +) +tindex(vi-insert-bol) +item(tt(vi-insert-bol) (unbound) (I) (unbound))( +Move to the first non-blank character on the line and enter insert mode. +) +tindex(vi-join) +item(tt(vi-join) (^X^J) (J) (unbound))( +Join the current line with the next one. +) +tindex(kill-line) +item(tt(kill-line) (^K) (unbound) (unbound))( +Kill from the cursor to the end of the line. +If already on the end of the line, kill the newline character. +) +tindex(vi-kill-line) +item(tt(vi-kill-line) (unbound) (unbound) (^U))( +Kill from the cursor back to wherever insert mode was last entered. +) +tindex(vi-kill-eol) +item(tt(vi-kill-eol) (unbound) (D) (unbound))( +Kill from the cursor to the end of the line. +) +tindex(kill-region) +item(tt(kill-region))( +Kill from the cursor to the mark. +) +tindex(kill-buffer) +item(tt(kill-buffer) (^X^K) (unbound) (unbound))( +Kill the entire buffer. +) +tindex(kill-whole-line) +item(tt(kill-whole-line) (^U) (unbound) (unbound))( +Kill the current line. +) +tindex(vi-match-bracket) +item(tt(vi-match-bracket) (^X^B) (%) (unbound))( +Move to the bracket character (one of tt({}), tt(()) or tt([])) that +matches the one under the cursor. +If the cursor is not on a bracket character, move forward without going +past the end of the line to find one, and then go to the matching bracket. +) +tindex(vi-open-line-above) +item(tt(vi-open-line-above) (unbound) (O) (unbound))( +Open a line above the cursor and enter insert mode. +) +tindex(vi-open-line-below) +item(tt(vi-open-line-below) (unbound) (o) (unbound))( +Open a line below the cursor and enter insert mode. +) +tindex(vi-oper-swap-case) +item(tt(vi-oper-swap-case))( +Read a movement command from the keyboard, and swap +the case of all characters +from the cursor position to the endpoint of the movement. +If the movement command is tt(vi-oper-swap-case), +swap the case of all characters on the current line. +) +tindex(overwrite-mode) +item(tt(overwrite-mode) (^X^O) (unbound) (unbound))( +Toggle between overwrite mode and insert mode. +) +tindex(vi-put-before) +item(tt(vi-put-before) (unbound) (P) (unbound))( +Insert the contents of the kill buffer before the cursor. +If the kill buffer contains a sequence of lines (as opposed to characters), +paste it above the current line. +) +tindex(vi-put-after) +item(tt(vi-put-after) (unbound) (p) (unbound))( +Insert the contents of the kill buffer after the cursor. +If the kill buffer contains a sequence of lines (as opposed to characters), +paste it below the current line. +) +tindex(quoted-insert) +item(tt(quoted-insert) (^V) (unbound) (unbound))( +Insert the next character typed into the buffer literally. +An interrupt character will not be inserted. +) +tindex(vi-quoted-insert) +item(tt(vi-quoted-insert) (unbound) (unbound) (^Q ^V))( +Display a `tt(^)' at the cursor position, and +insert the next character typed into the buffer literally. +An interrupt character will not be inserted. +) +tindex(quote-line) +item(tt(quote-line) (ESC-') (unbound) (unbound))( +Quote the current line; that is, put a `tt(')' character at the +beginning and the end, and convert all `tt(')' characters +to `tt('\'')'. +) +tindex(quote-region) +item(tt(quote-region) (ESC-") (unbound) (unbound))( +Quote the region from the cursor to the mark. +) +tindex(vi-replace) +item(tt(vi-replace) (unbound) (R) (unbound))( +Enter overwrite mode. +) +tindex(vi-repeat-change) +item(tt(vi-repeat-change) (unbound) (.) (unbound))( +Repeat the last vi mode text modification. +If a count was used with the modification, it is remembered. +If a count is given to this command, it overrides the remembered count, +and is remembered for future uses of this command. +The cut buffer specification is similarly remembered. +) +tindex(vi-replace-chars) +item(tt(vi-replace-chars) (unbound) (r) (unbound))( +Replace the character under the cursor with a character +read from the keyboard. +) +tindex(self-insert) +item(tt(self-insert) (printable characters) (unbound) (printable characters and some control characters))( +Insert a character into the buffer at the cursor position. +) +tindex(self-insert-unmeta) +item(tt(self-insert-unmeta) (ESC-^I ESC-^J ESC-^M) (unbound) (unbound))( +Insert a character into the buffer after stripping the meta bit +and converting ^M to ^J. +) +tindex(vi-substitute) +item(tt(vi-substitute) (unbound) (s) (unbound))( +Substitute the next characte+CHAR(r)(s). +) +tindex(vi-swap-case) +item(tt(vi-swap-case) (unbound) (~) (unbound))( +Swap the case of the character under the cursor and move past it. +) +tindex(transpose-chars) +item(tt(transpose-chars) (^T) (unbound) (unbound))( +Exchange the two characters to the left of the +cursor if at end of line, else exchange the +character under the cursor with the character +to the left. +) +tindex(transpose-words) +item(tt(transpose-words) (ESC-T ESC-t) (unbound) (unbound))( +Exchange the current word with the one before it. +) +tindex(vi-unindent) +item(tt(vi-unindent) (unbound) (<) (unbound))( +Unindent a number of lines. +) +tindex(up-case-word) +item(tt(up-case-word) (ESC-U ESC-u) (unbound) (unbound))( +Convert the current word to all caps and move past it. +) +tindex(yank) +item(tt(yank) (^Y) (unbound) (unbound))( +Insert the contents of the kill buffer at the cursor position. +) +tindex(yank-pop) +item(tt(yank-pop) (ESC-y) (unbound) (unbound))( +Remove the text just yanked, rotate the kill-ring, +and yank the new top. Only works following +tt(yank) or tt(yank-pop). +) +tindex(vi-yank) +item(tt(vi-yank) (unbound) (y) (unbound))( +Read a movement command from the keyboard, and copy the region +from the cursor position to the endpoint of the movement +into the kill buffer. +If the command is tt(vi-yank), copy the current line. +) +tindex(vi-yank-whole-line) +item(tt(vi-yank-whole-line) (unbound) (Y) (unbound))( +Copy the current line into the kill buffer. +) +tindex(vi-yank-eol) +item(tt(vi-yank-eol))( +Copy the region from the cursor position to the end of the line +into the kill buffer. +Arguably, this is what Y should do in vi, but it isn't what it actually does. +) +enditem() +texinode(Arguments)(Completion)(Modifying Text)(Zsh Line Editor) +subsect(Arguments) +startitem() +tindex(digit-argument) +item(tt(digit-argument) (ESC-0..ESC-9) (1-9) (unbound))( +Start a new numeric argument, or add to the current one. +See also tt(vi-digit-or-beginning-of-line). +) +tindex(neg-argument) +item(tt(neg-argument) (ESC--) (unbound) (unbound))( +Changes the sign of the following argument. +) +tindex(universal-argument) +item(tt(universal-argument))( +Multiply the argument of the next command by 4. Alternatively, if +this command is followed by an integer (positive or negative), use +that as the argument for the next command. Thus digits cannot be +repeated using this command. For example, if this command occurs +twice, followed immediately by tt(forward-char), move forward sixteen +spaces; if instead it is followed by tt(-2), then tt(forward-char), +move backward two spaces. +) +enditem() +texinode(Completion)(Miscellaneous)(Arguments)(Zsh Line Editor) +subsect(Completion) +startitem() +tindex(accept-and-menu-complete) +item(tt(accept-and-menu-complete))( +In a menu completion, insert the current completion into the buffer, +and advance to the next possible completion. +) +tindex(complete-word) +item(tt(complete-word))( +Attempt completion on the current word. +) +tindex(delete-char-or-list) +item(tt(delete-char-or-list) (^D) (unbound) (unbound))( +Delete the character under the cursor. If the cursor +is at the end of the line, list possible completions for the +current word. +) +tindex(expand-cmd-path) +item(tt(expand-cmd-path))( +Expand the current command to its full pathname. +) +tindex(expand-or-complete) +item(tt(expand-or-complete) (TAB) (unbound) (TAB))( +Attempt shell expansion on the current word. +If that fails, +attempt completion. +) +tindex(expand-or-complete-prefix) +item(tt(expand-or-complete-prefix))( +Attempt shell expansion on the current word up to cursor. +) +tindex(expand-history) +item(tt(expand-history) (ESC-space ESC-!) (unbound) (unbound))( +Perform history expansion on the edit buffer. +) +tindex(expand-word) +item(tt(expand-word) (^X*) (unbound) (unbound))( +Attempt shell expansion on the current word. +) +tindex(list-choices) +item(tt(list-choices) (ESC-^D) (^D =) (^D))( +List possible completions for the current word. +) +tindex(list-expand) +item(tt(list-expand) (^Xg ^XG) (^G) (^G))( +List the expansion of the current word. +) +tindex(magic-space) +item(tt(magic-space))( +Perform history expansion and insert a space into the +buffer. This is intended to be bound to space. +) +tindex(menu-complete) +pindex(MENU_COMPLETE, use of) +item(tt(menu-complete))( +Like tt(complete-word), except that menu completion is used. +See the tt(MENU_COMPLETE) option. +) +tindex(menu-expand-or-complete) +item(tt(menu-expand-or-complete))( +Like tt(expand-or-complete), except that menu completion is used. +) +tindex(reverse-menu-complete) +item(tt(reverse-menu-complete))( +Perform menu completion, like tt(menu-complete), except that if +a menu completion is already in progress, move to the em(previous) +completion rather than the next. +) +enditem() +texinode(Miscellaneous)()(Completion)(Zsh Line Editor) +subsect(Miscellaneous) +startitem() +tindex(accept-and-hold) +item(tt(accept-and-hold) (ESC-A ESC-a) (unbound) (unbound))( +Push the contents of the buffer on the buffer stack +and execute it. +) +tindex(accept-and-infer-next-history) +item(tt(accept-and-infer-next-history))( +Execute the contents of the buffer. +Then search the history list for a line matching the current one +and push the event following onto the buffer stack. +) +tindex(accept-line) +item(tt(accept-line) (^J ^M) (^J ^M) (^J ^M))( +Finish editing the buffer. Normally this causes the buffer to be +executed as a shell command. +) +tindex(accept-line-and-down-history) +item(tt(accept-line-and-down-history) (^O) (unbound) (unbound))( +Execute the current line, and push the next history +event on the the buffer stack. +) +tindex(vi-cmd-mode) +item(tt(vi-cmd-mode) (^X^V) (unbound) (^[))( +Enter command mode; that is, select the `tt(vicmd)' keymap. +Yes, this is bound by default in emacs mode. +) +tindex(vi-caps-lock-panic) +item(tt(vi-caps-lock-panic))( +Hang until any lowercase key is pressed. +This is for vi users without the mental capacity to keep +track of their caps lock key (like the author). +) +tindex(clear-screen) +item(tt(clear-screen) (^L ESC-^L) (^L) (^L))( +Clear the screen and redraw the prompt. +) +tindex(describe-key-briefly) +item(tt(describe-key-briefly))( +Reads a key sequence, then prints the function bound to that sequence. +) +tindex(exchange-point-and-mark) +item(tt(exchange-point-and-mark) (^X^X) (unbound) (unbound))( +Exchange the cursor position with the position of the mark. +) +tindex(execute-named-cmd) +item(tt(execute-named-cmd) (ESC-x) (unbound) (unbound))( +Read the name of an editor command and +execute it. A restricted set of editing functions is available in the +mini-buffer. An interrupt signal, as defined by the stty setting, will +abort the function. The allowed functions are: +tt(backward-delete-char), +tt(vi-backward-delete-char), +tt(clear-screen), +tt(redisplay), +tt(quoted-insert), +tt(vi-quoted-insert), +tt(backward-kill-word), +tt(vi-backward-kill-word), +tt(kill-whole-line), +tt(vi-kill-line), +tt(backward-kill-line), +tt(list-choices), +tt(delete-char-or-list), +tt(complete-word), +tt(accept-line), +tt(expand-or-complete) and +tt(expand-or-complete-prefix). + +tt(kill-region) kills the last word, +and vi-cmd-mode is treated the same as accept-line. +The space and tab characters, if not bound to one of +these functions, will complete the name and then list the +possibilities if the tt(AUTO_LIST) option is set. +Any other character that is not bound to tt(self-insert) or +tt(self-insert-unmeta) will beep and be ignored. +The bindings of the current insert mode will be used. +) +tindex(execute-last-named-cmd) +item(tt(execute-last-named-cmd) (ESC-z) (unbound) (unbound))( +Redo the last function executed with tt(execute-named-cmd). +) +tindex(get-line) +item(tt(get-line) (ESC-G ESC-g) (unbound) (unbound))( +Pop the top line off the buffer stack and insert it at the +cursor position. +) +tindex(pound-insert) +item(tt(pound-insert) (unbound) (#) (unbound))( +If there is no # character at the beginning of the buffer, +add one to the beginning of each line. +If there is one, remove a # from each line that has one. +In either case, accept the current line. +The tt(INTERACTIVE_COMMENTS) option must be set +for this to have any usefulness. +) +tindex(vi-pound-insert) +item(tt(vi-pound-insert))( +If there is no # character at the beginning of the current line, +add one. If there is one, remove it. +The tt(INTERACTIVE_COMMENTS) option must be set +for this to have any usefulness. +) +tindex(push-input) +item(tt(push-input))( +Push the entire current multiline construct onto the buffer stack and +return to the top-level (tt(PS1)) prompt. +If the current parser construct is only a single line, this is exactly +like tt(push-line). +Next time the editor starts up or is popped with tt(get-line), the +construct will be popped off the top of the buffer stack and loaded +into the editing buffer. +) +tindex(push-line) +item(tt(push-line) (^Q ESC-Q ESC-q) (unbound) (unbound))( +Push the current buffer onto the buffer stack and clear +the buffer. +Next time the editor starts up, the buffer will be popped +off the top of the buffer stack and loaded into the editing +buffer. +) +tindex(push-line-or-edit) +item(tt(push-line-or-edit))( +At the top-level (tt(PS1)) prompt, equivalent to tt(push-line). +At a secondary (tt(PS2)) prompt, move the entire current multiline +construct into the editor buffer. +The latter is equivalent to tt(push-input) followed by tt(get-line). +) +tindex(redisplay) +item(tt(redisplay) (unbound) (^R) (^R))( +Redisplays the edit buffer. +) +tindex(send-break) +item(tt(send-break) (^G ESC-^G) (unbound) (unbound))( +Abort the current editor function, e.g. tt(execute-named-command), or the +editor itself, e.g. if you are in tt(vared). Otherwise abort the parsing of +the current line. +) +tindex(run-help) +item(tt(run-help) (ESC-H ESC-h) (unbound) (unbound))( +Push the buffer onto the buffer stack, and execute the +command `tt(run-help) var(cmd)', where var(cmd) is the current +command. tt(run-help) is normally aliased to var(man). +) +tindex(vi-set-buffer) +item(tt(vi-set-buffer) (unbound) (") (unbound))( +Specify a buffer to be used in the following command. +There are 35 buffers that can be specified: +the 26 `named' buffers tt("a) to tt("z) +and the nine `queued' buffers tt("1) to tt("9). The named buffers can also +be specified as tt("A) to tt("Z). + +When a buffer is specified for a cut command, the text being cut replaces +the previous contents of the specified buffer. If a named buffer +is specified using a capital, the newly cut text is appended to the buffer +instead of overwriting it. + +If no buffer is specified for a cut command, tt("1) is used, and the +contents of tt("1) to tt("8) are each shifted along one buffer; the contents of +tt("9) is lost. +) +tindex(vi-set-mark) +item(tt(vi-set-mark) (unbound) (m) (unbound))( +Set the specified mark at the cursor position. +) +tindex(set-mark-command) +item(tt(set-mark-command) (^@) (unbound) (unbound))( +Set the mark at the cursor position. +) +tindex(spell-word) +item(tt(spell-word) (ESC-$ ESC-S ESC-s) (unbound) (unbound))( +Attempt spelling correction on the current word. +) +tindex(undefined-key) +item(tt(undefined-key))( +This command is executed when a key sequence that is not bound to any +command is typed. By default it beeps. +) +tindex(undo) +item(tt(undo) (^_ ^Xu ^X^U) (unbound) (unbound))( +Incrementally undo the last text modification. +) +tindex(redo) +item(tt(redo))( +Incrementally redo undone text modifications. +) +tindex(vi-undo-change) +item(tt(vi-undo-change) (unbound) (u) (unbound))( +Undo the last text modification. +If repeated, redo the modification. +) +tindex(what-cursor-position) +item(tt(what-cursor-position) (^X=) (unbound) (unbound))( +Print the character under the cursor, its code as an octal, decimal and +hexadecimal number, the current cursor position within the buffer and the +column of the cursor in the current line. +) +tindex(where-is) +item(tt(where-is))( +Read the name of an editor command and and print the listing of key +sequences that invoke the specified command. +) +tindex(which-command) +item(tt(which-command) (ESC-?) (unbound) (unbound))( +Push the buffer onto the buffer stack, and execute the +command `tt(which-command) var(cmd)'. where var(cmd) is the current +command. tt(which-command) is normally aliased to var(whence). +) +tindex(vi-digit-or-beginning-of-line) +item(tt(vi-digit-or-beginning-of-line) (unbound) (0) (unbound))( +If the last command executed was a digit as part of an argument, +continue the argument. Otherwise, execute vi-beginning-of-line. +) +enditem() diff --git a/Doc/intro.ms b/Doc/intro.ms new file mode 100644 index 000000000..5024b9bfd --- /dev/null +++ b/Doc/intro.ms @@ -0,0 +1,2701 @@ +.nr PI 0 +.nr LL 6.5i +.de Ds +.DS I .5i +.ft C +.ps 9 +.vs 11 +.ss 11 +.. +.de De +.DE +.ft R +.ps +.vs +.ss +.. +.de Sh +.SH +\\$1 +.XS +\\$1 +.XE +.. +.nr HM 4i +.ce 99 +.ps 18 +.vs 20 +.ss 20 +\f3An Introduction to the Z Shell\fP + +.ps 14 +.vs 16 +.ss 16 +\f2Paul Falstad +pf@software.com + +Bas de Bakker +bas@phys.uva.nl\fP +.ce 0 +.nr HM 1i +.pn 1 +.bp +.\" This blank page on the reverse of the cover. +.sv |1i +.pn 1 +.bp +.TL +An Introduction to the Z Shell +.AU +Paul Falstad +pf@software.com +.AU +Bas de Bakker +bas@phys.uva.nl +.PP +.Sh "Introduction" +.PP +\fBzsh\fP is a shell designed for interactive use, although it is also +a powerful scripting language. Many of the useful features of bash, +ksh, and tcsh were incorporated into \fBzsh\fP; many original features were +added. This document details some of the unique features of \fBzsh\fP. It +assumes basic knowledge of the standard UNIX shells; the intent is to +show a reader already familiar with one of the other major shells what +makes \fBzsh\fP more useful or more powerful. This document is not at all +comprehensive; read the manual entry for a description of the shell +that is complete and concise, although somewhat overwhelming and +devoid of examples. +.PP +The text will frequently mention options that you can set to change +the behaviour of \fBzsh\fP. You can set these options with the +command +.Ds +%\0setopt\0\fIoptionname\fC +.De +and unset them again with +.Ds +%\0unsetopt\0\fIoptionname\fC +.De +Case is ignored in option names, as are embedded underscores. +.Sh "Filename Generation" +.PP +Otherwise known as \fIglobbing\fP, filename generation +is quite extensive in \fBzsh\fP. Of course, it has all the +basics: +.Ds +%\0ls +Makefile\0\0\0file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff +bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub +file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303 +%\0ls\0*.c +foo.c\0\0q.c +%\0ls\0*.[co] +bar.o\0\0\0foo.c\0\0\0foo.o\0\0\0main.o\0\0q.c +%\0ls\0foo.? +foo.c\0\0foo.o +%\0ls\0*.[^c] +bar.o\0\0\0file.h\0\0foo.o\0\0\0main.h\0\0main.o +%\0ls\0*.[^oh] +foo.c\0\0q.c +.De +Also, if the \fIEXTENDEDGLOB\fP option is set, +some new features are activated. +For example, the \fC^\fP character negates the pattern following it: +.Ds +%\0setopt\0extendedglob +%\0ls\0-d\0^*.c +Makefile\0\0\0file.pro\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run2\0\0\0\0\0\0\0run303 +bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run234\0\0\0\0\0stuff +file.h\0\0\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub +%\0ls\0-d\0^*.* +Makefile\0\0\0link\0\0\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run240\0\0\0\0\0stuff +foo\0\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run234\0\0\0\0\0run303\0\0\0\0\0sub +%\0ls\0-d\0^Makefile +bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub +file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303 +file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff +%\0ls\0-d\0*.^c +\&.rhosts\0\0\0bar.o\0\0\0\0\0file.h\0\0\0\0file.pro\0\0foo.o\0\0\0\0\0main.h\0\0\0\0main.o +.De +An expression of the form +\fC<\fIx\fR\-\fIy\fC>\fR +matches a range of integers: +.Ds +%\0ls\0run<200-300> +run234\0\0run240 +%\0ls\0run<300-400> +run303 +%\0ls\0run<-200> +run123\0\0run2 +%\0ls\0run<300-> +run303 +%\0ls\0run<> +run123\0\0run2\0\0\0\0run234\0\0run240\0\0run303 +.De +The \fINUMERICGLOBSORT\fP option will sort files with numbers +according to the number. This will not work with \fCls\fP as it +resorts its arguments: +.Ds +%\0setopt\0numericglobsort +%\0echo\0run<> +run2\0run123\0run234\0run240\0run303 +.De +Grouping is possible: +.Ds +%\0ls\0(foo|bar).* +bar.o\0\0foo.c\0\0foo.o +%\0ls\0*.(c|o|pro) +bar.o\0\0\0\0\0file.pro\0\0foo.c\0\0\0\0\0foo.o\0\0\0\0\0main.o\0\0\0\0q.c +.De +Also, the string \fC**/\fP forces a recursive search of +subdirectories: +.Ds +%\0ls\0-R +Makefile\0\0\0file.pro\0\0\0foo.o\0\0\0\0\0\0main.o\0\0\0\0\0q.c\0\0\0\0\0\0\0\0run234\0\0\0\0\0stuff +bar.o\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0link\0\0\0\0\0\0\0morestuff\0\0run123\0\0\0\0\0run240\0\0\0\0\0sub +file.h\0\0\0\0\0foo.c\0\0\0\0\0\0main.h\0\0\0\0\0pipe\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0run303 + +morestuff: + +stuff: +file\0\0xxx\0\0\0yyy + +stuff/xxx: +foobar + +stuff/yyy: +frobar +%\0ls\0**/*bar +stuff/xxx/foobar\0\0stuff/yyy/frobar +%\0ls\0**/f* +file.h\0\0\0\0\0\0\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0foo.o\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/xxx/foobar +file.pro\0\0\0\0\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/file\0\0\0\0\0\0\0\0stuff/yyy/frobar +%\0ls\0*bar* +bar.o +%\0ls\0**/*bar* +bar.o\0\0\0\0\0\0\0\0\0\0\0\0\0stuff/xxx/foobar\0\0stuff/yyy/frobar +%\0ls\0stuff/**/*bar* +stuff/xxx/foobar\0\0stuff/yyy/frobar +.De +.PP +It is possible to exclude certain files from the patterns using +the ~ character. A pattern of the form \fC*.c~bar.c\fP lists all +files matching \fC*.c\fP, except for the file \fCbar.c\fP. +.Ds +%\0ls\0*.c +foo.c\0\0\0\0foob.c\0\0\0\0bar.c +%\0ls\0*.c~bar.c +foo.c\0\0\0\0foob.c +%\0ls\0*.c~f* +bar.c +.De +.PP +One can add a number of \fIqualifiers\fP to the end of +any of these patterns, to restrict matches to certain +file types. A qualified pattern is of the form +.DS +\fIpattern\fC(\fR...\fC)\fR +.De +with single-character qualifiers inside the parentheses. +.Ds +%\0alias\0l='ls\0-dF' +%\0l\0* +Makefile\0\0\0\0foo*\0\0\0\0\0\0\0\0main.h\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run240 +bar.o\0\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.o\0\0\0\0\0\0run123\0\0\0\0\0\0run303 +file.h\0\0\0\0\0\0foo.o\0\0\0\0\0\0\0morestuff/\0\0run2\0\0\0\0\0\0\0\0stuff/ +file.pro\0\0\0\0link@\0\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0sub +%\0l\0*(/) +morestuff/\0\0stuff/ +%\0l\0*(@) +link@ +%\0l\0*(*) +foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/ +%\0l\0*(x) +foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/ +%\0l\0*(X) +foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/ +%\0l\0*(R) +bar.o\0\0\0\0\0\0\0foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0run123\0\0\0\0\0\0run240 +file.h\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.h\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0\0run303 +file.pro\0\0\0\0foo.o\0\0\0\0\0\0\0main.o\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0stuff/ +.De +Note that \fC*(x)\fP and \fC*(*)\fP both match executables. +\fC*(X)\fP matches files executable by others, as opposed to +\fC*(x)\fP, which matches files executable by the owner. +\fC*(R)\fP and \fC*(r)\fP match readable files; +\fC*(W)\fP and \fC*(w)\fP, which checks for writable files. +\fC*(W)\fP is especially important, since it checks for world-writable +files: +.Ds +%\0l\0*(w) +bar.o\0\0\0\0\0\0\0foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0run123\0\0\0\0\0\0run240 +file.h\0\0\0\0\0\0foo.c\0\0\0\0\0\0\0main.h\0\0\0\0\0\0pipe\0\0\0\0\0\0\0\0run2\0\0\0\0\0\0\0\0run303 +file.pro\0\0\0\0foo.o\0\0\0\0\0\0\0main.o\0\0\0\0\0\0q.c\0\0\0\0\0\0\0\0\0run234\0\0\0\0\0\0stuff/ +%\0l\0*(W) +link@\0\0\0run240 +%\0l\0-l\0link\0run240 +lrwxrwxrwx\0\01\0pfalstad\0\0\0\0\0\0\010\0May\023\018:12\0link\0->\0/usr/bin/ +-rw-rw-rw-\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\023\018:12\0run240 +.De +If you want to have all the files of a certain type as well as all +symbolic links pointing to files of that type, prefix the qualifier +with a \fC-\fP: +.Ds +%\0l\0*(-/) +link@\0\0\0\0\0\0\0morestuff/\0\0stuff/ +.De +You can filter out the symbolic links with the \fC^\fP character: +.Ds +%\0l\0*(W^@) +run240 +%\0l\0*(x) +foo*\0\0\0\0\0\0\0\0link@\0\0\0\0\0\0\0morestuff/\0\0stuff/ +%\0l\0*(x^@/) +foo* +.De +To find all plain files, you can use \fC.\fP: +.Ds +%\0l\0*(.) +Makefile\0\0file.h\0\0\0\0foo*\0\0\0\0\0\0foo.o\0\0\0\0\0main.o\0\0\0\0run123\0\0\0\0run234\0\0\0\0run303 +bar.o\0\0\0\0\0file.pro\0\0foo.c\0\0\0\0\0main.h\0\0\0\0q.c\0\0\0\0\0\0\0run2\0\0\0\0\0\0run240\0\0\0\0sub +%\0l\0*(^.) +link@\0\0\0\0\0\0\0morestuff/\0\0pipe\0\0\0\0\0\0\0\0stuff/ +%\0l\0s*(.) +stuff/\0\0\0sub +%\0l\0*(p) +pipe +%\0l\0-l\0*(p) +prw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\023\018:12\0pipe +.De +\fC*(U)\fP matches all files owned by you. +To search for all files not owned by you, use \fC*(^U)\fP: +.Ds +%\0l\0-l\0*(^U) +-rw-------\0\01\0subbarao\0\0\0\0\0\0\029\0May\023\018:13\0sub +.De +This searches for setuid files: +.Ds +%\0l\0-l\0*(s) +-rwsr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\016\0May\023\018:12\0foo* +.De +This checks for a certain user's files: +.Ds +%\0l\0-l\0*(u[subbarao]) +-rw-------\0\01\0subbarao\0\0\0\0\0\0\029\0May\023\018:13\0sub +.De +.Sh "Startup Files" +.PP +There are five startup files that \fBzsh\fP will read commands from: +.Ds +$ZDOTDIR/.zshenv +$ZDOTDIR/.zprofile +$ZDOTDIR/.zshrc +$ZDOTDIR/.zlogin +$ZDOTDIR/.zlogout +.De +If \fBZDOTDIR\fP is not set, then the value of \fBHOME\fP is used; +this is the usual case. +.\".KE <--- missing .KS or .KF above +.PP +\&\fC.zshenv\fP is sourced on all invocations of the shell, +unless the \fC-f\fP option is set. It should contain commands to set +the command search path, plus other important environment +variables. +\&\fC.zshenv\fP should not contain commands that produce output +or assume the shell is attached to a tty. +.PP +\&\fC.zshrc\fP is sourced in interactive shells. It should contain +commands to set up aliases, functions, options, key bindings, etc. +.PP +\&\fC.zlogin\fP is sourced in login shells. It should contain +commands that should be executed only in login shells. +\&\fC.zlogout\fP is sourced when login shells exit. +\&\fC.zprofile\fP is similar to \fC.zlogin\fP, except that it is sourced before +\&\fC.zshrc\fP. +\&\fC.zprofile\fP is meant as an alternative to \fC.zlogin\fP for +ksh fans; +the two are not intended to be used together, although this +could certainly be done if desired. +\&\fC.zlogin\fP is not the place for alias definitions, options, environment +variable settings, etc.; +as a general rule, it should not change the shell environment +at all. Rather, it should be used to set the terminal type +and run a series of external commands (\fCfortune\fP, \fCmsgs\fP, etc). +.Sh "Shell Functions" +.PP +\fBzsh\fP also allows you to create your own commands by defining shell +functions. For example: +.Ds +%\0yp\0()\0{ +>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname +>\0} +%\0yp\0pfalstad +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +.De +This function looks up a user in the NIS password map. +The \fC$1\fP expands to the first argument to \fCyp\fP. +The function could have been equivalently defined in one of the following +ways: +.Ds +%\0function\0yp\0{ +>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname +>\0} +%\0function\0yp\0()\0{ +>\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname +>\0} +%\0function\0yp\0()\0ypmatch\0$1\0passwd.byname +.De +Note that aliases are expanded when the function definition is +parsed, not when the function is executed. For example: +.Ds +%\0alias\0ypmatch=echo +%\0yp\0pfalstad +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +.De +Since the alias was defined after the function was parsed, it has +no effect on the function's execution. +However, if we define the function again with the alias in place: +.Ds +%\0function\0yp\0()\0{\0ypmatch\0$1\0passwd.byname\0} +%\0yp\0pfalstad +pfalstad\0passwd.byname +.De +it is parsed with the new alias definition in place. +Therefore, in general you must define aliases before functions. +.\".KE <--- missing .KS or .KF above +.PP +We can make the function take multiple arguments: +.Ds +%\0unalias\0ypmatch +%\0yp\0()\0{ +>\0\0\0\0\0\0\0for\0i +>\0\0\0\0\0\0\0do\0ypmatch\0$i\0passwd.byname +>\0\0\0\0\0\0\0done +>\0} +%\0yp\0pfalstad\0subbarao\0sukthnkr +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +subbarao:*:3338:35:Kartik\0Subbarao:/u/subbarao:/usr/princeton/bin/zsh +sukthnkr:*:1267:35:Rahul\0Sukthankar:/u/sukthnkr:/usr/princeton/bin/tcsh +.De +The \fCfor i\fP loops through each of the function's arguments, +setting \fCi\fP equal to each of them in turn. +We can also make the function do something sensible +if no arguments are given: +.Ds +%\0yp\0()\0{ +>\0\0\0\0\0\0\0if\0((\0$#\0==\00\0)) +>\0\0\0\0\0\0\0then\0echo\0usage:\0yp\0name\0...;\0fi +>\0\0\0\0\0\0\0for\0i;\0do\0ypmatch\0$i\0passwd.byname;\0done +>\0} +%\0yp +usage:\0yp\0name\0... +%\0yp\0pfalstad\0sukthnkr +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +sukthnkr:*:1267:35:Rahul\0Sukthankar:/u/sukthnkr:/usr/princeton/bin/tcsh +.De +\fC$#\fP is the number of arguments supplied to the function. +If it is equal to zero, we print a usage message; otherwise, +we loop through the arguments, and \fCypmatch\fP all of them. +.\".KE <--- missing .KS or .KF above +.PP +Here's a function that selects a random line from a file: +.Ds +%\0randline\0()\0{ +>\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1) +>\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1 +>\0} +%\0randline\0/etc/motd +PHOENIX\0WILL\0BE\0DOWN\0briefly\0Friday\0morning,\05/24/91\0from\08\0AM\0to +%\0randline\0/etc/motd +SunOS\0Release\04.1.1\0(PHOENIX)\0#19:\0Tue\0May\014\019:03:15\0EDT\01991 +%\0randline\0/etc/motd +|\0Please\0use\0the\0"msgs"\0command\0to\0read\0announcements.\0\0Refer\0to\0the\0\0\0| +%\0echo\0$z + +% +.De +\fCrandline\fP has a local variable, \fCz\fP, that holds the number of +lines in the file. \fC$[RANDOM % z + 1]\fP expands to a random number +between 1 and \fCz\fP. An expression of the form \fC$[\fR...\fC]\fR +expands to the value of the arithmetic expression within the brackets, +and the \fBRANDOM\fP variable returns a random number each time it +is referenced. \fC%\fP is the modulus operator, as in C. +Therefore, \fCsed -n $[RANDOM%z+1]p\fP picks a random line from its +input, from 1 to \fCz\fP. +.PP +Function definitions can be viewed with the \fCfunctions\fP builtin: +.Ds +%\0functions\0randline +randline\0()\0{ +\0\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1) +\0\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1 + +} +%\0functions +yp\0()\0{ +\0\0\0\0\0\0\0\0if\0let\0$#\0==\00\0 +\0\0\0\0\0\0\0\0 +\0\0\0\0\0\0\0\0then +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0echo\0usage:\0yp\0name\0... +\0\0\0\0\0\0\0\0 +\0\0\0\0\0\0\0\0fi +\0\0\0\0\0\0\0\0for\0i +\0\0\0\0\0\0\0\0do +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0ypmatch\0$i\0passwd.byname +\0\0\0\0\0\0\0\0 +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0done + +} +randline\0()\0{ +\0\0\0\0\0\0\0\0integer\0z=$(wc\0-l\0<$1) +\0\0\0\0\0\0\0\0sed\0-n\0$[RANDOM\0%\0z\0+\01]p\0$1 + +} +.De +Here's another one: +.Ds +%\0cx\0()\0{\0chmod\0+x\0$*\0} +%\0ls\0-l\0foo\0bar +-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar +-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo +%\0cx\0foo\0bar +%\0ls\0-l\0foo\0bar +-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar +-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo +.De +Note that this could also have been implemented as an alias: +.Ds +%\0chmod\0644\0foo\0bar +%\0alias\0cx='chmod\0+x' +%\0cx\0foo\0bar +%\0ls\0-l\0foo\0bar +-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0bar +-rwxr-xr-x\0\01\0pfalstad\0\0\0\0\0\0\029\0May\024\004:38\0foo +.De +.PP +Instead of defining a lot of functions in your \fC.zshrc\fP, +all of which you may not use, +it is often better to use the \fCautoload\fP builtin. +The idea is, you create a directory where function +definitions are stored, declare the names in +your \fC.zshrc\fP, and tell the shell where to look for them. +Whenever you reference a function, the shell +will automatically load it into memory. +.Ds +%\0mkdir\0/tmp/funs +%\0cat\0>/tmp/funs/yp +ypmatch\0$1\0passwd.byname +^D +%\0cat\0>/tmp/funs/cx +chmod\0+x\0$* +^D +%\0FPATH=/tmp/funs +%\0autoload\0cx\0yp +%\0functions\0cx\0yp +undefined\0cx\0() +undefined\0yp\0() +%\0chmod\0755\0/tmp/funs/{cx,yp} +%\0yp\0egsirer +egsirer:*:3214:35:Emin\0Gun\0Sirer:/u/egsirer:/bin/sh +%\0functions\0yp +yp\0()\0{ +\0\0\0\0\0\0\0\0ypmatch\0$1\0passwd.byname +} +.De +This idea has other benefits. By adding a \fC#!\fP header +to the files, you can make them double as shell scripts. +(Although it is faster to use them as functions, since a +separate process is not created.) +.Ds +%\0ed\0/tmp/funs/yp +25 +i +#!\0/usr/local/bin/zsh +. +w +42 +q +%\0\0cd\0src +~/src> +.De +the shell will print the current directory in the prompt, +using the \fC~\fP character. +However, \fBzsh\fP is smarter than most other shells in this respect: +.Ds +~/src>\0cd\0~subbarao +~subbarao>\0cd\0~maruchck +~maruchck>\0cd\0lib +~maruchck/lib>\0cd\0fun +~maruchck/lib/fun>\0foo=/usr/princeton/common/src +~maruchck/lib/fun>\0cd\0~foo +~foo>\0cd\0.. +/usr/princeton/common>\0cd\0src +~foo>\0cd\0news/nntp +~foo/news/nntp>\0cd\0inews +~foo/news/nntp/inews> +.De +Note that \fBzsh\fP prints \fIother\fP users' directories +in the form \fC~user\fP. Also note that you can +set a parameter and use it as a directory name; +\fBzsh\fP will act as if \fCfoo\fP is a user +with the login directory \fC/usr/princeton/common/src\fP. +This is convenient, especially if you're sick of seeing +prompts like this: +.Ds +phoenix:/usr/princeton/common/src/X.V11R4/contrib/clients/xv/docs> +.De +If you get stuck in this position, you can give the current +directory a short name, like this: +.Ds +/usr/princeton/common/src/news/nntp/inews>\0inews=$PWD +/usr/princeton/common/src/news/nntp/inews>\0echo\0~inews +/usr/princeton/common/src/news/nntp/inews +~inews> +.De +When you reference a directory in the form \fC~inews\fP, +the shell assumes that you want the directory displayed +in this form; thus simply typing \fCecho ~inews\fP or +\fCcd ~inews\fP causes the prompt to be shortened. +You can define a shell function for this purpose: +.Ds +~inews>\0namedir\0()\0{\0$1=$PWD\0;\0\0:\0~$1\0} +~inews>\0cd\0/usr/princeton/bin +/usr/princeton/bin>\0namedir\0pbin +~pbin>\0cd\0/var/spool/mail +/var/spool/mail>\0namedir\0spool +~spool>\0cd\0.msgs +~spool/.msgs> +.De +You may want to add this one-line function to your \fC.zshrc\fP. + +\fBzsh\fP can also put the current directory in your title bar, +if you are using a windowing system. +One way to do this is with the \fCchpwd\fP function, which is +automatically executed by the shell whenever you change +directory. If you are using xterm, this will work: +.Ds +chpwd\0()\0{\0print\0-Pn\0'^[]2;%~^G'\0} +.De +The \fC-P\fP option tells \fCprint\fP to treat its arguments like a prompt +string; otherwise the \fC%~\fP would not be expanded. +The \fC-n\fP option suppresses the terminating newline, as with \fCecho\fP. +.PP +If you are using an IRIS \fCwsh\fP, do this: +.Ds +chpwd\0()\0{\0print\0-Pn\0'\e2201.y%~\e234'\0} +.De +The \fCprint -D\fP command has other uses. For example, to +print the current directory to standard output in short form, +you can do this: +.Ds +%\0print\0-D\0$PWD +~subbarao/src +.De +and to print each component of the path in short form: +.Ds +%\0print\0-D\0$path +/bin\0/usr/bin\0~locbin\0~locbin/X11\0~/bin +.De +.Sh "Directory Stacks" +.PP +If you use csh, you may know about directory stacks. +The \fCpushd\fP command puts the current directory on the +stack, and changes to a new directory; the \fCpopd\fP command +pops a directory off the stack and changes to it. +.Ds +phoenix%\0cd\0 +phoenix%\0PROMPT='Z\0%~>\0' +Z\0~>\0pushd\0/tmp +/tmp\0~ +Z\0/tmp>\0pushd\0/usr/etc +/usr/etc\0/tmp\0~ +Z\0/usr/etc>\0pushd\0/usr/bin +/usr/bin\0/usr/etc\0/tmp\0~ +Z\0/usr/bin>\0popd +/usr/etc\0/tmp\0~ +Z\0/usr/etc>\0popd +/tmp\0~ +Z\0/tmp>\0pushd\0/etc +/etc\0/tmp\0~ +Z\0/etc>\0popd\0 +/tmp\0~ +.De +\fBzsh\fP's directory stack commands work similarly. One +difference is the way \fCpushd\fP is handled if no arguments +are given. As in csh, this exchanges the top two elements +of the directory stack: +.Ds +Z\0/tmp>\0dirs +/tmp\0~ +Z\0/tmp>\0pushd +~\0/tmp +.De +unless the stack only has one entry: +.Ds +Z\0~>\0popd +/tmp +Z\0/tmp>\0dirs +/tmp +Z\0/tmp>\0pushd +~\0/tmp +Z\0~> +.De +or unless the \fIPUSHDTOHOME\fP option is set: +.Ds +Z\0~>\0setopt\0pushdtohome +Z\0~>\0pushd +~\0~\0/tmp +.De +.PP +As an alternative to using directory stacks in this manner, +we can get something like a \fIdirectory history\fP +by setting a few more options and parameters: +.Ds +~>\0DIRSTACKSIZE=8 +~>\0setopt\0autopushd\0pushdminus\0pushdsilent\0pushdtohome +~>\0alias\0dh='dirs\0-v' +~>\0cd\0/tmp +/tmp>\0cd\0/usr +/usr>\0cd\0bin +/usr/bin>\0cd\0../pub +/usr/pub>\0dh +0\0\0\0\0\0\0\0/usr/pub +1\0\0\0\0\0\0\0/usr/bin +2\0\0\0\0\0\0\0/usr +3\0\0\0\0\0\0\0/tmp +4\0\0\0\0\0\0\0~ +/usr/pub>\0cd\0-3 +/tmp>\0dh +0\0\0\0\0\0\0\0/tmp +1\0\0\0\0\0\0\0/usr/pub +2\0\0\0\0\0\0\0/usr/bin +3\0\0\0\0\0\0\0/usr +4\0\0\0\0\0\0\0~ +/tmp>\0ls\0=2/df +/usr/bin/df +/tmp>\0cd\0-4 +~> +.De +Note that \fC=2\fP expanded to the second directory in the +history list, and that \fCcd -3\fP recalled the third +directory in the list. +.PP +You may be wondering what all those options do. +\fIAUTOPUSHD\fP made \fCcd\fP act like \fCpushd\fP. +(\fCalias cd=pushd\fP is not sufficient, for various reasons.) +\fIPUSHDMINUS\fP swapped the meaning of \fCcd +1\fP and +\fCcd -1\fP; we want them to mean the opposite of what they mean in csh, +because it makes more sense in this scheme, and it's easier to type: +.Ds +~>\0dh +0\0\0\0\0\0\0\0~ +1\0\0\0\0\0\0\0/tmp +2\0\0\0\0\0\0\0/usr/pub +3\0\0\0\0\0\0\0/usr/bin +4\0\0\0\0\0\0\0/usr +~>\0unsetopt\0pushdminus +~>\0cd\0+1 +/tmp>\0dh +0\0\0\0\0\0\0\0/tmp +1\0\0\0\0\0\0\0~ +2\0\0\0\0\0\0\0/usr/pub +3\0\0\0\0\0\0\0/usr/bin +4\0\0\0\0\0\0\0/usr +/tmp>\0cd\0+2 +/usr/pub> +.De +\fIPUSHDSILENT\fP keeps the shell from printing +the directory stack each time we do a \fCcd\fP, +and \fIPUSHDTOHOME\fP we mentioned earlier: +.Ds +/usr/pub>\0unsetopt\0pushdsilent +/usr/pub>\0cd\0/etc +/etc\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr +/etc>\0cd +~\0/etc\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr +~>\0unsetopt\0pushdtohome +~>\0cd +/etc\0~\0/usr/pub\0/tmp\0~\0/usr/bin\0/usr +/etc> +.De +\fBDIRSTACKSIZE\fP keeps the directory stack +from getting too large, much like \fIHISTSIZE\fP: +.Ds +/etc>\0setopt\0pushdsilent +/etc>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0cd\0/ +/>\0dh +0\0\0\0\0\0\0\0/ +1\0\0\0\0\0\0\0/ +2\0\0\0\0\0\0\0/ +3\0\0\0\0\0\0\0/ +4\0\0\0\0\0\0\0/ +5\0\0\0\0\0\0\0/ +6\0\0\0\0\0\0\0/ +7\0\0\0\0\0\0\0/ +.De +.Sh "Command/Process Substitution" +.PP +Command substitution in \fBzsh\fP can take two forms. +In the traditional form, a command enclosed in +backquotes (\fC`\fP...\fC`\fP) is replaced on the command line with its output. +This is the form used by the older shells. +Newer shells (like \fBzsh\fP) also provide another form, +\fC$(\fR...\fC)\fR. This form is much easier to nest. +.Ds +%\0ls\0-l\0`echo\0/vmunix` +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0/vmunix +%\0ls\0-l\0$(echo\0/vmunix) +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0/vmunix +%\0who\0|\0grep\0mad +subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince) +pfalstad\0ttyu1\0\0\0May\023\016:25\0\0\0(mad55sx14.Prince) +subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince) +pfalstad\0ttyv3\0\0\0May\023\016:25\0\0\0(mad55sx14.Prince) +%\0who\0|\0grep\0mad\0|\0awk\0'{print\0$2}' +ttyt7 +ttyu1 +ttyu6 +ttyv3 +%\0cd\0/dev;\0ls\0-l\0$(who\0| +>\0grep\0$(echo\0mad)\0| +>\0awk\0'{\0print\0$2\0}') +crwx-w----\0\01\0subbarao\0\020,\0\071\0May\023\018:35\0ttyt7 +crw--w----\0\01\0pfalstad\0\020,\0\081\0May\023\018:42\0ttyu1 +crwx-w----\0\01\0subbarao\0\020,\0\086\0May\023\018:38\0ttyu6 +crw--w----\0\01\0pfalstad\0\020,\0\099\0May\023\018:41\0ttyv3 +.De +Many common uses of command substitution, however, are +superseded by other mechanisms of \fBzsh\fP: +.Ds +%\0ls\0-l\0`tty` +crw-rw-rw-\0\01\0root\0\0\0\0\0\020,\0\028\0May\023\018:35\0/dev/ttyqc +%\0ls\0-l\0$TTY +crw-rw-rw-\0\01\0root\0\0\0\0\0\020,\0\028\0May\023\018:35\0/dev/ttyqc +%\0ls\0-l\0`which\0rn` +-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0172032\0Mar\0\06\018:40\0/usr/princeton/bin/rn +%\0ls\0-l\0=rn +-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0172032\0Mar\0\06\018:40\0/usr/princeton/bin/rn +.De +A command name with a \fC=\fP prepended is replaced with its full +pathname. This can be very convenient. If it's not convenient +for you, you can turn it off: +.Ds +%\0ls +=foo\0\0\0\0=bar +%\0ls\0=foo\0=bar +zsh:\0foo\0not\0found +%\0setopt\0noequals +%\0ls\0=foo\0=bar +=foo\0\0\0\0=bar +.De +.PP +Another nice feature is process substitution: +.Ds +%\0who\0|\0fgrep\0-f\0=(print\0-l\0root\0lemke\0shgchan\0subbarao) +root\0\0\0\0\0console\0May\019\010:41 +lemke\0\0\0\0ttyq0\0\0\0May\022\010:05\0\0\0(narnia:0.0) +lemke\0\0\0\0ttyr7\0\0\0May\022\010:05\0\0\0(narnia:0.0) +lemke\0\0\0\0ttyrd\0\0\0May\022\010:05\0\0\0(narnia:0.0) +shgchan\0\0ttys1\0\0\0May\023\016:52\0\0\0(gaudi.Princeton.) +subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince) +subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince) +shgchan\0\0ttyvb\0\0\0May\023\016:51\0\0\0(gaudi.Princeton.) +.De +A command of the form \fC=(\fR...\fC)\fR is replaced with the name of a \fIfile\fP +containing its output. (A command substitution, on the other +hand, is replaced with the output itself.) +\fCprint -l\fP is like \fCecho\fP, excepts that it prints its arguments +one per line, the way \fCfgrep\fP expects them: +.Ds +%\0print\0-l\0foo\0bar +foo +bar +.De +We could also have written: +.Ds +%\0who\0|\0fgrep\0-f\0=(echo\0'root +>\0lemke +>\0shgchan +>\0subbarao') +.De +Using\0process\0substitution, +you\0can\0edit\0the\0output\0of\0a\0command: +.Ds +%\0ed\0=(who\0|\0fgrep\0-f\0~/.friends) +355 +g/lemke/d +w\0/tmp/filbar +226 +q +%\0cat\0/tmp/filbar +root\0\0\0\0\0console\0May\019\010:41 +shgchan\0\0ttys1\0\0\0May\023\016:52\0\0\0(gaudi.Princeton.) +subbarao\0ttyt7\0\0\0May\023\015:02\0\0\0(mad55sx15.Prince) +subbarao\0ttyu6\0\0\0May\023\015:04\0\0\0(mad55sx15.Prince) +shgchan\0\0ttyvb\0\0\0May\023\016:51\0\0\0(gaudi.Princeton.) +.De +or easily read archived mail: +.Ds +%\0mail\0-f\0=(zcat\0~/mail/oldzshmail.Z) +"/tmp/zsha06024":\084\0messages,\00\0new,\043\0unread +>\0\01\0\0U\0\0TO:\0pfalstad,\0zsh\0(10) +\0\0\02\0\0U\0\0nytim!tim@uunet.uu.net,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3 +\0\0\03\0\0U\0\0JAM%TPN@utrcgw.utc.com,\0zsh\0fix\0(15) +\0\0\04\0\0U\0\0djm@eng.umd.edu,\0way\0to\0find\0out\0if\0running\0zsh?\0(25) +\0\0\05\0\0U\0\0djm@eng.umd.edu,\0Re:\0way\0to\0find\0out\0if\0running\0zsh?\0(17) +\0\0\06\0\0\0r\0djm@eng.umd.edu,\0Meta\0.\0(18) +\0\0\07\0\0U\0\0jack@cs.glasgow.ac.uk,\0Re:\0problem\0building\0zsh\0(147) +\0\0\08\0\0U\0\0nytim!tim@uunet.uu.net,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3 +\0\0\09\0\0\0\0\0ursa!jmd,\0Another\0fix...\0(61) +\0\010\0\0U\0\0pplacewa@bbn.com,\0Re:\0v18i084:\0Zsh\02.00\0-\0A\0small\0complaint\0(36) +\0\011\0\0U\0\0lubkin@cs.rochester.edu,\0POSIX\0job\0control\0(34) +\0\012\0\0U\0\0yale!bronson!tan@uunet.UU.NET +\0\013\0\0U\0\0brett@rpi.edu,\0zsh\0(36) +\0\014\0\0S\0\0subbarao,\0zsh\0sucks!!!!\0(286) +\0\015\0\0U\0\0snibru!d241s008!d241s013!ala@relay.EU.net,\0zsh\0(165) +\0\016\0\0U\0\0nytim!tim@uunet.UU.NET,\0Re:\0Zsh\0on\0Sparc1\0/SunOS\04.0.3 +\0\017\0\0U\0\0subbarao,\0zsh\0is\0a\0junk\0shell\0(43) +\0\018\0\0U\0\0amaranth@vela.acs.oakland.edu,\0zsh\0(33) +43u/84\01:\0x +%\0ls\0-l\0/tmp/zsha06024 +/tmp/zsha06024\0not\0found +.De +Note that the shell creates a temporary file, and deletes it +when the command is finished. +.Ds +%\0diff\0=(ls)\0=(ls\0-F) +3c3 +<\0fortune +--- +>\0fortune* +10c10 +<\0strfile +--- +>\0strfile* +.De +If you read \fBzsh\fP's man page, you may notice that \fC<(\fR...\fC)\fR +is another form of process substitution which is similar to +\fC=(\fR...\fC)\fR. +There is an important difference between the two. +In the \fC<(\fR...\fC)\fR case, the shell creates a named pipe (FIFO) +instead of a file. This is better, since it does not +fill up the file system; but it does not work in all cases. +In fact, if we had replaced \fC=(\fR...\fC)\fR with \fC<(\fR...\fC)\fR in +the examples above, all of them would have stopped working +except for \fCfgrep -f <(\fR...\fC)\fR. +You can not edit a pipe, or open it as a mail folder; +\fCfgrep\fP, however, has no problem with reading +a list of words from a pipe. +You may wonder why \fCdiff <(foo) bar\fP doesn't work, since +\fCfoo | diff - bar\fP works; this is because \fCdiff\fP creates +a temporary file if it notices that one of its arguments +is \fC-\fP, and then copies its standard input to the temporary +file. +.PP +\fC>(\fR...\fC)\fR is just like \fC<(\fR...\fC)\fR except that the +command between the parentheses will get its input from the named +pipe. +.Ds +%\0dvips\0-o\0>(lpr)\0zsh.dvi +.De +.Sh "Redirection" +.PP +Apart from all the regular redirections like the Bourne shell has, +\fBzsh\fP can do more. You can send the output of a command to more +than one file, by specifying more redirections like +.Ds +%\0echo\0Hello\0World\0>file1\0>file2 +.De +and the text will end up in both files. Similarly, you can send the +output to a file and into a pipe: +.Ds +%\0make\0>\0make.log\0|\0grep\0Error +.De +The same goes for input. You can make the input of a command come +from more than one file. +.Ds +%\0sort\0 >(\fR...\fC)\fR. +.Ds +%\0find\0/\0-name\0games\02>\0>(grep\0-v\0'Permission'\0>\0realerrors) +.De +The above redirection will actually be implemented with a regular +pipe, not a temporary named pipe. +.Sh "Aliasing" +.PP +Often-used commands can be abbreviated with an alias: +.Ds +%\0alias\0uc=uncompress +%\0ls +hanoi.Z +%\0uc\0hanoi +%\0ls +hanoi +.De +or commands with certain desired options: +.Ds +%\0alias\0fm='finger\0-m' +%\0fm\0root +Login\0name:\0root\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0In\0real\0life:\0Operator +Directory:\0/\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Shell:\0/bin/csh +On\0since\0May\019\010:41:15\0on\0console\0\0\0\0\03\0days\05\0hours\0Idle\0Time +No\0unread\0mail +No\0Plan. + +%\0alias\0lock='lock\0-p\0-60000' +%\0lock +lock:\0/dev/ttyr4\0on\0phoenix.\0timeout\0in\060000\0minutes +time\0now\0is\0Fri\0May\024\004:23:18\0EDT\01991 +Key:\0 + +%\0alias\0l='ls\0-AF' +%\0l\0/ +\&.bash_history\0\0\0\0\0\0\0\0\0\0\0\0\0\0kadb* +\&.bashrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0lib@ +\&.cshrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0licensed/ +\&.exrc\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0lost+found/ +\&.login\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0macsyma +\&\fR... +.De +Aliases can also be used to replace old commands: +.Ds +%\0alias\0grep=egrep\0ps=sps\0make=gmake +%\0alias\0whoami='echo\0root' +%\0whoami +root +.De +or to define new ones: +.Ds +%\0cd\0/ +%\0alias\0sz='ls\0-l\0|\0sort\0-n\0+3\0|\0tail\0-10' +%\0sz +drwxr-sr-x\0\07\0bin\0\0\0\0\0\0\0\0\0\03072\0May\023\011:59\0etc +drwxrwxrwx\026\0root\0\0\0\0\0\0\0\0\05120\0May\024\004:20\0tmp +drwxr-xr-x\0\02\0root\0\0\0\0\0\0\0\0\08192\0Dec\026\019:34\0lost+found +drwxr-sr-x\0\02\0bin\0\0\0\0\0\0\0\0\014848\0May\023\018:48\0dev +-r--r--r--\0\01\0root\0\0\0\0\0\0\0140520\0Dec\026\020:08\0boot +-rwxr-xr-x\0\01\0root\0\0\0\0\0\0\0311172\0Dec\026\020:08\0kadb +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209695\0Apr\016\015:33\0vmunix.old +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209702\0May\014\019:04\0vmunix +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01209758\0May\021\012:23\0vmunix.new.kernelmap.old +-rwxr-xr-x\0\01\0root\0\0\0\0\0\01711848\0Dec\026\020:08\0vmunix.org +%\0cd +%\0alias\0rable='ls\0-AFtrd\0*(R)'\0nrable='ls\0-AFtrd\0*(^R)' +%\0rable +README\0\0\0\0\0\0func/\0\0\0\0\0\0\0bin/\0\0\0\0\0\0\0\0pub/\0\0\0\0\0\0\0\0News/\0\0\0\0\0\0\0src/ +nicecolors\0\0etc/\0\0\0\0\0\0\0\0scr/\0\0\0\0\0\0\0\0tmp/\0\0\0\0\0\0\0\0iris/\0\0\0\0\0\0\0zsh* +%\0nrable +Mailboxes/\0\0mail/\0\0\0\0\0\0\0notes +.De +(The pattern \fC*(R)\fP matches all readable files in the current +directory, and \fC*(^R)\fP matches all unreadable files.) +.PP +Most other shells have aliases of this kind (\fIcommand\fP aliases). +However, \fBzsh\fP also has \fIglobal\fP aliases, which are substituted +anywhere on a line. +Global aliases can be used to abbreviate frequently-typed +usernames, hostnames, etc. +.Ds +%\0alias\0-g\0me=pfalstad\0gun=egsirer\0mjm=maruchck +%\0who\0|\0grep\0me +pfalstad\0ttyp0\0\0\0May\024\003:39\0\0\0(mickey.Princeton) +pfalstad\0ttyp5\0\0\0May\024\003:42\0\0\0(mickey.Princeton) +%\0fm\0gun +Login\0name:\0egsirer\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0In\0real\0life:\0Emin\0Gun\0Sirer +Directory:\0/u/egsirer\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Shell:\0/bin/sh +Last\0login\0Thu\0May\023\019:05\0on\0ttyq3\0from\0bow.Princeton.ED +New\0mail\0received\0Fri\0May\024\002:30:28\01991; +\0\0unread\0since\0Fri\0May\024\002:30:27\01991 +%\0alias\0-g\0phx=phoenix.princeton.edu\0warc=wuarchive.wustl.edu +%\0ftp\0warc +Connected\0to\0wuarchive.wustl.edu. +.De +Here are some more interesting uses. +.Ds +%\0alias\0-g\0M='|\0more'\0GF='|\0fgrep\0-f\0~/.friends' +%\0who\0M\0\0\0#\0\fIpipes\0the\0output\0of\0\fCwho\fI\0through\0\fCmore +%\0who\0GF\0\0#\0\fIsee\0if\0your\0friends\0are\0on\fC +%\0w\0GF\0\0\0\0#\0\fIsee\0what\0your\0friends\0are\0doing +.De +Another example makes use of \fBzsh\fP's process substitution. +If you run NIS, and you miss being able to do this: +.Ds +%\0grep\0pfalstad\0/etc/passwd +.De +you can define an alias that will seem more natural +than \fCypmatch pfalstad passwd\fP: +.Ds +%\0alias\0-g\0PASS='<(ypcat\0passwd)' +%\0grep\0pfalstad\0PASS +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +.De +If you're really crazy, you can even call it \fC/etc/passwd\fP: +.Ds +%\0alias\0-g\0/etc/passwd='<(ypcat\0passwd)' +%\0grep\0pfalstad\0/etc/passwd +pfalstad:*:3564:35:Paul\0John\0Falstad:/u/pfalstad:/usr/princeton/bin/zsh +.De +The last example shows one of the perils of global aliases; +they have a lot of potential to cause confusion. +For example, if you defined a global alias called \fC|\fP (which is +possible), \fBzsh\fP would begin to act very strangely; every pipe +symbol would be replaced with the text of your alias. +To some extent, global aliases are like macros in C; +discretion is advised in using them and in choosing names for them. +Using names in all caps is not a bad idea, especially +for aliases which introduce shell metasyntax (like \fCM\fP and \fCGF\fP +above). +.PP +Note that \fBzsh\fP aliases are not like csh aliases. The syntax for +defining them is different, and they do not have arguments. +All your favorite csh aliases will probably not work under \fBzsh\fP. +For example, if you try: +.Ds +alias\0rm\0mv\0'\e!*\0/tmp/wastebasket' +.De +no aliases will be defined, but \fBzsh\fP will not report an error. +In csh, this line defines an alias that makes \fCrm\fP safe---files +that are \fCrm\fP'd will be moved to a temporary directory instead of +instantly destroyed. In \fBzsh\fP's syntax, however, this line asks +the shell to print any existing alias definitions for \fCrm\fP, +\fCmv\fP, or \fC!*\ /tmp/wastebasket\fP. Since there are none, most +likely, the shell will not print anything, although \fCalias\fP will +return a nonzero exit code. The proper syntax is this: +.Ds +alias\0rm='mv\0\e!*\0/tmp/wastebasket' +.De +However, this won't work either: +.Ds +%\0rm\0foo.dvi +zsh:\0no\0matches\0found:\0!* +.De +While this makes \fCrm\fP safe, it is certainly not what the user +intended. In \fBzsh\fP, you must use a shell function for this: +.Ds +%\0unalias\0rm +%\0rm\0()\0{\0mv\0$*\0/tmp/wastebasket\0} +%\0rm\0foo.dvi +%\0ls\0/tmp/wastebasket +foo.dvi +.De +While this is much cleaner and easier to read (I hope you will +agree), it is not csh-compatible. Therefore, a script to convert +csh aliases and variables has been provided. You should only need to use it +once, to convert all your csh aliases and parameters to \fBzsh\fP format: +.Ds +%\0csh +csh>\0alias +l\0\0\0\0\0\0\0ls\0-AF +more\0\0\0\0less +on\0\0\0\0\0\0last\0-2\0!:1\0;\0who\0|\0grep\0!:1 +csh>\0exit +%\0c2z\0>neat_zsh_aliases +%\0cat\0neat_zsh_aliases +alias\0l='ls\0-AF' +alias\0more='less' +on\0()\0{\0last\0-2\0$1\0;\0who\0|\0grep\0$1\0} +\&... +.De +The first two aliases were converted to regular \fBzsh\fP aliases, while +the third, since it needed to handle arguments, was converted to +a function. \fCc2z\fP can convert most aliases to \fBzsh\fP format without +any problems. However, if you're using some really arcane csh tricks, +or if you have an alias with a name like \fCdo\fP (which is reserved +in \fBzsh\fP), you may have to fix some of the aliases by hand. +.PP +The \fCc2z\fP script checks your csh setup, and produces a list +of \fBzsh\fP commands which replicate your aliases and parameter settings +as closely as possible. You could include its output in your +startup file, \fC.zshrc\fP. +.Sh "History" +.PP +There are several ways to manipulate history in \fBzsh\fP. +One way is to use csh-style \fC!\fP history: +.Ds +%\0/usr/local/bin/!:0\0!-2*:s/foo/bar/\0>>!$ +.De +If you don't want to use this, you can turn it off +by typing \fCsetopt nobanghist\fP. If you are afraid of accidentally +executing the wrong command you can set the \fIHISTVERIFY\fP option. +If this option is set, commands that result from history expansion +will not be executed immediately, but will be put back into the editor +buffer for further consideration. +.PP +If you're not familiar with \fC!\fP history, here follows some +explanation. History substitutions always start with a \fC!\fP, +commonly called \*Qbang\*U. After the \fC!\fP comes an (optional) +designation of which \*Qevent\*U (command) to use, then a colon, and +then a designation of what word of that command to use. For example, +\fC!-\fIn\fR refers to the command \fIn\fP commands ago. +.Ds +%\0ls +foo\0\0bar +%\0cd\0foo +%\0!-2 +ls +baz\0\0bam +.De +No word designator was used, which means that the whole command +referred to was repeated. Note that the shell will echo the result of +the history substitution. The word designator can, among other +things, be a number indicating the argument to use, where \fC0\fP is +the command. +.Ds +%\0/usr/bin/ls\0foo +foo +%\0!:0\0bar +/usr/bin/ls\0bar +bar +.De +In this example, no event designator was used, which tells \fBzsh\fP +to use the previous command. A \fC$\fP specifies the last argument +.Ds +%\0mkdir\0/usr/local/lib/emacs/site-lisp/calc +%\0cd\0!:$ +cd\0/usr/local/lib/emacs/site-lisp/calc +.De +If you use more words of the same command, only the first \fC!\fP +needs an event designator. +.Ds +%\0make\0prig\0>>\0make.log +make:\0***\0No\0rule\0to\0make\0target\0`prig'.\0\0Stop. +%\0cd\0src +%\0!-2:0\0prog\0>>\0!:$ +make\0prog\0>>\0make.log +.De +This is different from csh, where a bang with no event designator +always refers to the previous command. If you actually like this +behaviour, set the \fICSHJUNKIEHISTORY\fP option. +.Ds +%\0setopt\0cshjunkiehistory +%\0!-2:0\0prog2\0>>\0!:$ +make\0prog2\0>>\0cshjunkiehistory +.De +Another way to use history is to use the \fCfc\fP command. For +example, if you type an erroneous command: +.Ds +%\0for\0i\0in\0`cat\0/etc/clients`\0 +\0do\0 +\0rpu\0$i\0 +\0done +zsh:\0command\0not\0found:\0rpu +zsh:\0command\0not\0found:\0rpu +zsh:\0command\0not\0found:\0rpu +\&\fR... +.De +typing \fCfc\fP will execute an editor on this command, allowing +you to fix it. (The default editor is \fCvi\fP, by the way, +not \fCed\fP). +.Ds +%\0fc +49 +/rpu/s//rup/p +\0rup\0$i\0 +w +49 +q +for\0i\0in\0`cat\0/etc/clients`\0 +\0do\0 +\0rup\0$i\0 +\0done +\0\0\0\0\0\0\0\0beam\0\0\0\0up\0\02\0days,\010:17,\0\0\0\0load\0average:\00.86,\00.80,\00.50 +\0\0\0\0\0\0\0\0\0bow\0\0\0\0up\0\04\0days,\0\08:41,\0\0\0\0load\0average:\00.91,\00.80,\00.50 +\0\0\0\0\0\0\0\0burn\0\0\0\0up\0\0\0\0\0\0\0\0\0\017:18,\0\0\0\0load\0average:\00.91,\00.80,\00.50 +\0\0\0\0\0\0\0burst\0\0\0\0up\0\09\0days,\0\01:49,\0\0\0\0load\0average:\00.95,\00.80,\00.50 +\0\0\0\0\0\0\0\0\0tan\0\0\0\0up\0\0\0\0\0\0\0\0\0\011:14,\0\0\0\0load\0average:\00.91,\00.80,\00.50 +\0\0\0\0\0\0\0bathe\0\0\0\0up\0\03\0days,\017:49,\0\0\0\0load\0average:\01.84,\01.79,\01.50 +\0\0\0\0\0\0\0\0bird\0\0\0\0up\0\01\0day,\0\0\09:13,\0\0\0\0load\0average:\01.95,\01.82,\01.51 +\0\0\0\0\0\0bonnet\0\0\0\0up\0\02\0days,\021:18,\0\0\0\0load\0average:\00.93,\00.80,\00.50 +\&\fR... +.De +A variant of the \fCfc\fP command is \fCr\fP, which redoes the last +command, with optional changes: +.Ds +%\0echo\0foo +foo +%\0r +echo\0foo +foo + +%\0echo\0foo +foo +%\0r\0foo=bar +echo\0bar +bar +.De +.Sh "Command Line Editing" +.PP +\fBzsh\fP's command line editor, \fBZLE\fP, is quite powerful. +It is designed to emulate either emacs or vi; the default +is emacs. To set the bindings for vi mode, type \fCbindkey -v\fP. If +your \fBEDITOR\fP or \fBVISUAL\fP environment variable is vi, +\fBzsh\fP will use vi emulation by default. You can then switch to +emacs mode with \fCbindkey -e\fP. +.PP +In addition to basic editing, the shell allows you to +recall previous lines in the history. In emacs mode, +this is done with \fI^P\fP (control-P) or (on many terminals) with the +cursor-up key: +.Ds +%\0ls\0~ +-\0\0\0\0\0\0\0\0\0\0\0README\0\0\0\0\0\0file\0\0\0\0\0\0\0\0mail\0\0\0\0\0\0\0\0pub\0\0\0\0\0\0\0\0\0tmp +Mailboxes\0\0\0bin\0\0\0\0\0\0\0\0\0func\0\0\0\0\0\0\0\0nicecolors\0\0scr\0\0\0\0\0\0\0\0\0zsh +News\0\0\0\0\0\0\0\0etc\0\0\0\0\0\0\0\0\0iris\0\0\0\0\0\0\0\0notes\0\0\0\0\0\0\0src +%\0echo\0foobar +foobar +%\0\fI^P\fC +%\0echo\0foobar\fI^P\fC +%\0ls\0~_ +.De +Pressing \fI^P\fP once brings up the previous line (\fCecho foobar\fP); +pressing it again brings up the line before that (\fCls ~\fP). +The cursor is left at the end of the line, allowing you to +edit the line if desired before executing it. +In many cases, \fBZLE\fP eliminates the need for the \fCfc\fP command, +since it is powerful enough to handle even multiline commands: +.Ds +%\0for\0i\0in\0a\0b\0c\0d\0e +>\0do +>\0echo\0$i +>\0done +a +b +c +d +e +%\0\fI^P\fC +%\0for\0i\0in\0a\0b\0c\0d\0e\0 +\0do\0 +\0echo\0$i\0 +\0done_ +.De +Now you can just move up to the part you want to change... +.Ds +%\0for\0i\0in\0\kxa\l'|\nxu\(ul'\0b\0c\0d\0e +\0do\0 +\0echo\0$i\0 +\0done +.De +change it, and execute the new command. +.Ds +%\0for\0i\0in\0f\0g\0h\0i\0j +\0do\0 +\0echo\0$i\0 +\0done +f +g +h +i +j +.De +Also, you can search the history for a certain command using +\fIESC-P\fP, this will look for the last command that started with the +(part of the) word at the beginning of the current line. Hitting +\fIESC-P\fP another time gets you the command before that, etc. +.Ds +%\0set\0\fIESC-P\fC +%\0setopt\0autolist\0\fIESC-P\fC +%\0setopt\0nocorrect_ +.De +Another way is to do an incremental search, emacs-style: +.Ds +%\0\fI^R\fC +%\0_ +i-search: + +%\0l\kxs\l'|\nxu\(ul'\0/usr/bin +i-search:\0l + +%\0date\0>\0foofile\kx.\l'|\nxu\(ul'c +i-search:\0le +.De +Suppose you have retrieved an old history event in one of these ways +and would like to execute several consecutive old commands starting +with this one. \fC^O\fP will execute the current command and then put +the next command from the history into the editor buffer. Typing +\fC^O\fP several times will therefore reexecute several consecutive +commands from the history. Of course, you can edit some of those +commands in between. +.PP +In addition to completion (see below), \fITAB\fP performs expansion if +possible. +.Ds +%\0ls\0*.c\fITAB\fC +%\0ls\0foofile.c\0fortune.c\0rnd.c\0strfile.c\0unstr.c_ +.De +For example, suppose you have a bunch of weird files in an important +directory: +.Ds +%\0ls +\0\0*\0*\0*\0\0\0\0\0\0\0;\0&\0%\0$??foo\0\0dspfok\0\0\0\0\0\0\0\0foo.c +\0\0!"foo"!\0\0\0\0\0\0\0`\0\e\0`\0\0\0\0\0\0\0\0\0foo\0\0\0\0\0\0\0\0\0\0\0rrr +.De +You want to remove them, but you don't want to damage \fCfoo.c\fP. +Here is one way to do this: +.Ds +%\0rm\0*\fITAB\fC +%\0rm\0\e\0\e\0\e*\e\0\e*\e\0\e*\e\0\e\0\e\0\0\e!\e"foo\e"\e!\0\e;\e\0\e&\e\0%\e\0\e$' +'' +'foo\0\e`\e\0\e\e\e\0\e`\0dspfok\0foo\0foo.c\0rrr_ +.De +When you expand \fC*\fP, \fBzsh\fP inserts the names of all the files +into the editing buffer, with proper shell quoting. +Now, just move back and remove \fCfoo.c\fP from the buffer: +.Ds +%\0rm\0\e\0\e\0\e*\e\0\e*\e\0\e*\e\0\e\0\e\0\0\e!\e"foo\e"\e!\0\e;\e\0\e&\e\0%\e\0\e$' +'' +'foo\0\e`\e\0\e\e\e\0\e`\0dspfok\0foo\0\kxr\l'|\nxu\(ul'rr +.De +and press return. +Everything except \fCfoo.c\fP will be deleted from the directory. If +you do not want to actually expand the current word, but would like to +see what the matches are, type \fC^Xg\fP. +.Ds +%\0rm\0f*\fI^Xg\fP +foo\0\0\0\0foo.c +%\0rm\0f*_ +.De +Here's another trick; let's say you have typed this command in: +.Ds +%\0gcc\0-o\0x.out\0foob.c\0-g\0-Wpointer-arith\0-Wtrigraphs_ +.De +and you forget which library you want. You need to escape +out for a minute and check by typing +\fCls /usr/lib\fP, or some other such command; +but you don't want to retype the whole command again, +and you can't press return now because the current command +is incomplete. +In \fBzsh\fP, you can put the line on the \fIbuffer stack\fP, using +\fIESC-Q\fP, and type some other commands. The next time a prompt is printed, +the \fCgcc\fP line will be popped off the stack and put +in the editing buffer automatically; you can then enter the +proper library name and press return (or, \fIESC-Q\fP again and look +for some other libraries whose names you forgot). +.PP +A similar situation: what if you forget the option to gcc that +finds bugs using AI techniques? You could either use \fIESC-Q\fP +again, and type \fCman gcc\fP, or you could press \fIESC-H\fP, which +essentially does the same thing; it puts the current line on +the buffer stack, and executes the command \fCrun-help gcc\fP, +where \fCrun-help\fP is an alias for \fCman\fP. +.PP +Another interesting command is \fIESC-A\fP. This executes the +current line, but retains it in the buffer, so that it appears +again when the next prompt is printed. +Also, the cursor stays in the same place. +This is useful for executing a series of similar commands: +.Ds +%\0cc\0grok.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out +%\0cc\0fubar.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out +%\0cc\0fooble.c\0-g\0-lc\0-lgl\0-lsun\0-lmalloc\0-Bstatic\0-o\0b.out +.De +.PP +The \fIESC-'\fP command is useful for managing the shell's quoting +conventions. Let's say you want to print this string: +.Ds +don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*. +.De +All that is necessary is to type it into the editing buffer: +.Ds +%\0don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*. +.De +press \fIESC-'\fP (escape-quote): +.Ds +%\0'don'\e''t\0do\0that;\0type\0'\e''rm\0-rf\0\e*'\e'',\0with\0a\0\e\0before\0the\0*.' +.De +then move to the beginning and add the \fCecho\fP command. +.Ds +%\0echo\0'don'\e''t\0do\0that;\0type\0'\e''rm\0-rf\0\e*'\e'',\0with\0a\0\e\0before\0the\0*.' +don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*. +.De +Let's say you want to create an alias to do this \fCecho\fP command. +This can be done by recalling the line with \fI^P\fP and pressing +\fIESC-'\fP again: +.Ds +%\0'echo\0'\e''don'\e''\e'\e'''\e''t\0do\0that;\0type\0'\e''\e'\e'''\e''rm\0-rf +\e*'\e''\e'\e'''\e'',\0with\0a\0\e\0before\0the\0*.'\e''' +.De +and then move to the beginning and add the command to create +an alias. +.Ds +%\0alias\0zoof='echo\0'\e''don'\e''\e'\e'''\e''t\0do\0that;\0type\0'\e''\e'\e'''\e''rm +-rf\0\e*'\e''\e'\e'''\e'',\0with\0a\0\e\0before\0the\0*.'\e''' +%\0zoof +don't\0do\0that;\0type\0'rm\0-rf\0\e*',\0with\0a\0\e\0before\0the\0*. +.De +If one of these fancy editor commands changes your command line in a +way you did not intend, you can undo changes with \fC^_\fP, if you can +get it out of your keyboard, or \fC^X^U\fP, otherwise. +.PP +Another use of the editor is to edit the value of variables. +For example, an easy way to change your path is to use +the \fCvared\fP command: +.Ds +%\0vared\0PATH +>\0/u/pfalstad/scr:/u/pfalstad/bin/sun4:/u/maruchck/scr:/u/subbarao/bin:/u/maruc +hck/bin:/u/subbarao/scripts:/usr/princeton/bin:/usr/ucb:/usr/bin:/bin:/usr/host +s:/usr/princeton/bin/X11:/./usr/lang:/./usr/etc:/./etc +.De +You can now edit the path. When you press return, the contents +of the edit buffer will be assigned to \fBPATH\fP. +.Sh "Completion" +.PP +Another great \fBzsh\fP feature is completion. If you hit \fITAB\fP, \fBzsh\fP +will complete all kinds of stuff. Like commands or filenames: +.Ds +%\0comp\fITAB\fC +%\0compress\0_ + +%\0ls\0nic\fITAB\fC +%\0ls\0nicecolors\0_ + +%\0ls\0/usr/pr\fITAB\fC +%\0ls\0/usr/princeton/_ + +%\0ls\0-l\0=com\fITAB\fC +%\0ls\0-l\0=compress\0_ +.De +If the completion is ambiguous, the editor will beep. If you find +this annoying, you can set the \fINOLISTBEEP\fP option. Completion +can even be done in the middle of words. To use this, you will have +to set the \fICOMPLETEINWORD\fP option: +.Ds +%\0setopt\0completeinword +%\0ls\0/usr/p\kxt\l'|\nxu\(ul'on\fITAB\fC +%\0ls\0/usr/prince\kxt\l'|\nxu\(ul'on/ +%\0setopt\0alwaystoend +%\0ls\0/usr/p\kxt\l'|\nxu\(ul'on\fITAB\fC +%\0ls\0/usr/princeton/_ +.De +You can list possible completions by pressing \fI^D\fP: +.Ds +%\0ls\0/vmu\fITAB\0\(embeep\(em\fC +%\0ls\0/vmunix_ +%\0ls\0/vmunix\fI^D\fC +vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +vmunix.new.kernelmap.old\0\0vmunix.org +.De +Or, you could just set the \fIAUTOLIST\fP option: +.Ds +%\0setopt\0autolist +%\0ls\0/vmu\fITAB\0\(embeep\(em\fC +vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +vmunix.new.kernelmap.old\0\0vmunix.org +%\0ls\0/vmunix_ +.De +If you like to see the types of the files in these lists, like in +\fCls\ -F\fP, you can set the \fILISTTYPES\fP option. Together with +\fIAUTOLIST\fP you can use \fILISTAMBIGUOUS\fP. This will only list +the possibilities if there is no unambiguous part to add: +.Ds +%\0setopt\0listambiguous +%\0ls\0/vmu\fITAB\0\(embeep\(em\fC +%\0ls\0/vmunix_\fITAB\0\(embeep\(em\fC +vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +vmunix.new.kernelmap.old\0\0vmunix.org +.De +If you don't want several of these listings to scroll the screen so +much, the \fIALWAYSLASTPROMPT\fP option is useful. If set, you can +continue to edit the line you were editing, with the completion +listing appearing beneath it. +.PP +Another interesting option is \fIMENUCOMPLETE\fP. This affects the +way \fITAB\fP works. Let's look at the \fC/vmunix\fP example again: +.Ds +%\0setopt\0menucomplete +%\0ls\0/vmu\fITAB\fC +%\0ls\0/vmunix\fITAB\fC +%\0ls\0/vmunix.new.kernelmap.old\fITAB\fC +%\0ls\0/vmunix.old_ +.De +Each time you press \fITAB\fP, it displays the next possible completion. +In this way, you can cycle through the possible completions until +you find the one you want. +.PP +The \fIAUTOMENU\fP option makes a nice compromise between this method +of completion and the regular method. If you set this option, +pressing \fITAB\fP once completes the unambiguous part normally, +pressing the \fITAB\fP key repeatedly after an ambiguous completion +will cycle through the possible completions. +.PP +Another option you could set is \fIRECEXACT\fP, which causes +exact matches to be accepted, even if there are other possible +completions: +.Ds +%\0setopt\0recexact +%\0ls\0/vmu\fITAB\0\(embeep\(em\fC +vmunix\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0vmunix.old\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 +vmunix.new.kernelmap.old\0\0vmunix.org +%\0ls\0/vmunix_\fITAB\fC +%\0ls\0/vmunix\0_ +.De +To facilitate the typing of pathnames, a slash will be added whenever +a directory is completed. Some computers don't like the spurious +slashes at the end of directory names. In that case, the +\fIAUTOREMOVESLASH\fP option comes to rescue. It will remove these +slashes when you type a space or return after them. +.PP +The \fIfignore\fP variable lists suffixes of files to ignore +during completion. +.Ds +%\0ls\0foo\fITAB\0\(embeep\(em\fC +foofile.c\0\0foofile.o +%\0fignore=(\0.o\0\e~\0.bak\0.junk\0) +%\0ls\0foo\fITAB\fP +%\0ls\0foofile.c\0_ +.De +Since \fCfoofile.o\fP has a suffix that is in the \fCfignore\fP list, +it was not considered a possible completion of \fCfoo\fP. +.PP +Username completion is also supported: +.Ds +%\0ls\0~pfal\fITAB\fC +%\0ls\0~pfalstad/_ +.De +and parameter name completion: +.Ds +%\0echo\0$ORG\fITAB\fC +%\0echo\0$ORGANIZATION\0_ +%\0echo\0${ORG\fITAB\fC +%\0echo\0${ORGANIZATION\0_ +.De +Note that in the last example a space is added after the completion as +usual. But if you want to add a colon or closing brace, you probably +don't want this extra space. Setting the \fIAUTOPARAMKEYS\fP option +will automatically remove this space if you type a colon or closing +brace after such a completion. +.PP +There is also option completion: +.Ds +%\0setopt\0nocl\fITAB\fC +%\0setopt\0noclobber\0_ +.De +and binding completion: +.Ds +%\0bindkey\0'^X^X'\0pu\fITAB\fC +%\0bindkey\0'^X^X'\0push-line\0_ +.De +The \fCcompctl\fP command is used to control completion of the +arguments of specific commands. For example, to specify that certain +commands take other commands as arguments, you use \fCcompctl -c\fP: +.Ds +%\0compctl\0-c\0man\0nohup +%\0man\0upt\fITAB\fC +%\0man\0uptime\0_ +.De +To specify that a command should complete filenames, you should use +\fCcompctl -f\fP. This is the default. It can be combined with \fC-c\fP, +as well. +.Ds +%\0compctl\0-cf\0echo +%\0echo\0upt\fITAB\fC +%\0echo\0uptime\0_ + +%\0echo\0fo\fITAB\fC +%\0echo\0foo.c +.De +Similarly, use \fC-o\fP to specify options, \fC-v\fP to specify +variables, and \fC-b\fP to specify bindings. +.Ds +%\0compctl\0-o\0setopt\0unsetopt +%\0compctl\0-v\0typeset\0vared\0unset\0export +%\0compctl\0-b\0bindkey +.De +You can also use \fC-k\fP to specify a custom list of keywords to use +in completion. After the \fC-k\fP comes either the name of an array +or a literal array to take completions from. +.Ds +%\0ftphosts=(ftp.uu.net\0wuarchive.wustl.edu) +%\0compctl\0-k\0ftphosts\0ftp +%\0ftp\0wu\fITAB\fC +%\0ftp\0wuarchive.wustl.edu\0_ + +%\0compctl\0-k\0'(cpirazzi\0subbarao\0sukthnkr)'\0mail\0finger +%\0finger\0cp\fITAB\fC +%\0finger\0cpirazzi\0_ +.De +To better specify the files to complete for a command, use the +\fC-g\fP option which takes any glob pattern as an argument. Be sure +to quote the glob patterns as otherwise they will be expanded when the +\fCcompctl\fP command is run. +.Ds +%\0ls +letter.tex\0\0letter.dvi\0\0letter.aux\0\0letter.log\0\0letter.toc +%\0compctl\0-g\0'*.tex'\0latex +%\0compctl\0-g\0'*.dvi'\0xdvi\0dvips +%\0latex\0l\fITAB\fC +%\0latex\0letter.tex\0_ +%\0xdvi\0l\fITAB\fC +%\0xdvi\0letter.dvi\0_ +.De +Glob patterns can include qualifiers within parentheses. To rmdir +only directories and cd to directories and symbolic links pointing to +them: +.Ds +%\0compctl\0-g\0'*(-/)'\0cd +%\0compctl\0-g\0'*(/)'\0rmdir +.De +RCS users like to run commands on files which are not in the current +directory, but in the RCS subdirectory where they all get \fC,v\fP +suffixes. They might like to use +.Ds +%\0compctl\0-g\0'RCS/*(:t:s/\e,v//)'\0co\0rlog\0rcs +%\0ls\0RCS +builtin.c,v\0\0lex.c,v\0\0\0\0\0\0zle_main.c,v +%\0rlog\0bu\fITAB\fC +%\0rlog\0builtin.c\0_ +.De +The \fC:t\fP modifier keeps only the last part of the pathname and the +\fC:s/\e,v//\fP will replace any \fC,v\fP by nothing. +.PP +The \fC-s\fP flag is similar to \fC-g\fP, but it uses all expansions, +instead of just globbing, like brace expansion, parameter substitution +and command substitution. +.Ds +%\0compctl\0-s\0'$(setopt)'\0unsetopt +.De +will only complete options which are actually set to be arguments to +\fCunsetopt\fP. +.PP +Sometimes a command takes another command as its argument. You can +tell \fBzsh\fP to complete commands as the first argument to such a +command and then use the completion method of the second command. The +\fC-l\fP flag with a null-string argument is used for this. +.Ds +%\0compctl\0-l\0''\0nohup\0exec +%\0nohup\0comp\fITAB\fC +%\0nohup\0compress\0_ +%\0nohup\0compress\0fil\fITAB\fC +%\0nohup\0compress\0filename\0_ +.De +Sometimes you would like to run really complicated commands to find +out what the possible completions are. To do this, you can specify a +shell function to be called that will assign the possible completions +to a variable called reply. Note that this variable must be an array. +Here's another (much slower) way to get the completions for \fCco\fP +and friends: +.Ds +%\0function\0getrcs\0{ +>\0reply=() +>\0for\0i\0in\0RCS/* +>\0\0\0do +>\0\0\0reply=($reply[*]\0$(basename\0$i\0,v)) +>\0\0\0done +>\0} +%\0compctl\0-K\0getrcs\0co\0rlog\0rcs +.De +Some command arguments use a prefix that is not a part of the things +to complete. The kill builtin command takes a signal name after a +\fC-\fP. To make such a prefix be ignored in the completion process, +you can use the \fC-P\fP flag. +.Ds +%\0compctl\0-P\0-\0-k\0signals\0kill +%\0kill\0-H\fITAB\fP +%\0kill\0-HUP\0_ +.De +TeX is usually run on files ending in \fC.tex\fP, but also sometimes +on other files. It is somewhat annoying to specify that the arguments +of TeX should end in \fC.tex\fP and then not be able to complete these +other files. Therefore you can specify things like \*QComplete to +files ending in \fC.tex\fP if available, otherwise complete to any +filename.\*U. This is done with \fIxor\fPed completion: +.Ds +%\0compctl\0-g\0'*.tex'\0+\0-f\0tex +.De +The \fC+\fP tells the editor to only take the next thing into account +if the current one doesn't generate any matches. If you have not +changed the default completion, the above example is in fact +equivalent to +.Ds +%\0compctl\0-g\0'*.tex'\0+\0tex +.De +as a lone \fC+\fP at the end is equivalent to specifying the default +completion after the \fC+\fP. This form of completion is also +frequently used if you want to run some command only on a certain type +of files, but not necessarily in the current directory. In this case +you will want to complete both files of this type and directories. +Depending on your preferences you can use either of +.Ds +%\0compctl\0-g\0'*.ps'\0+\0-g\0'*(-/)'\0ghostview +%\0compctl\0-g\0'*.ps\0*(-/)'\0ghostview +.De +where the first one will only complete directories (and symbolic links +pointing to directories) if no postscript file matches the already +typed part of the argument. +.Sh "Extended completion" +.PP +If you play with completion, you will soon notice that you would like +to specify what to complete, depending on what flags you give to the +command and where you are on the command line. For example, a command +could take any filename argument after a \fC-f\fP flag, a username +after a \fC-u\fP flag and an executable after a \fC-x\fP flag. This +section will introduce you to the ways to specify these things. To +many people it seems rather difficult at first, but taking the trouble +to understand it can save you lots of typing in the end. Even I keep +being surprised when \fBzsh\fP manages to complete a small or even +empty prefix to the right file in a large directory. +.PP +To tell \fBzsh\fP about these kinds of completion, you use \*Qextended +completion\*U by specifying the \fC-x\fP flag to compctl. The +\fC-x\fP flag takes a list of patterns/flags pairs. The patterns +specify when to complete and the flags specify what. The flags are +simply those mentioned above, like \fC-f\fP or \fC-g \fIglob +pattern\fR. +.PP +As an example, the \fCr[\fIstring1\fC,\fIstring2\fC]\fR pattern +matches if the cursor is after something that starts with +\fIstring1\fP and before something that starts with \fIstring2\fP. +The \fIstring2\fP is often something that you do not want to match +anything at all. +.Ds +%\0ls +foo1\0\0\0bar1\0\0\0foo.Z\0\0bar.Z +%\0compctl\0-g\0'^*.Z'\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0compress +%\0compress\0f\fITAB\fP +%\0compress\0foo1\0_ +%\0compress\0-d\0f\fITAB\fP +%\0compress\0-d\0foo.Z\0_ +.De +In the above example, if the cursor is after the \fC-d\fP the pattern +will match and therefore \fBzsh\fP uses the \fC-g *.Z\fP flag that will only +complete files ending in \fC.Z\fP. Otherwise, if no pattern matches, +it will use the flags before the \fC-x\fP and in this case complete +every file that does not end in \fC.Z\fP. +.PP +The \fCs[\fIstring\fC]\fR pattern matches if the current word starts +with \fIstring\fP. The \fIstring\fP itself is not considered to be +part of the completion. +.Ds +%\0compctl\0-x\0's[-]'\0-k\0signals\0--\0kill +%\0kill\0-H\fITAB\fP +%\0kill\0-HUP\0_ +.De +The \fCtar\fP command takes a tar file as an argument after the +\fC-f\fP option. The \fCc[\fIoffset\fC,\fIstring\fC]\fR pattern +matches if the word in position \fIoffset\fP relative to the current +word is \fIstring\fP. More in particular, if \fIoffset\fP is -1, it +matches if the previous word is \fIstring\fP. This suggests +.Ds +%\0compctl\0-f\0-x\0'c[-1,-f]'\0-g\0'*.tar'\0--\0tar +.De +But this is not enough. The \fC-f\fP option could be the last of a +longer string of options. \fCC[\fR...\fC,\fR...\fC]\fR is just like +\fCc[\fR...\fC,\fR...\fC]\fR, except that it uses glob-like pattern +matching for \fIstring\fP. So +.Ds +%\0compctl\0-f\0-x\0'C[-1,-*f]'\0-g\0'*.tar'\0--\0tar +.De +will complete tar files after any option string ending in an \fCf\fP. +But we'd like even more. Old versions of tar used all options as the +first argument, but without the minus sign. This might be +inconsistent with option usage in all other commands, but it is still +supported by newer versions of \fCtar\fP. So we would also like to +complete tar files if the first argument ends in an \fCf\fP and we're +right behind it. +.PP +We can `and' patterns by putting them next to each other with a space +between them. We can `or' these sets by putting comma's between them. +We will also need some new patterns. \fCp[\fInum\fC]\fR will match if +the current argument (the one to be completed) is the \fInum\fPth +argument. \fCW[\fIindex\fC,\fIpattern\fC]\fR will match if the +argument in place \fIindex\fP matches the \fIpattern\fP. This gives +us +.Ds +%\0compctl\0-f\0-x\0'C[-1,-*f]\0,\0W[1,*f]\0p[2]'\0-g\0'*.tar'\0--\0tar +.De +In words: If the previous argument is an option string that ends in an +\fCf\fP, or the first argument ended in an \fCf\fP and it is now the +second argument, then complete only filenames ending in \fC.tar\fP. +.PP +All the above examples used only one set of patterns with one +completion flag. You can use several of these pattern/flag pairs +separated by a \fC-\fP. The first matching pattern will be used. +Suppose you have a version of \fCtar\fP that supports compressed files +by using a \fC-Z\fP option. Leaving the old tar syntax aside for a +moment, we would like to complete files ending in \fC.tar.Z\fP if a +\fC-Z\fP option has been used and files ending in \fC.tar\fP +otherwise, all this only after a \fC-f\fP flag. Again, the \fC-Z\fP +can be alone or it can be part of a longer option string, perhaps the +same as that of the \fC-f\fP flag. Here's how to do it; note the +backslash and the secondary prompt which are not part of the +\fCcompctl\fP command. +.Ds +%\0compctl\0-f\0-x\0'C[-1,-*Z*f]\0,\0R[-*Z*,---]\0C[-1,-*f]'\0-g\0'*.tar.Z'\0-\0\e +>\0'C[-1,-*f]'\0-g\0'*.tar'\0--\0tar +.De +The first pattern set tells us to match if either the previous +argument was an option string including a \fCZ\fP and ending in an +\fCf\fP or there was an option string with a \fCZ\fP somewhere and the +previous word was any option string ending in an \fCf\fP. If this is +the case, we need a compressed tar file. Only if this is not the case +the second pattern set will be considered. By the way, +\fCR[\fIpattern1\fC,\fIpattern2\fC]\fR is just like +\fCr[\fR...\fC,\fR...\fC]\fR except that it uses pattern matching with +shell metacharacters instead of just strings. +.PP +You will have noticed the \fC--\fP before the command name. This ends +the list of pattern/flag pairs of \fC-x\fP. It is usually used just +before the command name, but you can also use an extended completion +as one part of a list of xored completions, in which case the \fC--\fP +appears just before one of the \fC+\fP signs. +.PP +Note the difference between using extended completion as part of a +list of xored completions as in +.Ds +%\0ls +foo\0\0bar +%\0compctl\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0+\0-g\0'^*.Z'\0compress +%\0compress\0-d\0f\fITAB\fP +%\0compress\0-d\0foo\0_ +.De +and specifying something before the \fC-x\fP as in +.Ds +%\0compctl\0-g\0'^*.Z'\0-x\0'r[-d,---]'\0-g\0'*.Z'\0--\0compress +%\0compress\0-d\0f\fITAB\fP +%\0compress\0-d\0f_ +.De +In the first case, the alternative glob pattern (\fC^*.Z\fP) will be +used if the first part does not generate any possible completions, +while in the second case the alternative glob pattern will only be +used if the \fCr[\fR...\fC]\fR pattern doesn't match. +.Sh "Bindings" +.PP +Each of the editor commands we have seen was actually a function bound +by default to a certain key. The real names of the commands are: +.Ds +\fCexpand-or-complete\0\0\0\fITAB\fR +\fCpush-line\0\0\0\0\0\0\0\0\0\0\0\0\fIESC-Q\fR +\fCrun-help\0\0\0\0\0\0\0\0\0\0\0\0\0\fIESC-H\fR +\fCaccept-and-hold\0\0\0\0\0\0\fIESC-A\fR +\fCquote-line\0\0\0\0\0\0\0\0\0\0\0\fIESC-'\fR +.De +These bindings are arbitrary; you could change them if you want. +For example, to bind \fCaccept-line\fP to \fI^Z\fP: +.Ds +%\0bindkey\0'^Z'\0accept-line +.De +Another idea would be to bind the delete key to \fCdelete-char\fP; +this might be convenient if you use \fI^H\fP for backspace. +.Ds +%\0bindkey\0'^?'\0delete-char +.De +Or, you could bind \fI^X\fP\fI^H\fP to \fCrun-help\fP: +.Ds +%\0bindkey\0'^X^H'\0run-help +.De +Other examples: +.Ds +%\0bindkey\0'^X^Z'\0universal-argument +%\0bindkey\0'\0'\0magic-space +%\0bindkey\0-s\0'^T'\0'uptime +>\0' +%\0bindkey\0'^Q'\0push-line-or-edit +.De +\fCuniversal-argument\fP multiplies the next command by 4. +Thus \fI^X\fP\fI^Z\fP\fI^W\fP might delete the last four words on the line. +If you bind space to \fCmagic-space\fP, then csh-style history +expansion is done on the line whenever you press the space bar. +.PP +Something that often happens is that I am typing a multiline command +and discover an error in one of the previous lines. In this case, +\fCpush-line-or-edit\fP will put the entire multiline construct into +the editor buffer. If there is only a single line, it is equivalent +to \fCpush-line\fP. +.PP +The \fC-s\fP flag to \fCbindkey\fP specifies that you are binding the key +to a string, not a command. Thus \fCbindkey -s '^T' 'uptime\en'\fP +lets you VMS lovers get the load average whenever you press \fI^T\fP. +.PP +If you have a NeXT keyboard, the one with the \fC|\fP and \fC\e\fP keys +very inconveniently placed, the following +bindings may come in handy: +.Ds +%\0bindkey\0-s\0'\ee/'\0'\e\e' +%\0bindkey\0-s\0'\ee='\0'|' +.De +Now you can type \fIALT-/\fP to get a backslash, and \fIALT-=\fP to +get a vertical bar. This only works inside \fBzsh\fP, of course; +\fCbindkey\fP has no effect on the key mappings inside \fCtalk\fP +or \fCmail\fP, etc. +.PP +Some people like to bind \fC^S\fP and \fC^Q\fP to editor commands. +Just binding these has no effect, as the terminal will catch them and +use them for flow control. You could unset them as stop and start +characters, but most people like to use these for external commands. +The solution is to set the \fINOFLOWCONTROL\fP option. This will +allow you to bind the start and stop characters to editor commands, +while retaining their normal use for external commands. +.Sh "Parameter Substitution" +.PP +In \fBzsh\fP, parameters are set like this: +.Ds +%\0foo=bar +%\0echo\0$foo +bar +.De +Spaces before or after the \fC=\fP are frowned upon: +.Ds +%\0foo\0=\0bar +zsh:\0command\0not\0found:\0foo +.De +Also, \fCset\fP doesn't work for setting parameters: +.Ds +%\0set\0foo=bar +%\0set\0foo\0=\0bar +%\0echo\0$foo + +% +.De +Note that no error message was printed. This is because both +of these commands were perfectly valid; the \fCset\fP builtin +assigns its arguments to the \fIpositional parameters\fP +(\fC$1\fP, \fC$2\fP, etc.). +.Ds +%\0set\0foo=bar +%\0echo\0$1 +foo=bar +%\0set\0foo\0=\0bar +%\0echo\0$3\0$2 +bar\0= +.De +If you're really intent on using the csh syntax, define a +function like this: +.Ds +%\0set\0()\0{ +>\0\0\0\0eval\0"$1$2$3" +>\0} +%\0set\0foo\0=\0bar +%\0set\0fuu=brrr +%\0echo\0$foo\0$fuu +bar\0brrr +.De +But then, of course you can't use the form of \fCset\fP with +options, like \fCset -F\fP (which turns off filename generation). +Also, the \fCset\fP command by itself won't list all the parameters +like it should. +To get around that you need a \fCcase\fP statement: +.Ds +%\0set\0()\0{ +>\0\0\0\0case\0$1\0in +>\0\0\0\0-*|+*|'')\0builtin\0set\0$*\0;; +>\0\0\0\0*)\0eval\0"$1$2$3"\0;; +>\0\0\0\0esac +>\0} +.De +For the most part, this should make csh users happy. +.PP +The following sh-style operators are supported in \fBzsh\fP: +.Ds +%\0unset\0null +%\0echo\0${foo-xxx} +bar +%\0echo\0${null-xxx} +xxx +%\0unset\0null +%\0echo\0${null=xxx} +xxx +%\0echo\0$null +xxx +%\0echo\0${foo=xxx} +bar +%\0echo\0$foo +bar +%\0unset\0null +%\0echo\0${null+set} + +%\0echo\0${foo+set} +set +.De +Also, csh-style \fC:\fP modifiers may be appended to a parameter +substitution. +.Ds +%\0echo\0$PWD +/home/learning/pf/zsh/zsh2.00/src +%\0echo\0$PWD:h +/home/learning/pf/zsh/zsh2.00 +%\0echo\0$PWD:h:h +/home/learning/pf/zsh +%\0echo\0$PWD:t +src +%\0name=foo.c +%\0echo\0$name +foo.c +%\0echo\0$name:r +foo +%\0echo\0$name:e +c +.De +The equivalent constructs in ksh (which are also supported in \fBzsh\fP) +are a bit more general and easier to remember. +When the shell expands \fC${foo#\fR\fIpat\fR\fC}\fR, +it checks to see if \fIpat\fP matches a substring at the beginning +of the value +of \fCfoo\fP. If so, it removes that portion of \fCfoo\fP, using the shortest +possible match. +With \fC${foo##\fR\fIpat\fR\fC}\fR, the longest possible match is removed. +\fC${foo%\fR\fIpat\fR\fC}\fR and \fC${foo%%\fR\fIpat\fR\fC}\fR remove the match +from the end. +Here are the ksh equivalents of the \fC:\fP modifiers: +.Ds +%\0echo\0${PWD%/*} +/home/learning/pf/zsh/zsh2.00 +%\0echo\0${PWD%/*/*} +/home/learning/pf/zsh +%\0echo\0${PWD##*/} +src +%\0echo\0${name%.*} +foo +%\0echo\0${name#*.} +c +.De +\fBzsh\fP also has upper/lowercase modifiers: +.Ds +%\0xx=Test +%\0echo\0$xx:u +TEST +%\0echo\0$xx:l +test +.De +and a substitution modifier: +.Ds +%\0echo\0$name:s/foo/bar/ +bar.c +%\0ls +foo.c\0\0\0\0foo.h\0\0\0\0foo.o\0\0\0\0foo.pro +%\0for\0i\0in\0foo.*;\0mv\0$i\0$i:s/foo/bar/ +%\0ls +bar.c\0\0\0\0bar.h\0\0\0\0bar.o\0\0\0\0bar.pro +.De +There is yet another syntax to modify substituted parameters. You can +add certain modifiers in parentheses after the opening brace like: +.Ds +${(\fImodifiers\fC)\fIparameter\fC} +.De +For example, \fCo\fP sorts the words resulting from the expansion: +.Ds +%\0echo\0${path} +/usr/bin\0/usr/bin/X11\0/etc +%\0echo\0${(o)path} +/etc\0/usr/bin\0/usr/bin/X11 +.De +One possible source of confusion is the fact that in \fBzsh\fP, +the result of parameter substitution is \fInot\fP split into +words. Thus, this will not work: +.Ds +%\0srcs='glob.c\0exec.c\0init.c' +%\0ls\0$srcs +glob.c\0exec.c\0init.c\0not\0found +.De +This is considered a feature, not a bug. +If splitting were done by default, as it is in most other shells, +functions like this would not work properly: +.Ds +$\0ll\0()\0{\0ls\0-F\0$*\0} +$\0ll\0'fuu\0bar' +fuu\0not\0found +bar\0not\0found + +%\0ll\0'fuu\0bar' +fuu\0bar\0not\0found +.De +Of course, a hackish workaround is available in sh (and \fBzsh\fP): +.Ds +%\0setopt\0shwordsplit +%\0ll\0()\0{\0ls\0-F\0"$@"\0} +%\0ll\0'fuu\0bar' +fuu\0bar\0not\0found +.De +If you like the sh behaviour, \fBzsh\fP can accomodate you: +.Ds +%\0ls\0${=srcs} +exec.c\0\0glob.c\0\0init.c +%\0setopt\0shwordsplit +%\0ls\0$srcs +exec.c\0\0glob.c\0\0init.c +.De +Another way to get the \fC$srcs\fP trick to work is to use an array: +.Ds +%\0unset\0srcs +%\0srcs=(\0glob.c\0exec.c\0init.c\0)\0\0 +%\0ls\0$srcs +exec.c\0\0glob.c\0\0init.c +.De +or an alias: +.Ds +%\0alias\0-g\0SRCS='exec.c\0glob.c\0init.c' +%\0ls\0SRCS +exec.c\0\0glob.c\0\0init.c +.De +Another option that modifies parameter expansion is +\fIRCEXPANDPARAM\fP: +.Ds +%\0echo\0foo/$srcs +foo/glob.c\0exec.c\0init.c +%\0setopt\0rcexpandparam +%\0echo\0foo/$srcs +foo/glob.c\0foo/exec.c\0foo/init.c +%\0echo\0foo/${^srcs} +foo/glob.c\0foo/exec.c\0foo/init.c +%\0echo\0foo/$^srcs +foo/glob.c\0foo/exec.c\0foo/init.c +.De +.Sh "Shell Parameters" +.PP +The shell has many predefined parameters that may be +accessed. Here are some examples: +.Ds +%\0sleep\010\0& +[1]\03820 +%\0echo\0$! +3820 +%\0set\0a\0b\0c +%\0echo\0$# +3 +%\0echo\0$ARGC +3 +%\0(\0exit\020\0)\0;\0echo\0$? +20 +%\0false;\0echo\0$status +1 +.De +(\fC$?\fP and \fC$status\fP are equivalent.) +.Ds +%\0echo\0$HOST\0$HOSTTYPE +dendrite\0sun4 +%\0echo\0$UID\0$GID +701\060 +%\0cd\0/tmp +%\0cd\0/home +%\0echo\0$PWD\0$OLDPWD +/home\0/tmp +%\0ls\0$OLDPWD/.getwd\0 +/tmp/.getwd +.De +\fC~+\fP and \fC~-\fP are short for \fC$PWD\fP and \fC$OLDPWD\fP, respectively. +.Ds +%\0ls\0~-/.getwd +/tmp/.getwd +%\0ls\0-d\0~+/learning +/home/learning +%\0echo\0$RANDOM +4880 +%\0echo\0$RANDOM +11785 +%\0echo\0$RANDOM +2062 +%\0echo\0$TTY +/dev/ttyp4 +%\0echo\0$VERSION +zsh\0v2.00.03 +%\0echo\0$USERNAME +pf +.De +.PP +The \fCcdpath\fP variable sets the search path for the \fCcd\fP command. +If you do not specify \fC.\fP somewhere in the path, it is assumed to +be the first component. +.Ds +%\0cdpath=(\0/usr\0~\0~/zsh\0) +%\0ls\0/usr +5bin\0\0\0\0\0\0\0\0\0dict\0\0\0\0\0\0\0\0\0lang\0\0\0\0\0\0\0\0\0net\0\0\0\0\0\0\0\0\0\0sccs\0\0\0\0\0\0\0\0\0sys +5include\0\0\0\0\0etc\0\0\0\0\0\0\0\0\0\0lector\0\0\0\0\0\0\0nserve\0\0\0\0\0\0\0services\0\0\0\0\0tmp +5lib\0\0\0\0\0\0\0\0\0export\0\0\0\0\0\0\0lib\0\0\0\0\0\0\0\0\0\0oed\0\0\0\0\0\0\0\0\0\0share\0\0\0\0\0\0\0\0ucb +adm\0\0\0\0\0\0\0\0\0\0games\0\0\0\0\0\0\0\0local\0\0\0\0\0\0\0\0old\0\0\0\0\0\0\0\0\0\0skel\0\0\0\0\0\0\0\0\0ucbinclude +bin\0\0\0\0\0\0\0\0\0\0geac\0\0\0\0\0\0\0\0\0lost+found\0\0\0openwin\0\0\0\0\0\0spool\0\0\0\0\0\0\0\0ucblib +boot\0\0\0\0\0\0\0\0\0hosts\0\0\0\0\0\0\0\0macsyma_417\0\0pat\0\0\0\0\0\0\0\0\0\0src\0\0\0\0\0\0\0\0\0\0xpg2bin +demo\0\0\0\0\0\0\0\0\0include\0\0\0\0\0\0man\0\0\0\0\0\0\0\0\0\0princeton\0\0\0\0stand\0\0\0\0\0\0\0\0xpg2include +diag\0\0\0\0\0\0\0\0\0kvm\0\0\0\0\0\0\0\0\0\0mdec\0\0\0\0\0\0\0\0\0pub\0\0\0\0\0\0\0\0\0\0swap\0\0\0\0\0\0\0\0\0xpg2lib +%\0cd\0spool +/usr/spool +%\0cd\0bin +/usr/bin +%\0cd\0func +~/func +%\0cd\0 +%\0cd\0pub +%\0pwd +/u/pfalstad/pub +%\0ls\0-d\0/usr/pub +/usr/pub +.De +\fBPATH\fP and \fBpath\fP both set the search path for commands. +These two variables are equivalent, except that one is a string +and one is an array. If the user modifies \fBPATH\fP, the shell +changes \fBpath\fP as well, and vice versa. +.Ds +%\0PATH=/bin:/usr/bin:/tmp:. +%\0echo\0$path +/bin\0/usr/bin\0/tmp\0. +%\0path=(\0/usr/bin\0.\0/usr/local/bin\0/usr/ucb\0) +%\0echo\0$PATH +/usr/bin:.:/usr/local/bin:/usr/ucb +.De +The same is true of \fBCDPATH\fP and \fBcdpath\fP: +.Ds +%\0echo\0$CDPATH +/usr:/u/pfalstad:/u/pfalstad/zsh +%\0CDPATH=/u/subbarao:/usr/src:/tmp +%\0echo\0$cdpath +/u/subbarao\0/usr/src\0/tmp +.De +In general, predefined parameters with names in all lowercase are +arrays; assignments to them take the form: +.Ds +\fIname\fR\fC=(\fR\0\fIelem\fR\0...\\0\fC)\fR +.De +Predefined parameters with names in all uppercase are strings. If +there is both an array and a string version of the same parameter, the +string version is a colon-separated list, like \fBPATH\fP. +.PP +\fBHISTFILE\fP is the name of the history file, where the history +is saved when a shell exits. +.Ds +%\0zsh +phoenix%\0HISTFILE=/tmp/history +phoenix%\0SAVEHIST=20 +phoenix%\0echo\0foo +foo +phoenix%\0date +Fri\0May\024\005:39:35\0EDT\01991 +phoenix%\0uptime +\0\05:39am\0\0up\04\0days,\020:02,\0\040\0users,\0\0load\0average:\02.30,\02.20,\02.00 +phoenix%\0exit +%\0cat\0/tmp/history +HISTFILE=/tmp/history +SAVEHIST=20 +echo\0foo +date +uptime +exit +%\0HISTSIZE=3 +%\0history +\0\0\028\0\0rm\0/tmp/history +\0\0\029\0\0HISTSIZE=3 +\0\0\030\0\0history +.De +If you have several incantations of \fBzsh\fP running at the same +time, like when using the X window system, it might be preferable to +append the history of each shell to a file when a shell exits instead +of overwriting the old contents of the file. You can get this +behaviour by setting the \fIAPPENDHISTORY\fP option. +.PP +In \fBzsh\fP, if you say +.Ds +%\0>file +.De +the command \fCcat\fP is normally assumed: +.Ds +%\0>file +foo!\0\0\0\0 +^D +%\0cat\0file +foo! +.De +Thus, you can view a file simply by typing: +.Ds +%\0file +%\0ls\0-l\0file +-rw-r--r--\0\01\0pfalstad\0\0\0\0\0\0\0\00\0May\024\005:41\0file +.De +If \fCNULLCMD\fP is unset, the shell reports an error if no +command is specified (like csh). +.Ds +%\0unset\0NULLCMD +%\0>file +zsh:\0redirection\0with\0no\0command +.De +Actually, \fBREADNULLCMD\fP is used whenever you have a null command +reading input from a single file. Thus, you can set \fBREADNULLCMD\fP +to \fCmore\fP or \fCless\fP rather than \fCcat\fP. Also, if you +set \fBNULLCMD\fP to \fC:\fP for sh compatibility, you can still read +files with \fC< file\fP if you leave \fBREADNULLCMD\fP set to \fCmore\fP. +.Sh "Prompting" +.PP +The default prompt for \fBzsh\fP is: +.Ds +phoenix%\0echo\0$PROMPT +%m%#\0 +.De +The \fC%m\fP stands for the short form of the current hostname, +and the \fC%#\fP stands for a \fC%\fP or a \fC#\fP, depending on whether +the shell is running as root or not. +\fBzsh\fP supports many other control sequences +in the \fBPROMPT\fP variable. +.Ds +%\0PROMPT='%/>\0' +/u/pfalstad/etc/TeX/zsh> + +%\0PROMPT='%~>\0'\0\0\0 +~/etc/TeX/zsh>\0 + +%\0PROMPT='%h\0%~>\0' +6\0~/etc/TeX/zsh>\0 +.De +\fC%h\fP\0represents\0the\0number\0of\0current\0history\0event. +.Ds +%\0PROMPT='%h\0%~\0%M>\0' +10\0~/etc/TeX/zsh\0apple-gunkies.gnu.ai.mit.edu>\0 + +%\0PROMPT='%h\0%~\0%m>\0' +11\0~/etc/TeX/zsh\0apple-gunkies>\0 + +%\0PROMPT='%h\0%t>\0' +12\06:11am>\0 + +%\0PROMPT='%n\0%w\0tty%l>' +pfalstad\0Fri\024\0ttyp0> +.De +\fBPROMPT2\fP is used in multiline commands, like for-loops. The +\fC%_\fP escape sequence was made especially for this prompt. It is +replaced by the kind of command that is being entered. +.Ds +%\0PROMPT2='%_>\0' +%\0for\0i\0in\0foo\0bar +for> + +%\0echo\0'hi +quote> +.De +Also available is the \fBRPROMPT\fP parameter. +If this is set, the shell puts a prompt on the \fIright\fP side +of the screen. +.Ds +%\0RPROMPT='%t' +%\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06:14am + +%\0RPROMPT='%~' +%\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~/etc/TeX/zsh + +%\0PROMPT='%l\0%T\0%m[%h]\0'\0RPROMPT='\0%~' +p0\06:15\0phoenix[5]\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~/etc/TeX/zsh +.De +These special escape sequences can also be used with the +\fC-P\fP option to \fCprint\fP: +.Ds +%\0print\0-P\0%h\0tty%l +15\0ttyp1 +.De +.PP +The \fBPOSTEDIT\fP parameter is printed whenever the editor exits. +This can be useful for termcap tricks. To highlight the prompt +and command line while leaving command output unhighlighted, try this: +.Ds +%\0POSTEDIT=`echotc\0se` +%\0PROMPT='%S%%\0' +.De +.Sh "Login/logout watching" +.PP +You can specify login or logout events to monitor +by setting the \fBwatch\fP variable. +Normally, this is done by specifying a list of usernames. +.Ds +%\0watch=(\0pfalstad\0subbarao\0sukthnkr\0egsirer\0) +.De +The \fClog\fP command reports all people logged in +that you are watching for. +.Ds +%\0log +pfalstad\0has\0logged\0on\0p0\0from\0mickey. +pfalstad\0has\0logged\0on\0p5\0from\0mickey. +%\0\fR...\fC +subbarao\0has\0logged\0on\0p8\0from\0phoenix. +%\0\fR...\fC +subbarao\0has\0logged\0off\0p8\0from\0phoenix. +%\0\fR...\fC +sukthnkr\0has\0logged\0on\0p8\0from\0dew. +%\0\fR...\fC +sukthnkr\0has\0logged\0off\0p8\0from\0dew. +.De +If you specify hostnames with an \fC@\fP prepended, +the shell will watch for all users logging in from +the specified host. +.Ds +%\0watch=(\0@mickey\0@phoenix\0) +%\0log +djthongs\0has\0logged\0on\0q2\0from\0phoenix. +pfalstad\0has\0logged\0on\0p0\0from\0mickey. +pfalstad\0has\0logged\0on\0p5\0from\0mickey. +.De +If you give a tty name with a \fC%\fP prepended, the shell +will watch for all users logging in on that tty. +.Ds +%\0watch=(\0%ttyp0\0%console\0) +%\0log +root\0has\0logged\0on\0console\0from\0. +pfalstad\0has\0logged\0on\0p0\0from\0mickey. +.De +The format of the reports may also be changed. +.Ds +%\0watch=(\0pfalstad\0gettes\0eps\0djthongs\0jcorr\0bdavis\0) +%\0log +jcorr\0has\0logged\0on\0tf\0from\0128.112.176.3:0. +jcorr\0has\0logged\0on\0r0\0from\0128.112.176.3:0. +gettes\0has\0logged\0on\0p4\0from\0yo:0.0. +djthongs\0has\0logged\0on\0pe\0from\0grumpy:0.0. +djthongs\0has\0logged\0on\0q2\0from\0phoenix. +bdavis\0has\0logged\0on\0qd\0from\0BRUNO. +eps\0has\0logged\0on\0p3\0from\0csx30:0.0. +pfalstad\0has\0logged\0on\0p0\0from\0mickey. +pfalstad\0has\0logged\0on\0p5\0from\0mickey. +%\0WATCHFMT='%n\0on\0tty%l\0from\0%M' +%\0log +jcorr\0on\0ttytf\0from\0128.112.176.3:0. +jcorr\0on\0ttyr0\0from\0128.112.176.3:0. +gettes\0on\0ttyp4\0from\0yo:0.0 +djthongs\0on\0ttype\0from\0grumpy:0.0 +djthongs\0on\0ttyq2\0from\0phoenix.Princeto +bdavis\0on\0ttyqd\0from\0BRUNO.pppl.gov +eps\0on\0ttyp3\0from\0csx30:0.0 +pfalstad\0on\0ttyp0\0from\0mickey.Princeton +pfalstad\0on\0ttyp5\0from\0mickey.Princeton +%\0WATCHFMT='%n\0fm\0%m' +%\0log +jcorr\0fm\0128.112.176.3:0 +jcorr\0fm\0128.112.176.3:0 +gettes\0fm\0yo:0.0 +djthongs\0fm\0grumpy:0.0 +djthongs\0fm\0phoenix +bdavis\0fm\0BRUNO +eps\0fm\0csx30:0.0 +pfalstad\0fm\0mickey +pfalstad\0fm\0mickey +%\0WATCHFMT='%n\0%a\0at\0%t\0%w.' +%\0log +jcorr\0logged\0on\0at\03:15pm\0Mon\020. +jcorr\0logged\0on\0at\03:16pm\0Wed\022. +gettes\0logged\0on\0at\06:54pm\0Wed\022. +djthongs\0logged\0on\0at\07:19am\0Thu\023. +djthongs\0logged\0on\0at\07:20am\0Thu\023. +bdavis\0logged\0on\0at\012:40pm\0Thu\023. +eps\0logged\0on\0at\04:19pm\0Thu\023. +pfalstad\0logged\0on\0at\03:39am\0Fri\024. +pfalstad\0logged\0on\0at\03:42am\0Fri\024. +.De +If you have a \fC.friends\fP file in your home directory, +a convenient way to make \fBzsh\fP watch for all your friends +is to do this: +.Ds +%\0watch=(\0$(<\0~/.friends)\0) +%\0echo\0$watch +subbarao\0maruchck\0root\0sukthnkr\0\fR... +.De +If watch is set to \fCall\fP, then all users logging in or out +will be reported. +.Sh "Options" +.PP +Some options have already been mentioned; here are a few more: +.PP +Using the \fIAUTOCD\fP option, you can simply type the name +of a directory, and it will become the current directory. +.Ds +%\0cd\0/ +%\0setopt\0autocd +%\0bin +%\0pwd +/bin +%\0../etc +%\0pwd +/etc +.De +With \fICDABLEVARS\fP, if the argument to \fCcd\fP is the name of a +parameter whose value is a valid directory, it will become +the current directory. +.Ds +%\0setopt\0cdablevars +%\0foo=/tmp +%\0cd\0foo +/tmp +.De +\fICORRECT\fP turns on spelling correction for commands, +and the \fICORRECTALL\fP option turns on spelling correction +for all arguments. +.Ds +%\0setopt\0correct +%\0sl +zsh:\0correct\0`sl'\0to\0`ls'\0[nyae]?\0y +%\0setopt\0correctall +%\0ls\0x.v11r4 +zsh:\0correct\0`x.v11r4'\0to\0`X.V11R4'\0[nyae]?\0n +/usr/princton/src/x.v11r4\0not\0found +%\0ls\0/etc/paswd +zsh:\0correct\0to\0`/etc/paswd'\0to\0`/etc/passwd'\0[nyae]?\0y +/etc/passwd +.De +If you press \fCy\fP +when the shell asks you if you want to correct a word, it will +be corrected. If you press \fCn\fP, it will be left alone. +Pressing \fCa\fP aborts the command, and pressing \fCe\fP brings the line +up for editing again, in case you agree the word is spelled wrong +but you don't like the correction. +.PP +Normally, a quoted expression may contain a newline: +.Ds +%\0echo\0' +>\0foo +>\0' + +foo + +% +.De +With \fICSHJUNKIEQUOTES\fP set, this is illegal, as it is +in csh. +.Ds +%\0setopt\0cshjunkiequotes +%\0ls\0'foo +zsh:\0unmatched\0' +.De +\fIGLOBDOTS\fP lets files beginning with a \fC.\fP be matched without +explicitly specifying the dot. +.Ds +%\0ls\0-d\0*x* +Mailboxes +%\0setopt\0globdots +%\0ls\0-d\0*x* +\&.exrc\0\0\0\0\0\0\0\0\0.pnewsexpert\0\0.xserverrc +\&.mushexpert\0\0\0.xinitrc\0\0\0\0\0\0Mailboxes +.De +\fIHISTIGNOREDUPS\fP prevents the current line from being +saved in the history if it is the same as the previous one; +\fIHISTIGNORESPACE\fP prevents the current line from being +saved if it begins with a space. +.Ds +%\0PROMPT='%h>\0' +39>\0setopt\0histignoredups +40>\0echo\0foo +foo +41>\0echo\0foo +foo +41>\0echo\0foo +foo +41>\0echo\0bar +bar +42>\0setopt\0histignorespace +43>\0\0echo\0foo +foo +43>\0\0echo\0fubar +fubar +43>\0\0echo\0fubar +fubar +.De +\fIIGNOREBRACES\fP turns off csh-style brace expansion. +.Ds +%\0echo\0x{y{z,a},{b,c}d}e +xyze\0xyae\0xbde\0xcde +%\0setopt\0ignorebraces +%\0echo\0x{y{z,a},{b,c}d}e +x{y{z,a},{b,c}d}e +.De +\fIIGNOREEOF\fP forces the user to type \fCexit\fP or \fClogout\fP, +instead of just pressing \fI^D\fP. +.Ds +%\0setopt\0ignoreeof +%\0^D +zsh:\0use\0'exit'\0to\0exit. +.De +\fIINTERACTIVECOMMENTS\fP turns on interactive comments; +comments begin with a \fC#\fP. +.Ds +%\0setopt\0interactivecomments +%\0date\0#\0this\0is\0a\0comment +Fri\0May\024\006:54:14\0EDT\01991 +.De +\fINOBEEP\fP makes sure the shell never beeps. +.PP +\fINOCLOBBER\fP prevents you from accidentally +overwriting an existing file. +.Ds +%\0setopt\0noclobber +%\0cat\0/dev/null\0>~/.zshrc +zsh:\0file\0exists:\0/u/pfalstad/.zshrc +.De +If you really do want to clobber a file, you can use the +\fC>!\fP operator. +To make things easier in this case, the \fC>\fP is stored in +the history list as a \fC>!\fP: +.Ds +%\0cat\0/dev/null\0>!\0~/.zshrc +%\0cat\0/etc/motd\0>\0~/.zshrc +zsh:\0file\0exists:\0/u/pfalstad/.zshrc +%\0!! +cat\0/etc/motd\0>!\0~/.zshrc +%\0\fR... +.De +\fIRCQUOTES\fP lets you use a more elegant method for including +single quotes in a singly quoted string: +.Ds +%\0echo\0'"don'\e''t\0do\0that."' +"don't\0do\0that." +%\0echo\0'"don''t\0do\0that."' +"dont\0do\0that." +%\0setopt\0rcquotes +%\0echo\0'"don''t\0do\0that."' +"don't\0do\0that." +.De +Finally, +\fISUNKEYBOARDHACK\fP wins the award for the strangest option. +If a line ends with \fC`\fP, and there are an odd number of them +on the line, the shell will ignore the trailing \fC`\fP. This +is provided for keyboards whose RETURN key is too small, +and too close to the \fC`\fP key. +.Ds +%\0setopt\0sunkeyboardhack +%\0date` +Fri\0May\024\006:55:38\0EDT\01991 +.De +.Sh "Closing Comments" +.PP +I (Bas de Bakker) would be happy to receive mail if anyone has any +tricks or ideas to add to this document, or if there are some points +that could be made clearer or covered more thoroughly. Please notify +me of any errors in this document. +.if o \{\ +.bp +.sv 1i +.\} +.pn 1 +.bp +.PX diff --git a/Doc/zmacros.yo b/Doc/zmacros.yo new file mode 100644 index 000000000..c6df3d551 --- /dev/null +++ b/Doc/zmacros.yo @@ -0,0 +1,32 @@ +STARTDEF() + +DEFINEMACRO(includefile)(1)(\ + TYPEOUT(Including file ARG1)\ + comment(Yodl file: ARG1)NL()\ + INCLUDEFILE(ARG1)\ +) + +DEFINEMACRO(def)(3)(\ + DEFINEMACRO(ARG1)(ARG2)(ARG3)\ +) +DEFINEMACRO(undef)(1)(\ + UNDEFINEMACRO(ARG1)\ +) +DEFINEMACRO(redef)(3)(\ + UNDEFINEMACRO(ARG1)\ + DEFINEMACRO(ARG1)(ARG2)(ARG3)\ +) + +DEFINEMACRO(LPAR)(0)(CHAR(40)) +DEFINEMACRO(RPAR)(0)(CHAR(41)) +DEFINEMACRO(PLUS)(0)(CHAR(+)) + +DEFINEMACRO(NL)(0)( +) + +DEFINEMACRO(ifzman)(1)() +DEFINEMACRO(ifnzman)(1)(ARG1) +DEFINEMACRO(ifztexi)(1)() +DEFINEMACRO(ifnztexi)(1)(ARG1) + +ENDDEF() diff --git a/Doc/zman.yo b/Doc/zman.yo new file mode 100644 index 000000000..7d7fc120e --- /dev/null +++ b/Doc/zman.yo @@ -0,0 +1,192 @@ +STARTDEF() + +TYPEOUT(Zsh Yodl-to-man converter) +DEFINESYMBOL(zman) + +INCLUDEFILE(zmacros) +redef(ifzman)(1)(ARG1) +redef(ifnzman)(1)() + +def(CMT)(0)(NOTRANS(.')) + +COMMENT(--- character translation ---) + +DEFINECHARTABLE(standard)( + '' = ".' (avoiding a yodl bug)" + '\\' = "\\e" + '.' = "\\&." + '-' = "\\-" +) +USECHARTABLE(standard) + +def(STDPAR)(0)(\ + redef(PARAGRAPH)(0)(NL()NOTRANS(.PP)NL())\ +) + +COMMENT(--- emphasised text ---) + +def(em)(1)(NOTRANS(\fI)ARG1NOTRANS(\fP)) +def(bf)(1)(NOTRANS(\fB)ARG1NOTRANS(\fP)) +def(tt)(1)(NOTRANS(\fB)ARG1NOTRANS(\fP)) +def(var)(1)(NOTRANS(\fI)ARG1NOTRANS(\fP)) + +COMMENT(--- man page headers ---) + +def(manpage)(4)(\ + NOTRANS(.TH ")ARG1" "ARG2" "ARG3" "ARG4"\ +) +def(manpagename)(2)(\ + sect(NAME)NL()\ + ARG1 - ARG2\ +) + +COMMENT(--- TeXinfo headers and conditionals ---) + +def(texinfo)(2)(CMT()) + +def(texiifinfo)(1)() +def(texiiftex)(1)() + +def(texipage)(0)(CMT()) +def(texititlepage)(0)(CMT()) +def(texiendtitlepage)(0)(CMT()) +def(texititle)(1)(CMT()) +def(texisubtitle)(1)(CMT()) +def(texiauthor)(1)(CMT()) + +def(texinode)(4)(CMT()) +def(texitop)(1)(CMT()) + +COMMENT(--- section divisions ---) + +def(chapter)(1)(CMT()) + +def(sect)(1)(\ + NOTRANS(.SH ")UPPERCASE(ARG1)(0)"NL()\ + STDPAR()\ + CMT()\ +) + +def(subsect)(1)(\ + NOTRANS(.SS ")ARG1"NL()\ + CMT()\ +) + +COMMENT(--- comment output ---) + +DEFINECHARTABLE(roffcomment)( + '\n' = "\n.\\\" " +) +def(comment)(1)(\ + USECHARTABLE(roffcomment)\ + NOTRANS(.\" )ARG1\ + USECHARTABLE(standard)\ +) + +COMMENT(--- cross-references ---) + +def(manref)(2)(\ + NOTRANS(\fI)ARG1NOTRANS(\fP)(ARG2)\ +) +def(zmanref)(1)(manref(ARG1)(1)) +def(noderef)(1)(the section `ARG1') + +COMMENT(--- lists ---) + +def(startitem)(0)(\ + NOTRANS(.PD 0)\ + redef(ITEM)(0)(NOTRANS(.PD)NL())\ +) +def(enditem)(0)(\ + ENDITEM()\ + STDPAR()\ + redef(ENDITEM)(0)(NOTRANS(.RE)STDPAR())\ +) +def(item)(2)(\ + NOTRANS(.TP)NL()\ + ITEM()\ + redef(ITEM)(0)()\ + ARG1\ + redef(ENDITEM)(0)(CMT())\ + redef(PARAGRAPH)(0)(\ + NL()NOTRANS(.RS)NL()NOTRANS(.PP)NL()\ + STDPAR()\ + redef(ENDITEM)(0)(NOTRANS(.RE)STDPAR())\ + )\ + ARG2\ + ENDITEM()\ +) +def(xitem)(1)(\ + NOTRANS(.TP)NL()\ + NOTRANS(.PD 0)NL()\ + redef(ITEM)(0)(NOTRANS(.PD)NL())\ + ARG1\ +) + +def(startsitem)(0)(\ + NOTRANS(.PD 0)\ +) +def(endsitem)(0)(\ + NOTRANS(.PD)\ +) +def(sitem)(2)(\ + NOTRANS(.TP)NL()\ + ARG1NL()\ + ARG2\ +) +def(sxitem)(1)(\ + NOTRANS(.TP)NL()\ + ARG1\ +) + +def(startlist)(0)(\ + NOTRANS(.PD 0)\ +) +def(endlist)(0)(\ + NOTRANS(.PD)\ +) +def(list)(1)(\ + NOTRANS(.TP)NL()\ + ARG1\ +) + +def(startitemize)(0)(\ + startitem()\ +) +def(enditemize)(0)(\ + enditem()\ +) +def(itemiz)(1)(\ + item(NOTRANS(\)LPAR()NOTRANS(bu))(NL()ARG1NL())\ +) + +COMMENT(--- special effects ---) + +def(nofill)(1)(\ + NOTRANS(.nf)NL()\ + ARG1\ + NL()NOTRANS(.fi)\ +) + +def(indent)(1)(\ + NOTRANS(.RS)\ + ARG1\ + NOTRANS(.RE)\ +) + +COMMENT(--- hyperlink menus ---) + +def(startmenu)(0)(CMT()) +def(endmenu)(0)(CMT()) +def(menu)(1)(CMT()) + +COMMENT(--- indices ---) + +def(cindex)(1)(CMT()) +def(findex)(1)(CMT()) +def(kindex)(1)(CMT()) +def(pindex)(1)(CMT()) +def(tindex)(1)(CMT()) +def(vindex)(1)(CMT()) + +ENDDEF()\ diff --git a/Doc/zsh.yo b/Doc/zsh.yo new file mode 100644 index 000000000..a97f023e7 --- /dev/null +++ b/Doc/zsh.yo @@ -0,0 +1,83 @@ +ifzman(\ +IFDEF(ZSHALL)(\ +def(ifzshone)(1)()\ +def(ifzshall)(1)(ARG1)\ +manpage(ZSHALL)(1)(date())(zsh version()) +manpagename(zshall)(the Z shell meta-man page) +)(\ +def(ifzshone)(1)(ARG1)\ +def(ifzshall)(1)()\ +manpage(ZSH)(1)(date())(zsh version()) +manpagename(zsh)(the Z shell) +)\ +)\ +ifnzman(\ +def(ifzshone)(1)()\ +def(ifzshall)(1)()\ +)\ +ifztexi(\ +texinfo(zsh.info)(zsh) +NOTRANS(@setchapternewpage odd +@iftex +@finalout +@afourpaper +@end iftex) +texititlepage() +texititle(The Z Shell Guide) +texisubtitle(Version version()) +texisubtitle(Updated date()) +texiauthor(Original documentation by Paul Falstad) +texipage() +This is a texinfo version of the documentation for the Z Shell, originally by +Paul Falstad. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +texiendtitlepage() +)\ +ifnzman(includefile(Zsh/guide.yo)) +includefile(Zsh/intro.yo) +includefile(Zsh/invoke.yo) +includefile(Zsh/files.yo) +ifnzman(includefile(Zsh/grammar.yo)) +ifnzman(includefile(Zsh/redirect.yo)) +ifnzman(includefile(Zsh/exec.yo)) +ifnzman(includefile(Zsh/func.yo)) +ifnzman(includefile(Zsh/jobs.yo)) +ifnzman(includefile(Zsh/arith.yo)) +ifnzman(includefile(Zsh/cond.yo)) +ifnzman(includefile(Zsh/compat.yo)) +ifnzman(includefile(Zsh/prompt.yo)) +ifnzman(includefile(Zsh/restricted.yo)) +ifnzman(includefile(Zsh/expn.yo)) +ifnzman(includefile(Zsh/params.yo)) +ifnzman(includefile(Zsh/options.yo)) +ifnzman(includefile(Zsh/builtins.yo)) +ifnzman(includefile(Zsh/zle.yo)) +ifnzman(includefile(Zsh/compctl.yo)) +ifnzman(includefile(Zsh/modules.yo)) +ifzshall(\ +def(source)(1)(NOTRANS(.so )man1/ARG1NOTRANS(.)1)\ +CMT() +source(zshmisc) +source(zshexpn) +source(zshparam) +source(zshoptions) +source(zshbuiltins) +source(zshzle) +source(zshcompctl) +source(zshmodules) +manpage(ZSHALL)(1)(date())(zsh version()) +)\ +ifzman(includefile(Zsh/filelist.yo)) +ifzman(includefile(Zsh/seealso.yo)) +ifnzman(includefile(Zsh/index.yo)) diff --git a/Doc/zshbuiltins.yo b/Doc/zshbuiltins.yo new file mode 100644 index 000000000..557ba7995 --- /dev/null +++ b/Doc/zshbuiltins.yo @@ -0,0 +1,3 @@ +manpage(ZSHBUILTINS)(1)(date())(zsh version()) +manpagename(zshbuiltins)(zsh built-in commands) +includefile(Zsh/builtins.yo) diff --git a/Doc/zshcompctl.yo b/Doc/zshcompctl.yo new file mode 100644 index 000000000..3e3bedf5a --- /dev/null +++ b/Doc/zshcompctl.yo @@ -0,0 +1,3 @@ +manpage(ZSHCOMPCTL)(1)(date())(zsh version()) +manpagename(zshcompctl)(zsh programmable completion) +includefile(Zsh/compctl.yo) diff --git a/Doc/zshexpn.yo b/Doc/zshexpn.yo new file mode 100644 index 000000000..aa8decebb --- /dev/null +++ b/Doc/zshexpn.yo @@ -0,0 +1,3 @@ +manpage(ZSHEXPN)(1)(date())(zsh version()) +manpagename(zshexpn)(zsh expansion and substitution) +includefile(Zsh/expn.yo) diff --git a/Doc/zshmisc.yo b/Doc/zshmisc.yo new file mode 100644 index 000000000..332df1e25 --- /dev/null +++ b/Doc/zshmisc.yo @@ -0,0 +1,12 @@ +manpage(ZSHMISC)(1)(date())(zsh version()) +manpagename(zshmisc)(everything and then some) +includefile(Zsh/grammar.yo) +includefile(Zsh/redirect.yo) +includefile(Zsh/exec.yo) +includefile(Zsh/func.yo) +includefile(Zsh/jobs.yo) +includefile(Zsh/arith.yo) +includefile(Zsh/cond.yo) +includefile(Zsh/compat.yo) +includefile(Zsh/prompt.yo) +includefile(Zsh/restricted.yo) diff --git a/Doc/zshmodules.yo b/Doc/zshmodules.yo new file mode 100644 index 000000000..9def096ca --- /dev/null +++ b/Doc/zshmodules.yo @@ -0,0 +1,3 @@ +manpage(ZSHMODULES)(1)(date())(zsh version()) +manpagename(zshmodules)(zsh loadable modules) +includefile(Zsh/modules.yo) diff --git a/Doc/zshoptions.yo b/Doc/zshoptions.yo new file mode 100644 index 000000000..266d32ac0 --- /dev/null +++ b/Doc/zshoptions.yo @@ -0,0 +1,3 @@ +manpage(ZSHOPTIONS)(1)(date())(zsh version()) +manpagename(zshoptions)(zsh options) +includefile(Zsh/options.yo) diff --git a/Doc/zshparam.yo b/Doc/zshparam.yo new file mode 100644 index 000000000..ac39e9267 --- /dev/null +++ b/Doc/zshparam.yo @@ -0,0 +1,3 @@ +manpage(ZSHPARAM)(1)(date())(zsh version()) +manpagename(zshparam)(zsh parameters) +includefile(Zsh/params.yo) diff --git a/Doc/zshzle.yo b/Doc/zshzle.yo new file mode 100644 index 000000000..66e1d588f --- /dev/null +++ b/Doc/zshzle.yo @@ -0,0 +1,3 @@ +manpage(ZSHZLE)(1)(date())(zsh version()) +manpagename(zshzle)(zsh command line editor) +includefile(Zsh/zle.yo) diff --git a/Doc/ztexi.yo b/Doc/ztexi.yo new file mode 100644 index 000000000..b8e115ec0 --- /dev/null +++ b/Doc/ztexi.yo @@ -0,0 +1,246 @@ +STARTDEF() + +TYPEOUT(Zsh Yodl-to-TeXinfo converter) +DEFINESYMBOL(ztexi) + +INCLUDEFILE(zmacros) +redef(ifztexi)(1)(ARG1) +redef(ifnztexi)(1)() + +def(CMT)(0)(NOTRANS(@c)) + +ATEXIT(\ + NL()\ + NOTRANS(@setchapternewpage odd)NL()\ + NOTRANS(@contents)NL()\ + NOTRANS(@bye)NL()\ +) + +COMMENT(--- character translation ---) + +DEFINECHARTABLE(standard)( + '' = "@c (avoiding a yodl bug)" + '@' = "@@" + '{' = "@{" + '}' = "@}" +) +USECHARTABLE(standard) +SUBST('')(NOTRANS(@value{dsq})) + +def(STDPAR)(0)(redef(PARAGRAPH)(0)(NL()NL()NOTRANS(@noindent)NL())) + +COMMENT(--- emphasised text ---) + +def(em)(1)(NOTRANS(@emph{)ARG1NOTRANS(})) +def(bf)(1)(NOTRANS(@cite{)ARG1NOTRANS(})) +def(tt)(1)(NOTRANS(@code{)ARG1NOTRANS(})) +def(var)(1)(NOTRANS(@var{)ARG1NOTRANS(})) + +COMMENT(--- man page headers ---) + +def(manpage)(4)(STDPAR()) +def(manpagename)(2)() + +COMMENT(--- TeXinfo headers and conditionals ---) + +def(texinfo)(2)(\ + STDPAR()\ + NOTRANS(\input texinfo.tex)NL()\ + NOTRANS(@c %**start of header)NL()\ + NOTRANS(@setfilename )ARG1NL()\ + NOTRANS(@settitle )ARG2NL()\ + NOTRANS(@c %**end of header)NL()\ + NL()\ + NOTRANS(@ifinfo)NL()\ + NOTRANS(@set dsq @'@')NL()\ + NOTRANS(@end ifinfo)NL()\ + NOTRANS(@iftex)NL()\ + NOTRANS(@set dsq '{}')NL()\ + NOTRANS(@end iftex)NL()\ +) + +def(texiifinfo)(1)(\ + NOTRANS(@ifinfo)NL()\ + ARG1\ + NOTRANS(@end ifinfo)NL()\ +) +def(texiiftex)(1)(\ + NOTRANS(@iftex)NL()\ + ARG1\ + NOTRANS(@end iftex)NL()\ +) + +def(texipage)(0)(\ + NOTRANS(@page)\ +) +def(texititlepage)(0)(\ + NOTRANS(@titlepage)\ +) +def(texiendtitlepage)(0)(\ + NOTRANS(@end titlepage)\ +) +def(texititle)(1)(\ + NOTRANS(@title )ARG1\ +) +def(texisubtitle)(1)(\ + NOTRANS(@subtitle )ARG1\ +) +def(texiauthor)(1)(\ + NOTRANS(@author )ARG1\ +) + +def(texinode)(4)(\ + NOTRANS(@node )ARG1, ARG2, ARG3, ARG4\ +) +def(texitop)(1)(\ + NOTRANS(@top )ARG1\ +) + +COMMENT(--- section divisions ---) + +def(chapter)(1)(\ + NL()\ + NOTRANS(@chapter )ARG1NL()\ + NOTRANS(@noindent)\ +) + +def(sect)(1)(\ + NL()\ + NOTRANS(@section )ARG1NL()\ + NOTRANS(@noindent)\ +) + +def(subsect)(1)(\ + NL()\ + NOTRANS(@subsection )ARG1NL()\ + NOTRANS(@noindent)\ +) + +COMMENT(--- comment output ---) + +DEFINECHARTABLE(texicomment)( + '\n' = "\n@c " +) +def(comment)(1)(\ + USECHARTABLE(texicomment)\ + NOTRANS(@c )ARG1\ + USECHARTABLE(standard)\ +) + +COMMENT(--- cross-references ---) + +def(manref)(2)(man page ARG1LPAR()ARG2RPAR()) +def(zmanref)(1)(manref(ARG1)(1)) +def(noderef)(1)(\ + NOTRANS(@ref{)ARG1NOTRANS(})\ +) + +COMMENT(--- lists ---) + +def(startitem)(0)(\ + NOTRANS(@table @asis)\ + redef(ITEMX)(0)()\ +) +def(enditem)(0)(\ + NOTRANS(@end table)\ +) +def(item)(2)(\ + NOTRANS(@item)ITEMX() ARG1\ + ARG2\ + redef(ITEMX)(0)()\ +) +def(xitem)(1)(\ + NOTRANS(@item)ITEMX() ARG1\ + redef(ITEMX)(0)(x)\ +) + +def(startsitem)(0)(\ + startitem()\ +) +def(endsitem)(0)(\ + enditem()\ +) +def(sitem)(2)(\ + item(ARG1)(NL()ARG2)\ +) +def(sxitem)(1)(\ + xitem(ARG1)\ +) + +def(startlist)(0)(\ + startitem()\ +) +def(endlist)(0)(\ + enditem()\ +) +def(list)(1)(\ + item(ARG1)()\ +) + +def(startitemize)(0)(\ + NOTRANS(@itemize @bullet)NL()\ +) +def(enditemize)(0)(\ + NOTRANS(@end itemize)\ +) +def(itemiz)(1)(\ + sitem()(ARG1)\ +) + +COMMENT(--- special effects ---) + +DEFINECHARTABLE(nofillchars)( + '@' = "@@" + '{' = "@{" + '}' = "@}" + '\n' = "@*\n" +) +def(nofill)(1)(\ + USECHARTABLE(nofillchars)\ + ARG1\ + USECHARTABLE(standard)\ +) + +def(indent)(1)(\ + ARG1\ +) + +COMMENT(--- hyperlink menus ---) + +def(startmenu)(0)(\ + NOTRANS(@menu)\ +) +def(endmenu)(0)(\ + NOTRANS(@end menu)\ +) +def(menu)(1)(\ + * ARG1NOTRANS(::)\ +) + +COMMENT(--- indices ---) + +def(cindex)(1)(\ + NOTRANS(@cindex )ARG1\ +) + +def(findex)(1)(\ + NOTRANS(@findex )ARG1\ +) + +def(kindex)(1)(\ + NOTRANS(@kindex )ARG1\ +) + +def(pindex)(1)(\ + NOTRANS(@pindex )ARG1\ +) + +def(tindex)(1)(\ + NOTRANS(@tindex )ARG1\ +) + +def(vindex)(1)(\ + NOTRANS(@vindex )ARG1\ +) + +ENDDEF()\ diff --git a/Etc/.cvsignore b/Etc/.cvsignore new file mode 100644 index 000000000..9f48d4e1b --- /dev/null +++ b/Etc/.cvsignore @@ -0,0 +1,3 @@ +Makefile +FAQ +FAQ.html diff --git a/Etc/.distfiles b/Etc/.distfiles new file mode 100644 index 000000000..1eb7c1a50 --- /dev/null +++ b/Etc/.distfiles @@ -0,0 +1,5 @@ +DISTFILES_SRC=' + .cvsignore .distfiles Makefile.in + BUGS CONTRIBUTORS FAQ FAQ.yo FEATURES MACHINES NEWS + FTP-README pubring.pgp +' diff --git a/Etc/BUGS b/Etc/BUGS new file mode 100644 index 000000000..2a255444f --- /dev/null +++ b/Etc/BUGS @@ -0,0 +1,41 @@ +----------------- +KNOWN BUGS IN ZSH +----------------- + +------------------------------------------------------------------------ +Completion has a habit of doing the wrong thing after a +backslash/newline. +------------------------------------------------------------------------ +If you suspend "man", zle seems to get into cooked mode. It works ok +for plain "less". +It is not specific neither to man nor to zsh. +E.g. call the following program foo: +#include +#include + +int main(int argc, char *argv[]) +{ + int status; + + if (!fork()) /* child */ + execvp(argv[1], argv + 1); + else /* parent */ + wait(&status); +} +Then if you suspend +% foo less something +from zsh/bash, zle/readline gets into cooked mode. +------------------------------------------------------------------------ +% zsh -c 'cat a_long_file | less ; :' +can be interrupted with ^C. The prompt comes back and less is orphaned. +If you go to the end of the file with less and cat terminates, ^C +will not terminate less. The `; :' after less forces zsh to fork before +executing less. +------------------------------------------------------------------------ +The pattern %?* matches names beginning with %? instead of names with at +least two characters beginning with %. This is a hack to allow %?foo job +substitution without quoting. This behaviour is incompatible with sh +and ksh and may be removed in the future. A good fix would be to keep +such patterns unchanged if they do not match regardless of the state of +the nonomatch and nullglob options. +------------------------------------------------------------------------ diff --git a/Etc/CONTRIBUTORS b/Etc/CONTRIBUTORS new file mode 100644 index 000000000..52d664fad --- /dev/null +++ b/Etc/CONTRIBUTORS @@ -0,0 +1,127 @@ +---------------- +ZSH CONTRIBUTORS +---------------- + +Zsh was originally written by Paul Falstad . Zsh is +now maintained by the members of the zsh-workers mailing list +. The development is currently coordinated +by Andrew Main (Zefram) . + +This file credits only the major contributors to the current release. +See the ChangeLog files for a complete list of people who have submitted +patches. Note that email addresses below and in the ChangeLog file +are included for disambiguation purposes only, and are not guaranteed +to be currently accurate. If you feel that you or someone else have +been unfairly omitted from this list please mail the current maintainer +at . + +Version 3.0 +----------- + +* Richard Coleman maintained the code till the + release of zsh-2.6-beta16. Converted zsh to use autoconf thus greatly + improving the portability. Rewrote signal handling code. Reorganized + internal hash tables and rewrote the related builtins (enable, disable, + hash, unhash). Made some cleanups in exec.c. + +* Zoltán Hidvégi maintained zsh from version + 2.6-beta16. Rewrote most of the lexer and substitution and the related + completion code. Improved sh/ksh/POSIX compatibility. Fixed lots + of bugs in completion, parameter and history code. Made zsh fully + 8-bit clean. Made some reorganizations in exec.c. Fixed signal + handling bugs. Fixed lots of bugs in various places. + +* Peter W. Stephenson the maintainer of the zsh FAQ. + Reorganizations in exec.c. Rewrote and reorganized the history code. + Rewrote the zshcompctl manual page. Fixed several bugs related to + programmable completion. Fixed several signal handling bugs. Rewrote + test and read builtins. Lots of other bugfixes. + +* Andrew Main (Zefram) reorganized builtin.c. + Rewrote large parts of the zle vi mode. Redirection fixes. Reorganized + parts of the completion code, added some enhancements and fixed lots of + bugs. Made zle fully 8-bit clean. Fixed several zle bugs. Reorganized + zsh option handling. Lots of other bugfixes. + +* Sven Wischnowsky wrote most of the + programmable completion code in zsh-2.5.0. Several bugfixes in exec.c + and jobs.c. Lots of completion bugfixes and enhancements. + +* Geoff Wing rewrote most of zle_refresh.c. Some + other bugfixes. + +* Clive Messer brought the texinfo documentation + up-to-date. + +* Mark Borges maintains the zsh web page + (http://www.mal.com/zsh/). Several documentation fixes. Maintains the + texinfo documentation together with Clive. + +* Wayne Davison improved the the zle search functions + and made them 8-bit clean. Some other little bugfixes. + +* Bart Schaefer submitted several + bugfixes, reported lots of bugs and gave many very useful suggestions. + +Version 2.5 +----------- + +Bas de Bakker maintained zsh till the release of zsh-2.5.0. People who +have contributed to zsh-2.5.0 are (in lexical order): + +Chris.Moore@src.bae.co.uk (Chris Moore) +Harald.Eikrem@delab.sintef.no +Irving_Wolfe@happy-man.com (Irving Wolfe) +Jarkko.Hietaniemi@hut.fi (Jarkko Hietanimi) +P.Stephenson@swansea.ac.uk (Peter Stephenson) +Richard.Sharman@software.mitel.com (Richard Sharman) +Tero_Kivinen@hut.FI (Tero Kivinen) +arf@maths.nott.ac.uk (Anthony Iano-Fletcher) +bas@phys.uva.nl (Bas de Bakker) +benson@odi.com (Benson Margulies) +billb@bedford.progress.com (Bill Burton) +brown@wi.extrel.com (M. Brown) +carlos@snfep1.if.usp.br (Carlos Carvalho) +cedman@capitalist.princeton.edu (Carl Edman) +chip%fin@myrddin.sybus.com (Chip Salzenberg) +chs@apu.fi (Hannu Strang) +coleman@math.gatech.edu (Richard Coleman) +cross@eng.umd.edu (Chris Ross) +dm@cs.brown.edu (Dimitris Michailidis) +dmm0t@rincewind.mech.virginia.edu (David M. Meyer) +esky@CS.UCLA.EDU (Eskandar Ensafi) +franl@centerline.com (Fran Litterio) +gansevle@cs.utwente.nl (Fred Gansevles) +gnohmon@ssiny.com (Ralph Betza) +guillaum@clipper.ens.fr (Florent Guillaume) +guthrie@math.upenn.edu (John Guthrie) +hegedus@celeste.eng.yale.edu (Peter Hegedus) +henryg@tusc.com.au (Henry Guillaume) +hoh@approve.se (Goran Larsson) +hooft@chem.ruu.nl (Rob Hooft) +hsw1@papa.attmail.com (Stephen Harris) +irving@happy-man.com (Irving Wolfe) +jch@cs.cmu.edu (Jonathan Hardwick) +jos@oce.nl (Jos Backus) +liblit@cs.psu.edu (Benjamin Liblit) +marc@cam.org (Marc Boucher) +mason@werple.apana.org.au (Geoff Wing) +mycroft@gnu.ai.mit.edu (Charles Hannum) +mystic@axposf.pa.dec.com (D. Hall) +norbert@i3.informatik.rwth-aachen.de (Norbert Kiesel) +oberon@cs.tu-berlin.de (Sven Wischnowsky) +pclink@qld.tne.oz.au (Rick) +pem@aaii.oz.au (Paul Maisano) +per@efd.lth.se (Per Foreby) +pf@z-code.com (Paul Falstad) +roderick@ibcinc.com (Roderick Schertler) +schaefer@z-code.com (Bart Schaefer) +schlangm@informatik.uni-muenchen.de (Harald Schlangmann) +seniorr@teleport.com (Russell Senior) +sinclair@dcs.gla.ac.uk (Duncan Sinclair) +sterling@oldcolo.com (Bruce Sterling Woodcock) +suzuki@otsl.oki.co.jp (Hisao Suzuki) +tsm@cs.brown.edu (Timothy Miller) +vogelke@c17mis.wpafb.af.mil (Karl E. Vogel) +wacker@physik.uni-dortmund.de (Klaus Wacker) +wacren@cis10.ens-cachan.fr (Laurent Wacrenier) diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo new file mode 100644 index 000000000..3bb53de39 --- /dev/null +++ b/Etc/FAQ.yo @@ -0,0 +1,2018 @@ +mailto(pws@ifh.de)\ +whentxt(notableofcontents())\ +COMMENT(-- mytt is like tt but adds quotes `like this' for plain text --)\ +def(mytt)(1)(\ + whentxt(`ARG1')\ + whenhtml(tt(ARG1))\ + whenlatex(tt(ARG1))\ + whenms(tt(ARG1))\ + whensgml(tt(ARG1)))\ +COMMENT(-- mybf/em are like bf/em but add *emphasis* for text too --)\ +def(mybf)(1)(\ + whentxt(*ARG1*)\ + whenhtml(bf(ARG1))\ + whenlatex(bf(ARG1))\ + whenms(bf(ARG1))\ + whensgml(bf(ARG1))) +def(myem)(1)(\ + whentxt(_ARG1_)\ + whenhtml(em(ARG1))\ + whenlatex(em(ARG1))\ + whenms(em(ARG1))\ + whensgml(em(ARG1)))\ +COMMENT(-- mydit is like dit but no `o' for text mode --)\ +def(mydit)(1)(\ + whenlatex(dit(ARG1))\ + whenhtml(dit(ARG1))\ + whentxt(ARG1)\ + whenman(dit(ARG1))\ + whenms(dit(ARG1))\ + whensgml(dit(ARG1)))\ +COMMENT(-- myeit is like eit but fancier text formatting --)\ +def(myeit)(0)(\ + whenlatex(eit())whenhtml(eit())whenman(eit())whenms(eit())whensgml(eit())\ + whentxt(USECOUNTER(XXenumcounter)CHAR(41)))\ +def(myeitd)(0)(\ + whenlatex(eit())whenhtml(eit())whenman(eit())whenms(eit())whensgml(eit())\ + whentxt(USECOUNTER(XXenumcounter).))\ +COMMENT(-- don't want headers for text, USENET headers must come first --)\ +def(myreport)(3)(\ +whentxt(report()()())\ +whenhtml(report(ARG1)(ARG2)(ARG3))\ +whenlatex(report(ARG1)(ARG2)(ARG3))\ +whenman(report(ARG1)(ARG2)(ARG3))\ +whenms(report(ARG1)(ARG2)(ARG3))\ +whensgml(report(ARG1)(ARG2)(ARG3))) +myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1998/10/26) +COMMENT(-- the following are for Usenet and must appear first)\ +description( +mydit(Archive-Name:) unix-faq/shell/zsh +mydit(Last-Modified:) 1998/10/26 +mydit(Submitted-By:) email(pws@amtp.liv.ac.uk (Peter Stephenson)) +mydit(Version:) $Id: FAQ.yo,v 1.1 1999/04/15 18:05:37 akr Exp $ +mydit(Frequency:) Monthly +mydit(Copyright:) (C) P.W. Stephenson, 1995, 1996, 1997, 1998 \ +(see end of document) +) + +bf(Changes since issue posted September 1998:) +description( +mydit(2.1) Another mytt(typeset) difference turned up. +mydit(5.4) Slight addition to Y2K item (prompt formatting) +) + +This document contains a list of frequently-asked (or otherwise +significant) questions concerning the Z-shell, a command interpreter +for many UNIX systems which is freely available to anyone with FTP +access. Zsh is among the most powerful freely available Bourne-like +shell for interactive use. + +If you have never heard of mytt(sh), mytt(csh) or mytt(ksh), then you are +probably better off to start by reading a general introduction to UNIX +rather than this document. + +If you just want to know how to get your hands on the latest version, +skip to question link(1.6)(16); if you want to know what to do with +insoluble problems, go to link(5.2)(52). + +whentxt(Notation: Quotes `like this' are ordinary textual quotation +marks. Other uses of quotation marks are input to the shell.) + +COMMENT(-- need to do this specially in text since it should go here --) +whentxt(Contents: +Chapter 1: Introducing zsh and how to install it +1.1. Sources of information +1.2. What is it? +1.3. What is it good at? +1.4. On what machines will it run? (Plus important compilation notes) +1.5. What's the latest version? +1.6. Where do I get it? +1.7. I don't have root access: how do I make zsh my login shell? + +Chapter 2: How does zsh differ from...? +2.1. sh and ksh? +2.2. csh? +2.3. Why do my csh aliases not work? (Plus other alias pitfalls.) +2.4. tcsh? +2.5. bash? +2.6. Shouldn't zsh be more/less like ksh/(t)csh? + +Chapter 3: How to get various things to work +3.1. Why does `$var' where `var="foo bar"' not do what I expect? +3.2. What is the difference between `export' and the ALL_EXPORT option? +3.3. How do I turn off spelling correction/globbing for a single command? +3.4. How do I get the meta key to work on my xterm? +3.5. How do I automatically display the directory in my xterm title bar? +3.6. How do I make the completion list use eight bit characters? +3.7. Why do the cursor (arrow) keys not work? +3.8. Why does my terminal act funny in some way? +3.9. Why does zsh not work in an Emacs shell mode any more? +3.10. Why do my autoloaded functions not autoload [the first time]? +3.11. How does base arithmetic work? +3.12. How do I get a newline in my prompt? +3.13. Why does `bindkey ^a command-name' or 'stty intr ^-' do something funny? +3.14. Why can't I bind \C-s and \C-q any more? +3.15. How do I execute command `foo' within function `foo'? +3.16. Why do history substitutions with single bangs do something funny? +3.17. Why does zsh kill off all my background jobs when I logout? +3.18. How do I list all my history entries? +3.19. How does the alternative loop syntax, e.g. mytt(while {...} {...}) work? +3.20. Why is my history not being saved? + +Chapter 4: The mysteries of completion +4.1. What is completion? +4.2. What sorts of things can be completed? +4.3. How does zsh deal with ambiguous completions? +4.4. How do I complete in the middle of words / just what's before the cursor? +4.5. How do I get started with programmable completion? +4.6. And if programmable completion isn't good enough? + +Chapter 5: The future of zsh +5.1. What bugs are currently known and unfixed? (Plus recent important changes) +5.2. Where do I report bugs, get more info / who's working on zsh? +5.3. What's on the wish-list? +5.4. Will zsh have problems in the year 2000? + +Acknowledgments + +Copyright +--- End of Contents --- +) + +chapter(Introducing zsh and how to install it) + +sect(Sources of information) +label(11) + + Information on zsh is available via the World Wide Web. The URL + is url(http://sunsite.auc.dk/zsh/)(http://sunsite.auc.dk/zsh/) (note the \ + change of address from the + end of April 1998). The server provides this FAQ and much else and is + now maintained by Karsten Thygesen and others (mail \ + email(zsh@sunsite.auc.dk) + with any related messages). The FAQ is at \ +url(http://sunsite.auc.dk/zsh/FAQ/)(http://sunsite.auc.dk/zsh/FAQ/) . + The site also contains some contributed zsh scripts and functions; + we are delighted to add more, or simply links to your own collection. + + This document was originally written in YODL, allowing it to be + converted easily into various other formats. The master source + file lives at url(http://sunsite.auc.dk/zsh/FAQ/zshfaq.yo) +(http://sunsite.auc.dk/zsh/FAQ/zshfaq.yo) . + + Another useful source of information is the collection of FAQ articles + posted frequently to the Usenet news groups comp.unix.questions, + comp.unix.shells and comp.answers with answers to general questions + about UNIX. The fifth of the seven articles deals with shells, + including zsh, with a brief description of differences. (This article + also talks about shell startup files which would otherwise rate a + mention here.) There is also a separate FAQ on shell differences + and how to change your shell. Usenet FAQs are available via FTP + from rtfm.mit.edu and mirrors and also on the World Wide Web; see + description( + mydit(USA) url(http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html) + (http://www.cis.ohio-state.edu/hypertext/faq/usenet/top.html) + mydit(UK) url(http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html) + (http://www.lib.ox.ac.uk/internet/news/faq/comp.unix.shell.html) + mydit(Netherlands) url(http://www.cs.ruu.nl/wais/html/na-dir/unix-faq/shell/.html) + (http://www.cs.ruu.nl/wais/html/na-dir/unix-faq/shell/.html) + ) + + The latest version of this FAQ is also available directly from any + of the zsh archive sites listed in question link(1.6)(16). + + There is now a preliminary version of a reference card for + zsh 3.0, which you can find (while it's being developed) at + url(http://www.ifh.de/~pws/computing/refcard.ps) + (http://www.ifh.de/~pws/computing/refcard.ps) + This is optimised for A4 paper. The tt(LaTeX) source is in the + same place with the extension tt(.tex). It is not a good place + from which to learn zsh for the first time. + + (As a method of reading the following in Emacs, you can type tt(\M-2 + \C-x $) to make all the indented text vanish, then tt(\M-0 \C-x $) + when you are on the title you want.) + + For any more eclectic information, you should contact the mailing + list: see question link(5.2)(52). + + +sect(What is it?) + + Zsh is a UNIX command interpreter (shell) which of the standard + shells most resembles the Korn shell (ksh); its compatibility with + the 1988 Korn shell has been gradually increasing. It includes + enhancements of many types, notably in the command-line editor, + options for customising its behaviour, filename globbing, features + to make C-shell (csh) users feel more at home and extra features + drawn from tcsh (another `custom' shell). + + It was written by Paul Falstad when a student at Princeton; however, + Paul doesn't maintain it any more and enquiries should be sent to + the mailing list (see question link(5.2)(52)). Zsh is distributed under a + standard Berkeley style copyright. + + For more information, the files Doc/intro.txt or Doc/intro.troff + included with the source distribution are highly recommended. A list + of features is given in FEATURES, also with the source. + + +sect(What is it good at?) + + Here are some things that zsh is particularly good at. No claim of + exclusivity is made, especially as shells copy one another, though + in the areas of command line editing and globbing zsh is well ahead + of the competition. I am not aware of a major interactive feature + in any other freely-available shell which zsh does not also have + (except smallness). + + itemize( + it() Command line editing: + itemize( + it() programmable completion: incorporates the ability to use + the full power of zsh globbing (compctl -g), + it() multi-line commands editable as a single buffer (even files!), + it() variable editing (vared), + it() command buffer stack, + it() print text straight into the buffer for immediate editing (print -z), + it() execution of unbound commands, + it() menu completion, + it() variable, editing function and option name completion, + it() inline expansion of variables, history commands. + ) + it() Globbing --- extremely powerful, including: + itemize( + it() recursive globbing (cf. find), + it() file attribute qualifiers (size, type, etc. also cf. find), + it() full alternation and negation of patterns. + ) + it() Handling of multiple redirections (simpler than tee). + it() Large number of options for tailoring. + it() Path expansion (=foo -> /usr/bin/foo). + it() Adaptable messages for spelling, watch, time as well as prompt + (including conditional expressions). + it() Named directories. + it() Comprehensive integer arithmetic. + it() Manipulation of arrays (including reverse subscripting). + it() Spelling correction. + ) + + +sect(On what machines will it run?) + + From version 3.0, zsh uses GNU autoconf as the installation + mechanism. This considerably increases flexibility over the old + `buildzsh' mechanism. Consequently, zsh should compile and run on + any modern version of UNIX, and a great many not-so-modern versions + too. The file Etc/MACHINES in the distribution has more details. + + There are also now separate ports for Windows and OS/2, see `Where + do I get it' below. + + If you need to change something to support a new machine, it would be + appreciated if you could add any necessary preprocessor code and + alter configure.in and config.h.in to configure zsh automatically, + then send the required context diffs to the list (see question + link(5.2)(52)). Changes based on version 2.5 are very unlikely to + be useful. + + To get it to work, retrieve the source distribution (see question + link(1.6)(16)), un-gzip it, un-tar it and read the INSTALL file in the top + directory. Also read the Etc/MACHINES file for up-to-date + information on compilation on certain architectures. + + mybf(Note for users of nawk) (The following information comes from Zoltan + Hidvegi): On some systems nawk is broken and produces an incorrect + signames.h file. This makes the signals code unusable. This often happens + on Ultrix, HP-UX, IRIX (?). Install gawk if you experience such problems. + + +sect(What's the latest version?) + + Zsh 3.0.5 is the latest production version. The new major number 3.0 + largely reflects the considerable internal changes in zsh to make it + more reliable, consistent and (where possible) compatible. Those + planning on upgrading their zsh installation should take a look at + the list of incompatibilities at the end of link(5.1)(51). This is + longer than usual due to enhanced sh, ksh and POSIX compatibility. + + The beta version 3.1.4 is also available. Development of zsh is + usually patch by patch, with each intermediate version publicly + available. Note that this `open' development system does mean bugs + are sometimes introduced into the most recent archived version. + These are usually fixed quickly. + + Note also that as the shell changes, it may become incompatible with + older versions; see the end of question link(5.1)(51) for a partial list. + Changes of this kind are almost always forced by an awkward or + unnecessary feature in the original design (as perceived by current + users), or to enhance compatibility with other Bourne shell + derivatives, or (most recently) to provide POSIX compliancy. + + +sect(Where do I get it?) +label(16) + + The archive is now run by email(Andrew Main ). + The following are known mirrors (kept frequently up to date); the + first is the official archive site, currently in Australia. All are + available by anonymous FTP. The major sites keep test versions in + the 'testing' subdirectory: such up-to-the-minute development + versions should only be retrieved if you actually plan to help test + the latest version of the shell. The following list also appears + on the WWW at url(http://www.zsh.org)(http://www.zsh.org) . + + description( + mydit(Home site) url(ftp://ftp.zsh.org)(ftp://ftp.zsh.org) + mydit(Australia) url(ftp://ftp.ips.gov.au/mirror/zsh/) +(ftp://ftp.ips.gov.au/mirror/zsh/) + mydit(Denmark) url(ftp://sunsite.auc.dk/pub/unix/shells/zsh) +(ftp://sunsite.auc.dk/pub/unix/shells/zsh) + mydit(Finland) url(ftp://ftp.funet.fi/pub/unix/shells/zsh/) +(ftp://ftp.funet.fi/pub/unix/shells/zsh/) + mydit(France) url(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/) +(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/) + mydit(Germany) url(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/) +(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/) + mydit() url(ftp://ftp.gmd.de/packages/zsh/) +(ftp://ftp.gmd.de/packages/zsh/) + mydit() url(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/) +(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/) + mydit(Hungary) url(ftp://ftp.cs.elte.hu/pub/zsh/) +(ftp://ftp.cs.elte.hu/pub/zsh/) + mydit() (also url(http://www.cs.elte.hu/pub/zsh/) + (http://www.cs.elte.hu/pub/zsh/) ) + mydit(Israel) \ +url(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/) +(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/) + mydit() \ +url(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/) +(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/) + mydit(Japan) url(ftp://ftp.tohoku.ac.jp/mirror/zsh/) +(ftp://ftp.tohoku.ac.jp/mirror/zsh/) + mydit() url(ftp://ftp.nis.co.jp/pub/shells/zsh/) +(ftp://ftp.nis.co.jp/pub/shells/zsh/) + mydit(Norway) url(ftp://ftp.uit.no/pub/unix/shells/zsh/) +(ftp://ftp.uit.no/pub/unix/shells/zsh/) + mydit(Romania) url(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/) +(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/) + mydit(Slovenia) url(ftp://ftp.siol.net/pub/unix/shells/zsh/) +(ftp://ftp.siol.net/pub/unix/shells/zsh/) + mydit(Sweden) url(ftp://ftp.lysator.liu.se/pub/unix/zsh/) +(ftp://ftp.lysator.liu.se/pub/unix/zsh/) + mydit(UK) url(ftp://ftp.net.lut.ac.uk/zsh/) +(ftp://ftp.net.lut.ac.uk/zsh/) + mydit() (also by FSP at port 21) + mydit() url(ftp://src.doc.ic.ac.uk/packages/unix/shells/zsh/) +(ftp://src.doc.ic.ac.uk/packages/unix/shells/zsh/) + mydit(USA) url(ftp://ftp.math.gatech.edu/pub/zsh/) +(ftp://ftp.math.gatech.edu/pub/zsh/) + mydit() url(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/) +(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/) + mydit() url(ftp://ftp.sterling.com/zsh/) +(ftp://ftp.sterling.com/zsh/) + mydit() url(ftp://ftp.rge.com/pub/shells/zsh/) +(ftp://ftp.rge.com/pub/shells/zsh/) + ) + + The Windows port mentioned above is maintained separately by email(Amol + Deshpande ); please mail Amol directly about any + Windows-specific problems. This is quite new, so don't expect it to + be perfect. You can get it from: + + description( + mydit() url(ftp://ftp.blarg.net/users/amol/zsh) +(ftp://ftp.blarg.net/users/amol/zsh) + ) + + Likewise the OS/2 port is available from email(TAMURA Kent + ) at + + description( + mydit() url(http://cgi.din.or.jp/~tkent/tmp/zsh-3.0.0-os2-a01.zip) +(http://cgi.din.or.jp/~tkent/tmp/zsh-3.0.0-os2-a01.zip) + ) + + Starting from mid-October 1997, there is an archive of patches sent + to the maintainers' mailing list. Note that these may not all be + added to the shell, and some may already have been; you simply have + to search for something you might want which is not in the version + you have. Also, there may be some prerequisites earlier in the + archive. It can be found on the zsh WWW pages (as described in + link(1.1)(11)) at: + + description( + mydit() url(http://sunsite.auc.dk/zsh/Patches/) +(http://sunsite.auc.dk/zsh/Patches/) + ) + +sect(I don't have root access: how do I make zsh my login shell?) + + Unfortunately, on many machines you can't use mytt(chsh) to change your + shell unless the name of the shell is contained in /etc/shells, so if + you have your own copy of zsh you need some sleight-of-hand to use it + when you log on. (Simply typing mytt(zsh) is not really a solution since + you still have your original login shell waiting for when you exit.) + + The basic idea is to use mytt(exec ) to replace the current + shell with zsh. Often you can do this in a login file such as .profile + (if your shell is sh or ksh) or .login (if it's csh). Make sure you + have some way of altering the file (e.g. via FTP) before you try this as + mytt(exec) is often rather unforgiving. + + If you have zsh in a subdirectory mytt(bin) of your home directory, + put this in .profile: + verb( + [ -f $HOME/bin/zsh ] && exec $HOME/bin/zsh -l + ) + or if your login shell is csh or tcsh, put this in .login: + verb( + if ( -f ~/bin/zsh ) exec ~/bin/zsh -l + ) + (in each case the mytt(-l) tells zsh it is a login shell). + + If you want to check this works before committing yourself to it, + you can make the login shell ask whether to exec zsh. The following + work for Bourne-like shells: + verb( + [ -f $HOME/bin/zsh ] && { + echo "Type Y to run zsh: \c" + read line + [ "$line" = Y ] && exec $HOME/bin/zsh -l + } + ) + and for C-shell-like shells: + verb( + if ( -f ~/bin/zsh ) then + echo -n "Type Y to run zsh: " + if ( "$<" == Y ) exec ~/bin/zsh -l + endif + ) + + + It's not a good idea to put this (even without the -l) into .cshrc, + at least without some tests on what the csh is supposed to be doing, + as that will cause _every_ instance of csh to turn into a zsh and + will cause csh scripts (yes, unfortunately some people write these) + which do not call `csh -f' to fail. If you want to tell xterm to + run zsh, change the SHELL environment variable to the full path of + zsh at the same time as you exec zsh (in fact, this is sensible for + consistency even if you aren't using xterm). If you have to exec + zsh from your .cshrc, a minimum safety check is mytt(if ($?prompt) exec + zsh). + + If you like your login shell to appear in the process list as mytt(-zsh), + you can link mytt(zsh) to mytt(-zsh) (e.g. by mytt(ln -s ~/bin/zsh + ~/bin/-zsh)) and change the exec to mytt(exec -zsh). (Make sure + mytt(-zsh) is in your path.) This has the same effect as the mytt(-l) + option. + + Footnote: if you DO have root access, make sure zsh goes in + /etc/shells on all appropriate machines, including NIS clients, or you + may have problems with FTP to that machine. + + +chapter(How does zsh differ from...?) + +As has already been mentioned, zsh is most similar to ksh, while many +of the additions are to please csh users. Here are some more detailed +notes. See also the article `UNIX shell differences and how to change +your shell' posted frequently to the USENET group comp.unix.shell. + +sect(Differences from sh and ksh) +label(21) + + Most features of ksh (and hence also of sh) are implemented in zsh; + problems can arise because the implementation is slightly different. + Note also that not all ksh's are the same either. I have based this + on the 11/16/88f version of ksh; differences from ksh93 will be more + substantial. + + As a summary of the status: + enumerate( + myeit() because of all the options it is not safe to assume a general + zsh run by a user will behave as if sh or ksh compatible; + myeit() invoking zsh as sh or ksh (or if either is a symbolic link to + zsh) sets appropriate options and improves compatibility (from + within zsh itself, calling mytt(ARGV0=sh zsh) will also work); + myeit() from version 3.0 onward the degree of compatibility with sh + under these circumstances is very high: zsh can now be used + with GNU configure or perl's Configure, for example; + myeit() the degree of compatibility with ksh is also high, but a few + things are missing: for example the more sophisticated + pattern-matching expressions are different for versions before + 3.1.3 --- see the detailed list below; + myeit() also from 3.0, the command `emulate' is available: `emulate + ksh' and `emulate sh' set various options as well as changing the + effect of single-letter option flags as if the shell had been + invoked with the appropriate name. Including the commands + `emulate sh; setopt localoptions' in a shell function will + turn on sh emulation for that function only. + ) + + The classic difference is word splitting, discussed in link(3.1)(31); this + catches out very many beginning zsh users. As explained there, this + is actually a bug in every other shell. The answer is to set + SH_WORD_SPLIT for backward compatibility. The next most classic + difference is that unmatched glob patterns cause the command to + abort; set NO_NOMATCH for those. + + Here is a list of various options which will increase ksh + compatibility, though maybe decrease zsh's abilities: see the manual + entries for GLOB_SUBST, IGNORE_BRACES (though brace expansion occurs + in some versions of ksh), KSH_ARRAYS, KSH_GLOB, KSH_OPTION_PRINT, + LOCAL_OPTIONS, NO_BAD_PATTERN, NO_BANG_HIST, NO_EQUALS, NO_HUP, + NO_NOMATCH, NO_RCS, NO_SHORT_LOOPS, PROMPT_SUBST, RM_STAR_SILENT, + POSIX_BUILTINS, SH_FILE_EXPANSION, SH_GLOB, SH_OPTION_LETTERS, + SH_WORD_SPLIT (see question link(3.1)(31)) and SINGLE_LINE_ZLE. + Note that you can also disable any built-in commands which get in + your way. If invoked as `ksh', the shell will try and set suitable + options. + + Here are some differences from ksh which might prove significant for + ksh programmers, some of which may be interpreted as bugs; there + must be more. Note that this list is deliberately rather full and + that most of the items are fairly minor. Those marked `*' perform + in a ksh-like manner if the shell is invoked with the name `ksh', or + if `emulate ksh' is in effect. Capitalised words with underlines + refer to shell options. + + itemize( + it() Syntax: + itemize( + it()* Shell word splitting: see question link(3.1)(31). + it()* Arrays are (by default) more csh-like than ksh-like: + subscripts start at 1, not 0; tt(array[0]) refers to tt(array[1]); + mytt($array) refers to the whole array, not tt($array[0]); + braces are unnecessary: tt($a[1] == ${a[1]}), etc. + The KSH_ARRAYS option is now available. + it() Coprocesses are established by mytt(coproc); mytt(|&) behaves like + csh. Handling of coprocess file descriptors is also different. + it() In mytt(cmd1 && cmd2 &), only mytt(cmd2) instead of the whole + expression is run in the background in zsh. The manual implies + this is a bug. Use mytt({ cmd1 && cmd2 } &) as a workaround. + ) + it() Command line substitutions, globbing etc.: + itemize( + it()* Failure to match a globbing pattern causes an error (use + NO_NOMATCH). + it()* The results of parameter substitutions are treated as plain text: + mytt(foo="*"; print $foo) prints all files in ksh but mytt(*) in zsh. + (GLOB_SUBST has been added to fix this.) + it() The backslash in tt($(echo '\$x')) is treated differently: in \ +ksh, it + is not stripped, in zsh it is. (The tt(`...`) form gives the same in + both shells.) + it()* tt($PSn) do not do parameter substitution by default (use \ +PROMPT_SUBST). + it()* Standard globbing does not allow ksh-style `pattern-lists'. + Equivalents: + verb( +---------------------------------------------------------------------- + ksh zsh Meaning + ----- ----- --------- + !(foo) ^foo Anything but foo. + or foo1~foo2 Anything matching foo1 but foo2[1]. +@(foo1|foo2|...) (foo1|foo2|...) One of foo1 or foo2 or ... + ?(foo) (foo|) Zero or one occurrences of foo. + *(foo) (foo)# Zero or more occurrences of foo. + +(foo) (foo)## One or more occurrences of foo. +---------------------------------------------------------------------- + ) + The mytt(^), mytt(~) and mytt(#) (but not mytt(|))forms require \ +EXTENDED_GLOB. + From version 3.1.3, the ksh forms are fully supported when the + option KSH_GLOB is in effect; for previous versions you + must use the table above. + + [1] Note that mytt(~) is the only globbing operator to have a lower + precedence than mytt(/). For example, mytt(**/foo~*bar*) matches any + file in a subdirectory called mytt(foo), except where mytt(bar) + occurred somewhere in the path (e.g. mytt(users/barstaff/foo) will + be excluded by the mytt(~) operator). As the mytt(**) operator cannot + be grouped (inside parentheses it is treated as mytt(*)), this is + the way to exclude some subdirectories from matching a mytt(**). + it() Unquoted assignments do file expansion after mytt(:)s (intended for + PATHs). + it() mytt(integer) does not allow mytt(-i). + it() mytt(typeset) and mytt(integer) have special behaviour for + assignments in ksh, but not in zsh. For example, this doesn't + work in zsh: + verb( + integer k=$(wc -l ~/.zshrc) + ) + because the return value from tt(wc) includes leading + whitespace which causes wordsplitting. Ksh handles the + assignment specially as a single word. + ) + it() Command execution: + itemize( + it()* There is no tt($ENV) variable (use tt(/etc/zshrc), tt(~/.zshrc); + note also tt($ZDOTDIR)). + it() tt($PATH) is not searched for commands specified + at invocation without -c. + ) + it() Aliases and functions: + itemize( + it() The order in which aliases and functions are defined is significant: + function definitions with () expand aliases -- see question \ +link(2.3)(23). + it() Aliases and functions cannot be exported. + it() There are no tracked aliases: command hashing replaces these. + it() The use of aliases for key bindings is replaced by `bindkey'. + it()* Options are not local to functions (use LOCAL_OPTIONS; note this + may always be unset locally to propagate options settings from a + function to the calling level). + ) + it() Traps and signals: + itemize( + it() Traps are not local to functions. + it() TRAPERR has become TRAPZERR (this was forced by UNICOS which + has SIGERR). + ) + it() Editing: + itemize( + it() The options tt(emacs), tt(gmacs), tt(viraw) are not supported. + Use bindkey to change the editing behaviour: mytt(set -o {emacs,vi}) + becomes mytt(bindkey -{e,v}); for gmacs, go to emacs mode and use + mytt(bindkey \^t gosmacs-transpose-characters). + it() The mytt(keyword) option does not exist and mytt(-k) is instead + interactivecomments. (mytt(keyword) will not be in the next ksh + release either.) + it() Management of histories in multiple shells is different: + the history list is not saved and restored after each command. + it() mytt(\) does not escape editing chars (use mytt(^V)). + it() Not all ksh bindings are set (e.g. mytt(#); try mytt(q)). + it()* mytt(#) in an interactive shell is not treated as a comment by + default. + ) + it() Built-in commands: + itemize( + it() Some built-ins (tt(r), tt(autoload), tt(history), tt(integer) ...) + were aliases in ksh. + it() There is no built-in command newgrp: use e.g. mytt(alias + newgrp="exec newgrp") + it() mytt(jobs) has no mytt(-n) flag. + it() mytt(read) has no mytt(-s) flag. + ) + it() Other idiosyncrasies: + itemize( + it() mytt(select) always redisplays the list of selections on each loop. + ) + ) + + +sect(Similarities with csh) + + Although certain features aim to ease the withdrawal symptoms of csh + (ab)users, the syntax is in general rather different and you should + certainly not try to run scripts without modification. The c2z script + is provided with the source (in Misc/c2z) to help convert .cshrc + and .login files; see also the next question concerning aliases, + particularly those with arguments. + + Csh-compatibility additions include: + itemize( + it() tt(logout), tt(rehash), tt(source), tt((un)limit) built-in commands. + it() tt(*rc) file for interactive shells. + it() Directory stacks. + it() tt(cshjunkie*), tt(ignoreeof) options. + it() The CSH_NULL_GLOB option. + it() tt(>&), tt(|&) etc. redirection. + (Note that mytt(>file 2>&1) is the standard Bourne shell command for + csh's mytt(>&file).) + it() tt(foreach ...) loops; alternative syntax for other loops. + it() Alternative syntax mytt(if ( ... ) ...), though this still doesn't + work like csh: it expects a command in the parentheses. Also + mytt(for), mytt(which). + it() tt($PROMPT) as well as tt($PS1), tt($status) as well as tt($?), + tt($#argv) as well as tt($#), .... + it() Escape sequences via tt(%) for prompts. + it() Special array variables tt($PATH) etc. are colon-separated, tt($path) + are arrays. + it() tt(!)-type history (which may be turned off via mytt(setopt + nobanghist)). + it() Arrays have csh-like features (see under link(2.1)(21)). + ) + + +sect(Why do my csh aliases not work? (Plus other alias pitfalls.)) +label(23) + + First of all, check you are using the syntax + verb( + alias newcmd='list of commands' + ) + and not + verb( + alias newcmd 'list of commands' + ) + which won't work. (It tells you if `newcmd' and `list of commands' are + already defined as aliases.) + + Otherwise, your aliases probably contain references to the command + line of the form mytt(\!*), etc. Zsh does not handle this behaviour as it + has shell functions which provide a way of solving this problem more + consistent with other forms of argument handling. For example, the + csh alias + verb( + alias cd 'cd \!*; echo $cwd' + ) + can be replaced by the zsh function, + verb( + cd() { builtin cd $*; echo $PWD; } + ) + (the `builtin' tells zsh to use its own `cd', avoiding an infinite loop) + or, perhaps better, + verb( + cd() { builtin cd $*; print -D $PWD; } + ) + (which converts your home directory to a tt(~)). In fact, this problem is + better solved by defining the special function chpwd() (see the manual). + Note also that the mytt(;) at the end of the function is optional in zsh, + but not in ksh or sh (for sh's where it exists). + + Here is Bart Schaefer's guide to converting csh aliases for zsh. + + SETCOUNTER(XXenumcounter)(0) + enumerate( + myeit() If the csh alias references "parameters" (tt(\!:1), tt(\!*) etc.), + then in zsh you need a function (referencing tt($1), tt($*) etc.). + Otherwise, you can use a zsh alias. + + myeit() If you use a zsh function, you need to refer _at_least_ to + tt($*) in the body (inside the tt({ })). Parameters don't magically + appear inside the tt({ }) the way they get appended to an alias. + + myeit() If the csh alias references its own name (tt(alias rm "rm -i")), + then in a zsh function you need the "command" keyword + (function tt(rm() { command rm -i $* })), but in a zsh alias + you don't (tt(alias rm="rm -i")). + + myeit() If you have aliases that refer to each other (tt(alias ls "ls -C"; + alias lf "ls -F" ==> lf == ls -C -F)) then you must either: + itemize( + it() convert all of them to zsh functions; or + it() after converting, be sure your .zshrc defines all of your + aliases before it defines any of your functions. + ) + + Those first four are all you really need, but here are four more for + heavy csh alias junkies: + + myeit() Mapping from csh alias "parameter referencing" into zsh function + (assuming shwordsplit and ksharrays are NOT set in zsh): + verb( + csh zsh + ===== ========== + \!* $* (or $argv) + \!^ $1 (or $argv[1]) + \!:1 $1 + \!:2 $2 (or $argv[2], etc.) + \!$ $*[$#] (or $argv[$#], or $*[-1]) + \!:1-4 $*[1,4] + \!:1- $*[1,$#-1] (or $*[1,-2]) + \!^- $*[1,$#-1] + \!*:q "$@" ($*:q doesn't work (yet)) + \!*:x $=* ($*:x doesn't work (yet)) + ) + + myeit() Remember that it is NOT a syntax error in a zsh function to + refer to a position (tt($1), tt($2), etc.) greater than the number of + parameters. (E.g., in a csh alias, a reference to tt(\!:5) will + cause an error if 4 or fewer arguments are given; in a zsh + function, tt($5) is the empty string if there are 4 or fewer + parameters.) + + myeit() To begin a zsh alias with a - (dash, hyphen) character, use + mytt(alias --): + verb( + csh zsh + =============== ================== + alias - "fg %-" alias -- -="fg %-" + ) + + myeit() Stay away from mytt(alias -g) in zsh until you REALLY know what + you're doing. + ) + + There is one other serious problem with aliases: consider + verb( + alias l='/bin/ls -F' + l() { /bin/ls -la $* | more } + ) + mytt(l) in the function definition is in command position and is expanded + as an alias, defining mytt(/bin/ls) and mytt(-F) as functions which call + mytt(/bin/ls), which gets a bit recursive. This can be avoided if you use + mytt(function) to define a function, which doesn't expand aliases. It is + possible to argue for extra warnings somewhere in this mess. Luckily, + it is not possible to define mytt(function) as an alias. + + Bart Schaefer's rule is: Define first those aliases you expect to + use in the body of a function, but define the function first if the + alias has the same name as the function. + + +sect(Similarities with tcsh) + + (The sections on csh apply too, of course.) Certain features have + been borrowed from tcsh, including tt($watch), tt(run-help), tt($savehist), + tt($histlit), periodic commands etc., extended prompts, tt(sched) + and tt(which) built-ins. Programmable completion was inspired by, + but is entirely different to, tcsh's mytt(complete). (There is a perl + script called tt(lete2ctl) in the Misc directory of the source + distribution to convert mytt(complete) to mytt(compctl) statements.) + This list is not definitive: some features have gone in the other + direction. + + If you're missing the editor function tt(run-fg-editor), try something + with mytt(bindkey -s) (which binds a string to a keystroke), e.g. + verb( + bindkey -s '^z' '\eqfg %$EDITOR:t\n' + ) + which pushes the current line onto the stack and tries to bring a job + with the basename of your editor into the foreground. mytt(bindkey -s) + allows limitless possibilities along these lines. You can execute + any command in the middle of editing a line in the same way, + corresponding to tcsh's mytt(-c) option: + verb( + bindkey -s '^p' '\eqpwd\n' + ) + In both these examples, the mytt(\eq) saves the current input line to + be restored after the command runs; a better effect with multiline + buffers is achieved if you also have + verb( + bindkey '\eq' push-input + ) + to save the entire buffer. + + +sect(Similarities with bash) + + The Bourne-Again Shell, bash, is another enhanced Bourne-like shell; + the most obvious difference from zsh is that it does not attempt to + emulate the Korn shell. Since both shells are under active + development it is probably not sensible to be too specific here. + Broadly, bash has paid more attention to standards compliancy + (i.e. POSIX) for longer, and has so far avoided the more abstruse + interactive features (programmable completion, etc.) that zsh has. + + +sect(Shouldn't zsh be more/less like ksh/(t)csh?) + + People often ask why zsh has all these `unnecessary' csh-like features, + or alternatively why zsh doesn't understand more csh syntax. This is + far from a definitive answer and the debate will no doubt continue. + + Paul's object in writing zsh was to produce a ksh-like shell which + would have features familiar to csh users. For a long time, csh was + the preferred interactive shell and there is a strong resistance to + changing to something unfamiliar, hence the additional syntax and + CSH_JUNKIE options. This argument still holds. On the other hand, + the arguments for having what is close to a plug-in replacement for ksh + are, if anything, even more powerful: the deficiencies of csh as a + programming language are well known (look in any Usenet FAQ archive, e.g. + url(http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/\ + shell/csh-whynot/faq.html) +(http://www.cis.ohio-state.edu/hypertext/faq/usenet/unix-faq/shell/csh-whynot/faq.html) + if you are in any doubt) and zsh is able to run many standard + scripts such as /etc/rc. + + Of course, this makes zsh rather large and feature-ridden so that it + seems to appeal mainly to hackers. The only answer, perhaps not + entirely satisfactory, is that you have to ignore the bits you don't + want. The introduction of loadable in modules in version 3.1 should + help. + + +chapter(How to get various things to work) + +sect(Why does mytt($var) where mytt(var="foo bar") not do what I expect?) +label(31) + + In most Bourne-shell derivatives, multiple-word variables such as + verb( + var="foo bar" + ) + are split into words when passed to a command or used in a mytt(for foo in + $var) loop. By default, zsh does not have that behaviour: the + variable remains intact. (This is not a bug! See below.) An option + (SHWORDSPLIT) exists to provide compatibility. + + For example, defining the function args to show the number of its + arguments: + verb( + args() { echo $#; } + ) + and with our definition of `var', + verb( + args $var + ) + produces the output `1'. After + verb( + setopt shwordsplit + ) + the same function produces the output `2', as with sh and ksh. + + Unless you need strict sh/ksh compatibility, you should ask yourself + whether you really want this behaviour, as it can produce unexpected + effects for variables with entirely innocuous embedded spaces. This + can cause horrendous quoting problems when invoking scripts from + other shells. The natural way to produce word-splitting behaviour + in zsh is via arrays. For example, + verb( + set -A array one two three twenty + ) + (or + verb( + array=(one two three twenty) + ) + if you prefer), followed by + verb( + args $array + ) + produces the output `4', regardless of the setting of SHWORDSPLIT. + Arrays are also much more versatile than single strings. Probably + if this mechanism had always been available there would never have + been automatic word splitting in scalars, which is a sort of + uncontrollable poor man's array. + + Note that this happens regardless of the value of the internal field + separator, tt($IFS); in other words, with mytt(IFS=:; foo=a:b; args $foo) + you get the answer 1. + + Other ways of causing word splitting include a judicious use of + `eval': + verb( + sentence="Longtemps, je me suis couch\\'e de bonne heure." + eval "words=($sentence)" + ) + after which $words is an array with the words of $sentence (note + characters special to the shell, such as the mytt(') in this example, + must already be quoted), or, less standard but more reliable, + turning on SHWORDSPLIT for one variable only: + verb( + args ${=sentence} + ) + always returns 8 with the above definition of mytt(args). (In older + versions of zsh, tt(${=foo}) toggled SHWORDSPLIT; now it forces it on.) + + Note also the tt("$@") method of word splitting is always available in zsh + functions and scripts (though strictly this does array splitting, not + word splitting). + + SHWORDSPLIT is set when zsh is invoked with the names `ksh' or `sh', + or (entirely equivalent) when mytt(emulate ksh) or mytt(emulate sh) is in + effect. + + +sect(What is the difference between `export' and the ALL_EXPORT option?) + + Normally, you would put a variable into the environment by using + mytt(export var). The command mytt(setopt allexport) causes all + variables which are subsequently set (N.B. not all the ones which + already exist) to be put into the environment. + + This may seem a useful shorthand, but in practice it can have + unhelpful side effects: + SETCOUNTER(XXenumcounter)(0) + enumerate( + myeit() Since every variable is in the environment as well as remembered + by the shell, the memory for it needs to be allocated twice. + This is bigger as well as slower. + myeit() It really is mybf(every) variable which is exported, even loop + variables in mytt(for) loops. This is probably a waste. + myeit() An arbitrary variable created by the user might have a special + meaning to a command. Since all shell variables are visible to + commands, there is no protection against this. + ) + For these reasons it is usually best to avoid ALL_EXPORT unless you + have a specific use for it. One safe use is to set it before + creating a list of variables in an initialisation file, then unset + it immediately afterwards. Only those variables will be automatically + exported. + + +sect(How do I turn off spelling correction/globbing for a single command?) + + In the first case, you presumably have mytt(setopt correctall) in an + initialisation file, so that zsh checks the spelling of each word in + the command line. You probably do not want this behaviour for + commands which do not operate on existing files. + + The answer is to alias the offending command to itself with + mytt(nocorrect) stuck on the front, e.g. + verb( + alias mkdir='nocorrect mkdir' + ) + + To turn off globbing, the rationale is identical: + verb( + alias mkdir='noglob mkdir' + ) + You can have both tt(nocorrect) and tt(noglob), if you like, but the + tt(nocorrect) must come first, since it is needed by the line editor, + while tt(noglob) is only handled when the command is examined. + + Note also that a shell function won't work: the no... directives must + be expanded before the rest of the command line is parsed. + + +sect(How do I get the meta key to work on my xterm?) +label(34) + + As stated in the manual, zsh needs to be told about the meta key by + using mytt(bindkey -me) or mytt(bindkey -mv) in your .zshrc or on the + command line. You probably also need to tell the terminal driver to + allow the `meta' bit of the character through; mytt(stty pass8) is the + usual incantation. Sample .zshrc entry: + verb( + [[ $TERM = "xterm" ]] && stty pass8 && bindkey -me + ) + or, on SYSVR4-ish systems without pass8, + verb( + [[ $TERM = "xterm" ]] && stty -parenb -istrip cs8 && bindkey -me + ) + (disable parity detection, don't strip high bit, use 8-bit characters). + Make sure this comes myem(before) any bindkey entries in your .zshrc which + redefine keys normally defined in the emacs/vi keymap. + + You don't need the mytt(bindkey) to be able to define your own sequences + with the meta key, though you still need the mytt(stty). + + +sect(How do I automatically display the directory in my xterm title bar?) + + You should use the special function mytt(chpwd), which is called when + the directory changes. The following checks that standard output is + a terminal, then puts the directory in the title bar if the terminal + is an tt(xterm) or a tt(sun-cmd). + + verb( + chpwd() { + [[ -t 1 ]] || return + case $TERM in + sun-cmd+CHAR(41) print -Pn "\e]l%~\e\\" + ;; + xterm+CHAR(41) print -Pn "\e]2;%~\a" + ;; + esac + } + ) + + Change mytt(%~) if you want the message to be different. (The mytt(-P) + option interprets such sequences just like in prompts, in this case + producing the current directory; you can of course use mytt($PWD) here, + but that won't use the mytt(~) notation which I find clearer.) Note that + when the tt(xterm) starts up you will probably want to call tt(chpwd) + directly: just put mytt(chpwd) in tt(.zshrc) after it is defined or \ + autoloaded. + + +sect(How do I make the completion list use eight bit characters?) + + A traditional UNIX environment (character terminal and ASCII + character sets) is not sufficient to be able to handle non-ASCII + characters, and there are so many possible enhancements that in + general this is hard. However, if you have something like an xterm + using a standard character set like ISO-8859-1 (which is often the + default for xterm), read on. You should also note question + link(3.4)(34) on the subject of eight bit characters. + + You are probably creating files with names including non-ASCII + accented characters, and find they show up in the completion list as + verb(\M-i) or something such. This is because the library routines + (not zsh itself) which test whether a character is printable have + replied that it is not; zsh has simply found a way to show them + anyway. + + The answer, under a modern POSIXy operating system, is to find a + locale where these are treated as printable characters. Zsh has + handling for locales built in and will recognise when you set a + relevant variable. You need to look in /usr/lib/locale to find one + which suits you; the subdirectories correspond to the locale names. + The simplest possibility is likely to be en_US, so that the simplest + answer to your problem is to set + + verb( + LC_CTYPE=en_US + ) + + when your terminal is capable of showing eight bit characters. If + you only have a default domain (called C), you may need to have some + additional files installed on your system. + + +sect(Why do the cursor (arrow) keys not work?) + + The cursor keys send different codes depending on the terminal; zsh + only binds the most well known versions. If you see these problems, + try putting the following in your tt(.zshrc): + + verb( + bindkey "$(echotc kl)" backward-char + bindkey "$(echotc kr)" forward-char + bindkey "$(echotc ku)" up-line-or-history + bindkey "$(echotc kd)" down-line-or-history + ) + + If you use vi mode, use mytt(vi-backward-char) and mytt(vi-forward-char) + where appropriate. + + Note, however, that up to version 3.0 binding arbitrary multiple key + sequences can cause problems, so check that this works with your set + up first. Also, from version 3.1.3, more sequences are supported by + default, namely those in the form mytt(O) followed by tt(A), + tt(B), tt(C) or tt(D), as well as the corresponding set beginning + mytt([), so this may be redundant. + + +sect(Why does my terminal act funny in some way?) + + If you are using an OpenWindows cmdtool as your terminal, any + escape sequences (such as those produced by cursor keys) will be + swallowed up and never reach zsh. Either use shelltool or avoid + commands with escape sequences. You can also disable scrolling from + the cmdtool pane menu (which effectively turns it into a shelltool). + If you still want scrolling, try using an xterm with the scrollbar + activated. + + If that's not the problem, and you are using stty to change some tty + settings, make sure you haven't asked zsh to freeze the tty settings: + type + verb( + ttyctl -u + ) + before any stty commands you use. + + On the other hand, if you aren't using stty and have problems you may + need the opposite: mytt(ttyctl -f) freezes the terminal to protect it + from hiccups introduced by other programmes (kermit has been known to + do this). + + If myem(that)'s not the problem, and you are having difficulties with + external commands (not part of zsh), and you think some terminal + setting is wrong (e.g. tt(^V) is getting interpreted as `literal next + character' when you don't want it to be), try + verb( + ttyctl -u + STTY='lnext "^-"' commandname + ) + (in this example), or just export STTY for all commands to see. Note + that zsh doesn't reset the terminal completely afterwards: just the + modes it uses itself and a number of special processing characters + (see the tt(stty(1)) manual page). + + At some point there may be an overhaul which allows the terminal + modes used by the shell to be modified separately from those seen by + external programmes. This is partially implemented already: from 2.5, + the shell is less susceptible to mode changes inherited from + programmes than it used to be. + + +sect(Why does zsh not work in an Emacs shell mode any more?) + + (This information comes from Bart Schaefer and other zsh-workers.) + + Emacs 19.29 or thereabouts stopped using a terminal type of "emacs" + in shell buffers, and instead sets it to "dumb". Zsh only kicks in + its special I'm-inside-emacs initialization when the terminal type + is "emacs". + + Probably the most reliable way of dealing with this is to look for + the environment variable mytt($EMACS), which is set to mytt(t) in + Emacs' shell mode. Putting + verb( + [[ $EMACS = t ]] && unsetopt zle + ) + in your .zshrc should be sufficient. + + Another method is to put + verb( + #!/bin/sh + TERM=emacs exec zsh + ) + into a file ~/bin/eshell, then mytt(chmod +x ~/bin/eshell), and + tell emacs to use that as the shell by adding + verb( + (setenv "ESHELL" "~/bin/eshell") + ) + to ~/.emacs. + + +sect(Why do my autoloaded functions not autoload [the first time]?) + + The problem is that there are two possible ways of autoloading a + function (see the AUTOLOADING FUNCTIONS section of the zsh manual + page zshmisc for more detailed information): + SETCOUNTER(XXenumcounter)(0) + enumerate( + myeit() The file contains just the body of the function, i.e. + there should be no line at the beginning saying mytt(function foo {) + or mytt(foo () {), and consequently no matching mytt(}) at the end. + This is the traditional zsh method. The advantage is that the + file is called exactly like a script, so can double as both. + To define a function mytt(xhead () { print -n "\033]2;$*\a"; }), + the file would just contain mytt(print -n "\033]2;$*\a"). + myeit() The file contains the entire definition, and maybe even + other code: it is run when the function needs to be loaded, then + the function itself is called up. This is the method in ksh. + To define the same function mytt(xhead), the whole of the + usual definition should be in the file. + ) + + In old versions of zsh, before 3.0, only the first behaviour was + allowed, so you had to make sure the file found for autoload just + contained the function body. You could still define other functions + in the file with the standard form for definitions, though they + would be redefined each time you called the main function. + + In version 3.0.x, the second behaviour is activated if the file + defines the autoloaded function. Unfortunately, this is + incompatible with the old zsh behaviour which allowed you to + redefine the function when you called it. + + From version 3.1, there is an option KSHAUTOLOAD to allow full ksh + compatiblity, i.e. the function myem(must) be in the second form + above. If that is not set, zsh tries to guess which form you are + using: if the file contains only a complete definition of the + function in the second form, and nothing else apart from comments + and whitespace, it will use the function defined in the file; + otherwise, it will assume the old behaviour. The option is set + if mytt(emulate ksh) is in effect, of course. + + (A neat trick to autoload all functions in a given directory is to + include a line like mytt(autoload ~/fns/*(:t)) in .zshrc; the bit in + parentheses removes the directory part of the filenames, leaving + just the function names.) + + +sect(How does base arithmetic work?) + + The ksh syntax is now understood, i.e. + verb( + let 'foo = 16#ff' + ) + or equivalently + verb( + (( foo = 16#ff )) + ) + or even + verb( + foo=$[16#ff] + ) + (note that `foo=$((16#ff))' is now supported). The original syntax was + verb( + (( foo = [16]ff )) + ) + --- this was based on a misunderstanding of the ksh manual page. It + still works but its use is deprecated. Then + verb( + echo $foo + ) + gives the answer `255'. It is possible to declare variables explicitly + to be integers, via + verb( + typeset -i foo + ) + which has a different effect: namely the base used in the first + assignment (hexadecimal in the example) is subsequently used whenever + `foo' is displayed (although the internal representation is unchanged). + To ensure foo is always displayed in decimal, declare it as + verb( + typeset -i 10 foo + ) + which requests base 10 for output. You can change the output base of an + existing variable in this fashion. Using the mytt($(( ... ))) method will + always display in decimal. + + +sect(How do I get a newline in my prompt?) + + You can place a literal newline in quotes, i.e. + verb( + PROMPT="Hi Joe, + what now?%# " + ) + If you have the bad taste to set the option cshjunkiequotes, which + inhibits such behaviour, you will have to bracket this with + mytt(unsetopt cshjunkiequotes) and mytt(setopt cshjunkiequotes), or put it + in your tt(.zshrc) before the option is set. + + Arguably the prompt code should handle `print'-like escapes. Feel + free to write this :-CHAR(41). Otherwise, you can use + verb( + PROMPT=$(print "Hi Joe,\nwhat now?%# ") + ) + in your initialisation file. + + +sect(Why does mytt(bindkey ^a command-name) or mytt(stty intr ^-) do something funny?) + + You probably have the extendedglob option set in which case tt(^) and tt(#) + are metacharacters. tt(^a) matches any file except one called tt(a), so the + line is interpreted as bindkey followed by a list of files. Quote the + tt(^) with a backslash or put quotation marks around tt(^a). + + +sect(Why can't I bind tt(\C-s) and tt(\C-q) any more?) + + The control-s and control-q keys now do flow control by default, + unless you have turned this off with mytt(stty -ixon) or redefined the + keys which control it with mytt(stty start) or mytt(stty stop). (This is + done by the system, not zsh; the shell simply respects these + settings.) In other words, tt(\C-s) stops all output to the terminal, + while tt(\C-q) resumes it. + + There is an option NO_FLOW_CONTROL to stop zsh from allowing flow + control and hence restoring the use of the keys: put mytt(setopt + noflowcontrol) in your tt(.zshrc) file. + + +sect(How do I execute command mytt(foo) within function mytt(foo)?) + + The command mytt(command foo) does just that. You don't need this with + aliases, but you do with functions. Note that error messages like + verb( + zsh: job table full or recursion limit exceeded + ) + are a good sign that you tried calling `foo' in function `foo' without + using `command'. If mytt(foo) is a builtin rather than an external + command, use mytt(builtin foo) instead. + + +sect(Why do history substitutions with single bangs do something funny?) + + If you have a command like "tt(echo !-2:$ !$)", the first history + substitution then sets a default to which later history substitutions + with single unqualified bangs refer, so that !$ becomes equivalent to + tt(!-2:$). The option CSH_JUNKIE_HISTORY makes all single bangs refer + to the last command. + + +sect(Why does zsh kill off all my background jobs when I logout?) + + Simple answer: you haven't asked it not to. Zsh (unlike [t]csh) gives + you the option of having background jobs killed or not: the mytt(nohup) + option exists if you don't want them killed. Note that you can always + run programs with mytt(nohup) in front of the pipeline whether or not the + option is set, which will prevent that job from being killed on + logout. (mytt(nohup) is actually an external command.) + + The mytt(disown) builtin is very useful in this respect: if zsh informs + you that you have background jobs when you try to logout, you can + mytt(disown) all the ones you don't want killed when you exit. This is + also a good way of making jobs you don't need the shell to know about + (such as commands which create new windows) invisible to the shell. + Likewise, you can start a background job with mytt(&!) instead of just + mytt(&) at the end, which will automatically disown the job. + + +sect(How do I list all my history entries?) + + Tell zsh to start from entry 1: mytt(history 1). Those entries at the + start which are no longer in memory will be silently omitted. + + +sect(How does the alternative loop syntax, e.g. mytt(while {...} {...}) \ +work?) + + Zsh provides an alternative to the traditional sh-like forms with mytt(do), + verb( + while TEST; do COMMANDS; done + ) + allowing you to have the COMMANDS delimited with some other command + structure, often mytt({...}). The rules are quite complicated and + in most scripts it is probably safer --- and certainly more + compatible --- to stick with the sh-like rules. If you are + wondering, the following is a rough guide. + + To make it work you must make sure the TEST itself is clearly + delimited. For example, this works: + verb( + while (( i++ < 10 )) { echo i is $i; } + ) + but this does myem(not): + verb( + while let "i++ < 10"; { echo i is $i; } # Wrong! + ) + The reason is that after mytt(while), any sort of command list is valid. + This includes the whole list mytt(let "i++ < 10"; { echo i $i; }); + the parser simply doesn't know when to stop. Furthermore, it is + wrong to miss out the semicolon, as this makes the mytt({...}) part + of the argument to mytt(let). A newline behaves the same as a + semicolon, so you can't put the brace on the next line as in C. + + So when using this syntax, the test following the mytt(while) must + be wrapped up: any of mytt(((...))), mytt([[...]]), mytt({...}) or + mytt((...)) will have this effect. (They have their usual syntactic + meanings too, of course; they are not interchangeable.) Note that + here too it is wrong to put in the semicolon, as then the case + becomes identical to the preceding one: + verb( + while (( i++ < 10 )); { echo i is $i; } # Wrong! + ) + + The same is true of the mytt(if) and mytt(until) constructs: + verb( + if { true } { echo yes } else { echo no } + ) + but with mytt(for), which only needs a list of words, you can get + away with it: + verb( + for foo in a b; { echo foo is $a; bar=$foo; } + ) + since the parser knows it only needs everything up to the first + semicolon. For the same reason, there is no problem with the mytt(repeat), + mytt(case) or mytt(select) constructs; in fact, mytt(repeat) doesn't even + need the semicolon since it knows the repeat count is just one word. + + This is independent of the behaviour of the SHORTLOOPS option (see + manual), which you are in any case encouraged even more strongly not + to use in programs as it can be very confusing. + + +sect(Why is my history not being saved?) + + In zsh, you need to set three variables to make sure your history is + written out when the shell exits. For example, + verb( + HISTSIZE=200 + HISTFILE=~/.zsh_history + SAVEHIST=200 + ) + tt($HISTSIZE) tells the shell how many lines to keep internally, + tt($HISTFILE) tells it where to write the history, and tt($SAVEHIST), + the easiest one to forget, tells it how many to write out. The + simplest possibility is to set it to the same as tt($HISTSIZE) as + above. There are also various options affecting history; see the + manual. + + +chapter(The mysteries of completion) + +Programmable completion using the `compctl' command is one of the most +powerful, and also potentially confusing, features of zsh; here I give +a short introduction. There is a set of example completions supplied +with the source in Misc/compctl-examples; completion definitions for +many of the most obvious commands can be found there. + +sect(What is completion?) + + `Completion' is where you hit a particular command key (TAB is the + standard one) and the shell tries to guess the word you are typing + and finish it for you --- a godsend for long file names, in + particular, but in zsh there are many, many more possibilities than + that. + + There is also a related process, `expansion', where the shell sees + you have typed something which would be turned by the shell into + something else, such as a variable turning into its value ($PWD + becomes /home/users/mydir) or a history reference (!! becomes + everything on the last command line). In zsh, when you hit TAB it + will look to see if there is an expansion to be done; if there is, + it does that, otherwise it tries to perform completion. (You can + see if the word would be expanded --- not completed --- by TAB by + typing mytt(\C-x g), which lists expansions.) Expansion is generally + fairly intuitive and not under user control; for the rest of the + chapter I will discuss completion only. + + +sect(What sorts of things can be completed?) +label(42) + + The simplest sort is filename completion, mentioned above. Unless + you have made special arrangements, as described below, then after + you type a command name, anything else you type is assumed by the + completion system to be a filename. If you type part of a word and + hit TAB, zsh will see if it matches the first part a file name and + if it does it will automatically insert the rest. + + The other simple type is command completion, which applies + (naturally) to the first word on the line. In this case, zsh + assumes the word is some command to be executed lying in your $PATH + (or something else you can execute, like a builtin command, a + function or an alias) and tries to complete that. + + Other forms of completion have to be set up by special arrangement. + See the manual entry for compctl for a list of all the flags: you + can make commands complete variable names, user names, job names, + etc., etc. + + For example, one common use is that you have an array variable, + tt($hosts), which contains names of other machines you use frequently on + the network: + verb( + hosts=(fred.ph.ku.ac.uk snuggles.floppy-bunnies.com here.there.edu) + ) + then you can tell zsh that when you use telnet (or ftp, or ...), the + argument will be one of those names: + verb( + compctl -k hosts telnet ftp ... + ) + so that if you type mytt(telnet fr) and hit TAB, the rest of the name + will appear by itself. + + An even more powerful option to tt(compctl) (tt(-g)) is to tell zsh that + only certain sorts of filename are allowed. The argument to tt(-g) is + exactly like a glob pattern, with the usual wildcards mytt(*), mytt(?), etc. + In the compctl statement it needs to be quoted to avoid it being + turned into filenames straight away. For example, + verb( + compctl -g '*.(ps|eps)' ghostview + ) + tells zsh that if you type TAB on an argument after a ghostview + command, only files ending in mytt(.ps) or mytt(.eps) should be considered + for completion. + + A useful addition for zsh from version 3.1 is directory completion: + verb( + compctl -/ cd + ) + Before, you had to use tt(-g), but this is neater: it takes care of + things like ignoring directories beginning with a dot unless you've + typed the dot yourself, and whole directory paths are understood. + + Note that flags may be combined; if you have more than one, all the + possible completions for all of them are put into the same list, all + of them being possible completions. So + verb( + compctl -k hosts -f rcp + ) + tells zsh that rcp can have a hostname or a filename after it. (You + really need to be able to handle host:file, which is where + programmable completion comes in, see link(4.5)(45).) Also, from + version 3.1 you can always handle directories at the same time as + other files just by adding tt(-/) to the list. + + +sect(How does zsh deal with ambiguous completions?) + + Often there will be more than one possible completion: two files + start with the same characters, for example. Zsh has a lot of + flexibility for what it does here via its options. The default is + for it to beep and completion to stop until you type another + character. You can type tt(\C-D) to see all the possible completions. + (That's assuming your at the end of the line, otherwise tt(\C-D) will + delete the next character and you have to use tt(ESC-\C-D).) This can be + changed by the following options, among others: + itemize( + it() with nobeep set, that annoying beep goes away + it() with nolistbeep, beeping is only turned off for ambiguous completions + it() with autolist set, when the completion is ambiguous you get a + list without having to type tt(\C-D) + it() with listambigous, this is modified so that nothing is listed if + there is an unambiguous prefix or suffix to be inserted + it() with menucomplete set, one completion is always inserted + completely, then when you hit TAB it changes to the next, and so + on until you get back to where you started + it() with automenu, you only get the menu behaviour when you hit TAB + again on the ambiguous completion. + it() Finally, although it affects all completion lists, including + those explicitly requested, note also alwayslastprompt, which + causes the cursor to return to the line you were editing after + printing the list, provided that is short enough. + ) + Combinations of these are possible; for example, autolist and + automenu together give an intuitive combination. Note that + from version 3.1 listambiguous is set by default; if you use + autolist, you may well want to `unsetopt listambiguous'. + + +sect(How do I complete in the middle of words / just what's before the cursor?) + + Sometimes you have a word on the command-line (let's stick to file + names) which is incomplete in the middle. Normally if you hit tab + in zsh, it will simply go to the end of the word and try to complete + there. However, there are two ways of changing this. + + First, there is the option COMPLETE_IN_WORD. This tries to fill in + the word at the point of the cursor. For example, if the current + directory contains mytt(foobar), then with the option set, you can + complete mytt(fbar) to mytt(foobar) by moving the cursor to the + mytt(b) and hitting tab. + + That's not the full story, however. Sometimes you just want the + part of the word before the cursor completed. For example, the word + is mytt(/usr/loc/b), which you want to complete to mytt(/usr/local/bin). + Normally, zsh won't do this in one go because there are two bits + missing (but see below!), so you need to complete the mytt(/usr/loc) + on its own first. For this you need the function + tt(expand-or-complete-prefix): it works mostly like the usual + function bound to tab, but it ignores anything on the right of the + cursor. If you always want this behaviour (some other shells do + this), bind it to tab; otherwise put another binding, e.g. mytt(^X + TAB) in tt(~/.zshrc): + verb( + bindkey "^X^I" expand-or-complete-prefix + ) + then in the example you can move to just after mytt(/usr/loc), hit + whatever key you've just bound, move to the end, and hit tab. + (Note that AUTO_REMOVE_SLASH behaviour applies here, see the manual.) + + Even that doesn't exhaust the possibilities. Included with the + source distribution is the file tt(Functions/multicomp), a function + which you can bind as an alternative form of default completion (see + below for a description of alternative completion), e.g. + verb( + compctl -D -f + -U -Q -K multicomp + ) + and whole sequences of directories, like mytt(/usr/loc/b) or even + mytt(/u/l/b) can be completed in one go. It works best with + menucompletion if the result is ambiguous. + + +sect(How do I get started with programmable completion?) +label(45) + + Finally, the hairiest part of completion. It is possible to get zsh + to consider different completions not only for different commands, + but for different words of the same command, or even to look at + other words on the command line (for example, if the last word was a + particular flag) and decide then. + + There are really two sorts of things to worry about. The simpler is + alternative completion: that just means zsh will try one + alternative, and only if there are no possible completions try the + next. For example + verb( + compctl -g '*.ps' + -f lpr + ) + says that after lpr you'd prefer to find only mytt(.ps) files, so if + there are any, only those are used, but if there aren't any, any + old file is a possibility. You can also have a tt(+) with no flags + after it, which tells zsh that it's to treat the command like any + other if nothing was found. That's only really useful if your + default completion is fancy, i.e. you have done something with + mytt(compctl -D) to tell zsh how commands which aren't specially handled + are to have their arguments completed. + + The second sort is the hard one. Following a mytt(-x), zsh expects that + the next thing will be some completion code, which is a single + letter followed by an argument in square brackets. For example + mytt(p[1]): mytt(p) is for position, and the argument tells it to look at + position 1; that says that this completion only applies to the word + immediately after the command. You can also say mytt(p[1,3]) which says + the completion only applies to the word if it's between the first + and third words, inclusive, after the command, and so on. See the + list in the `compctl' manual entry for a list of these conditions: + some conditions take one argument in the square brackets, some two. + Usually, negative numeric arguments count backwards from the end + (for example, mytt(p[-1]) applies to the last word on the line). + + (Note the difference in the ways mytt(+) and mytt(-x) work. A mytt(+) + completion will always try and find completions for what's before + the mytt(+) first; it will only produce a list for what's after if + the first list was empty. On the other hand, if a condition for a + mytt(-x) matches, the appropriate set of completions is always used, + even if the list of completions produced is empty.) + + The condition is then followed by the flags as usual (as in link(4.2)(42)), + and possibly other condition/flag sets following a single -; the + whole lot ends with a double -- before the command name. In other + words, each extended completion section looks like this: + verb( + -x ... [ - ... ...] -- + ) + + Let's look at rcp again: this assumes you've set up tt($hosts) as above. + This uses the mytt(n[,]) flag, which tells zsh to look for + the tt()'th occurrence of in the word, ignoring anything up + to and including that. We'll use it for completing the bits of + rcp's mytt(user@host:file) combination. (Of course, the file name is on + the local machine, not mytt(host), but let's ignore that; it may still + be useful.) + COMMENT(-- note space after backslash --) + verb( + compctl -k hosts -S ':' + -f -x 'n[1,:]' -f - \ + 'n[1,@]' -k hosts -S ':' -- rcp + ) + This means: (1) try and complete a hostname (the bit before the + mytt(+)), if successful add a mytt(:) (tt(-S) for suffix); (2) if that fails + move on to try the code after the mytt(+): look and see if there is a + mytt(:) in a word (the mytt(n[1,:])); if there is, complete filenames + (tt(-f)) after the first of them; (3) otherwise look for an mytt(@) and + complete hostnames after the first of them (the mytt(n[1,@])), adding a + mytt(:) if successful; (4) if all else fails use the mytt(-f) before the + mytt(-x) and try to complete files. + + So the rules for order are (1) try anything before a mytt(+) before + anything after it (2) try the conditions after a tt(-x) in order until + one succeeds (3) use the default flags before the tt(-x) if none of the + conditions was true. + + Different conditions can also be combined. There are three levels + of this (in decreasing order of precedence): + SETCOUNTER(XXenumcounter)(0) + enumerate( + myeit() multiple square brackets after a single condition give + alternatives: for example, mytt(s[foo][bar]) says apply the + completion if the word begins with mytt(foo) or mytt(bar), + myeit() spaces between conditions mean both must match: for example, + mytt(p[1] s[-]) says this completion only applies for the first word + after the command and only if it begins with a mytt(-), + myeit() commas between conditions mean either can match: for example, + mytt(c[-1,-f], s[-f]) means either the previous word (-1 relative to + the current one) is tt(-f), or the current word begins with tt(-f) --- + useful to use the same completion whether or not the tt(-f) has a + space after it. + ) + You must be careful to put the whole expression inside quotation + marks, so that it appears as a single argument to tt(compctl). + + Here's a useless example just to show a general mytt(-x) completion. + verb( + compctl -f -x 'c[-1,-u][-1,-U] p[2], s[-u]' -u - \ + 'c[-1,-j]' -P % -j -- foobar + ) + The way to read this is: for command mytt(foobar), look and see if (((the + word before the current one is tt(-u)) or (the word before the current + one is tt(-U))) and (the current word is 2)) or (the current word begins + with tt(-u)); if so, try to complete user names. If the word before + the current one is tt(-j), insert the prefix mytt(%) before the current word + if it's not there already and complete job names. Otherwise, just + complete file names. + + +sect(And if programmable completion isn't good enough?) + + ...then your last resort is to write a shell function to do it for + you. By combining the mytt(-U) and mytt(-K func) flags you can get + almost unlimited power. The mytt(-U) tells zsh that whatever the + completion produces is to be used, even if it doesn't fit what's + there already (so that gets deleted when the completion is + inserted). The mytt(-K func) tells zsh a function name. The + function is passed the part of the word already typed, and can read + the rest of the line with mytt(read -c). It can return a set of + completions via the mytt(reply) array, and this becomes the set of + possible completions. The best way to understand this is to look at + mytt(multicomp) and other functions supplied with the zsh + distribution. + + +chapter(The future of zsh) + +sect(What bugs are currently known and unfixed? (Plus recent \ +important changes)) +label(51) + + Here are some of the more well-known ones, very roughly in + decreasing order of significance. Many of these can also be counted + against differences from ksh in question link(2.1)(21); note that \ +this applies + to the latest beta version and that simple bugs are often fixed + quite quickly. There is a file Etc/BUGS in the source distribution + with more detail. + + itemize( + it() mytt(time) is ignored with builtins and can't be used with mytt({...}). + it() mytt(set -x) (mytt(setopt xtrace)) still has a few glitches. + it() Zsh's notion of the current line number (via tt($LINENO)) is + sometimes not well handled, particularly when using functions and traps. + it() In vi mode, mytt(u) can go past the original modification point. + it() The singlelinezle option has problems with prompts containing escapes. + it() The mytt(r) command does not work inside mytt($(...)) or mytt(`...`) + expansions. (This is fixed in 3.1.) + it() mytt(typeset) handling is non-optimal, particularly with regard to + flags, and is ksh-incompatible in unpredictable ways. + it() Nested closures in extended globbing and pattern matching, such as + verb( + [[ fofo = (fo#)# ]] + ) + were not correctly handled, and there were problems with + complicated exclusions using mytt(^) or mytt(~). (These + are fixed in version 3.1.3.) + ) + + Note that a few recent changes introduce incompatibilities (these + are not bugs): + + Changes after zsh 3.0 (3.1.x is still currently in beta): + itemize( + it() The options ALWAYS_LAST_PROMPT (return to the line you were + editing after displaying completion lists) and LIST_AMBIGUOUS + (show matching files when there are several) are now set by + default. This is in response to complaints that too many zsh + features are never noticed by many users. To turn them off, + just put mytt(unsetopt alwayslastprompt listambiguous) in your + tt(.zshrc) file. + it() tt(history-search-{forward,backward}) now only find previous + lines where the first word is the same as the current one. For + example, + verb( + compp + ) + will find lines in the history like mytt(comp -edit emacs), but not + mytt(compress file) any more. For this reason, mytt(\M-n) and + mytt(\M-p) use tt(history-beginning-search-{forward,backward}) which + search for a line with the same prefix up to the cursor position. + It is possible to write functions which go a little closer to the + original behaviour; further changes are still possible. + it() In vi insert mode, the cursor keys no longer work. The following + will bind them: + COMMENT(-- note space after backslash --) + verb( + bindkey -M viins '^[[D' vi-backward-char '^[[C' vi-forward-char \ + '^[[A' up-line-or-history '^[[B' down-line-or-history + ) + (unless your terminal requires mytt(^[O) instead of mytt(^[[)). The + rationale is that the insert mode and command mode keymaps for + keys with prefixes are now separate. + ) + + Changes since zsh 2.5: + itemize( + it() The left hand of an assignment is no longer substituted. Thus, + mytt($1=$2) will not work. You can use something like mytt(eval + "$1=\$2"), which should have the identical effect. + it() Signal traps established with the `trap' builtin are now called with + the environment of the caller, as in ksh, instead of as a new + function level. Traps established as functions (e.g. mytt(TRAPINT() + {...})) work as before. + it() The NO_CLOBBER option is now -C and PRINT_EXIT_VALUE -1; they used + to be the other way around. (Use of names rather than letters is + generally recommended.) + it() mytt([[) is a reserved word, hence must be separated from + other characters by whitespace; mytt({) and mytt(}) are also reserved + words if the IGNORE_BRACES option is set. + it() The option CSH_JUNKIE_PAREN has been removed: csh-like code now + always does what it looks like it does, so mytt(if ( ... ) ...) + executes the code in parentheses in a subshell. To make this + useful, the syntax expected after an mytt(if), etc., is less strict + than in other shells. + it() mytt(foo=*) does not perform globbing immediately on the right + hand side of the assignment; the old behaviour now requires the + option GLOB_ASSIGN. (mytt(foo=(*)) is and has always been the + consistent way of doing this.) + it() tt(<>) performs redirection of input and output to the specified file. + For numeric globs, you now need tt(<->). + it() The command line qualifiers tt(exec), tt(noglob), tt(command), \ + tt(-) are now + treated more like builtin commands: previously they were + syntactically special. This should make it easier to perform + tricks with them (disabling, hiding in parameters, etc.). + it() The pushd builtin has been rewritten for compatibility with other + shells. The old behavour can be achieved with a shell function. + it() The current version now uses tt(~)'s for directory stack substitution + instead of tt(=)'s. This is for consistency: all other directory + substitution (tt(~user), tt(~name), tt(~+), ...) used a tilde, while + tt(=) caused problems with tt(=program) substitution. + it() The `HISTLIT' option was broken in various ways and has been removed: + the rewritten history mechanism doesn't alter history lines, making + the option unnecessary. + it() History expansion is disabled in single-quoted strings, like other + forms of expansion -- hence exclamation marks there should not be + backslashed. + it() The mytt($HISTCHARS) variable is now mytt($histchars). Currently both + are tied together for compatibility. + it() The PROMPT_SUBST option now performs backquote expansion -- hence + you should quote these in prompts. (SPROMPT has changed as a result.) + it() Quoting in prompts has changed: close parentheses inside ternary + expressions should be quoted with a tt(%); history is now tt(%!), not + tt(!). Backslashes are no longer special. + ) + + +sect(Where do I report bugs, get more info / who's working on zsh?) +label(52) + + The shell is being maintained by various (entirely self-appointed) + subscribers to the mailing list, + verb( + zsh-workers@math.gatech.edu + ) + so mail on any issues (bug reports, suggestions, complaints...) + related to the development of the shell should be sent there. If + you want someone to mail you directly, say so. Most patches to zsh + appear there first. + + Please note when reporting bugs that many exist only on certain + architectures, which the developers may not have access to. In + this case debugging information, as detailed as possible, is + particularly welcome. + + Two progressively lower volume lists exist, one with messages + concerning the use of zsh, + verb( + zsh-users@math.gatech.edu + ) + and one just containing announcements: about releases, about major + changes in the shell, or this FAQ, for example, + verb( + zsh-announce@math.gatech.edu + ) + (posting to the last one is currently restricted). + + Note that you should only join one of these lists: people on + zsh-workers receive all the lists, and people on zsh-users will + also receive the announcements list. + + The lists are handled by an automated server. The instructions for + zsh-announce and zsh-users are the same as for zsh-workers: just + change zsh-workers to whatever in the following. + + To join zsh-workers, send email to + verb( + zsh-workers-request@math.gatech.edu + ) + with the mybf(subject) line (this is a change from the old list) + verb( + subscribe + ) + e.g. + verb( + Subject: subscribe P.Stephenson@swansea.ac.uk + ) + and you can unsubscribe in the same way. + The list maintainer, Richard Coleman, can be reached at + email(coleman@math.gatech.edu). + + The list from May 1992 to May 1995 is archived in + url(ftp://ftp.sterling.com/zsh/zsh-list/YY-MM) +(ftp://ftp.sterling.com/zsh/zsh-list/YY-MM) + where YY-MM are the year and month in digits. More recent + mailings up to date are to be found at + url(http://www.zsh.org/mla/)(http://www.zsh.org/mla/) + at the main zsh archive in Australia. + + Of course, you can also post zsh queries to the Usenet group + comp.unix.shell; if all else fails, you could even e-mail me. + + +sect(What's on the wish-list?) + + With version 3, the code is much cleaner than before, but still + bears the marks of the ages and many things could be done much + better with a rewrite. A more efficient set of code for + lexing/parsing/execution might also be an advantage. Volunteers are + particularly welcome for these tasks. + + An improved line editor, with user-definable functions and binding + of multiple functions to keystrokes, is being developed. + + itemize( + it() Loadable module support (will be in 3.1 but much work still needs doing). + it() Ksh compatibility could be improved. + it() Option for glob qualifiers to follow perl syntax (a traditional item). + it() Binding of shell functions to key strokes, accessing editing + buffer from functions, executing zle functions as a command: now + under development for 3.1. + it() Users should be able to create their own foopath/FOOPATH array/path + combinations. + ) + + +sect(Will zsh have problems in the year 2000?) + + (This information was written by Bart Schaefer. Note it is a + description of the state of affairs as seen by the developers, it is + not a guarantee!) + + You can confirm the following by looking at the source code yourself + if necessary; there's no other definitive reference: + + Zsh uses UNIX/POSIX time_t, timeval, and tm data types for internal + date manipulations. These types either do not store year values at + all (for example, time_t is measured in seconds since midnight, Jan + 1, 1970) or store them as integer types and NOT as pairs of digits. + Thus there can be no overflows at year 2000. On some unix systems, + time_t is a 32-bit value and will overflow during the year 2038, but + more modern systems use a 64-bit time_t. + + The only input and output of dates that zsh performs for its own use + is optional history time-stamping. This is performed using time_t + values converted to long integers, which are either 32 or 64 bits, + see above. + + Note, however, that zsh does provide facilities for formatted date + output, in particular in prompt escapes such as mytt(%W) and + mytt(%D) using mytt(print -P), so it's possible that scripts written + for zsh might employ 2-digit years. Shell scripts should always be + considered separate programs and therefore evaluated individually. + + +nsect(Acknowledgments:) + +Thanks to zsh-list, in particular Bart Schaefer, for suggestions +regarding this document. Zsh has been in the hands of archivists Jim +Mattson, Bas de Bakker, Richard Coleman, Zoltan Hidvegi and Andrew +Main, and the mailing list has been run by Peter Gray, Rick Ohnemus +and Richard Coleman, all of whom deserve thanks. The world is +eternally in the debt of Paul Falstad for inventing zsh in the first +place (though the wizzo extended completion is by Sven Wischnowsky). + + +nsect(Copyright Information:) + +This document is copyright (C) P.W. Stephenson, 1995, 1996, 1997, +1998. This text originates in the U.K. and the author asserts his +moral rights under the Copyrights, Designs and Patents Act, 1988. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +documentation for any purpose, provided that the above copyright +notice appears in all copies of this documentation. Remember, +however, that this document changes monthly and it may be more useful +to provide a pointer to it rather than the entire text. A suitable +pointer is "information on the Z-shell can be obtained on the World +Wide Web at URL http://sunsite.auc.dk/zsh/". diff --git a/Etc/FEATURES b/Etc/FEATURES new file mode 100644 index 000000000..1953a5de1 --- /dev/null +++ b/Etc/FEATURES @@ -0,0 +1,74 @@ +------------ +ZSH FEATURES +------------ + +very close to ksh/sh grammar, with csh additions +most features of ksh, bash, and tcsh +can emulate ksh or POSIX sh +81 builtins, 102 options, 162 key bindings +short for loops, ex: for i (*.c) echo $i +select +shell functions +conditional expressions (test builtin, [ ... ], and ksh-style [[ ... ]]) +global aliases (may be expanded anywhere on the line) +directory stack access with =num +process substitution (vi =(cmd) edits the output of cmd) +generalized pipes (ls foo >>(cmd1) 2>>(cmd2) pipes stdout to cmd1 + and stderr to cmd2) +arithmetic expressions +advanced globbing: + ls **/file searches recursively for "file" in subdirectories + ls file<20-> matches file20, file30, file100, etc. + ls *.(c|pro) matches *.c and *.pro + ls *(R) matches only world-readable files + ls *.c~lex.c matches all .c files except lex.c +null command shorthands: + "< file" is same as "more file" is same as "cat >file" + ">> file" is same as "cat >>file" +ksh-style coprocesses +automatic file stream teeing (ls >foo >bar puts output in two places) +chpwd() function run every time you change directory (useful for + updating the status line) +job control +csh-style history +full vi line editing, including "c2w" and "y$" and such things +full emacs line editing +incremental history search +magic-space history +spelling correction +array parameters +$MACHTYPE, $VENDOR and $OSTYPE identify the host machine +$LINENO, $RANDOM, $SECONDS, $cdpath, $COLUMNS, $fignore, $HISTCHARS, $mailpath +$UID, $EUID, $GID, $EGID and $USERNAME can be assigned to +with autocd option, typing a directory name by itself is the same as + typing "cd dirname" +menu completion: pressing TAB repeatedly cycles through the possible matches +incremental path hashing +automatic process time reporting for commands that run over a certain limit +full tcsh-style prompt substitution +utmp login/logout reporting +with histverify option, performing csh-style history expansions causes the + input line to be brought up for editing instead of being executed +with sunkeyboardhack option, accidentally typed trailing ` characters + are removed from the input line (for those of you with Sun keyboards :-) ) +autoloaded functions (loaded from a file when they are first referenced) +"cd old new" replaces "old" with "new" in directory string +generalized argument completion, including: + - command name completion + - filename and path completion + - hostname completion + - key binding completion + - option completion + - variable name completion + - user-specified keyword completion + - anything else you can think of +prompt on right side of screen +directory stacks +history datestamps and execution time records +command scheduling (like at(1), but in the shell's context) +tty mode freezing +up to 9 startup files (but you only need 1 or 2) +really 8-bit clean, and we mean it this time +which -a cmd lists all occurrences of "cmd" in the path +dynamically loadable binary modules diff --git a/Etc/FTP-README b/Etc/FTP-README new file mode 100644 index 000000000..a87bc74fc --- /dev/null +++ b/Etc/FTP-README @@ -0,0 +1,61 @@ +------------------- +FTP ARCHIVE FOR ZSH +------------------- + +General +------- + +README + You're reading it. + +META-FAQ + Information about zsh ftp sites, web sites, and mailing lists. + +FAQ + The zsh Frequently Asked Questions (FAQ) list. + +pubring.pgp + PGP keys of some major Zsh developers. + +MD5SUM + MD5 checksums of each file. + +Source Code +----------- + +zsh.tar.gz + Latest production release of zsh. Includes the source files of all + documentation. + +zsh-beta.tar.gz + The current development version of zsh. Not guaranteed to be stable. + +zsh-*.tar.gz + Specific zsh versions. If you just want the latest zsh then use + zsh.tar.gz or zsh-beta.tar.gz. + +zsh-*-*.diff.gz + Context diffs between releases. Note that if you use this for + upgrading and you do not have the latest version of GNU autoconf + installed on your system you have to touch stamp.h.in and configure + in the main directory after applying the patches otherwise make will + think that these files are not up-to-date and will try to remake them. + Do not forget to specify the -p0 flag to patch. Without -p0 new + files will be created in the current directory. + +old/* + Older zsh versions. Of historical interest only. + +Documentation +------------- + +zsh-doc.tar.gz + Pre-built Postscript, Info, DVI and HTML versions of the documentation + contained in the stable zsh distribution zsh.tar.gz. + +zsh-beta-doc.tar.gz + Pre-built Postscript, Info, DVI and HTML versions of the documentation + contained in the beta zsh distribution zsh-beta.tar.gz. + +zsh-*-doc.tar.gz + Pre-built documentation for specific zsh versions. diff --git a/Etc/MACHINES b/Etc/MACHINES new file mode 100644 index 000000000..303508a93 --- /dev/null +++ b/Etc/MACHINES @@ -0,0 +1,94 @@ +----------------------------- +ZSH ON SPECIFIC ARCHITECTURES +----------------------------- + +These are the OSes that zsh has been tried on. If you succeed in getting +zsh to work on an OS not listed, let us know. + +On all machines if you use gcc and upgrade your OS you must rebuild gcc +after the OS upgrade. A gcc left from a previous OS may seem to work +but compiling more complex programs may fail mysteriously. + +The format of entries is thus: + + Vendor: OS & version (hardware type) [zsh version tried] + information + +Machines +-------- + +Cray: Unicos (C90 and T90) + Should build `out-of-the-box'. + +Data General: DG/UX 5.4R3.10 MU01 (various AViiONs) + Should build `out-of-the-box'. + +DEC: Ultrix (Alpha or DECstation) +DEC: Mach 3.0 (DECstation 5000/25) +DEC: OSF/1 1.2, 1.3, 2.0, 3.*, DEC Unix 4.* (Alpha) + In OSF/1 3.x, there is apparently a bug in the header file + /usr/include/rpcsvc/ypclnt.h; the prototype for yp_all() has a + struct ypall_callback as its final argument, which should be a + pointer (struct ypall_callback *). This prevents compilation of + one of zsh' files (zle_tricky.c). If you can't modify the header + file, create a directory called `rpcsvc' in zsh's Src subdirectory + and put a fixed version of the header file to it before compiling. + + The strip coming with gcc-2.7.2 seems to create unusable binaries. + This problem is not related to zsh. If you have such problems, + remove the bogus strip and use /bin/strip instead. + +FreeBSD: FreeBSD 2.2.7 [3.1.4] + Should build `out-of-the-box'. + +HP: HP-UX 9, 10.20 + Should build `out-of-the-box'. + +IBM: AIX + Should build `out-of-the-box'. + +Linux: Linux (i386) [3.1.4] + If you are using an early minor version of libc 5, then a bug + in the auto-configuration process may cause zsh to think that + your system doesn't support the lstat function. If the configure + process reports that there is no lstat, edit config.h and change + HAVE_LSTAT to 1. libc-5.2.18 or later does not have this problem. + +NetBSD: NetBSD 1.* + Should build `out-of-the-box'. + +Next: NextStep 3.* + Should build `out-of-the-box', but the zsh malloc routines are + not recommended. + +Reliant: Reliant UNIX + Should build `out-of-the-box'. + +Reliant: SINIX + Should build `out-of-the-box'. There is a bad combination of + static and shared libraries that prevents the use of dynamic + linking; configure now detects this and will disable dynamic + linking even if you requested it. + +SGI: IRIX 5.1.1.1, 5.2, 5.3, 6.2, 6.3 + Should build `out-of-the-box'. + +Sun: SunOS 4.1.* + Under 4.1.3 if yellow pages is used, username completion may cause + segmentation violation. This is a bug in the shared library not + in zsh. Some libc.so.1.9.* has this bug (it fails in yp_all). + Statically linked binaries will work if linked with libc.so.1.8.1 + (which means that if you can get a statically linked binary + compiled under 4.1.2 that it will probably work). An alternative + but untested solution may be to undefine HAVE_NIS in config.h. + This may work, but the first username completion will be _very_ + slow (as slow as in tcsh). + +Sun: Solaris 2.* + The UCB versions of the routines for reading directories are not + usable (the struct definitions are incompatible with the ones + assumed by zsh). The symptom of this is that globbed filenames in + the compiled version of zsh will be missing the first two letters. + To avoid this, make sure you compile zsh without any reference + to /usr/ucblib in your LD_LIBRARY_PATH. You can easily do this + by just unsetting LD_LIBRARY_PATH before building zsh. diff --git a/Etc/Makefile.in b/Etc/Makefile.in new file mode 100644 index 000000000..bdb9234fd --- /dev/null +++ b/Etc/Makefile.in @@ -0,0 +1,59 @@ +# +# Makefile for Etc subdirectory +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +subdir = Etc +dir_top = .. +SUBDIRS = + +@@version.mk@@ +@@defs.mk@@ + +# ========== DEPENDENCIES FOR BUILDING ========== + +all: FAQ + +FAQ: FAQ.yo + cd $(sdir) && $(YODL2TXT) FAQ.yo && mv -f FAQ.txt FAQ + +FAQ.html: FAQ.yo + $(YODL2HTML) $(sdir)/FAQ.yo + +# ========== DEPENDENCIES FOR CLEANUP ========== + +@@clean.mk@@ + +mostlyclean-here: + rm -f FAQ.html + +distclean-here: + rm -f Makefile + +realclean-here: + rm -f FAQ + +# ========== DEPENDENCIES FOR MAINTENANCE ========== + +@@config.mk@@ diff --git a/Etc/NEWS b/Etc/NEWS new file mode 100644 index 000000000..e4bafc08d --- /dev/null +++ b/Etc/NEWS @@ -0,0 +1,203 @@ +------------------------------------- +CHANGES FROM PREVIOUS VERSIONS OF ZSH +------------------------------------- + +New features in zsh version 3.1 (beta version) +---------------------------------------------- + +On most operating systems zsh can load binary modules dynamically at +run-time. ZLE and the compctl builtin are now reside in a separate +module which is loaded automatically on demand. + +for ((expr; expr; expr)) do ... done loop syntax from AT&T ksh93 is +now supported. + +POSIX globbing character classes ([:alnum:] etc.) are now supported. + +ksh's case fall-through feature (;&) is supported. + +ksh93's $'' quoting syntax is supported. + +Restricted mode is now supported. This is controlled by the new option +RESTRICTED (-r). + +New options BARE_GLOB_QUAL, HIST_NO_FUNCTIONS (alias NO_LOG), KSH_GLOB, +PRINT_EIGHT_BIT, PROMPT_BANG, PROMPT_PERCENT, RM_STAR_WAIT. + +Options ALWAYS_LAST_PROMPT, APPEND_HISTORY, AUTO_LIST, AUTO_MENU, +AUTO_PARAM_KEYS, AUTO_PARAM_SLASH, AUTO_REMOVE_SLASH, LIST_AMBIGUOUS +and LIST_TYPES are now on by default. + +In ZLE, arbitrarily many keymaps can be defined. Multi-character +keybindings now work. + +Completion can be performed within a brace expansion. + +EMACS-like universal-argument function. + + +New features in zsh version 3.0 +------------------------------- + +Trailing "/" in a glob pattern now works like in other shell thus it +can no longer be used as a sorthand for "(/)". + +Much improved sh/ksh emulation. When zsh is invoked as sh it mostly +conforms to POSIX 1003.2. + +Enhanced parameter expansion features: new flags: A, @, e, W, p, f, F. +Expansions can be nested. For example, +"${${(M)${(f@)$( is a redirection operator which opens the standard input for both +reading and writing. To match a number use <->. + +Option letters -1 and -C for PRINT_EXIT_VALUE and NO_CLOBBER are swapped: +`set -C' sets NO_CLOBBER and `set -1' sets PRINT_EXIT_VALUE. + +AUTO_PUSHD behaviour is changed. Now cd without arguments will always go +to the $HOME directory even if AUTO_PUSHD is set and PUSHD_TO_HOME is not +set. If you preferred the old behaviour you can alias cd to pushd. + +IFS word splitting with SH_WORD_SPLIT and the splitting of the input in the +read builtin has changed in cases when IFS contains characters other than +, , . See the description of IFS in the zshparam +manual page for more details. + + +New features in zsh version 2.5 +------------------------------- + +Greatly expanded completion possibilities. Programmable completion +allows detailed control over what arguments of what commands can be +completed to what. See dots/zcomp in the distribution for examples. + +Expand filenames with ~ and = on the right hand side of parameter +assignments. New option MAGIC_EQUAL_SUBST to do it in all +identifier=expression arguments. + +${+name} becomes 1 or 0 if name is set or unset. ${~spec} toggles +GLOB_SUBST in substitution. Parameter substitution takes lots +of flags in the format ${(flags)name}. + +New glob qualifiers for block/character special files, times in glob +qualifiers can be in months, weeks, days, hours, minutes. Qualifiers can +work on links or on what they point to. Qualifiers separated by commas +are or-ed. + +New parameter substitution modifiers (fFwW) to repeat actions. New +option CSH_JUNKIE_HISTORY. + +New line editor functions history-beginning-search-backward, +history-beginning-search-forward, expand-or-complete-prefix, push-input, +push-line-or-edit. + +Assign to part of a string, use qualifiers on string subscription with +$foo[(qual)2,5] + +New parameters: EGID, EUID, KEYTIMEOUT + +New prompt escape sequence %_ to get constructs like for and while in +the secondary prompt. %E in prompt clears to end of screen. + +Conditional expressions in PROMPT and WATCHFMT. + +New options ALWAYS_LAST_PROMPT, ALWAYS_TO_END, AUTO_PARAM_KEYS, +COMPLETE_ALIASES, COMPLETE_IN_WORD, CSH_JUNKIE_HISTORY, GLOB_SUBST, +LIST_AMBIGUOUS, MAGIC_EQUAL_SUBST, NO_FLOW_CONTROL, PROMPT_SUBST + +New option -m to many builtins makes arguments subject to pattern +matching. + +Bindkey can now bind both key sequences and prefixes of those. You can +for example bind ESC and function keys sending ESC sequences. + +Additional options to read builtin to use in functions called by +completion. + +New options to print to sort arguments and print them in columns. + +Some additional resource limits can be specified. + +Some editor functions now work in the minibuffer. diff --git a/Etc/pubring.pgp b/Etc/pubring.pgp new file mode 100644 index 000000000..526d1a66e --- /dev/null +++ b/Etc/pubring.pgp @@ -0,0 +1,150 @@ +Type Bits KeyID Created Expires Algorithm Use +pub 2048 0x8E1E1EC1 1997-05-15 ---------- RSA Sign & Encrypt +uid Andrew Main + +pub 2048 0x0FD2FDD5 1998-04-22 ---------- RSA Sign & Encrypt +uid Geoff C. Wing + +pub 1024 0xEE305E20 1998-04-22 ---------- DSS Sign & Encrypt +sub 2048 0xB1A6D227 1998-04-22 ---------- Diffie-Hellman +uid Geoff C. Wing + +pub 1024 0x71FB29E1 1994-10-10 ---------- RSA Sign & Encrypt +uid Richard J. Coleman + +pub 1024 0x8B37BE3D 1995-11-20 ---------- RSA Sign & Encrypt +uid Zoltan Hidvegi + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: PGPfreeware 5.0i for non-commercial use + +mQCNAzCw9pkAAAEEAKzybIrP6bvoDF7kJjTVgErU59QOsDQuQAFyPYxx9TrGST9Y +5kVtimMFiHmOaePtLzEMlJvAqHNnYGQge2WmH7V/jC678wdTlSouBoPN/6U8qq5N ++9BsW/pVvFOEJ4vhEXdOnj5Jcmp4+M6/Tb4c/rS5SdyZPP9yhQupSCiLN749AAUR +tCFab2x0YW4gSGlkdmVnaSA8aHpvbGlAY3MuZWx0ZS5odT6JAJUDBRAwv1zNC6lI +KIs3vj0BAaObA/9nFIIRGrP9wlCAuxQDwqGTuNKVUeKVyzuaj9zwsUULABGITZGT +tASMEb0X1HA2I822PZ8b6m1xj7idlwOSmCrO9gNgWr2VblynZo9LAZflwcTxr/9e +0oC+3owLFXadg7zUrYeRc9EJrhQ299nNoqkjOZbUQtZ97xcRfoMs0brpHpkAjQMu +mbisAAABBADshMnQari3rUDdHrxfSUlCO/nWJ4E/pcKPOnft2SUWaTC5q6IzaTUK +FauLy0DxRSIgO3w2Cd7ynm8rwtSXIvUvJg3X+fO1lm8MwePazh3A0DQxqSV2IsXb +I7yLq5IUWHSFIEZkQ9+hR7mi1Sx0dJ3WfnEh8LA/glkOAgIJcfsp4QAFEbQsUmlj +aGFyZCBKLiBDb2xlbWFuIDxjb2xlbWFuQG1hdGguZ2F0ZWNoLmVkdT6JAJUDBRAw +sPeuC6lIKIs3vj0BAZNeA/4pezBr5xMV/HX1P/u1YZMkFE/XV33svOggOUOhui0F +m1MD64D6oofjO2j0L8cV/YWwzT+pNB0JANH67MPaeK/zPffFDeq1yVumR6jmBoWR +L2IgTS5t2+5oC7T7lXRKu1JF0F8lY+jfDc+ZnjwL/WIcZqf0PYoLwWBcA3bES1T/ +yIkAlQMFEC8TK1KxPDjWo/GviQEBGgwEAJvnaxkio5hj4I55NSDVFlvr98OttR5C +awR/TmWoAPUumpJ4QfErnnS7Ucv8thGRb62Mj+nF+T9/Tyj2piv1yHYPdyWqlhps +L3oxU7WG4dqv1KrfaxvLulHyrveYTdW1BQ+WzD7tQ4DOxpCUcfTxAwZ61cAQEiVd +JepcOUVes+SjiQCVAwUQLw9QuQ4CAglx+ynhAQGi9gQAxBOzT2OwGu7Ri9NuIk47 +BfONzb0mPIrEPG6ztKNN0h5m/VZxqKh0kQSXTk4QCt5LCBqdunZY86DJxHckHYd0 +l5Tt22gALhmJL0+pi7t6A5YOonW83LXxYlxpCPxoElxerE/gfb5xiXZ9qgL1GGvO +HD8l8WTImMGlkGDdRqNYn0GZAaIENT3vPBEEANHaBoXO7hHxcynHhNPxG+4NvPb9 +RhINSM1t+yC9GFKWNXv4mSbGqEIcFo0jsOQQFd3m5ETMBHbFy2hwlzxOYQTSzgGO +b5ULWJeGCYQ1tsZwAAdyFFh5hwOWiB9+KM5NXT8WcvF8KLZbvY3cFVSGJFnxtRn4 +olWhtdzMx1WRa+4/AKD/+KLMt958vS/YWxeKC+wt822GgwP+PpW2NeAHpheDoNnP +P/wpPjuYytdc2M+XwNaq1bcxJXfrOqT6ZY1QnwxzHIeGCgZ78XR5kduRJHDkq7/X +zYaEooCuuKZf8+raJ+egycYS/Oqc9fQitsQbvetzvGDJUIBYXrePwKpK9QxMh77+ +OeaOV8n+MjA8RA4nPWmhw7540twEAIzn42webcFtUbTWy+zXCp7fPw4lBDAXMRPZ +D8wIjzzn4z/c9o0ypiwAjKVu5V8aWwjcVJICyvCU4H34yoUb3xFg2UL/VGa72LbY +sccmuGdAsqkn1nCVnjV/IACVVZLfYZMBGQQdAmkKBDQ040itSse2Z3+ND9OlN1d/ +DnCGa4cwtCVHZW9mZiBDLiBXaW5nIDxtYXNvbkBwcmltZW5ldC5jb20uYXU+iQBL +BBARAgALBQI1Pe88BAsDAQIACgkQs67qk+4wXiA3+wCfWwTNkmLlcR8amztHk6Nu +KA4LPusAoIkx+pq8j7762htEs6tGfyscJqFGiQEVAwUQNT3vnw8wSIEP0v3VAQHs +nQf8CzJbDpKHSYSUf12dsJdLa6ewcacf9OKVobl3EIbpNdov+1C6QgAQsWogPrcA +z/2bzLPCJ+CilxcK4Rk4vywi8riuJm7ROEiBSsdhIDY0nBQHL4rqFFGlnq5/DzXO +jyLmJs4X6noWKJ1rFWxPFGzy8kICuKAXuQvzX0a1VqgKgIovCgbUJJg8Et1MHZsS +LeHhenNLAT0lNRbEyizDgxkZWvTqsmkLtlKkVxEyGjtl2l+2hSLgT6zuaSWNqQjB +XFyo4wzQLy+zmqTEseI3bVqYVsQv8LCkLNn8dCDqysbTd1bIbOzcGIxBlZYML2a6 +MxAebh2GTfkRnJE+2fQ7Tw6GKrkCDQQ1Pe9AEAgA9kJXtwh/CBdyorrWqULzBej5 +UxE5T7bxbrlLOCDaAadWoxTpj0BV89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1 +WV/cdlJPPT2N286Z4VeSWc39uK50T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01ue +jaClcjrUGvC/RgBYK+X0iP1YTknbzSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJ +I8BD8KVbGI2Ou1WMuF040zT9fBdXQ6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaG +xAMZyAcpesqVDNmWn6vQClCbAkbTCD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwAC +AggA9d0Df2yhKHDKkEejKtPIDlgaAcHMOzNekpzLwiRYv9C/mpTtbcWg4wMcP2WX +7rbkhsqXrQdcSqGtRDR83bt2ku1wu+bWyjcXeoR5azGjl5as/0oqD9qhl0yANnia +F+LwSrpjf8fn/Xor3TIQIOkNIUsYndVlsSws+OlWzZNsuT5leuL2ULIkf3IkkaxN +QuoZJfb5t+MHGzTmPr+nv2aufoIsgrMkYIjRU66jfaB+8t9dec8dusXDbxYdzkMw +rZ2FopY555yWGa35gIqlR0vLicqMVCxKlBGdVywgm88ivvRM0zIsQeKrDwjVX+72 +c6DpgGsUewyCVTcKrg6uAoxT24kAPwMFGDU970CzruqT7jBeIBEC8XoAoI+NzBGk +7TyKFeRu6cs9QanAlxd5AKDImBDYzuBL6Emr96VkyNXTMtOPK5kBDQM1PexvAAAB +CAC85eki1QHZQTQ10nYQ9Obu436/limVDqgCcefn7863bUFveY8uYhdB+rmd0+wa +ltUYHWrA4e7Tt0v/2V40KDB9xQeQlU4rXVGVSg9ffzuVHhBObvzCbyAQWVRezv8S +p4b7e/9nJSthy/Sovy/WE6svuwbiL2y3mFyYYE3z5WUCIXwpNXnTmmwyExduNtvy +GzLhiieVsQKLFnGiRgadzJxPu3bXxomJTbqeC91s5vtTL2X5pmFNVL+jWL2O4sev +E66XFPFdHSDnj9jnXBc051TGmemuyRsukAknXQCApRTc3nyiK8rVQP27OwEmy4rq +xe8MgnDTWq6QiQ8wSIEP0v3VAAURtB1HZW9mZiBDLiBXaW5nIDxnY3dAcG9ib3gu +Y29tPokBFQMFEDU97G8PMEiBD9L91QEBn74H/3e6mzIU5oIljf6Ycs00HP0MRHqh +pSvOeDR7oHZOVJTIWy/qkQ8QxCw9zyA+GQ/zWc/Db9VlUZvdYZbnHJG19WyVB3Y/ +nVYwP6TQqq/sfgweHhFlUvRJStbGXYdTjGPWxpd6Qn+G8XwCr9/4tS23rM9VPd4I +gMUbQH6ruCzrHI+G5BJE1IHShbK7i2RmZfdB6Yv06PpddB1BetJO77E/fwPneTvk +A7dD3s5El2RHTM2c0Z1Jpvg8YHLrUcXmfNKXa8hD8wRRavyIoHfvPtmjHj+dt1lE +T8B0o6bH/DPT027nT7Qo5k6rmHg3Qk1398794vhpBgwxpEC77OVUzMwOPhqJAD8D +BRA1Pe+0s67qk+4wXiARAoXsAJ9DYXxh0GN9FbE7Z2U5beFf37BPGgCeJPVD9rSr +gGtuca/4DEhDAGSAfn+ZAQ0DM3r8XAAAAQgApHzqec/wFmjoEDIX93y8L4fvVs13 +qzKFvdsGeTSiPAjKfEyw9rELlzAwtqWdkDUBeU6tld342GjcDCVKKY5snun1746Z +Ui6rkjnFdPimv8fwJc6tAC4NoWerVC9bbpdsDbbzdaxf1RATmB8B81vY7+3NNegk +WuxTBwl/QV7aS5qZ+kFpsP5ANYnjcBQeL2ejzmmLMU9ntdRa7XAHUvsUobV3bgP7 +8fdz6w+LEs5wHcD5FGBEOrmr5rk9AYErds/i2vCOKB66QrqzfXSg8AfY9CqfVn8p +o3os/GiXtLYS86vg44S8P9Vel2ajW8kWwjQhXLxjBB422B6ZpPRnjh4ewQAFEbQd +QW5kcmV3IE1haW4gPHplZnJhbUBmeXNoLm9yZz6JAJUDBRA0Ygop5kcdJXa50hkB +ARugBACiuBehrCsCJ9eskOIGYijVyOkw0ds+Rl/f491CoK4At7oAQzESR4sfBKRo +PpnCLGVen01dgshcf00lM+Yp8qrjT/BSrD58L98aaig7pBD5t5KwePjwhS+kB/tc +41SiCsXhcuzsacqsUhhZ0SoUtD7Dq901KCrhvmSLK0DGrI+dr4kAlQMFEDRfSDpL +2cze8VY7wQEBt0AD/06seQfvtDwduYd9xoUc9EHFmtJH1RkR4fn+KKngyKPZVUwn +38cHa5CfbEUhF2bD0ADFHcOMiaO2k6yHT9EG3FWRyGsF6lAAlUK6NqtTymA2sFig +R7VTbq25V4CjOFRSti8d2yeDPJ5nyj5YzTzkx0XHl2//hF6QrROIv3YYh16wiQCV +AgUQNF9FqnCjAd4lTWyNAQGAzgQAguA8BzjPfca6TDJbuj5fQdTwEJuMHZ9asQQf +zy43q9qHUINRy0LlyqiIEQtggQIbp20pvHtnUwBaK00y2wOToe3kprCym4NEuT/g +wMRXGiGF2cBJzWNXWn7aNXnGp1UP1Yb9C9zHIgCApFHd8d0qzQNQONN5vYTa6BRS +UzkCvkqJARUDBRAzhKKK1b5+4POEA70BASZqB/49jNe6xRyUe+3u3IiOiYjLRRLz +VkyA4x9xIURHsKE3oUa0vI6wyGhQzHWFuKom9mqQKDR12T9LYoVvNi94qixTgBlD +Fw+Tm+FfxmguQCTPgY9MRGGS6A9fuSd/kbyjn+w1HY9nVM4B2Nrn0xPQ/7uUZ0a1 +7cUBi5+jk6r9xDTfRkP7wn+LEA3rg6tNkn6apfsDyHOSHPr8GZKBdmqthAJQP6eF +im3k6pPzv+232XyejDBlHiPloGrX4bA6C69pqazyoH4YD5knZU0gYsF6DJfRsruB +lw9YIKj+lw6AwYRAO+2PgHjIY9sEFDuCZn2IFr/gwGSAVBRVtG9YZkA+l23ziQCV +AwUQM4HINSV6yMkAhfdJAQFBYQQAsu0G4HUtlUM92p4qxAVjG9mmdZRmb9YNfr1G +AQX9vgx7R2oJ+CwiGfmO1lUtvhJUQNbjZTCmF3n14/5gbJ1loOh7KUGE/wJHqeUJ +n6ziMkpR4Rzff6LmCr5zDsW8ZjTz+B8Cfar+SFWuNbue35tFmqVOvxv724eSCb47 +aHwlMkOJAJUDBRAzg6nxc4ScsTlXuf0BAST+A/4vQUMaVFYuKyNcgOkilcSOLHYE +g+jIlGoBBi6Khi+P0iFVUde0xr61WiSxsbTSTYLmHnGi7fQ+iqPBFzb6NuyJ4R3t +96SiFeD3Oe3znN11gF1AtR86wc3m3cymvwrMOzfK0vkN7iudv9jkrtbk4x8JAPTL +MfT6adD4NkFr7pZA6IkBFQMFEDOC9G+ZamtmIJq5/QEBN6wH/3isXVyHRue7uKDA +vsGnb4GmTazwuK1lmREaZ1ZL/609VCp0zo0osrjrDsWiqnU9zve1ZHrImr3BELCG +LrkaE+mjoK80reGc0hdQF0/mwBZrIkT8Pcncjv8vE6b9IuacWJf+S/HpFnfv+RxB +k57A7uAOJLP1vhI/Mq9B/TARdkmqDmKcTpYGIxYjhvRPV07aD/K7fRivhNBibCgm +n97sSBEdf4Nq3NTbByetTuktUoPEn3MpqnUjxnqrmt7HztRq96XXjz/gZdYVtI9o +nzuP92H6YKJcCUVZMt4zzhEOw8iDsrIGfGcje5UW3qSHI6JUOTmyGCd1mzLDsqMK +kaElcWiJAJUDBRAzgYq2TQiMTNnrYBEBAS1OBACOdN3qf88fl7bJtsZNqY6jQEQ3 +GPJrtUroP7vWSxnV8jKO2egxfAbmp+UGZoD6imoH89TU9Ny/E1/nsRWriWx4hZOJ +hUDA4TOUOX0nhfeeC43u2t+D/v36JDjUzipWL2mGe6B8jrElgqb71gT/qgT/yV81 +wPuHDO9zih/m69p2rokBFQMFEDOAxoyGWkrM32Hp2QEBGnMIAJ4k3kL3xVOxa+bM +5uXe57leOX6dsut4QKnrsQ862VYHhF7N4ZYQs3lv4ygLguqTZ02fcZyr6l9q102s +87AoY8RfE/ESewepTcqLT4Dm5K7EAoRdGZ/2yWrA8fHdVGKHl7UO5IqcTLQ5AOOg +lhAgy+GPx3UcN+EPNgLNd3pMvIG2NnBGwhP88sa4R9JfvK0eGAE9ElbTdbR6xBKn +JneuAQPUIdO0GVgowrDfiSlupjFhW+CeKfDix3isJEnRbohNq4BawSL2aC88UOIE +X7osbVd8nFufPlEKaN6EhaIWiixF1W3LI/wiF5HV0u3nwaN4Qy15OXjcD/7urbuQ +cU+B2yCJAJUDBRAzgN6EolKYYFEYdpEBAZc2BAClMzFxU50TN54jp444QicsjtlS +IioqQMchFq30WSwxkeZOE7QGAqX9pBxSoCjbK0mf2UXM/V+8dhIfl0Y/EQchNFyL +qv01GnMiW5r/pXm4eZoMw9atpXx+kuvEO7N5VgvdrBgix3PUSX9pYHSxeNVhrV9M +YZMzMaPoB36t1B+rkokBFQMFEDOA3nnZ/s5HNAtHpQEBXxcH/RoVXW1jg9PoJhTh +Ab4xO95QKPILKwNGUBTdMOZbwDKFmbfjAxOU0VSJqp7U5aQeHCHsm3lLCF/4gWE/ +FDEq7goNj/COivg6egB1ZTfgBFdpHbGqQhPJgvUoh7uufPIqNej2h0Vi4JeLyyp/ +Pdw8i7lvaMRp8W8q9votJ6ma3Nm8zNOXbr7hNl9LBLNrL6928s9RCT8GbrPoZqDZ +vs5AUhUxOuVgLmqxsw2jjQp9grqkIPsC46ANlyyGe+Iyfhnyc2EGuF0TpBSjJC8e +uQKmLagjGaW5qBZPqnut24z2YAyPxpPffQbkKmNuy0DCYM1vMeW3/5uPvHPsIA7w +/Tp++UiJAJUDBRAze0HFa/97sSWYQUUBAUp5A/9Ae02CVK2dTO2uNWE5V4DgFIcq +85xTd2LFw3lWs8dP5wNCINo+FYaxhQxlj7uzE7InVSMTmO1nOlHo/SB4DmwIRSEh +q2mZCMABjbQW1AyU0q8VRgtY3y/wfGpzeXTKNsf7ab2BkjLf63XeZcIY3UDjoJts +XHO8K5Z8CnUu8e4HMYkAlQMFEDN6/Yxw//hyU6VP4QEBvWsD+wWXB8Xtu0DPIvoy +ZvgjuhLcmibLcUNeD7piEh5WrXdjiUIJxwkw4X7eMqirvqCQLaKEoN6XJob+8KT9 +NCOB4ErTPGnzWM2vYApy8sra833xP3evOmN4bT5DuZpkN+RVRAGLa95RU4Q4eZnY +MSxtEk/f09l5pWyuPvDJUCZdzYD/iQEVAwUQM3r8XJmk9GeOHh7BAQEUmAgAly7y +5pNJBs24zzr46fGBLLwhrkzTRyhwIkgEI9cYMpRbV1E5XgqaOjS11vKnmSu+pEql +XMJUV7MlM5p52YtaEx7C5u+WK6eK6hIP0eFi6kehuegqdRfIKfAz6aeu80Zutu/K +i2vOA0O2+hRJnDRsqGBlx8KRQl5c8Vo2OkK8kxk+PVbbgYf5HZRF0yGxdaE4kxG2 +F14sL0DKmY99b+RPeu4v3Gz1rPz8lTetlIXaXJoFrgF8gCk+IDNB5aen69WoAQeP +yHE6uCn6a1RC+rM8Jhv/PI/lKEQabekGYC5gP7QEIYqcmwdKTv0pzP1FY9/tmVsB +C4+RT5QRIxKJMxXh6Q== +=/T9G +-----END PGP PUBLIC KEY BLOCK----- diff --git a/Functions/.distfiles b/Functions/.distfiles new file mode 100644 index 000000000..1aa4fbc89 --- /dev/null +++ b/Functions/.distfiles @@ -0,0 +1,5 @@ +DISTFILES_SRC=' + .distfiles + acx cat cdmatch cdmatch2 checkmail cx harden mere multicomp proto + pushd randline run-help yp yu zed zls +' diff --git a/Functions/acx b/Functions/acx new file mode 100755 index 000000000..f7c680bb0 --- /dev/null +++ b/Functions/acx @@ -0,0 +1,6 @@ +#! /bin/sh +# +# zsh shell function to make its arguments 755 +# also works as an sh script +# +chmod 755 $* diff --git a/Functions/cat b/Functions/cat new file mode 100644 index 000000000..612deac03 --- /dev/null +++ b/Functions/cat @@ -0,0 +1,16 @@ +#! /usr/local/bin/zsh -f + +local file + +if ((! ARGC)) then + set -- - +fi + +for file +do + if [[ "$file" == - ]] then + while read -u0ek 4096; do ; done + else + while read -u0ek 4096; do ; done < "$file" + fi +done diff --git a/Functions/cdmatch b/Functions/cdmatch new file mode 100755 index 000000000..7c4bb9ae7 --- /dev/null +++ b/Functions/cdmatch @@ -0,0 +1,23 @@ +# Start of cdmatch. +# Save in your functions directory and autoload, then do +# compctl -x 'S[/][~][./][../]' -g '*(-/)' - \ +# 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd +# +# Completes directories for cd, pushd, ... anything which knows about cdpath. +# You do not have to include `.' in your cdpath. +# +# It works properly only if $ZSH_VERSION > 3.0-pre4. Remove `emulate -R zsh' +# for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions +# it still works if RC_EXPAND_PARAM is not set or when cdpath is empty. +emulate -R zsh +setopt localoptions +local narg pref cdp + +read -nc narg +read -Ac pref + +cdp=(. $cdpath) +reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) ) + +return +# End of cdmatch. diff --git a/Functions/cdmatch2 b/Functions/cdmatch2 new file mode 100644 index 000000000..c70357a34 --- /dev/null +++ b/Functions/cdmatch2 @@ -0,0 +1,15 @@ +# This function should be called from compctl to complete the +# second argument of cd and pushd. + +emulate -R zsh # Requires zsh 3.0-pre4 or later +setopt localoptions +local from + +read -Ac from +from="${from[2]}" + +eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )" +reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" ) +[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''" + +return diff --git a/Functions/checkmail b/Functions/checkmail new file mode 100644 index 000000000..9cc743db4 --- /dev/null +++ b/Functions/checkmail @@ -0,0 +1,26 @@ +#! /usr/local/bin/zsh +# +# This autoloadable function checks the folders specified as arguments +# for new mails. The arguments are interpeted in exactly the same way +# as the mailpath special zsh parameter (see zshparam(1)). +# +# If no arguments are given mailpath is used. If mailpath is empty, $MAIL +# is used and if that is also empty, /var/spool/mail/$LOGNAME is used. +# This function requires zsh-3.0.1 or newer. +# + +local file message + +for file in "${@:-${mailpath[@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}" +do + message="${${(M)file%%\?*}#\?}" + file="${file%%\?*}" + if [[ -d "$file" ]] then + file=( "$file"/**/*(.ND) ) + if (($#file)) then + checkmail "${^file}\?$message" + fi + elif test -s "$file" -a -N "$file"; then # this also sets $_ to $file + print -r -- "${(e)message:-You have new mail.}" + fi +done diff --git a/Functions/cx b/Functions/cx new file mode 100755 index 000000000..a0b34a4f0 --- /dev/null +++ b/Functions/cx @@ -0,0 +1,6 @@ +#! /bin/sh +# +# zsh shell function to make its arguments executable +# also works as a sh script +# +chmod +x $* diff --git a/Functions/harden b/Functions/harden new file mode 100755 index 000000000..c02689362 --- /dev/null +++ b/Functions/harden @@ -0,0 +1,6 @@ +#! /bin/sh +# harden a link (convert it to a singly linked file) +cp $1 $1.foo +rm $1 +mv $1.foo $1 + diff --git a/Functions/mere b/Functions/mere new file mode 100755 index 000000000..cf8d8ad14 --- /dev/null +++ b/Functions/mere @@ -0,0 +1,3 @@ +#! /bin/sh +# read a man page in the current directory +nroff -man -Tman $1 | less -s diff --git a/Functions/multicomp b/Functions/multicomp new file mode 100755 index 000000000..ab206de0d --- /dev/null +++ b/Functions/multicomp @@ -0,0 +1,80 @@ +# multicomp() { +# Completes all manner of files given prefixes for each path segment. +# e.g. s/z/s -> src/zsh-2.4/src +# +# Usage: e.g. +# compctl -D -f + -U -Q -S '' -K multicomp +# +# Note that exactly matched directories are not expanded, e.g. +# s/zsh-2.4/s will not expand to src/zsh-2.4old/src. +# Will expand glob patterns already in the word, but use complete-word, +# not TAB (expand-or-complete), or you will get ordinary glob expansion. +# Requires the -U option to compctl. +# Menucompletion is highly recommended for ambiguous matches. +# Liable to screw up escaped metacharacters royally. +# $fignore is not used: feel free to add your own bit. + +emulate -R zsh # Requires zsh 3.0-pre4 or later +local pref head sofar origtop newtop globdir="(-/)" wild +setopt localoptions nullglob rcexpandparam globdots +unsetopt markdirs globsubst shwordsplit nounset + +pref="${1}$2" +# Hack to allow programmable completion to select multicomp after a : +# (e.g. +# compctl -D -f -x 's[:]' -U -Q -S '' -K multicomp +# ) +pref="${pref#:}" + +sofar=('') +reply=('') + +if [[ "$pref" = \~* ]]; then + # If the string started with ~, save the head and what it will become. + origtop="${pref%%/*}" + eval "newtop=$origtop" + # Save the expansion as the bit matched already + sofar=($newtop) + pref="${pref#$origtop}" +fi + +while [[ -n "$pref" ]]; do + [[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}" + head="${pref%%/*}" + pref="${pref#$head}" + if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then + # Exactly matched directory: don't try to glob + reply=("${sofar}$head") + else + [[ -z "$pref" ]] && globdir= + # if path segment contains wildcards, don't add another. + if [[ "$head" = *[\[\(\*\?\$\~]* || -z "$head" ]]; then + wild=$head + else + # Simulate case-insensitive globbing for ASCII characters + wild="[${(j(][))${(s())head:l}}]*" # :gs/a/[a]/ etc. + # The following could all be one expansion, but for readability: + wild=$wild:gs/a/aA/:gs/b/bB/:gs/c/cC/:gs/d/dD/:gs/e/eE/:gs/f/fF/ + wild=$wild:gs/g/gG/:gs/h/hH/:gs/i/iI/:gs/j/jJ/:gs/k/kK/:gs/l/lL/ + wild=$wild:gs/m/mM/:gs/n/nN/:gs/o/oO/:gs/p/pP/:gs/q/qQ/:gs/r/rR/ + wild=$wild:gs/s/sS/:gs/t/tT/:gs/u/uU/:gs/v/vV/:gs/w/wW/:gs/x/xX/ + wild=$wild:gs/y/yY/:gs/z/zZ/:gs/-/_/:gs/_/-_/:gs/[]// + + # Expand on both sides of '.' (except when leading) as for '/' + wild="${${wild:gs/[.]/*.*/}#\*}" + fi + + reply=(${sofar}"${wild}${globdir}") + reply=(${~reply}) + fi + + [[ -z $reply[1] ]] && reply=() && break + [[ -n $pref ]] && sofar=($reply) +done + +# Restore ~'s in front if there were any. +# There had better not be anything funny in $newtop. +[[ -n "$origtop" ]] && reply=("$origtop"${reply#$newtop}) + +# } + diff --git a/Functions/proto b/Functions/proto new file mode 100755 index 000000000..df1826506 --- /dev/null +++ b/Functions/proto @@ -0,0 +1,8 @@ +#! /bin/sh +# generate prototypes, if your style is the same as mine +for i +do + rm $i:r.pro 2>/dev/null + grep -v '[{};:#]' $i | grep '^[A-Za-z]' | + grep -v static | sed 's/$/;/' >! $i:r.pro +done diff --git a/Functions/pushd b/Functions/pushd new file mode 100644 index 000000000..965c774bf --- /dev/null +++ b/Functions/pushd @@ -0,0 +1,13 @@ +# pushd function to emulate the old zsh behaviour. With this function +# pushd +/-n just lifts the selected element to the top of the stack +# instead of just cycling the stack. + +emulate -R zsh +setopt localoptions + +if [[ ARGC -eq 1 && "$1" == [+-]<-> ]] then + setopt pushdignoredups + builtin pushd ~$1 +else + builtin pushd "$@" +fi diff --git a/Functions/randline b/Functions/randline new file mode 100755 index 000000000..9af714fa2 --- /dev/null +++ b/Functions/randline @@ -0,0 +1,3 @@ +# get a random line from a file +integer z=$(wc -l <$1) +sed -n $[RANDOM%z+1]p $1 diff --git a/Functions/run-help b/Functions/run-help new file mode 100755 index 000000000..a8109e3ea --- /dev/null +++ b/Functions/run-help @@ -0,0 +1,72 @@ +#!/usr/local/bin/zsh +# +# Figure out where to get the best help, and get it. +# +# Install this function by placing it in your FPATH and then +# adding to your .zshrc the lines: +# unalias run-help +# autoload run-help +# + +emulate -R zsh +setopt localoptions + +# Check whether Util/helpfiles has been used to generate zsh help +if [[ $1 == "-l" ]] +then + if [[ -n "${HELPDIR:-}" ]] + then + echo 'Here is a list of topics for which help is available:' + echo "" + print -rc $HELPDIR/*(:t) + else + echo 'There is no list of help topics available at this time' + fi + return 0 +elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]] +then + ${=PAGER:-more} $HELPDIR/$1 + return $? +fi + +# No zsh help, use "whence" to figure out where else we might look +local what places newline=' +' +integer i=0 didman=0 + +places=( "${(@f)$(builtin whence -va $1)}" ) + +while ((i++ < $#places)) +do + what=$places[$i] + builtin print -r $what + case $what in + (*( is an alias)*) + [[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t} + ;; + (*( is a * function)) + builtin functions ${what[(w)1]} | ${=PAGER:-more} + ;; + (*( is a * builtin)) + case ${what[(w)1]} in + (compctl) man zshcompctl;; + (bindkey) man zshzle;; + (*setopt) man zshoptions;; + (*) man zshbuiltins;; + esac + ;; + (*( is hashed to *)) + man ${what[(w)-1]:t} + ;; + (*) + ((! didman++)) && man $1 + ;; + esac + if ((i < $#places && ! didman)) + then + builtin print -nP "%SPress any key for more help or q to quit%s" + builtin read -k what + [[ $what != $newline ]] && echo + [[ $what == [qQ] ]] && break + fi +done diff --git a/Functions/yp b/Functions/yp new file mode 100755 index 000000000..7e09613ef --- /dev/null +++ b/Functions/yp @@ -0,0 +1,2 @@ +#! /bin/sh +ypmatch $1 passwd diff --git a/Functions/yu b/Functions/yu new file mode 100755 index 000000000..3c5f170cf --- /dev/null +++ b/Functions/yu @@ -0,0 +1,2 @@ +#! /bin/sh +ypmatch $1 passwd.byuid diff --git a/Functions/zed b/Functions/zed new file mode 100755 index 000000000..e8e7212ef --- /dev/null +++ b/Functions/zed @@ -0,0 +1,65 @@ +# +# zed +# +# No other shell could do this. +# Edit small files with the command line editor. +# Use ^X^W to save, ^C to abort. +# Option -f: edit shell functions. (Also if called as fned.) +# +# Completion: use +# compctl -f -x 'w[1,-f]' -F -- zed +# + +local var fun cleanup +# We do not want timeout while we are editing a file +integer TMOUT=0 + +[[ $1 = -f || $0 = fned ]] && fun=1 +[[ $1 = -(|-|f) ]] && shift + +[[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1 + +# catch interrupts +cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ" + echo "trap - INT EXIT"; trap)" +trap "return 130" INT +trap "$cleanup" EXIT + +# don't mangle !'s +setopt localoptions nobanghist + +bindkey "^M" self-insert-unmeta +# Depending on your stty's, you may be able to use ^J as accept-line, else: +bindkey -M emacs "^X^W" accept-line +bindkey -a "ZZ" accept-line + +if ((fun)) then + var="$(functions $1)" + # If function is undefined but autoloadable, load it + if [[ $var = undefined* ]] then + local dir + for dir in $fpath; do + if [[ -f $dir/$1 ]] then + var="$1() { +$(<$dir/$1) +}" + break + fi + done + elif [[ -z $var ]] then + var="$1() { +}" + fi + vared var && eval function "$var" +else + [[ -f $1 ]] && var="$(<$1)" + while vared var + do + (print -r -- "$var" >| $1) && break + echo -n -e '\a' + done +fi + +return 0 + +# End of zed diff --git a/Functions/zls b/Functions/zls new file mode 100644 index 000000000..da6eff856 --- /dev/null +++ b/Functions/zls @@ -0,0 +1,55 @@ +# zls () { +# simple internal ls using the stat module + +zmodload -i stat || return 1 + +emulate -R zsh +setopt localoptions + +local f stat opts='' L=L mod=: dirs list + +dirs=() +list=() + +while getopts ailLFd f +do + opts=$opts$f + if [[ $f == '?' ]] then + echo Usage: $0 [ -ailLFd ] [ filename ... ] + return 1 + fi +done +shift OPTIND-1 + +[[ $opts == *L* ]] && L='' +[[ $opts == *F* ]] && mod=T$mod +[[ $opts == *a* ]] && setopt globdots + +if ((! ARGC)) then + set * + opts=d$opts +fi + +for f in $* +do + stat -s$L -A stat -F "%b %e %H:%M" - $f || continue + if [[ $opts != *d* && $stat[3] == d* ]] then + dirs=( $dirs $f ) + elif [[ $opts == *l* ]] then + [[ $opts == *i* ]] && print -n "${(l:7:)stat[2]} " + [[ -n $stat[14] ]] && f=( $f '->' $stat[14] ) || f=( $f($mod) ) + print -r -- "$stat[3] ${(l:3:)stat[4]} ${(r:8:)stat[5]} " \ + "${(r:8:)stat[6]} ${(l:8:)stat[8]} $stat[10] $f" + else + f=( $f($mod) ) + list=( "$list[@]" "${${(M)opts:%*i*}:+${(l:7:)stat[2]} }$f" ) + fi +done +(($#list)) && print -cr -- "$list[@]" +while (($#dirs)) do + ((ARGC > $#dirs)) && echo + ((ARGC > 1)) && echo $dirs[1]: + (cd $dirs[1] && $0 -d$opts) + shift dirs +done +# } diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..4019a16b8 --- /dev/null +++ b/INSTALL @@ -0,0 +1,242 @@ +-------------- +INSTALLING ZSH +-------------- + +Check MACHINES File +------------------- + +Check the file MACHINES in the subdirectory Etc to see the architectures +that zsh is known to compile on, as well as any special instructions +for your particular architecture. Most architectures will not require any +special instructions. + +Configuring Zsh +--------------- + +To configure zsh, from the top level directory, do the command: + ./configure + +Configure accepts several options (explained below). To display +currently available options, do the command: + ./configure --help + +Most of the interesting configuration options can be added after running +configure by editing the user configuration section of config.h and the +top level Makefile. + +Dynamic loading +--------------- + +Zsh-3.1 has support for dynamically loadable modules. To enable this run +configure with the --enable-dynamic option. Note that dynamic loading +does not work on all systems. On these systems this option will have no +effect, so it is always safe to use --enable-dynamic. When dynamic +loading is enabled, major parts of zsh (including the Zsh Line Editor) are +compiled into modules and not included into the main zsh binary. Zsh +autoloads these modules when they are required. This means that you have +to execute make install.modules before you try the newly compiled zsh +executable. + +Adding more modules +------------------- + +The zsh distribution contains several modules, in the Src/Builtins, +Src/Modules and Src/Zle directories. If you have any additional zsh +modules that you wish to compile for this version of zsh, create another +subdirectory of the Src directory and put them there. You can create +as many extra subdirectory hierarchies as you need. The subdirectories +must be actual directories; symbolic links will not work. + +If you wish to add or remove modules or module directories after you +have already run make, then after adding or removing the modules run: + make prep + +Controlling what is compiled into the main zsh binary +----------------------------------------------------- + +By default the comp1, compctl, zle, sched and rlimits modules are compiled +into non-dynamic zsh and no modules are compiled into the main binary if +dynamic loading is available. This can be overridden by creating the +Src/modules-bltin file with the list of modules which are to be compiled +into the main binary. See the zshmodules manual page for the list of +available modules. + +Compiler Options or Using a Different Compiler +---------------------------------------------- + +By default, configure will use the "gcc" compiler if found. You can use a +different compiler, or add unusual options for compiling or linking that +the "configure" script does not know about, by either editing the user +configuration section of the top level Makefile (after running configure) +or giving "configure" initial values for these variables by setting them +in the environment. Using a Bourne-compatible shell (such as sh,ksh,zsh), + +you can do that on the command line like this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the "env" program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Check Generated Files +--------------------- + +Configure will probe your system and create a "config.h" header file. +You should check the user configuration section at the beginning of +this include file. You should also examine the values (determined by +configure) of HOSTTYPE, OSTYPE, MACHTYPE, and VENDOR to make sure they +are correct. The value of these #defines's is used only to initialize +the corresponding default shell parameters. Since these shell parameters +are only for informational purposes, you can change them to whatever +you feel is appropriate. + +Also configure will create a Makefile in the top level directory as well +as in the various subdirectories. You should check the user configuration +section of the top level Makefile. + +Compiling Zsh +------------- + +After configuring, to build zsh, do the command: + make + +Installing Zsh +-------------- + +If no make/compilation errors occur, then to install the zsh binary, do +the command: + make install.bin + +Any previous copy of zsh will be renamed "zsh.old" + +To install the dynamically-loadable modules, do the command: + make install.modules + +To install the zsh man page, do the command: + make install.man + +To install the zsh info files, do the command: + make install.info + +Or alternatively, you can install all the above with the command: + make install + +"make install.info" will only move the info files into the info directory. +You will have to edit the topmost node of the info tree "dir" manually +in order to have the zsh info files available to your info reader. + +Building Zsh On Additional Architectures +---------------------------------------- + +To build zsh on additional architectures, you can do a "make distclean". +This should restore the zsh source distribution back to its original +state. You can then configure zsh as above on other architectures in +which you wish to build zsh. Or alternatively, you can use a different +build directory for each architecture. + +Using A Different Build Directory +--------------------------------- + +You can compile the zsh in a different directory from the one containing +the source code. Doing so allows you to compile it on more than one +architecture at the same time. To do this, you must use a version of +"make" that supports the "VPATH" variable, such as GNU "make". "cd" to +the directory where you want the object files and executables to go and +run the "configure" script. "configure" automatically checks for the +source code in the directory that "configure" is in. For example, + + cd /usr/local/SunOS/zsh + /usr/local/src/zsh-3.0/configure + make + +Memory Routines +--------------- + +Included in this release are alternate malloc and associated functions +which reduce memory usage on some systems. To use these, add the option + --enable-zsh-mem +when invoking "configure". + +You should check Etc/MACHINES to see if there are specific recommendations +about using the zsh malloc routines on your particular architecture. + +Debugging Routines +------------------ + +You can turn on various debugging options when invoking "configure". + +To turn on some extra checking in the memory management routines, you +can use the following options when invoking "configure". + --enable-zsh-mem-warning # turn on warnings of memory allocation errors + --enable-zsh-secure-free # turn on memory checking of free() + +If you are using zsh's memory allocation routines (--enable-zsh-mem), you +can turn on debugging of this code. This enables the builtin "mem". + --enable-zsh-mem-debug # debug zsh's memory allocators + +You can turn on some debugging information of zsh's internal hash tables. +This enables the builtin "hashinfo". + --enable-zsh-hash-debug # turn on debugging of internal hash tables + +To add some sanity checks and generate debugging information for debuggers +you can use the following option. This also disables optimization. + --enable-zsh-debug # use it if you want to debug zsh + +Startup/shutdown files +---------------------- + +Zsh has several startup/shutdown files which are in /etc by default. This +can be overriden using one of the options below when invoking "configure". + + --enable-etcdir=directory # default directory for global zsh scripts + --enable-zshenv=pathname # the full pathname of the global zshenv script + --enable-zshrc=pathname # the full pathname of the global zshrc script + --enable-zlogin=pathname # the full pathname of the global zlogin script + --enable-zprofile=pathname # the full pathname of the global zprofile script + --enable-zlogout=pathname # the full pathname of the global zlogout script + +Any startup/shutdown script can be disabled by giving the +--disable-scriptname option to "configure". The --disable-etcdir option +disables all startup/shutdown files which are not explicitely enabled. + + +Options For Configure +--------------------- + +The `configure' program accepts many options, not all of which are useful +or relevant to zsh. To get the complete list of configure options, run +"./configure --help". The following list should contain most of the +options of interest for configuring zsh. + +Configuration: + --cache-file=FILE # cache test results in FILE + --help # print a help message + --version # print the version of autoconf that create configure + --quiet, --silent # do not print `checking...' messages + --no-create # do not create output files + +Directories: + --prefix=PREFIX # install host independent files in PREFIX [/usr/local] + --exec-prefix=EPREFIX # install host dependent files in EPREFIX [same as prefix] + --bindir=DIR # install user executables in DIR [EPREFIX/bin] + --infodir=DIR # install info documentation in DIR [PREFIX/info] + --mandir=DIR # install man documentation in DIR [PREFIX/man] + --srcdir=DIR # find the sources in DIR [configure dir or ..] + +Features: + --enable-FEATURE # enable use of this feature + --disable-FEATURE # disable use of this feature + + The FEATURES currently supported are: + zsh-debug # use it if you want to debug zsh + zsh-mem # use zsh's memory allocators + zsh-mem-debug # debug zsh's memory allocators + zsh-mem-warning # turn on warnings of memory allocation errors + zsh-secure-free # turn on memory checking of free() + zsh-hash-debug # turn on debugging of internal hash tables + etcdir=directory # default directory for global zsh scripts + zshenv=pathname # the full pathname of the global zshenv script + zshrc=pathname # the full pathname of the global zshrc script + zlogin=pathname # the full pathname of the global zlogin script + zprofile=pathname # the full pathname of the global zprofile script + zlogout=pathname # the full pathname of the global zlogout script + dynamic # allow dynamically loaded binary modules diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 000000000..c91ddcf56 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,124 @@ +# +# Makefile for top level of zsh distribution +# +# Copyright (c) 1995-1997 Richard Coleman +# All rights reserved. +# +# Permission is hereby granted, without written agreement and without +# license or royalty fees, to use, copy, modify, and distribute this +# software and to distribute modified versions of this software for any +# purpose, provided that the above copyright notice and the following +# two paragraphs appear in all copies of this software. +# +# In no event shall Richard Coleman or the Zsh Development Group be liable +# to any party for direct, indirect, special, incidental, or consequential +# damages arising out of the use of this software and its documentation, +# even if Richard Coleman and the Zsh Development Group have been advised of +# the possibility of such damage. +# +# Richard Coleman and the Zsh Development Group specifically disclaim any +# warranties, including, but not limited to, the implied warranties of +# merchantability and fitness for a particular purpose. The software +# provided hereunder is on an "as is" basis, and Richard Coleman and the +# Zsh Development Group have no obligation to provide maintenance, +# support, updates, enhancements, or modifications. +# + +subdir = . +dir_top = . +SUBDIRS = Doc Etc Src + +@@version.mk@@ +@@defs.mk@@ + +# ========== DEPENDENCIES FOR BUILDING ========== + +# default target +all: config.h + @for subdir in Src Doc; do \ + (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \ + done + +check test: + @echo zsh test suite not available yet + +# prepare module configuration +prep: + @cd Src && $(MAKE) $(MAKEDEFS) $@ + +META-FAQ: FORCE + @cd Doc && $(MAKE) $(MAKEDEFS) ../META-FAQ + +# ========== DEPENDENCIES FOR INSTALLING ========== + +# install/uninstall everything +install: install.bin install.modules install.man install.info +uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.info + +# install/uninstall just the binary +install.bin uninstall.bin: + @cd Src && $(MAKE) $(MAKEDEFS) $@ + +# install/uninstall just the modules +install.modules uninstall.modules: + @cd Src && $(MAKE) $(MAKEDEFS) $@ + +# install/uninstall just the man pages +install.man uninstall.man: + @cd Doc && $(MAKE) $(MAKEDEFS) $@ + +# install/uninstall just the info pages +install.info uninstall.info: + @cd Doc && $(MAKE) $(MAKEDEFS) $@ + +# ========== DEPENDENCIES FOR CLEANUP ========== + +@@clean.mk@@ + +distclean-here: + rm -f Makefile config.h config.status config.log config.cache stamp-h + +realclean-here: + cd $(sdir) && rm -f config.h.in stamp-h.in configure + +# ========== DEPENDENCIES FOR MAINTENANCE ========== + +@@config.mk@@ + +config: config.h + +config.status: configure + ./config.status --recheck + +configure: configure.in aclocal.m4 aczsh.m4 + cd $(sdir) && autoconf + +config.h: stamp-h +stamp-h: config.h.in config.status + cd $(dir_top) && \ + CONFIG_FILES= CONFIG_HEADERS=$(subdir)/config.h ./config.status + +config.h.in: stamp-h.in +stamp-h.in: configure.in acconfig.h aclocal.m4 aczsh.m4 + cd $(sdir) && autoheader + echo > $@ + +# ========== DEPENDENCIES FOR DISTRIBUTION ========== + +DISTNAME = zsh-$(VERSION) + +targz-src: $(DISTNAME).tar.gz +$(DISTNAME).tar.gz: FORCE + @$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \ + $(MAKE) $(MAKEDEFS) + tar cf - $(DISTNAME) | gzip -9 > $@ + rm -rf $(DISTNAME) + +targz-doc: $(DISTNAME)-doc.tar.gz +$(DISTNAME)-doc.tar.gz: FORCE + @$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) DOC \ + $(MAKE) $(MAKEDEFS) + tar cf - $(DISTNAME) | gzip -9 > $@ + rm -rf $(DISTNAME) + +FORCE: diff --git a/Misc/.distfiles b/Misc/.distfiles new file mode 100644 index 000000000..a02614511 --- /dev/null +++ b/Misc/.distfiles @@ -0,0 +1,4 @@ +DISTFILES_SRC=' + .distfiles + c2z compctl-examples globtests globtests.ksh lete2ctl +' diff --git a/Misc/.lastloc b/Misc/.lastloc new file mode 100644 index 000000000..8ba7dd946 --- /dev/null +++ b/Misc/.lastloc @@ -0,0 +1,2 @@ +(("/home/user2/pws/src/zsh-3.1.5/Misc/globtests.ksh" . 2763) + ("/home/user2/pws/src/zsh-3.1.5/Misc/globtests" . 3123)) diff --git a/Misc/c2z b/Misc/c2z new file mode 100755 index 000000000..8a90d5fd8 --- /dev/null +++ b/Misc/c2z @@ -0,0 +1,128 @@ +#! /bin/sh +# +# c2z - environment conversion tool +# Contributed by Bart Schaefer +# (Tweaked a bit by Paul Falstad) +# +# This is a quick script to convert csh aliases to zsh aliases/functions. +# It also converts the csh environment and local variables to zsh. c2z +# uses the csh to parse its own dot-files, then processes csh output to +# convert the csh settings to zsh. +# +# When run as a zsh fuction, c2z runs csh as if it were an interactive +# shell whenever the parent zsh is interactive. When run as a shell +# script, the -i switch can be used to force this behavior. +# +# The -l (login) switch causes csh to run as if it were a login shell. +# This is done "properly" if c2z is used as a zsh function, otherwise +# it's faked by explicitly sourcing .login. Use with caution if your +# .login initializes an X server or does other one-time-only startup +# procedures. +# +# usage: +# c2z [-i | -l | filename] +# +# You can use this script in your .zshrc or .zlogin files to load your +# regular csh environment into zsh; for example, in .zlogin: +# +# . =(c2z -l) +# +# This is not perfect, but it gets most common aliases and variables. +# It's also rather time-consuming to do this every time you log in. +# However, if you're moving from csh to zsh for the first time, this +# can get you started with a familiar environment right away. +# +# In case your mailer eats tabs, $T is set to expand to a tab. +# +T="`echo x | tr x '\011'`" + +# If we're zsh, we can run "- csh" to get the complete environment. +# +MINUS="" +LOADFILE="" +INTERACT="" +CSH=csh +case "$ZSH_NAME$ZSH_VERSION$VERSION" in +zsh*) + case $1 in + -l*) MINUS="-" ;; + -i*) INTERACT="-i" ;; + *) LOADFILE="source $1" CSH="csh -f";; + esac + if [[ -o INTERACTIVE ]]; then INTERACT="-i"; fi + setopt nobanghist + ;; +*) + case $1 in + -l*) LOADFILE="source ~/.login" ;; + -i*) INTERACT="-i" ;; + *) LOADFILE="source $1" CSH="csh -f";; + esac + ;; +esac + +( eval $MINUS $CSH $INTERACT ) <&1 >/dev/null +$LOADFILE +alias >! /tmp/cz$$.a +setenv >! /tmp/cz$$.e +set >! /tmp/cz$$.v +EOF + +# save stdin +exec 9<&0 + +# First convert aliases +exec < /tmp/cz$$.a + +# Taken straight from ctoz except for $T and "alias --" +sed -e 's/'"$T"'(\(.*\))/'"$T"'\1/' >/tmp/cz$$.1 +grep ! /tmp/cz$$.1 >/tmp/cz$$.2 +grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3 +sed -e "s/'/'"\\\\"''"/g \ + -e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/alias -- \1='"'\2'/" \ + /tmp/cz$$.3 +sed -e 's/![:#]*/$/g' \ + -e 's/\$cwd/$PWD/' \ + -e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/\1 () { \2 }/' \ + /tmp/cz$$.2 + +# Next, convert environment variables +exec < /tmp/cz$$.e + +# Would be nice to deal with embedded newlines, e.g. in TERMCAP, but ... +sed -e '/^SHLVL/d' \ + -e '/^PWD/d' \ + -e "s/'/'"\\\\"''"/g \ + -e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \ + -e "s/$/'/" + +# Finally, convert local variables +exec < /tmp/cz$$.v + +sed -e 's/'"$T"'/=/' \ + -e "s/'/'"\\\\"''"/g \ + -e '/^[A-Za-z0-9_]*=[^(]/{ + s/=/='"'/"' + s/$/'"'/"' + }' | +sed -e '/^argv=/d' -e '/^cwd=/d' -e '/^filec=/d' -e '/^status=/d' \ + -e '/^autolist=/s/.*/setopt autolist/' \ + -e '/^correct=all/s//setopt correctall/' \ + -e '/^correct=/s//setopt correct/' \ + -e '/^histchars=/s//HISTCHARS=/' \ + -e '/^history=/s//HISTSIZE=/' \ + -e '/^home=/s//HOME=/' \ + -e '/^ignoreeof=/s/.*/setopt ignoreeof/' \ + -e '/^noclobber=/s/.*/setopt noclobber/' \ + -e '/^notify=/d' \ + -e '/^prompt=/s/!/%h/' \ + -e 's/^prompt/PROMPT/' \ + -e '/^showdots=/s/.*/setopt globdots/' \ + -e '/^savehist=/s//HISTFILE=\~\/.zhistory SAVEHIST=/' \ + -e '/^who=/s//WATCHFMT=/' + + +exec 0<&9 + +rm /tmp/cz$$.? +exit diff --git a/Misc/compctl-examples b/Misc/compctl-examples new file mode 100644 index 000000000..e84a37fbb --- /dev/null +++ b/Misc/compctl-examples @@ -0,0 +1,716 @@ +# +# This file gives examples of possible programmable completions (compctl). +# You can either put the compctl commands in your .zshrc file, or put them +# in a separate file (say .zcompctl) and source it from your .zshrc file. +# +# These are just examples. Use and modify to personal taste. Copying +# this file without thought will needlessly increase zsh's memory usage +# and startup time. +# +# For a detailed description of how these work, check the zshcompctl man +# page. +# +#------------------------------------------------------------------------------ +hosts=("${${(s: :)${(s: :)${${(f)$(/dev/null)' + -o + -x 's[no]' -o -- unsetopt +compctl -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' + -o + -x 's[no]' -o -- setopt +compctl -s '${^fpath}/*(N:t)' autoload +compctl -b -x 'W[1,-*[DAN]*],C[-1,-*M]' -s '$(bindkey -l)' -- bindkey +compctl -c -x 'C[-1,-*k]' -A - 'C[-1,-*K]' -F -- compctl +compctl -x 'C[-1,-*e]' -c - 'C[-1,-[ARWI]##]' -f -- fc +compctl -x 'p[1]' - 'p[2,-1]' -l '' -- sched +compctl -x 'C[-1,[+-]o]' -o - 'c[-1,-A]' -A -- set +compctl -b -x 'w[1,-N] p[3]' -F -- zle +compctl -s '${^module_path}/*(N:t:r)' -x \ + 'W[1,-*(a*u|u*a)*],W[1,-*a*]p[3,-1]' -B - \ + 'W[1,-*u*]' -s '$(zmodload)' -- zmodload + +# Anything after nohup is a command by itself with its own completion +compctl -l '' nohup noglob exec nice eval - time rusage +compctl -l '' -x 'p[1]' -eB -- builtin +compctl -l '' -x 'p[1]' -em -- command +compctl -x 'p[1]' -c - 'p[2,-1]' -k signals -- trap +#------------------------------------------------------------------------------ +# kill takes signal names as the first argument after -, but job names after % +# or PIDs as a last resort +compctl -j -P '%' + -s '`ps -x | tail +2 | cut -c1-5`' + \ + -x 's[-] p[1]' -k "($signals[1,-3])" -- kill +#------------------------------------------------------------------------------ +compctl -s '$(groups)' + -k groups newgrp +compctl -f -x 'p[1], p[2] C[-1,-*]' -k groups -- chgrp +compctl -f -x 'p[1] n[-1,.], p[2] C[-1,-*] n[-1,.]' -k groups - \ + 'p[1], p[2] C[-1,-*]' -u -S '.' -q -- chown +compctl -/g '*.x' rpcgen +compctl -u -x 's[+] c[-1,-f],s[-f+]' -W ~/Mail -f - \ + 's[-f],c[-1,-f]' -f -- mail elm +compctl -x 'c[-1,-f]' -W ~/Mail -f -- pine +#------------------------------------------------------------------------------ +compctl -s "\$(awk '/^[a-zA-Z0-9][^ ]+:/ {print \$1}' FS=: [mM]akefile)" -x \ + 'c[-1,-f]' -f -- make gmake pmake +#------------------------------------------------------------------------------ +# tar +tarnames () { + # Completion function for use with tar: + # get the names of files in the tar archive to extract. + # + # The main claim to fame of this particular function is that it + # completes directories in the tar-file in a manner very roughly + # consistent with `compctl -f'. There are two bugs: first, the whole + # path prefix up to the present is listed with ^D, not just the new + # part to add; second, after a unique completion a space is always + # inserted, even if the completion ends with a slash. These are + # currently limitations of zsh. + # + # This only works for the (fairly common) tar argument style where + # the arguments are bunched into the first argument, and the second + # argument is the name of the tarfile. For example, + # tar xvzf zsh-3.1.2.tar.gz ... + # You can only use compressed/gzipped files if tar is GNU tar, + # although the correct name for the tar programme will be inferred. + + local line list=tf + read -cA line + # $line[2] is the first argument: check for possible compression args. + # (This is harmless when used with non-GNU tar, but then the file must + # be uncompressed to be able to use it with tar anyway.) + [[ $line[2] = *[Zz]* ]] && list=tfz + # $line[1] is the command name: something like tar or gnutar. + # $line[3] is the name of the tar archive. + + # cache contents for multiple completion: note tar_cache_name + # and tar_cache_list are not local. Assumes all files with the + # same name are the same file, even if in different directories: + # you can trick it with $PWD/file on the command line. + if [[ $line[3] != $tar_cache_name ]]; then + tar_cache_list=($($line[1] $list $line[3])) + tar_cache_name=$line[3] + fi + + # Now prune the list to include only appropriate directories. + local file new + reply=() + if [[ $1 = */* ]]; then + local sofar=${1%/*}/ + for file in $tar_cache_list; do + if [[ $file = $sofar* ]]; then + new=${file#$sofar} + if [[ $new = */* ]]; then + new=$sofar${new%%/*}/ + else + new=$file + fi + if [[ $1 != */ || $new != $1 ]]; then + reply=($reply $new) + fi + fi + done + else + for file in $tar_cache_list; do + if [[ $file = */* ]]; then + new=${file%%/*}/ + else + new=$file + fi + reply=($reply $new) + done + fi +} + +compctl -f \ + -x 'p[2] C[-1,*(z*f|f*z)*]' -/g '*.(taz|tar.(gz|z|Z)|tgz)' \ + - 'p[2] C[-1,*(Z*f|f*Z)*]' -/g '*.(tar.Z|taz)' \ + - 'p[2] C[-1,*f*]' -/g '*.tar' \ + - 'p[1] N[-1,ctxvzZ]' -k "(v z f)" \ + - 'p[1] s[]' -k "(c t x)" -S '' \ + - 'p[3,-1] W[1,*x*]' -K tarnames \ + -- tar gtar gnutar +#------------------------------------------------------------------------------ +# rmdir only real directories +compctl -/g '*(/)' rmdir dircmp +#------------------------------------------------------------------------------ +# cd/pushd only directories or symbolic links to directories +compctl -/ cd chdir dirs pushd + +# Another possibility for cd/pushd is to use it in conjunction with the +# cdmatch function (in the Functions subdirectory of zsh distribution). +compctl -K cdmatch -S '/' -q -x 'p[2]' -Q -K cdmatch2 - \ + 'S[/][~][./][../]' -g '*(-/)' + -g '*(-/D)' - \ + 'n[-1,/]' -K cdmatch -S '/' -q -- cd chdir pushd +#------------------------------------------------------------------------------ +# If the command is rsh, make the first argument complete to hosts and treat the +# rest of the line as a command on its own. +compctl -k hosts -x 'p[2,-1]' -l '' -- rsh + +# rlogin takes hosts and users after `-l' +compctl -k hosts -x 'c[-1,-l]' -u -- rlogin + +# rcp: match users, hosts and files initially. Match files after a :, or hosts +# after an @. If one argument contains a : then the other matches files only. +# Not quite perfect; compctl just isn't up to it yet. +compctl -u -k hosts -f -x 'n[1,:]' -f - 'n[1,@]' -k hosts -S ':' - \ + 'p[1] W[2,*:*]' -f - 'p[1] W[2,*?*]' -u -k hosts -S ':' - \ + 'p[2] W[1,*:*]' -f - 'p[2] W[1,*?*]' -u -k hosts -S ':' -- rcp + +compctl -k hosts host rup rusers ping +#------------------------------------------------------------------------------ +# strip, profile, and debug only executables. The compctls for the +# debuggers could be better, of course. +compctl -/g '*(*)' strip gprof adb dbx xdbx ups +compctl -/g '*.[ao]' -/g '*(*)' nm +#------------------------------------------------------------------------------ +# shells: compctl needs some more enhancement to do -c properly. +compctl -f -x 'C[-1,-*c]' -c - 'C[-1,[-+]*o]' -o -- bash ksh sh zsh +#------------------------------------------------------------------------------ +# su takes a username and args for the shell. +compctl -u -x 'w[1,-]p[3,-1]' -l sh - 'w[1,-]' -u - 'p[2,-1]' -l sh -- su +#------------------------------------------------------------------------------ +# Run ghostscript on postscript files, but if no postscript file matches what +# we already typed, complete directories as the postscript file may not be in +# the current directory. +compctl -/g '*.(e|E|)(ps|PS)' \ + gs ghostview nup psps pstops psmulti psnup psselect +#------------------------------------------------------------------------------ +# Similar things for tex, texinfo and dvi files. +compctl -/g '*.tex*' {,la,gla,ams{la,},{g,}sli}tex texi2dvi +compctl -/g '*.dvi' xdvi dvips +#------------------------------------------------------------------------------ +# For rcs users, co and rlog from the RCS directory. We don't want to see +# the RCS and ,v though. +compctl -g 'RCS/*(:s@RCS/@@:s/,v//)' co rlog rcs rcsdiff +#------------------------------------------------------------------------------ +# gzip uncompressed files, but gzip -d only gzipped or compressed files +compctl -x 'R[-*[dt],^*]' -/g '*.(gz|z|Z|t[agp]z|tarZ|tz)' + -f - \ + 's[]' -/g '^*(.(tz|gz|t[agp]z|tarZ|zip|ZIP|jpg|JPG|gif|GIF|[zZ])|[~#])' \ + + -f -- gzip +compctl -/g '*.(gz|z|Z|t[agp]z|tarZ|tz)' gunzip gzcat zcat +compctl -/g '*.Z' uncompress zmore +compctl -/g '*.F' melt fcat +#------------------------------------------------------------------------------ +# ftp takes hostnames +ftphosts=(prep.ai.mit.edu wuarchive.wustl.edu ftp.uu.net ftp.math.gatech.edu) +compctl -k ftphosts ftp + +# Some systems have directories containing indices of ftp servers. +# For example: we have the directory /home/ftp/index/INDEX containing +# files of the form `-INDEX.Z', this leads to: +#compctl -g '/home/ftp/index/INDEX/*-INDEX.Z(:t:r:s/-INDEX//)' ftp tftp +#------------------------------------------------------------------------------ +# Change default completion (see the multicomp function in the Function +# subdirectory of the zsh distribution). +#compctl -D -f + -U -K multicomp +# If completion of usernames is slow for you, you may want to add something +# like +# -x 'C[0,*/*]' -f - 's[~]' -S/ -k users + -u +# where `users' contains the names of the users you want to complete often. +# If you want to use this and to be able to complete named directories after +# the `~' you should add `+ -n' at the end +#------------------------------------------------------------------------------ +# This is to complete all directories under /home, even those that are not +# yet mounted (if you use the automounter). + +# This is for NIS+ (e.g. Solaris 2.x) +#compctl -Tx 's[/home/] C[0,^/home/*/*]' -S '/' -s '$(niscat auto_home.org_dir | \ +# awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)' + +# And this is for YP (e.g. SunOS4.x) +#compctl -Tx 's[/home/] C[0,^/home/*/*]' -S '/' -s '$(ypcat auto.home | \ +# awk '\''/export\/[a-zA-Z]*$/ {print $NF}'\'' FS=/)' +#------------------------------------------------------------------------------ +# Find is very system dependent, this one is for GNU find. +# Note that 'r[-exec,;]' must come first +if [[ -r /proc/filesystems ]]; then + # Linux + filesystems='"${${(f)$(' -- dd +#------------------------------------------------------------------------------ +# Various MH completions by Peter Stephenson +# You may need to edit where it says *Edit Me*. + +# The following three functions are best autoloaded. +# mhcomp completes folders (including subfolders), +# mhfseq completes sequence names and message numbers, +# mhfile completes files in standard MH locations. + +function mhcomp { + # Completion function for MH folders. + # Works with both + (rel. to top) and @ (rel. to current). + local nword args pref char mhpath + read -nc nword + read -cA args + + pref=$args[$nword] + char=$pref[1] + pref=$pref[2,-1] + + # The $(...) here accounts for most of the time spent in this function. + if [[ $char = + ]]; then + # mhpath=$(mhpath +) + # *Edit Me*: use a hard wired value here: it's faster. + mhpath=~/Mail + elif [[ $char = @ ]]; then + mhpath=$(mhpath) + fi + + eval "reply=($mhpath/$pref*(N-/))" + + # I'm frankly amazed that this next step works, but it does. + reply=(${reply#$mhpath/}) +} + +mhfseq() { + # Extract MH message names and numbers for completion. Use of the + # correct folder, if it is not the current one, requires that it + # should be the previous command line argument. If the previous + # argument is `-draftmessage', a hard wired draft folder name is used. + + local folder foldpath words pos nums + read -cA words + read -cn pos + + # Look for a folder name. + # First try the previous word. + if [[ $words[$pos-1] = [@+]* ]]; then + folder=$words[$pos-1] + # Next look and see if we're looking for a draftmessage + elif [[ $words[$pos-1] = -draftmessage ]]; then + # *Edit Me*: shortcut -- hard-wire draftfolder here + # Should really look for a +draftfolder argument. + folder=+drafts + fi + # Else use the current folder ($folder empty) + + if [[ $folder = +* ]]; then + # *Edit Me*: use hard-wired path with + for speed. + foldpath=~/Mail/$folder[2,-1] + else + foldpath=$(mhpath $folder) + fi + + # Extract all existing message numbers from the folder. + nums=($foldpath/<->(N:t)) + # If that worked, look for marked sequences. + # *Edit Me*: if you never use non-standard sequences, comment out + # or delete the next three lines. + if (( $#nums )); then + nums=($nums $(mark $folder | awk -F: '{print $1}')) + fi + + # *Edit Me*: `unseen' is the value of Unseen-Sequence, if it exists; + set -A reply next cur prev first last all unseen $nums + +} + +mhfile () { + # Find an MH file; for use with -form arguments and the like. + # Use with compctl -K mhfile. + + local mhfpath file + # *Edit Me*: Array containing all the places MH will look for templates etc. + mhfpath=(~/Mail /usr/local/lib/MH) + + # Emulate completeinword behaviour as appropriate + local wordstr + if [[ -o completeinword ]]; then + wordstr='$1*$2' + else + wordstr='$1$2*' + fi + + if [[ $1$2 = */* ]]; then + # path given: don't search MH locations + eval "reply=($wordstr(.N))" + else + # no path: only search MH locations. + eval "reply=(\$mhfpath/$wordstr(.N:t))" + fi +} + +# Note: you must type the initial + or @ of a folder name to get +# completion, even in places where only folder names are allowed. +# Abbreviations for options are not recognised. Hit tab to complete +# the option name first. +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(all fast nofast header noheader help list nolist \ + pack nopack pop push recurse norecurse total nototal)" -- folder +compctl -K mhfseq -x 's[+][@],c[-1,-draftfolder] s[+][@]' \ + -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq - \ + 'C[-1,-(editor|whatnowproc)]' -c - \ + 's[-]' -k "(draftfolder draftmessage nodraftfolder editor noedit \ + file form use nouse whatnowproc nowhatnowproc help)" - \ + 'c[-1,-form]' -K mhfile -- comp +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(audit noaudit changecur nochangecur form format \ + file silent nosilent truncate notruncate width help)" - \ + 'C[-1,-(audit|form)]' -K mhfile - 'c[-1,-file]' -f + -- inc +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(sequence add delete list public nopublic zero nozero help)" -- \ + mark +compctl -K mhfseq -x 's[+][@]' \ + -K mhcomp -S / -q - 'c[-1,-file]' -f - 'c[-1,-rmmprov]' -c - \ + 's[-]' -k "(draft link nolink preserve nopreserve src file \ + rmmproc normmproc help)" -- refile +compctl -K mhfseq -x 's[+][@]' \ + -K mhcomp -S / -q - 'c[-1,-draftmessage]' -K mhfseq -\ + 's[-]' -k "(annotate noannotate cc nocc draftfolder nodraftfolder \ + draftmessage editor noedit fcc filter form inplace noinplace query \ + noquery width whatnowproc nowhatnowproc help)" - 'c[-1,(cc|nocc)]' \ + -k "(all to cc me)" - 'C[-1,-(filter|form)]' -K mhfile - \ + 'C[-1,-(editor|whatnowproc)]' -c -- repl +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(clear noclear form format header noheader reverse noreverse \ + file help width)" - 'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile -- scan +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(draft form moreproc nomoreproc header noheader \ + showproc noshowproc length width help)" - 'C[-1,-(show|more)proc]' -c - \ + 'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile - \ + 'c[-1,-length]' -s '$LINES' - 'c[-1,-width]' -s '$COLUMNS' -- show next prev +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \ + -k "(help)" -- rmm +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - \ + 's[-]' -k "(after before cc date datefield from help list nolist \ + public nopublic search sequence subject to zero nozero not or and \ + lbrace rbrace)" -- pick +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \ + -k "(alias check draft draftfolder draftmessage help nocheck \ + nodraftfolder)" -- whom +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' \ + -k "(file part type list headers noheaders realsize norealsize nolist \ + show serialonly noserialonly form pause nopause noshow store auto noauto \ + nostore cache nocache rcache wcache check nocheck ebcdicsafe noebcdicsafe \ + rfc934mode norfc934mode verbose noverbose help)" - \ + 'c[-1,-file]' -f - 'c[-1,-form]' -K mhfile - \ + 'C[-1,-[rw]cache]' -k '(public private never ask)' -- mhn +compctl -K mhfseq -x 's[+][@]' -K mhcomp -S / -q - 's[-]' -k '(help)' -- mhpath +#------------------------------------------------------------------------------ +# CVS +# +cvscmds=(add admin rcs checkout commit diff rdiff export history import log rlog + release remove status tag rtag update annotate) +cvsignore="*~ *# .#* *.o *.a CVS . .." + +compctl -k cvscmds \ + -x "c[-1,-D]" -k '(today yesterday 1\ week\ ago)' \ + - "c[-1,-m]" -k '(bugfix cosmetic\ fix ... added\ functionality foo)' \ + - "c[-1,-F]" -f \ + - "c[-1,-r]" -K cvsrevisions \ + - "c[-1,-I]" -f \ + - "R[add,;]" -K cvsaddp \ + - "R[(admin|rcs),;]" -/K cvstargets \ + - "R[(checkout|co),;]" -K cvsrepositories \ + - "R[(commit|ci),;]" -/K cvstargets \ + - "R[(r|)diff,;]" -/K cvstargets \ + - "R[export,;]" -f \ + - "R[history,;]" -/K cvstargets \ + - "R[history,;] c[-1,-u]" -u \ + - "R[import,;]" -K cvsrepositories \ + - "R[(r|)log,;]" -/K cvstargets \ + - 'R[(r|)log,;] s[-w] n[-1,,],s[-w]' -u -S , -q \ + - "R[rel(|ease),;]" -f \ + - "R[(remove|rm),;] R[-f,;]" -/K cvstargets \ + - "R[(remove|rm),;]" -K cvsremovep \ + - "R[status,;]" -/K cvstargets \ + - "R[(r|)tag,;]" -/K cvstargets \ + - "R[up(|date),;]" -/K cvstargets \ + - "R[annotate,;]" -/K cvstargets \ + -- cvs + +compctl -/K cvstargets cvstest + +cvsprefix() { + local nword args f + read -nc nword; read -Ac args + pref=$args[$nword] + if [[ -d $pref:h && ! -d $pref ]]; then + pref=$pref:h + elif [[ $pref != */* ]]; then + pref= + fi + [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/ +} + +cvsentries() { + setopt localoptions nullglob unset + if [[ -f ${pref}CVS/Entries ]]; then + reply=( "${pref}${^${${${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}" ) + fi +} + +cvstargets() { + local pref + cvsprefix + cvsentries +} + +cvsrevisions() { + reply=( "${${${(M)${(f)$(cvs -q status -vl .)}:# *}##[ ]##}%%[ ]*}" ) +} + +cvsrepositories() { + local root=$CVSROOT + [[ -f CVS/Root ]] && root=$(/dev/null)}%%:*}"; do + reply=($reply ${u%% *}@${u##* }) + done +} +#------------------------------------------------------------------------------ +# Linux mount +comp_fsmount () { + local tmp; if [[ $UID = 0 ]]; then tmp=""; else tmp="user"; fi + sed -n -e "s|^[^# ][^ ]*[ ][ ]*\(/[^ ]*\)[ ].*$tmp.*|\1|p" /etc/fstab +} +comp_nfsmount () { + local cmd args host + read -Ac cmd; read -cn where + host=${${cmd[$where]}%%:*} + reply=("${(@f)$(showmount -e $host | sed -n -e "s|^/\([^ ]*\) .*|$host:/\1|p")}") +} +compctl -s '$(mount | \ + sed -e "s/^[^ ]* on \\([^ ]*\\) type.*/\\1/"'"$( + if [[ ! $UID = 0 ]]; then + echo ' | egrep "^${(j:|:)$(comp_fsmount)}\$"' + fi)"')' umount +compctl -s '$(comp_fsmount)' + \ + -x 'S[/]' -f -- + \ + -x 'C[0,*:*]' -K comp_nfsmount -- + \ + -s '$(< /etc/hosts)' \ + mount +#------------------------------------------------------------------------------ +# Lynx (web browser) +compctl -k '(http:// file: ftp:// gopher:// news://)' -S '' \ + -x 's[ftp://]' -k ftphosts -S/ \ + - 'n[1,://]' -k hosts -S/ \ + - 's[file:/]' -/g '*.html' -W/ \ + - 's[file:]' -s '~+' -S '/' \ + - 's[-]' -k '(anonymous auth base book buried_news cache case + cfg child cookies crawl display dump editor emacskeys + enable_scrollback error_file fileversions force_html + from ftp get_data head help historical homepage + image_links index link localhost locexec mime_header + minimal newschunksize newsmaxchunk nobrowse noexec + nofilereferer nofilereferer nolist nolog nopause + noprint noredir noreferer nosocks nostatus number_links + popup post_data print pseudo_inlines raw realm reload + restrictions resubmit_posts rlogin selective show_cursor + source startfile_ok telnet term trace traversal underscore + validate version vikeys)' \ + -- lynx +#------------------------------------------------------------------------------ +# ssh (secure shell) +compctl -k hosts \ + -x "c[-1,-l]" -u \ + - "c[-1,-i]" -f \ + - "c[-1,-e]" -k "(~ none)" \ + - "c[-1,-c]" -k "(idea des 3des tss arcfour none)" \ + - "c[-1,-p]" -k ports \ + - "c[-1,-L] c[-1,-R] c[-1,-o]" -k "()" \ + -- ssh +#------------------------------------------------------------------------------ +# network stuff +compctl -k hosts \ + -x "s[-class=]" -k "(any in chaos hesiod)" \ + - "s[-query=]" -k "(a cname hinfo md mx mb mg minfo ns ptr soa txt uinfo wks any)" \ + - "s[-]" -Q -S '' -k "(query= all\ class= d2\ nod2\ debug\ nodebug\ defname\ nodefname\ domain= ignoretc\ noignoretc\ )" \ + -- nslookup + +compctl -k hosts \ + -x "C[-1,[^-]*] p[2,-1]" -k ports \ + -- telnet + +compctl -x 'N[-1,@]' -k hosts - 's[]' -u -qS '@' -- finger +#------------------------------------------------------------------------------ +# gdb +compctl -/g "*(*)" \ + -x "s[-]" -k "(help nx q batch cd f b tty exec se core symbols c x d)" \ + - "C[-1,(-cd|-directory)]" -/ \ + - "C[-1,(-core|-c)]" -/g 'core*' \ + - "C[-1,(-se|-exec)]" -f \ + - "C[-1,(-symbols|-command|-x)]" -f \ + - "p[2,-1] C[-1,[^-]*]" -/g "core*" \ + -- gdb diff --git a/Misc/globtests b/Misc/globtests new file mode 100755 index 000000000..728aee5ae --- /dev/null +++ b/Misc/globtests @@ -0,0 +1,107 @@ +#!/usr/local/bin/zsh -f + +setopt extendedglob badpattern +unsetopt kshglob + +failed=0 +while read res str pat; do + [[ $res = '#' ]] && continue + [[ $str = ${~pat} ]] + ts=$? + [[ $1 = -q ]] || print "$ts: [[ $str = $pat ]]" + if [[ ( $ts -gt 0 && $res = t) || ($ts -eq 0 && $res = f) ]]; then + print "Test failed: [[ $str = $pat ]]" + (( failed++ )) + fi +done < always complete to `compress') then the +# resulting "compctl" statements will produce one of two behaviours: +# (1) By default (like tcsh), com etc. will also complete to +# "compress" and nothing else. +# (2) With -x, com does ordinary command completion: this is +# more flexible. +# I don't understand what the hyphen in complete does and I've ignored it. +# +# Notes: +# (1) The -s option is the way to do backquote expansion. In zsh, +# "compctl -s '`users`' talk" works (duplicates are removed). +# (2) Complicated backquote completions should definitely be rewritten as +# shell functions (compctl's "-K func" option). Although most of +# these will be translated correctly, differences in shell syntax +# are not handled. +# (3) Replacement of $:n with the n'th word on the current line with +# backquote expansion now works; it is not necessarily the most +# efficient way of doing it in any given case, however. +# (4) I have made use of zsh's more sophisticated globbing to change +# things like ^foo.{a,b,c,d} to ^foo.(a|b|c|d), which works better. +# It's just possible in some cases you may want to change it back. +# (5) Make sure all command names with wildcards are processed together -- +# they need to be lumped into one "compctl -C" or "compctl -D" +# statement for zsh. + +# Handle options +if (@ARGV) { + ($ARGV[0] eq '-x') && shift && ($opt_x = 1); + ($ARGV[0] =~ /^-+$/) && shift; +} + +# Function names used (via magic autoincrement) when cmdline words are needed +$funcnam = 'compfn001'; + +# Read next word on command line +sub getword { + local($word, $word2, $ret); + ($_) = /^\s*(.*)$/; + while ($_ =~ /^\S/) { + if (/^[\']/) { + ($word, $_) = /^\'([^\']*).(.*)$/; + } elsif (/^[\"]/) { + ($word, $_) = /^\"([^\"]*).(.*)$/; + while ($word =~ /\\$/) { + chop($word); + ($word2, $_) = /^([^\"]*).(.*)$/; + $word .= '"' . $word2; + } + } elsif (/\S/) { + ($word, $_) = /^([^\s\\\'\"\#;]*)(.*)$/; + # Backslash: literal next character + /^\\(.)/ && (($word .= substr($_,1,1)), + ($_ = substr($_,2))); + # Rest of line quoted or end of command + /^[\#;]/ && ($_ = ''); + } else { + return undef; + } + length($word) && ($ret = defined($ret) ? $ret . $word : $word); + } + $ret; +} + +# Interpret the x and arg in 'x/arg/type/' +sub getpat { + local($pat,$arg) = @_; + local($ret,$i); + if ($pat eq 'p') { + $ret = "p[$arg]"; + } elsif ($pat eq 'n' || $pat eq 'N') { + $let = ($arg =~ /[*?|]/) ? 'C' : 'c'; + $num = ($pat eq 'N') ? 2 : 1; + $ret = "${let}[-${num},$arg]"; + } elsif ($pat eq 'c' || $pat eq 'C') { + # A few tricks to get zsh to ignore up to the end of + # any matched pattern. + if (($pat eq 'c' && $arg =~ /^\*([^*?]*)$/)) { + $ret = "n[-1,$1]"; + } elsif ($arg =~ /[*?]([^*?]*)$/) { + length($1) && ($ret = " n[-1,$1]"); + $ret = "C[0,$arg] $ret"; + } else { + $let = ($pat eq 'c') ? 's' : 'S'; + $ret = "${let}[$arg]"; + } + } + $ret =~ s/'/'\\''/g; + $ret; +} + +# Interpret the type in 'x/arg/type/' +sub gettype { + local ($_) = @_; + local($qual,$c,$glob,$ret,$b,$m,$e,@m); + $c = substr($_,0,1); + ($c =~ /\w/) && (substr($_,1,1) eq ':') && ($glob = substr($_,2)); +# Nothing (n) can be handled by returning nothing. (C.f. King Lear, I.i.) + if ($c =~ /[abcjuv]/) { + $ret = "-$c"; + } elsif ($c eq 'S') { + $ret = '-k signals'; + } elsif ($c eq 'd') { + if (defined($glob)) { + $qual = '-/'; + } else { + $ret = '-/'; + } + } elsif ($c eq 'e') { + $ret = '-E'; + } elsif ($c eq 'f' && !$glob) { + $ret = '-f'; + } elsif ($c eq 'l') { + $ret = q!-k "(`limit | awk '{print $1}'`)"!; + } elsif ($c eq 'p') { + $ret = "-W $glob -f", undef($glob) if defined($glob); + } elsif ($c eq 's') { + $ret = '-p'; + } elsif ($c eq 't') { + $qual = '.'; + } elsif ($c eq 'x') { + $glob =~ s/'/'\\''/g; + $ret = "-X '$glob'"; + undef($glob); + } elsif ($c eq '$') { # '){ + $ret = "-k " . substr($_,1); + } elsif ($c eq '(') { + s/'/'\\''/g; + $ret = "-k '$_'"; + } elsif ($c eq '`') { + # this took some working out... + if (s/\$:(\d+)/$foo=$1+1,"\${word[$foo]}"/ge) { + $ret = "-K $funcnam"; + $genfunc .= <<"HERE"; +function $funcnam { + local word + read -cA word + reply=($_) +} +HERE + $funcnam++; + } else { + s/'/'\\''/g; + $ret = "-s '$_'"; + } + } + + # foo{bar,ba,blak,sheap} -> foo(bar|ba|blak|sheap). + # This saves a lot of mess, since in zsh brace expansion occurs + # before globbing. I'm sorry, but I don't trust $` and $'. + while (defined($glob) && (($b,$m,$e) = ($glob =~ /^(.*)\{(.*)\}(.*)$/)) + && $m =~ /,/) { + @m = split(/,/, $m); + for ($i = 0; $i < @m; $i++) { + while ($m[$i] =~ /\\$/) { + substr($m[$i],-1,1) = ""; + splice(@m,$i,2,"$m[$i]\\,$m[$i+1]"); + } + } + $glob = $b . "(" . join('|',@m) . ")" . $e; + } + + if ($qual) { + $glob || ($glob = '*'); + $glob .= "($qual)"; + } + $glob && (($glob =~ s/'/'\\''/g),($glob = "-g '$glob'")); + + defined($ret) && defined($glob) && ($ret .= " $glob"); + defined($ret) ? $ret : $glob; +} + +# Quoted array separator for extended completions +$" = " - "; + +while (<>) { + if (/^\s*complete\s/) { + undef(@stuff); + $default = ''; + $_ = $'; + while (/\\$/) { + # Remove backslashed newlines: in principle these should become + # real newlines inside quotes, but what the hell. + ($_) = /^(.*)\\$/; + $_ .= <>; + } + $command = &getword; + if ($command =~ /^-/ || $command =~ /[*?]/) { + # E.g. complete -co* ... + $defmatch = $command; + ($defmatch =~ /^-/) && ($defmatch = substr($defmatch,1)); + } else { + undef($defmatch); + } + while (defined($word = &getword)) { + # Loop over remaining arguments to "complete". + $sep = substr($word,1,1); + $sep =~ s/(\W)/\\$1/g; + @split = split(/$sep/,$word); + for ($i = 0; $i < 3; $i++) { + while ($split[$i] =~ /\\$/) { + substr($split[$i],-1,1) = ""; + splice(@split,$i,2,"$split[$i]\\$sep$split[$i+1]"); + } + } + ($pat,$arg,$type,$suffix) = @split; + defined($suffix) && ($suffix =~ /^\s*$/) && undef($suffix); + if (($word =~ /^n$sep\*$sep/) && + (!defined($defmatch))) { + # The "complete" catch-all: treat this as compctl\'s + # default (requiring no pattern matching). + $default .= &gettype($type) . ' '; + defined($suffix) && ($defsuf .= $suffix); + } else { + $pat = &getpat($pat,$arg); + $type = &gettype($type); + if (defined($defmatch)) { + # The command is a pattern: use either -C or -D option. + if ($pat eq 'p[0]') { + # Command word (-C): 'p[0]' is redundant. + if ($defmatch eq '*') { + $defcommand = $type; + } else { + ($defmatch =~ /\*$/) && chop($defmatch); + if ($opt_x) { + $c = ($defmatch =~ /[*?]/) ? 'C' : 'c'; + $pat = $c . "[0,${defmatch}]"; + } else { + $pat = ($defmatch =~ /[*?]/) ? + "C[0,${defmatch}]" : "S[${defmatch}]"; + } + push(@commandword,defined($suffix) ? + "'$pat' $type -S '$suffix'" : "'$pat' $type"); + } + } elsif ($pat eq "C[-1,*]") { + # Not command word completion, but match + # command word (only) + if ($defmatch eq "*") { + # any word of any command + $defaultdefault .= " $type"; + } else { + $pat = "W[0,$defmatch]"; + push(@defaultword,defined($suffix) ? + "'$pat' $type -S '$suffix'" : "'$pat' $type"); + } + } else { + # Not command word completion, but still command + # word with pattern + ($defmatch eq '*') || ($pat = "W[0,$defmatch] $pat"); + push(@defaultword,defined($suffix) ? + "'$pat' $type -S '$suffix'" : "'$pat' $type"); + } + } else { + # Ordinary command + push(@stuff,defined($suffix) ? + "'$pat' $type -S '$suffix'" : "'$pat' $type"); + } + } + } + if (!defined($defmatch)) { + # Ordinary commands with no pattern + print("compctl $default"); + defined($defsuf) && print("-S '$defsuf' ") && undef($defsuf); + defined(@stuff) && print("-x @stuff -- "); + print("$command\n"); + } + if (defined($genfunc)) { + print $genfunc; + undef($genfunc); + } + } +} + +(defined(@commandword) || defined($defcommand)) && + print("compctl -C ", + defined($defcommand) ? $defcommand : '-c', + defined(@commandword) ? " -x @commandword\n" : "\n"); + +if (defined($defaultdefault) || defined(@defaultword)) { + defined($defaultdefault) || ($defaultdefault = "-f"); + print "compctl -D $defaultdefault"; + defined(@defaultword) && print(" -x @defaultword"); + print "\n"; +} + +__END__ diff --git a/README b/README new file mode 100644 index 000000000..6a591b263 --- /dev/null +++ b/README @@ -0,0 +1,135 @@ +----------------- +THE Z SHELL (ZSH) +----------------- + +Version +------- + +This is zsh version 3.1 (beta) + +Note that this is a beta version. The latest stable version is zsh-3.0.5. + +Installing Zsh +-------------- + +The instructions for compiling zsh are in the file INSTALL. You should +also check the file MACHINES in the subdirectory Etc to see if there +are any special instructions for your particular architecture. + +Features +-------- + +Zsh is a shell with lots of features. For a list of these, see the +file Etc/FEATURES. For more details, see the documentation. + +Documentation +------------- + +There are a number of documents about zsh in this distribution: + +Doc/Zsh/*.yo The master source for the zsh documentation is written in + yodl. Yodl is a document language written by Karel Kubat. + It is not required by zsh but but it is a nice program so + you might want to get it anyway, especially if you are a + zsh developer. It can be downloaded from + ftp://ftp.icce.rug.nl/pub/unix/yodl* + +Doc/zsh*.1 Man pages in nroff format. These will be installed + by "make install.man" or "make install". By default, + these will be installed in /usr/local/man/man1, although + you can change this with the --mandir option to configure + or editing the user configuration section of the top level + Makefile. + +Doc/zsh.texi Everything the man pages have, but in texinfo format. These + will be installed by "make install.info" or "make install". + By default, these will be installed in /usr/local/info, + although you can change this with the --infodir option to + configure or editing the user configuration section of the + top level Makefile. + +Also include in the distribution are: + +Doc/intro.ms An introduction to zsh in troff format using the ms + macros. This document explains many of the features + that make zsh more equal than other shells. + Unfortunately this is based on zsh-2.5 so some examples + may not work without changes but it is still a good + introduction. + +If you do not have the necessary tools to process these documents, +PostScript, ASCII, Info and DVI versions are available in the separate +file zsh-beta-doc.tar.gz at the archive sites listed in the META-FAQ. + +The distribution also contains a Perl script in Utils/helpfiles which +can be used to extract the descriptions of builtin commands from the +zshbuiltins manual page. See the comments at the beginning of the +script about its usage. The files created by this script can be used +by example function run-help located in the subdirectory Functions to +show information about zsh builtins and run `man' on external commands. +For this the shell variable HELPDIR should point to a directory containing +the fileles generated by the helpfiles script. run-help should be +unaliased before loading the run-help function. After that this function +will be executed by the run-help ZLE function which is by default bound +to ESC-h in emacs mode. + +Examples +-------- + +Examples of zsh startup files are located in the subdirectory +StartupFiles. Examples of zsh functions and scripts are located in +the subdirectory Functions. Examples of completion control commands +(compctl) are located in the file Misc/compctl-examples. + +Zsh FTP Sites, Web Pages, and Mailing Lists +------------------------------------------- + +The current list of zsh FTP sites, web pages, and mailing lists can be +found in the META-FAQ. A copy is included in this distribution and is +available separately at any of the zsh FTP sites. + +Common Problems and Frequently Asked Questions +---------------------------------------------- + +Zsh has a list of Frequently Asked Questions (FAQ) maintained by Peter +Stephenson . It covers many common problems encountered +when building, installing, and using zsh. A copy is included in this +distribution in Etc/FAQ and is available separately at any of the zsh +ftp sites. + +Zsh Maintenance and Bug Reports +------------------------------- + +Zsh is currently maintained by the members of the zsh-workers mailing list +and coordinated by Andrew Main (Zefram) . Please send +any feedback and bugs reports to . + +There is a script "reporter" in the subdirectory Util which will print +out your current shell environment/setup. If you report a bug, please +use this script and include the output from sourcing this file. This way, +the problem you are reporting can be recreated. + +You can help even more if you can reproduce the bug starting zsh with +the -f option. This skips the execution of local startup files except +/etc/zshenv. If a bug occurs only when some options set try to locate +the option which triggers the bug. + +The known bugs in zsh are listed in the file Etc/BUGS. Check this as +well as the Frequently Asked Questions (FAQ) list before sending a bug +report. Note that zsh has some features which are not compatible with +sh but these are not bugs. Most of these incompatibilities go away +when zsh is invoked as sh or ksh (e.g. using a symbolic link). + +If you send a bug report to the list and are not a subscriber, please +mention this in your message if you want a response. + +If you would like to contribute to the development and maintenance of zsh, +then you should join the zsh-workers mailing list (check the META-FAQ +for info on this). You should also read the "zsh-development-guide" +located in the subdirectory Util. + +Contributors +------------ + +The people who have contributed to this software project are listed +in Etc/CONTRIBUTORS. diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 000000000..c74d33966 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,221 @@ + +/***** begin user configuration section *****/ + +/* Define this to be the location of your password file */ +#define PASSWD_FILE "/etc/passwd" + +/* Define this to be the name of your NIS/YP password * + * map (if applicable) */ +#define PASSWD_MAP "passwd.byname" + +/* Define to 1 if you want user names to be cached */ +#define CACHE_USERNAMES 1 + +/* Define to 1 if system supports job control */ +#define JOB_CONTROL 1 + +/* Define this if you use "suspended" instead of "stopped" */ +#define USE_SUSPENDED 1 + +/* The default history buffer size in lines */ +#define DEFAULT_HISTSIZE 30 + +/* The default editor for the fc builtin */ +#define DEFAULT_FCEDIT "vi" + +/* The default prefix for temporary files */ +#define DEFAULT_TMPPREFIX "/tmp/zsh" + + +/***** end of user configuration section *****/ +/***** shouldn't have to change anything below here *****/ +@TOP@ + +/* The global file to source absolutely first whenever zsh is run; * + * if undefined, don't source anything */ +#undef GLOBAL_ZSHENV + +/* The global file to source whenever zsh is run; * + * if undefined, don't source anything */ +#undef GLOBAL_ZSHRC + +/* The global file to source whenever zsh is run as a login shell; * + * if undefined, don't source anything */ +#undef GLOBAL_ZLOGIN + +/* The global file to source whenever zsh is run as a login shell, * + * before zshrc is read; if undefined, don't source anything */ +#undef GLOBAL_ZPROFILE + +/* The global file to source whenever zsh was run as a login shell. * + * This is sourced right before exiting. If undefined, don't source * + * anything */ +#undef GLOBAL_ZLOGOUT + +/* Define to 1 if compiler could initialise a union */ +#undef HAVE_UNION_INIT + +/* Define to 1 if compiler incorrectly cast signed to unsigned */ +#undef BROKEN_SIGNED_TO_UNSIGNED_CASTING + +/* Define to 1 if compiler supports variable-length arrays */ +#undef HAVE_VARIABLE_LENGTH_ARRAYS + +/* Define if your system defines TIOCGWINSZ in sys/ioctl.h. */ +#undef GWINSZ_IN_SYS_IOCTL + +/* Define to 1 if you have NIS */ +#undef HAVE_NIS + +/* Define to 1 if you have NISPLUS */ +#undef HAVE_NIS_PLUS + +/* Define to 1 if you have RFS superroot directory. */ +#undef HAVE_SUPERROOT + +/* Define to the path of the /dev/fd filesystem */ +#undef PATH_DEV_FD + +/* Define if sys/time.h and sys/select.h cannot be both included */ +#undef TIME_H_SELECT_H_CONFLICTS + +/* Define to be the machine type (microprocessor class or machine model) */ +#undef MACHTYPE + +/* Define to be the name of the operating system */ +#undef OSTYPE + +/* Define to 1 if ANSI function prototypes are usable. */ +#undef PROTOTYPES + +/* Define to be location of utmp file. */ +#undef PATH_UTMP_FILE + +/* Define to be location of utmpx file. */ +#undef PATH_UTMPX_FILE + +/* Define to be location of wtmp file. */ +#undef PATH_WTMP_FILE + +/* Define to be location of wtmpx file. */ +#undef PATH_WTMPX_FILE + +/* Define to 1 if struct utmp is defined by a system header */ +#undef HAVE_STRUCT_UTMP + +/* Define to 1 if struct utmpx is defined by a system header */ +#undef HAVE_STRUCT_UTMPX + +/* Define if your system's struct utmp has a member named ut_host. */ +#undef HAVE_STRUCT_UTMP_UT_HOST + +/* Define if your system's struct utmpx has a member named ut_host. */ +#undef HAVE_STRUCT_UTMPX_UT_HOST + +/* Define if your system's struct utmpx has a member named ut_xtime. */ +#undef HAVE_STRUCT_UTMPX_UT_XTIME + +/* Define if your system's struct utmpx has a member named ut_tv. */ +#undef HAVE_STRUCT_UTMPX_UT_TV + +/* Define if your system's struct dirent has a member named d_ino. */ +#undef HAVE_STRUCT_DIRENT_D_INO + +/* Define if your system's struct dirent has a member named d_stat. */ +#undef HAVE_STRUCT_DIRENT_D_STAT + +/* Define if your system's struct direct has a member named d_ino. */ +#undef HAVE_STRUCT_DIRECT_D_INO + +/* Define if your system's struct direct has a member named d_stat. */ +#undef HAVE_STRUCT_DIRECT_D_STAT + +/* Define to be a string corresponding the vendor of the machine */ +#undef VENDOR + +/* Define if your system defines `struct winsize' in sys/ptem.h. */ +#undef WINSIZE_IN_PTEM + +/* Define to 1 if you want to debug zsh */ +#undef DEBUG + +/* Define to 1 if you want to use zsh's own memory allocation routines */ +#undef ZSH_MEM + +/* Define to 1 if you want to debug zsh memory allocation routines */ +#undef ZSH_MEM_DEBUG + +/* Define to 1 if you want to turn on warnings of memory allocation errors */ +#undef ZSH_MEM_WARNING + +/* Define to 1 if you want to turn on memory checking for free() */ +#undef ZSH_SECURE_FREE + +/* Define to 1 if you want to get debugging information on internal * + * hash tables. This turns on the `hashinfo' builtin. */ +#undef ZSH_HASH_DEBUG + +/* Define to 1 if your termcap library has the ospeed variable */ +#undef HAVE_OSPEED +/* Define to 1 if you have ospeed, but it is not defined in termcap.h */ +#undef MUST_DEFINE_OSPEED + +/* Define to 1 if tgetent() accepts NULL as a buffer */ +#undef TGETENT_ACCEPTS_NULL + +/* Define to 1 if you use POSIX style signal handling */ +#undef POSIX_SIGNALS + +/* Define to 1 if you use BSD style signal handling (and can block signals) */ +#undef BSD_SIGNALS + +/* Define to 1 if you use SYS style signal handling (and can block signals) */ +#undef SYSV_SIGNALS + +/* Define to 1 if you have no signal blocking at all (bummer) */ +#undef NO_SIGNAL_BLOCKING + +/* Define to `unsigned int' if or doesn't define */ +#undef sigset_t + +/* Define to 1 if struct timezone is defined by a system header */ +#undef HAVE_STRUCT_TIMEZONE + +/* Define if your system's typeahead disappears from the shell editor. */ +#undef CLOBBERS_TYPEAHEAD + +/* Define to 1 if there is a prototype defined for brk() on your system */ +#undef HAVE_BRK_PROTO + +/* Define to 1 if there is a prototype defined for sbrk() on your system */ +#undef HAVE_SBRK_PROTO + +/* Define to 1 if there is a prototype defined for ioctl() on your system */ +#undef HAVE_IOCTL_PROTO + +/* Define to 1 if system has working FIFO's */ +#undef HAVE_FIFOS + +/* Define to 1 if struct rlimit use quad_t */ +#undef RLIM_T_IS_QUAD_T + +/* Define to 1 if rlimit use unsigned */ +#undef RLIM_T_IS_UNSIGNED + +/* Define to the type used in struct rlimit */ +#undef rlim_t + +/* Define to 1 if /bin/sh does not interpret \ escape sequences */ +#undef SH_USE_BSD_ECHO + +/* Define to 1 if an underscore has to be prepended to dlsym() argument */ +#undef DLSYM_NEEDS_UNDERSCORE + +/* Define to 1 if multiple modules defining the same symbol are OK */ +#undef DYNAMIC_NAME_CLASH_OK + +/* The exension used for dynamically loaded modules */ +#undef DL_EXT + +/* Define to 1 if you want to use dynamically loaded modules */ +#undef DYNAMIC diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 000000000..672341b58 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,52 @@ +# Local additions to Autoconf macros. +# Copyright (C) 1992, 1994 Free Software Foundation, Inc. +# Francois Pinard , 1992. + +# @defmac fp_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and +# handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{fp_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +define(fp_PROG_CC_STDC, +[AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, +fp_cv_prog_cc_stdc, +[fp_cv_prog_cc_stdc=no +ac_save_CFLAGS="$CFLAGS" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc +do + CFLAGS="$ac_save_CFLAGS $ac_arg" + AC_TRY_COMPILE( +[#ifndef __STDC__ +choke me +#endif +], [int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);};], +[fp_cv_prog_cc_stdc="$ac_arg"; break]) +done +CFLAGS="$ac_save_CFLAGS" +]) +case "x$fp_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $fp_cv_prog_cc_stdc" ;; +esac +]) + +builtin(include, aczsh.m4) diff --git a/aczsh.m4 b/aczsh.m4 new file mode 100644 index 000000000..44dd81f27 --- /dev/null +++ b/aczsh.m4 @@ -0,0 +1,433 @@ +dnl +dnl Autconf tests for zsh. +dnl +dnl Copyright (c) 1995-1997 Richard Coleman +dnl All rights reserved. +dnl +dnl Permission is hereby granted, without written agreement and without +dnl license or royalty fees, to use, copy, modify, and distribute this +dnl software and to distribute modified versions of this software for any +dnl purpose, provided that the above copyright notice and the following +dnl two paragraphs appear in all copies of this software. +dnl +dnl In no event shall Richard Coleman or the Zsh Development Group be liable +dnl to any party for direct, indirect, special, incidental, or consequential +dnl damages arising out of the use of this software and its documentation, +dnl even if Richard Coleman and the Zsh Development Group have been advised of +dnl the possibility of such damage. +dnl +dnl Richard Coleman and the Zsh Development Group specifically disclaim any +dnl warranties, including, but not limited to, the implied warranties of +dnl merchantability and fitness for a particular purpose. The software +dnl provided hereunder is on an "as is" basis, and Richard Coleman and the +dnl Zsh Development Group have no obligation to provide maintenance, +dnl support, updates, enhancements, or modifications. +dnl + +dnl +dnl zsh_SYS_DYNAMIC_BROKEN +dnl Check whether static/shared library linking is broken. +dnl +dnl On some systems, static modifiable library symbols (such as environ) +dnl may appear only in statically linked libraries. If this is the case, +dnl then two shared libraries that reference the same symbol, each linked +dnl with the static library, could be given distinct copies of the symbol. +dnl If this is the case then dynamic linking is FUBAR. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_BROKEN, +[AC_CACHE_CHECK([if static/shared library linking is broken], +zsh_cv_sys_dynamic_broken, +[if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ +else + us= +fi +echo ' + extern char **environ; + void *symlist1[] = { + (void *)&environ, + (void *)0 + }; +' > conftest1.c +sed 's/symlist1/symlist2/' < conftest1.c > conftest2.c +if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && +$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && +$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && +$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle1, *handle2; + void **symlist1, **symlist2; + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle1) exit(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle2) exit(1); + symlist1 = (void **) dlsym(handle1, "${us}symlist1"); + symlist2 = (void **) dlsym(handle2, "${us}symlist2"); + if(!symlist1 || !symlist2) exit(1); + for(; *symlist1; symlist1++, symlist2++) + if(*symlist1 != *symlist2) + exit(1); + exit(0); +} +], [zsh_cv_sys_dynamic_broken=no], +[zsh_cv_sys_dynamic_broken=yes], +[zsh_cv_sys_dynamic_broken=yes] +) +else + zsh_cv_sys_dynamic_broken=yes +fi +]) +]) + +dnl +dnl zsh_SYS_DYNAMIC_CLASH +dnl Check whether symbol name clashes in shared libraries are acceptable. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_CLASH, +[AC_CACHE_CHECK([if name clashes in shared objects are OK], +zsh_cv_sys_dynamic_clash_ok, +[if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ +else + us= +fi +echo 'int fred () { return 42; }' > conftest1.c +echo 'int fred () { return 69; }' > conftest2.c +if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && +$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && +$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && +$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle1, *handle2; + int (*fred1)(), (*fred2)(); + handle1 = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle1) exit(1); + handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle2) exit(1); + fred1 = (int (*)()) dlsym(handle1, "${us}fred"); + fred2 = (int (*)()) dlsym(handle2, "${us}fred"); + if(!fred1 || !fred2) exit(1); + exit((*fred1)() != 42 || (*fred2)() != 69); +} +], [zsh_cv_sys_dynamic_clash_ok=yes], +[zsh_cv_sys_dynamic_clash_ok=no], +[zsh_cv_sys_dynamic_clash_ok=no] +) +else + zsh_cv_sys_dynamic_clash_ok=no +fi +]) +if test "$zsh_cv_sys_dynamic_clash_ok" = yes; then + AC_DEFINE(DYNAMIC_NAME_CLASH_OK) +fi +]) + +dnl +dnl zsh_SYS_DYNAMIC_GLOBAL +dnl Check whether symbols in one dynamically loaded library are +dnl available to another dynamically loaded library. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_GLOBAL, +[AC_CACHE_CHECK([for working RTLD_GLOBAL], +zsh_cv_sys_dynamic_rtld_global, +[if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ +else + us= +fi +echo 'int fred () { return 42; }' > conftest1.c +echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest2.c +if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && +$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5 && +$CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest2.c 1>&5 2>&5 && +$DLLD -o conftest2.$DL_EXT $LDFLAGS $DLLDFLAGS conftest2.o $LIBS 1>&5 2>&5; then + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle) exit(1); + handle = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle) exit(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); + if(!barneysym) exit(1); + exit((*barneysym)() != 69); +} +], [zsh_cv_sys_dynamic_rtld_global=yes], +[zsh_cv_sys_dynamic_rtld_global=no], +[zsh_cv_sys_dynamic_rtld_global=no] +) +else + zsh_cv_sys_dynamic_rtld_global=no +fi +]) +]) + +dnl +dnl zsh_SYS_DYNAMIC_EXECSYMS +dnl Check whether symbols in the executable are available to dynamically +dnl loaded libraries. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_EXECSYMS, +[AC_CACHE_CHECK([whether symbols in the executable are available], +zsh_cv_sys_dynamic_execsyms, +[if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ +else + us= +fi +echo 'extern int fred(); int barney () { return fred() + 27; }' > conftest1.c +if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && +$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5; then + save_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle) exit(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); + if(!barneysym) exit(1); + exit((*barneysym)() != 69); +} + +int fred () { return 42; } +], [zsh_cv_sys_dynamic_execsyms=yes], +[zsh_cv_sys_dynamic_execsyms=no], +[zsh_cv_sys_dynamic_execsyms=no] +) + LDFLAGS=$save_ldflags +else + zsh_cv_sys_dynamic_execsyms=no +fi +]) +]) + +dnl +dnl zsh_SYS_DYNAMIC_STRIP_EXE +dnl Check whether it is safe to strip executables. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_STRIP_EXE, +[AC_REQUIRE([zsh_SYS_DYNAMIC_EXECSYMS]) +AC_CACHE_CHECK([whether executables can be stripped], +zsh_cv_sys_dynamic_strip_exe, +[if test "$zsh_cv_sys_dynamic_execsyms" != yes; then + zsh_cv_sys_dynamic_strip_exe=yes +elif + if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ + else + us= + fi + echo 'extern int fred(); int barney() { return fred() + 27; }' > conftest1.c + $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && + $DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS conftest1.o $LIBS 1>&5 2>&5; then + save_ldflags=$LDFLAGS + LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS -s" + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle; + int (*barneysym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle) exit(1); + barneysym = (int (*)()) dlsym(handle, "${us}barney"); + if(!barneysym) exit(1); + exit((*barneysym)() != 69); +} + +int fred () { return 42; } +], [zsh_cv_sys_dynamic_strip_exe=yes], +[zsh_cv_sys_dynamic_strip_exe=no], +[zsh_cv_sys_dynamic_strip_exe=no] +) + LDFLAGS=$save_ldflags +else + zsh_cv_sys_dynamic_strip_exe=no +fi +]) +]) + +dnl +dnl zsh_SYS_DYNAMIC_STRIP_EXE +dnl Check whether it is safe to strip dynamically loaded libraries. +dnl + +AC_DEFUN(zsh_SYS_DYNAMIC_STRIP_LIB, +[AC_CACHE_CHECK([whether libraries can be stripped], +zsh_cv_sys_dynamic_strip_lib, +[if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + us=_ +else + us= +fi +echo 'int fred () { return 42; }' > conftest1.c +if $CC -c $CFLAGS $CPPFLAGS $DLCFLAGS conftest1.c 1>&5 2>&5 && +$DLLD -o conftest1.$DL_EXT $LDFLAGS $DLLDFLAGS -s conftest1.o $LIBS 1>&5 2>&5; then + AC_TRY_RUN([ +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif + +main() +{ + void *handle; + int (*fredsym)(); + handle = dlopen("./conftest1.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL); + if(!handle) exit(1); + fredsym = (int (*)()) dlsym(handle, "${us}fred"); + if(!fredsym) exit(1); + exit((*fredsym)() != 42); +} +], [zsh_cv_sys_dynamic_strip_lib=yes], +[zsh_cv_sys_dynamic_strip_lib=no], +[zsh_cv_sys_dynamic_strip_lib=no] +) +else + zsh_cv_sys_dynamic_strip_lib=no +fi +]) +]) + +dnl +dnl zsh_PATH_UTMP(filename) +dnl Search for a specified utmp-type file. +dnl + +AC_DEFUN(zsh_PATH_UTMP, +[AC_CACHE_CHECK([for $1 file], [zsh_cv_path_$1], +[for dir in /etc /usr/etc /var/adm /usr/adm /var/run ./conftest; do + zsh_cv_path_$1=${dir}/$1 + test -f $zsh_cv_path_$1 && break + zsh_cv_path_$1=no +done +]) +if test $zsh_cv_path_$1 != no; then + AC_DEFINE_UNQUOTED(PATH_[]translit($1, [a-z], [A-Z])[]_FILE, "$zsh_cv_path_$1") +fi +]) + +dnl +dnl zsh_TYPE_EXISTS(#includes, type name) +dnl Check whether a specified type exists. +dnl + +AC_DEFUN(zsh_TYPE_EXISTS, +[AC_CACHE_CHECK([for $2], [zsh_cv_type_exists_[]translit($2, [ ], [_])], +[AC_TRY_COMPILE([$1], [$2 testvar;], +[zsh_cv_type_exists_[]translit($2, [ ], [_])=yes], +[zsh_cv_type_exists_[]translit($2, [ ], [_])=no]) +]) +if test $zsh_cv_type_exists_[]translit($2, [ ], [_]) = yes; then + AC_DEFINE(HAVE_[]translit($2, [ a-z], [_A-Z])) +fi +]) + +dnl +dnl zsh_STRUCT_MEMBER(#includes, type name, member name) +dnl Check whether a specified aggregate type exists and contains +dnl a specified member. +dnl + +AC_DEFUN(zsh_STRUCT_MEMBER, +[AC_CACHE_CHECK([for $3 in $2], [zsh_cv_struct_member_[]translit($2, [ ], [_])_$3], +[AC_TRY_COMPILE([$1], [$2 testvar; testvar.$3;], +[zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=yes], +[zsh_cv_struct_member_[]translit($2, [ ], [_])_$3=no]) +]) +if test $zsh_cv_struct_member_[]translit($2, [ ], [_])_$3 = yes; then + AC_DEFINE(HAVE_[]translit($2_$3, [ a-z], [_A-Z])) +fi +]) diff --git a/config.guess b/config.guess new file mode 100755 index 000000000..92b77bc52 --- /dev/null +++ b/config.guess @@ -0,0 +1,698 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-cbm-openbsd${UNAME_RELEASE} + exit 0 ;; + sa110:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-unknown-linux + exit 0;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-atari-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-sun-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-apple-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp3[0-9][05]:OpenBSD:*:*) + echo m68k-hp-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo i386-pc-cygwin32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin32 + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then + echo "${UNAME_MACHINE}-pc-linux" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32arm"; then + echo "arm-unknown-linux" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then + echo "${UNAME_MACHINE}-pc-linuxaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then + echo "${UNAME_MACHINE}-pc-linuxcoff" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then + echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then + echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0 + elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then + echo "powerpc-unknown-linux" ; exit 0 + elif test "${UNAME_MACHINE}" = "alpha" ; then + echo alpha-unknown-linux ; exit 0 + elif test "${UNAME_MACHINE}" = "sparc" ; then + echo sparc-unknown-linux ; exit 0 + else + # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us + # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout. + test ! -d /usr/lib/ldscripts/. \ + && echo "${UNAME_MACHINE}-pc-linuxoldld" && exit 0 + # Determine whether the default compiler is a.out or elf + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.sub b/config.sub new file mode 100755 index 000000000..c5aecfe37 --- /dev/null +++ b/config.sub @@ -0,0 +1,924 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \ + | arme[lb] | pyramid \ + | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | i370 | sh \ + | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel \ + | sparc | sparclet | sparclite | sparc64) + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[3456]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigados) + basic_machine=m68k-cbm + os=-amigados + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[3456]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[3456]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[3456]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[3456]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5) + basic_machine=i586-intel + ;; + pentiumpro | p6) + basic_machine=i686-intel + ;; + pentium-* | p5-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + k5) + # We don't have specific support for AMD's K5 yet, so just call it a Pentium + basic_machine=i586-amd + ;; + nexen) + # We don't have specific support for Nexgen yet, so just call it a Pentium + basic_machine=i586-nexgen + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + basic_machine=mips-mips + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -unixware* | svr4*) + os=-sysv4 + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux* | -uxpv*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigados + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/configure.in b/configure.in new file mode 100644 index 000000000..aa3170732 --- /dev/null +++ b/configure.in @@ -0,0 +1,1113 @@ +dnl +dnl configure.in: Configure template for zsh. +dnl Process this file with autoconf to produce a configure script. +dnl +dnl Copyright (c) 1995-1997 Richard Coleman +dnl All rights reserved. +dnl +dnl Permission is hereby granted, without written agreement and without +dnl license or royalty fees, to use, copy, modify, and distribute this +dnl software and to distribute modified versions of this software for any +dnl purpose, provided that the above copyright notice and the following +dnl two paragraphs appear in all copies of this software. +dnl +dnl In no event shall Richard Coleman or the Zsh Development Group be liable +dnl to any party for direct, indirect, special, incidental, or consequential +dnl damages arising out of the use of this software and its documentation, +dnl even if Richard Coleman and the Zsh Development Group have been advised of +dnl the possibility of such damage. +dnl +dnl Richard Coleman and the Zsh Development Group specifically disclaim any +dnl warranties, including, but not limited to, the implied warranties of +dnl merchantability and fitness for a particular purpose. The software +dnl provided hereunder is on an "as is" basis, and Richard Coleman and the +dnl Zsh Development Group have no obligation to provide maintenance, +dnl support, updates, enhancements, or modifications. +dnl + +AC_INIT(Src/zsh.h) +AC_CONFIG_HEADER(config.h) + +dnl What version of zsh are we building ? +. ${srcdir}/Config/version.mk +echo "configuring for zsh $VERSION" + +dnl ---------------------------------------------- +dnl CHECK FOR MACHINE/VENDOR/OPERATING SYSTEM TYPE +dnl ---------------------------------------------- +dnl Find out machine type, vendor, and operating system +dnl What type of host is this? +AC_CANONICAL_HOST +AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu") +AC_DEFINE_UNQUOTED(VENDOR, "$host_vendor") +AC_DEFINE_UNQUOTED(OSTYPE, "$host_os") + +dnl ----------------------------- +dnl CHECKING COMMAND LINE OPTIONS +dnl ----------------------------- +dnl Do you want to debug zsh? +undefine([zsh-debug])dnl +AC_ARG_ENABLE(zsh-debug, +[ --enable-zsh-debug use it if you want to debug zsh], +[if test x$enableval = xyes; then + AC_DEFINE(DEBUG) +fi]) + +dnl Do you want zsh memory allocation routines. +undefine([zsh-mem])dnl +AC_ARG_ENABLE(zsh-mem, +[ --enable-zsh-mem use zsh memory allocation routines], +[if test x$enableval = xyes; then + AC_DEFINE(ZSH_MEM) +fi]) + +dnl Do you want to debug zsh memory allocation routines. +undefine([zsh-mem-debug])dnl +AC_ARG_ENABLE(zsh-mem-debug, +[ --enable-zsh-mem-debug debug zsh memory allocation routines], +[if test x$enableval = xyes; then + AC_DEFINE(ZSH_MEM_DEBUG) +fi]) + +dnl Do you want to print warnings when errors in memory allocation. +undefine([zsh-mem-warning])dnl +AC_ARG_ENABLE(zsh-mem-warning, +[ --enable-zsh-mem-warning print warnings when error in memory allocation], +[if test x$enableval = xyes; then + AC_DEFINE(ZSH_MEM_WARNING) +fi]) + +dnl Do you want to turn on error checking for free(). +undefine([zsh-secure-free])dnl +AC_ARG_ENABLE(zsh-secure-free, +[ --enable-zsh-secure-free turn on error checking for free()], +[if test x$enableval = xyes; then + AC_DEFINE(ZSH_SECURE_FREE) +fi]) + +dnl Do you want debugging information on internal hash tables. +dnl This turns on the `hashinfo' builtin command. +undefine([zsh-hash-debug])dnl +AC_ARG_ENABLE(zsh-hash-debug, +[ --enable-zsh-hash-debug turn on debugging of internal hash tables], +[if test x$enableval = xyes; then + AC_DEFINE(ZSH_HASH_DEBUG) +fi]) + +dnl Pathnames for global zsh scripts +undefine([zshenv])dnl +AC_ARG_ENABLE(etcdir, +[ --enable-etcdir=directory default directory for global zsh scripts], +[etcdir="$enableval"], [etcdir=/etc]) + +undefine([zshenv])dnl +AC_ARG_ENABLE(zshenv, +[ --enable-zshenv=pathname the full pathname of the global zshenv script], +[zshenv="$enableval"], +[if test "x$etcdir" = xno; then + zshenv=no +else + zshenv="$etcdir/zshenv" +fi]) +if test "x$zshenv" != xno; then + AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv") +fi + +undefine([zshrc])dnl +AC_ARG_ENABLE(zshrc, +[ --enable-zshrc=pathname the full pathname of the global zshrc script], +[zshrc="$enableval"], +[if test "x$etcdir" = xno; then + zshrc=no +else + zshrc="$etcdir/zshrc" +fi]) +if test "x$zshrc" != xno; then + AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc") +fi + +undefine([zprofile])dnl +AC_ARG_ENABLE(zprofile, +[ --enable-zprofile=pathname the full pathname of the global zprofile script], +[zprofile="$enableval"], +[if test "x$etcdir" = xno; then + zprofile=no +else + zprofile="$etcdir/zprofile" +fi]) +if test "x$zprofile" != xno; then + AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile") +fi + +undefine([zlogin])dnl +AC_ARG_ENABLE(zlogin, +[ --enable-zlogin=pathname the full pathname of the global zlogin script], +[zlogin="$enableval"], +[if test "x$etcdir" = xno; then + zlogin=no +else + zlogin="$etcdir/zlogin" +fi]) +if test "x$zlogin" != xno; then + AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin") +fi + +undefine([zlogout])dnl +AC_ARG_ENABLE(zlogout, +[ --enable-zlogout=pathname the full pathname of the global zlogout script], +[zlogout="$enableval"], +[if test "x$etcdir" = xno; then + zlogout=no +else + zlogout="$etcdir/zlogout" +fi]) +if test "x$zlogout" != xno; then + AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout") +fi + +AC_SUBST(zshenv)dnl +AC_SUBST(zshrc)dnl +AC_SUBST(zprofile)dnl +AC_SUBST(zlogin)dnl +AC_SUBST(zlogout)dnl + +dnl Do you want dynamically loaded binary modules. +undefine([dynamic])dnl +AC_ARG_ENABLE(dynamic, +[ --enable-dynamic allow dynamically loaded binary modules], +[dynamic="$enableval"], [dynamic=no]) + +dnl Do you want to compile as K&R C. +AC_ARG_ENABLE(ansi2knr, +[ --enable-ansi2knr translate source to K&R C before compiling], +[ansi2knr="$enableval"], [ansi2knr=default]) + +dnl ------------------ +dnl CHECK THE COMPILER +dnl ------------------ +dnl We want these before the checks, so the checks can modify their values. +test -z "${CFLAGS+set}" && CFLAGS= auto_cflags=1 +test -z "${LDFLAGS+set}" && LDFLAGS= auto_ldflags=1 + +AC_PROG_CC + +dnl if the user hasn't specified CFLAGS, then +dnl if compiler is gcc, then use -O2 and some warning flags +dnl else use -O +if test -n "$auto_cflags"; then + if test "${enable_zsh_debug}" = yes; then + if test -n "$GCC"; then + CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -pedantic -ggdb" + else + CFLAGS="$CFLAGS -g" + fi + else + if test -n "$GCC"; then + CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -O2" + else + CFLAGS="$CFLAGS -O" + fi + fi +fi +if test -n "$auto_ldflags"; then + if test "${enable_zsh_debug}" = yes; then + LDFLAGS=-g + else + LDFLAGS=-s + fi +fi + +dnl ---------- +dnl SCO KLUDGE +dnl ---------- +dnl Sco doesn't define any useful compiler symbol, +dnl so we will check for sco and define __sco if +dnl found. +case "$host_os" in + sco*) CFLAGS="-D__sco $CFLAGS" ;; +esac + +sed=':1 + s/ -s / /g + t1 + s/^ *// + s/ *$//' + +case " $LDFLAGS " in + *" -s "*) strip_exeldflags=true strip_libldflags=true + LDFLAGS=`echo " $LDFLAGS " | sed "$sed"` ;; + *) strip_exeldflags=false strip_libldflags=false ;; +esac + +case " ${EXELDFLAGS+$EXELDFLAGS }" in + " ") ;; + *" -s "*) strip_exeldflags=true + EXELDFLAGS=`echo " $EXELDFLAGS " | sed "$sed"` ;; + *) strip_exeldflags=false ;; +esac + +case " ${LIBLDFLAGS+$LIBLDFLAGS }" in + " ") ;; + *" -s "*) strip_libldflags=true + LIBLDFLAGS=`echo " $LIBLDFLAGS " | sed "$sed"` ;; + *) strip_libldflags=false ;; +esac + +AC_SUBST(CFLAGS)dnl +AC_SUBST(LDFLAGS)dnl +AC_SUBST(EXELDFLAGS)dnl +AC_SUBST(LIBLDFLAGS)dnl + +AC_PROG_CPP dnl Figure out how to run C preprocessor. +AC_PROG_GCC_TRADITIONAL dnl Do we need -traditional flag for gcc. +AC_C_CONST dnl Does compiler support `const'. + +fp_PROG_CC_STDC +AC_MSG_CHECKING([whether to use prototypes]) +if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then + msg="(overridden) " +else + msg= + if test ."$fp_cv_prog_cc_stdc" = .no; then + ansi2knr=yes + else + ansi2knr=no + fi +fi +if test "$ansi2knr" = yes; then + AC_MSG_RESULT(${msg}no) + U=_ +else + AC_MSG_RESULT(${msg}yes) + AC_DEFINE(PROTOTYPES) + U= +fi +AC_SUBST(U) + +AC_FUNC_ALLOCA dnl Check how to get `alloca'. + +dnl If the compiler supports union initialisation +AC_CACHE_CHECK(if the compiler supports union initialisation, +zsh_cv_c_have_union_init, +[AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;], + zsh_cv_c_have_union_init=yes, + zsh_cv_c_have_union_init=no)]) +if test $zsh_cv_c_have_union_init = yes; then + AC_DEFINE(HAVE_UNION_INIT) +fi + +dnl Checking if compiler correctly cast signed to unsigned. +AC_CACHE_CHECK(if signed to unsigned casting is broken, +zsh_cv_c_broken_signed_to_unsigned_casting, +[AC_TRY_RUN([main(){return((int)(unsigned char)((char) -1) == 255);}], + zsh_cv_c_broken_signed_to_unsigned_casting=yes, + zsh_cv_c_broken_signed_to_unsigned_casting=no, + zsh_cv_c_broken_signed_to_unsigned_casting=no)]) +if test $zsh_cv_c_broken_signed_to_unsigned_casting = yes; then + AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING) +fi + +dnl Checking if the compiler supports variable-length arrays +AC_CACHE_CHECK(if the compiler supports variable-lenth arrays, +zsh_cv_c_variable_length_arrays, +[AC_TRY_COMPILE([int foo();], [int i[foo()];], + zsh_cv_c_variable_length_arrays=yes, + zsh_cv_c_variable_length_arrays=no)]) +if test $zsh_cv_c_variable_length_arrays = yes; then + AC_DEFINE(HAVE_VARIABLE_LENGTH_ARRAYS) +fi + +dnl ------------------ +dnl CHECK FOR PROGRAMS +dnl ------------------ +AC_PROG_MAKE_SET dnl Does make define $MAKE +AC_PROG_INSTALL dnl Check for BSD compatible `install' +AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk. +AC_CHECK_PROGS([YODL], [yodl], [:]) + +dnl ------------------ +dnl CHECK HEADER FILES +dnl ------------------ +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_HEADER_TIME +AC_HEADER_STAT +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \ + termios.h sys/param.h sys/filio.h string.h memory.h \ + limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \ + locale.h errno.h stdlib.h unistd.h sys/capability.h \ + utmp.h utmpx.h sys/types.h pwd.h grp.h) +if test $dynamic = yes; then + AC_CHECK_HEADERS(dlfcn.h) +fi + +dnl Some SCO systems cannot include both sys/time.h and sys/select.h +if test $ac_cv_header_sys_time_h = yes -a $ac_cv_header_sys_select_h = yes; then + AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h, + zsh_cv_header_time_h_select_h_conflicts, + [AC_TRY_COMPILE([#include +#include ], [int i;], + zsh_cv_header_time_h_select_h_conflicts=no, + zsh_cv_header_time_h_select_h_conflicts=yes)]) + if test $zsh_cv_header_time_h_select_h_conflicts = yes; then + AC_DEFINE(TIME_H_SELECT_H_CONFLICTS) + fi +fi + +AC_CACHE_CHECK(POSIX termios, zsh_cv_sys_posix_termios, +[AC_TRY_LINK([#include +#include +#include ], +[/* SunOS 4.0.3 has termios.h but not the library calls. */ +tcgetattr(0, 0);], + zsh_cv_sys_posix_termios=yes, zsh_cv_sys_posix_termios=no)]) + +if test $zsh_cv_sys_posix_termios = yes; then + AC_CACHE_CHECK(TIOCGWINSZ in termios.h, + zsh_cv_header_termios_h_tiocgwinsz, + [AC_TRY_LINK([#include +#include ], + [int x = TIOCGWINSZ;], + zsh_cv_header_termios_h_tiocgwinsz=yes, + zsh_cv_header_termios_h_tiocgwinsz=no)]) +else + zsh_cv_header_termios_h_tiocgwinsz=no +fi + +if test $zsh_cv_header_termios_h_tiocgwinsz = no; then + AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h, + zsh_cv_header_sys_ioctl_h_tiocgwinsz, + [AC_TRY_LINK([#include +#include ], + [int x = TIOCGWINSZ;], + zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes, + zsh_cv_header_sys_ioctl_h_tiocgwinsz=no)]) + if test $zsh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then + AC_DEFINE(GWINSZ_IN_SYS_IOCTL) + fi +fi + +AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM)) + +dnl ------------------- +dnl CHECK FOR LIBRARIES +dnl ------------------- + +dnl On some systems, modules need to be linked against libc explicitly, +dnl in case they require objects that exist only in the static version +dnl and might not be compiled into the zsh executable. +AC_CHECK_LIB(c, printf) + +dnl Prefer BSD termcap library to SysV curses library, except on certain +dnl versions of AIX and HP-UX. +if test `echo $host_os | sed 's/^.*\(aix\)[[1-9]]\.[[0-9]].*$/\1/'` = aix || + test `echo $host_os | sed 's/^.*\(hpux\)10\..*$/\1/'` = hpux; then + termcap_curses_order="curses ncurses termcap" +else + termcap_curses_order="termcap curses ncurses" +fi + +for lib in $termcap_curses_order; do + AC_CHECK_LIB(${lib}, tgetent, [LIBS="-l$lib $LIBS"; break]) +done + +dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require +dnl libnsl (Network Services Library) to find yp_all +AC_CHECK_FUNCS(yp_all) +if test $ac_cv_func_yp_all = no; then + AC_CHECK_LIB(nsl, yp_all) +fi + +dnl I am told that told that unicos reqire these for nis_list +if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then + LIBS="-lcraylm -lkrb -lnisdb -lnsl -lrpcsvc $LIBS" +fi + +if test "x$dynamic" = xyes; then + AC_CHECK_LIB(dl, dlopen) +fi + +AC_CHECK_LIB(cap, cap_get_proc) + +dnl --------------------- +dnl CHECK TERMCAP LIBRARY +dnl --------------------- +dnl Checks for external variable ospeed in the termcap library. +AC_CACHE_CHECK(if an include file defines ospeed, +zsh_cv_decl_ospeed_include_defines, +[AC_TRY_LINK( +[#include +#if HAVE_TERMIOS_H +#include +#endif +#if HAVE_TERMCAP_H +#include +#endif], [ospeed = 0;], +zsh_cv_decl_ospeed_include_defines=yes, +zsh_cv_decl_ospeed_include_defines=no)]) + +if test $zsh_cv_decl_ospeed_include_defines = no; then + AC_CACHE_CHECK(if you must define ospeed, + zsh_cv_decl_ospeed_must_define, + [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;], + zsh_cv_decl_ospeed_must_define=yes, + zsh_cv_decl_ospeed_must_define=no)]) +fi + +if test $zsh_cv_decl_ospeed_include_defines = yes; then + AC_DEFINE(HAVE_OSPEED) +elif test $zsh_cv_decl_ospeed_must_define = yes; then + AC_DEFINE(HAVE_OSPEED) + AC_DEFINE(MUST_DEFINE_OSPEED) +fi + +dnl Check if tgetent accepts NULL (and will allocate its own termcap buffer) +AC_CACHE_CHECK(if tgetent accepts NULL, +zsh_cv_func_tgetent_accepts_null, +[AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}], + zsh_cv_func_tgetent_accepts_null=yes, + zsh_cv_func_tgetent_accepts_null=no, + zsh_cv_func_tgetent_accepts_null=no)]) +if test $zsh_cv_func_tgetent_accepts_null = yes; then + AC_DEFINE(TGETENT_ACCEPTS_NULL) +fi + +dnl -------------- +dnl CHECK TYPEDEFS +dnl -------------- + +AC_TYPE_SIGNAL +AC_TYPE_PID_T +AC_TYPE_OFF_T +AC_TYPE_MODE_T +AC_TYPE_UID_T +AC_TYPE_SIZE_T + +dnl Check for sigset_t. Currently I'm looking in +dnl and . Others might need +dnl to be added. +AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t, +[AC_TRY_COMPILE( +[#include +#include ], [sigset_t tempsigset;], + zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)]) +if test $zsh_cv_type_sigset_t = no; then + AC_DEFINE(sigset_t, unsigned int) +fi + +dnl Check for struct timezone since some old SCO versions do not define it +zsh_TYPE_EXISTS([ +#ifdef HAVE_SYS_TIME_H +# include +#endif +], struct timezone) + +dnl Check for utmp structures, for watch +zsh_TYPE_EXISTS([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMP_H +# include +#endif +], struct utmp) +zsh_TYPE_EXISTS([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMPX_H +# include +#endif +], struct utmpx) + +dnl Check contents of utmp structures +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMP_H +# include +#endif +], struct utmp, ut_host) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMPX_H +# include +#endif +], struct utmpx, ut_host) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMPX_H +# include +#endif +], struct utmpx, ut_xtime) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_UTMPX_H +# include +#endif +], struct utmpx, ut_tv) + +dnl Check for inode numbers in directory entry structures +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_DIRENT_H +# include +#endif +], struct dirent, d_ino) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_DIRENT_H +# include +#endif +], struct dirent, d_stat) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_NDIR_H +# include +#endif +#ifdef HAVE_SYS_DIR_H +# include +#endif +#ifdef HAVE_NDIR_H +# include +#endif +], struct direct, d_ino) +zsh_STRUCT_MEMBER([ +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_NDIR_H +# include +#endif +#ifdef HAVE_SYS_DIR_H +# include +#endif +#ifdef HAVE_NDIR_H +# include +#endif +], struct direct, d_stat) + +dnl --------------- +dnl CHECK FUNCTIONS +dnl --------------- +AC_FUNC_GETPGRP +AC_FUNC_STRCOLL + +dnl need to integrate this function +dnl AC_FUNC_STRFTIME + +AC_CHECK_FUNCS(memcpy memmove \ + strftime waitpid select tcsetpgrp tcgetattr strstr lstat \ + getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \ + sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \ + sigprocmask setuid seteuid setreuid setresuid setsid strerror \ + nis_list initgroups fchdir cap_get_proc readlink nice \ + getgrgid getgrnam getpwent getpwnam getpwuid) +if test $dynamic = yes; then + AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose) +fi + + +dnl ------------- +dnl CHECK SIGNALS +dnl ------------- +dnl What style of signal do you have (POSIX, BSD, or SYSV)? +AC_MSG_CHECKING(what style of signals to use) +if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then + signals_style=POSIX_SIGNALS + AC_DEFINE(POSIX_SIGNALS) +elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then + signals_style=BSD_SIGNALS + AC_DEFINE(BSD_SIGNALS) +elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then + signals_style=SYSV_SIGNALS + AC_DEFINE(SYSV_SIGNALS) +else + signals_style=NO_SIGNAL_BLOCKING + AC_DEFINE(NO_SIGNAL_BLOCKING) +fi +AC_DEFINE_UNQUOTED($signals_style) +AC_MSG_RESULT($signals_style) + +dnl Where is located? Needed as input for signals.awk +AC_CACHE_CHECK(where signal.h is located, zsh_cv_path_signal_h, +[for SIGNAL_H in /usr/include/bsd/sys/signal.h dnl Next + /usr/include/asm/signum.h dnl alpha-Linux + /usr/include/asm/signal.h dnl Linux 1.3.0 and above + /usr/include/linux/signal.h dnl Linux up to 1.2.11 + /usr/include/sys/signal.h dnl Almost everybody else + /dev/null; dnl Just in case we fall through +do + test -f $SIGNAL_H && \ + grep '#[ ]*define[ ][ ]*SIG[0-9A-Z]*[ ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \ + break +done +zsh_cv_path_signal_h=$SIGNAL_H +]) +SIGNAL_H=$zsh_cv_path_signal_h +AC_SUBST(SIGNAL_H)dnl + +dnl ----------------------------------------------------- +dnl Look for the file containing the RLIMIT_* definitions +dnl ----------------------------------------------------- +dnl CALL FOR MORE (FEWER?) LOCATIONS: I've just copied the signal checking. +AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h, +[for RESOURCE_H in /usr/include/bsd/sys/resource.h dnl + /usr/include/asm/resource.h dnl + /usr/include/linux/resource.h dnl + /usr/include/sys/resource.h dnl + /usr/include/resourcebits.h dnl + /dev/null; +do + test -f $RESOURCE_H && \ + grep '#[ ]*define[ ][ ]*RLIMIT_[A-Z]*[ ]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \ + break +done +zsh_cv_path_rlimit_h=$RESOURCE_H +if test $RESOURCE_H = "/dev/null" -a $ac_cv_func_getrlimit = yes; then + echo "RLIMIT MACROS NOT FOUND: please report to developers" +fi]) +RLIMITS_INC_H=$zsh_cv_path_rlimit_h +dnl rlimits.h only appears in dependencies if we are actually using it. +dnl We are using it any time we have getrlimit, though if the macros were +dnl not found we simply awk through /dev/null and fail to find them. +dnl Thus, limit won't work, but at least the shell will compile. +AC_SUBST(RLIMITS_INC_H)dnl + +dnl ------------------ +dnl rlimit type checks +dnl ------------------ +DEFAULT_RLIM_T=long +AC_CACHE_CHECK(if rlim_t is quad_t, +zsh_cv_rlim_t_is_quad_t, +[AC_TRY_RUN([ +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}], +zsh_cv_rlim_t_is_quad_t=yes, +zsh_cv_rlim_t_is_quad_t=no, +zsh_cv_rlim_t_is_quad_t=yes)]) +if test $zsh_cv_rlim_t_is_quad_t = yes; then + AC_DEFINE(RLIM_T_IS_QUAD_T) + DEFAULT_RLIM_T=quad_t +else + AC_CACHE_CHECK(if the rlim_t is unsigned, + zsh_cv_type_rlim_t_is_unsigned, + [AC_TRY_RUN([ +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include + main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}], + zsh_cv_type_rlim_t_is_unsigned=yes, + zsh_cv_type_rlim_t_is_unsigned=no, + zsh_cv_type_rlim_t_is_unsigned=no)]) + if test $zsh_cv_type_rlim_t_is_unsigned = yes; then + AC_DEFINE(RLIM_T_IS_UNSIGNED) + DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T" + fi +fi + +AC_CACHE_CHECK(for rlim_t, zsh_cv_type_rlim_t, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include ], +[rlim_t l;], +zsh_cv_type_rlim_t=yes, +zsh_cv_type_rlim_t=no)]) +if test $zsh_cv_type_rlim_t = no; then + AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T) +fi + +dnl ---------------------------- +dnl CHECK FOR /dev/fd FILESYSTEM +dnl ---------------------------- +AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd, +[for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do + test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break + done]) +if test $zsh_cv_sys_path_dev_fd != no; then + AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd") +fi + +dnl --------------------------------- +dnl CHECK FOR RFS SUPERROOT DIRECTORY +dnl --------------------------------- +AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot, +[test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no]) +if test $zsh_cv_sys_superroot = yes; then + AC_DEFINE(HAVE_SUPERROOT) +fi + +dnl ------------- +dnl CHECK FOR NIS +dnl ------------- +AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis, +[test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \ +zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no]) +if test $zsh_cv_sys_nis = yes; then + AC_DEFINE(HAVE_NIS) +fi + +dnl ----------------- +dnl CHECK FOR NISPLUS +dnl ----------------- +AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus, +[test $ac_cv_func_nis_list = yes && test -f /usr/bin/nisls && \ + /usr/bin/nisls > /dev/null 2>&1 && \ +zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no]) +if test $zsh_cv_sys_nis_plus = yes; then + AC_DEFINE(HAVE_NIS_PLUS) +fi + +dnl ---------------------------------------- +dnl CHECK FOR LOCATION OF {U,W}TMP{,X} FILES +dnl ---------------------------------------- +zsh_PATH_UTMP(utmp) +zsh_PATH_UTMP(wtmp) +zsh_PATH_UTMP(utmpx) +zsh_PATH_UTMP(wtmpx) + +dnl ---------------- +dnl TYPEAHEAD KLUDGE +dnl ---------------- +dnl Some systems clobber typeahead when you go from canonical input +dnl processing to non-canonical, so we need a FIONREAD ioctl. +dnl I don't know how to check this with configure, so I am using the +dnl system names directly. +dnl The doubled square brackets are necessary because autoconf uses m4. +AC_CACHE_CHECK(if typeahead needs FIONREAD, zsh_cv_sys_clobbers_typeahead, +[case x-$host_vendor-$host_os in + x-*-ultrix* | x-*-dgux* | x-sni-sysv4*) + zsh_cv_sys_clobbers_typeahead=yes;; + *) + zsh_cv_sys_clobbers_typeahead=no;; +esac]) +if test $zsh_cv_sys_clobbers_typeahead = yes; then + AC_DEFINE(CLOBBERS_TYPEAHEAD) +fi + +dnl ------------------- +dnl brk/sbrk PROTOTYPES +dnl ------------------- +AC_CACHE_CHECK(for brk() prototype in , +zsh_cv_header_unistd_h_brk_proto, +[AC_TRY_COMPILE([#include +double brk();], [int i;], +zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)]) +if test $zsh_cv_header_unistd_h_brk_proto = yes; then + AC_DEFINE(HAVE_BRK_PROTO) +fi + +AC_CACHE_CHECK(for sbrk() prototype in , +zsh_cv_header_unistd_h_sbrk_proto, +[AC_TRY_COMPILE([#include +double sbrk();], [int i;], +zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)]) +if test $zsh_cv_header_unistd_h_sbrk_proto = yes; then + AC_DEFINE(HAVE_SBRK_PROTO) +fi + +dnl ------------------------ +dnl ioctl prototypes for OSF +dnl ------------------------ + +if test "$ac_cv_prog_cc_stdc" != no; then + AC_CACHE_CHECK(for ioctl prototype in , + zsh_cv_header_sys_ioctl_h_ioctl_proto, + [AC_TRY_COMPILE([#include + int ioctl(double x);], [int i;], + zsh_cv_header_sys_ioctl_h_ioctl_proto=no, + zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)]) + if test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then + AC_DEFINE(HAVE_IOCTL_PROTO) + fi +fi + +dnl ----------- +dnl named FIFOs +dnl ----------- +AC_CACHE_CHECK(if named FIFOs work, +zsh_cv_sys_fifo, +[AC_TRY_RUN([ +#include +#include +main() +{ + char c; + int fd; + int pid, ret; + unlink("/tmp/fifo$$"); +#ifdef HAVE_MKFIFO + if(mkfifo("/tmp/fifo$$", 0600) < 0) +#else + if(mknod("/tmp/fifo$$", 0010600, 0) < 0) +#endif + exit(1); + pid = fork(); + if(pid < 0) + exit(1); + if(pid) { + fd = open("/tmp/fifo$$", O_RDONLY); + exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x'); + } + fd = open("/tmp/fifo$$", O_WRONLY); + ret = (fd < 0 || write(fd, "x", 1) < 1); + unlink("/tmp/fifo$$"); + exit(ret); +} +], + zsh_cv_sys_fifo=yes, + zsh_cv_sys_fifo=no, + zsh_cv_sys_fifo=yes)]) +if test $zsh_cv_sys_fifo = yes; then + AC_DEFINE(HAVE_FIFOS) +fi +dnl --------------------- +dnl echo style of /bin/sh +dnl --------------------- +AC_CACHE_CHECK(if echo in /bin/sh interprets escape sequences, +zsh_cv_prog_sh_echo_escape, +[if test "`/bin/sh -c \"echo '\\n'\"`" = "\\n"; then + zsh_cv_prog_sh_echo_escape=no +else + zsh_cv_prog_sh_echo_escape=yes +fi]) +if test $zsh_cv_prog_sh_echo_escape = no; then + AC_DEFINE(SH_USE_BSD_ECHO) +fi + +dnl --------------- +dnl dynamic loading +dnl --------------- +L=N +if test "$ac_cv_func_dlopen" != yes; then + dynamic=no +elif test "$ac_cv_func_dlsym" != yes; then + dynamic=no +elif test "$ac_cv_func_dlerror" != yes; then + dynamic=no +fi +if test "x$dynamic" = xyes; then + AC_CACHE_CHECK(if your system use ELF binaries, + zsh_cv_sys_elf, + [AC_TRY_RUN([/* Test for whether ELF binaries are produced */ +#include +#include +main(argc, argv) +int argc; +char *argv[]; +{ + char b[4]; + int i = open(argv[0],O_RDONLY); + if(i == -1) + exit(1); /* fail */ + if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') + exit(0); /* succeed (yes, it's ELF) */ + else + exit(1); /* fail */ +}], + zsh_cv_sys_elf=yes, + zsh_cv_sys_elf=no, + zsh_cv_sys_elf=yes)]) + DL_EXT="${DL_EXT=so}" + if test $zsh_cv_sys_elf = yes; then + DLLD="${DLLD=$CC}" + else + DLLD="${DLLD=ld}" + fi + if test -n "$GCC"; then + DLCFLAGS="${DLCFLAGS=-fpic}" + else + case "$host_os" in + hpux*) DLCFLAGS="${DLCFLAGS=+z}" ;; + sunos*) DLCFLAGS="${DLCFLAGS=-pic}" ;; + solaris*|sysv4*|esix*) DLCFLAGS="${DLCFLAGS=-Kpic}" ;; + esac + fi + case "$host_os" in + hpux*) DLLDFLAGS="${DLLDFLAGS=-b}" ;; + linux*|irix*|osf*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;; + solaris*) DLLDFLAGS="${DLLDFLAGS=-G}" ;; + sunos*) DLLDFLAGS="${DLLDFLAGS=-assert nodefinitions}" ;; + sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;; + netbsd*) DLLDFLAGS="${DLLDFLAGS=-x -shared --whole-archive}" ;; + esac + case "$host_os" in + hpux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}" ;; + linux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}" ;; + esac + AC_CACHE_CHECK(if your dlsym() needs a leading underscore, + zsh_cv_func_dlsym_needs_underscore, + [cat >conftest.c <&5 2>&5 && + $DLLD -o conftest.$DL_EXT $LDFLAGS $DLLDFLAGS conftest.o 1>&5 2>&5 && + AC_TRY_RUN([ +#include +#ifdef HAVE_DLFCN_H +#include +#else +#include +#include +#include +#endif +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif + +extern int fred() ; + +main() +{ + void * handle ; + void * symbol ; + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + handle = dlopen("./conftest.$DL_EXT", RTLD_LAZY) ; + if (handle == NULL) { + fprintf (f, "dlopen failed") ; + exit(1); + } + symbol = dlsym(handle, "fred") ; + if (symbol == NULL) { + /* try putting a leading underscore */ + symbol = dlsym(handle, "_fred") ; + if (symbol == NULL) { + fprintf (f, "dlsym failed") ; + exit(1); + } + fprintf (f, "yes") ; + } + else + fprintf (f, "no") ; + exit(0); +}], zsh_cv_func_dlsym_needs_underscore=`cat conftestval`, + zsh_cv_func_dlsym_needs_underscore=failed + dynamic=no, + zsh_cv_func_dlsym_needs_underscore=no)]) + if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then + AC_DEFINE(DLSYM_NEEDS_UNDERSCORE) + fi +fi + +if test "x$dynamic" = xyes; then + zsh_SYS_DYNAMIC_BROKEN + test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no +fi + +if test "x$dynamic" = xyes; then + zsh_SYS_DYNAMIC_CLASH + zsh_SYS_DYNAMIC_GLOBAL + RTLD_GLOBAL_OK=$zsh_cv_sys_dynamic_rtld_global + zsh_SYS_DYNAMIC_EXECSYMS + if test "$zsh_cv_sys_dynamic_execsyms" != yes; then + L=L + fi + zsh_SYS_DYNAMIC_STRIP_EXE + zsh_SYS_DYNAMIC_STRIP_LIB + if $strip_exeldflags && test "$zsh_cv_sys_dynamic_strip_exe" = yes; then + EXELDFLAGS="$EXELDFLAGS -s" + fi + if $strip_libldflags && test "$zsh_cv_sys_dynamic_strip_lib" = yes; then + LIBLDFLAGS="$LIBLDFLAGS -s" + fi +else + $strip_exeldflags && EXELDFLAGS="$EXELDFLAGS -s" + $strip_libldflags && LIBLDFLAGS="$LIBLDFLAGS -s" + RTLD_GLOBAL_OK=no +fi + +if test "x$dynamic" = xyes; then + D=D + AC_DEFINE(DYNAMIC)dnl +else + D=N +fi + +AC_DEFINE_UNQUOTED(DL_EXT, "$DL_EXT")dnl +AC_SUBST(D)dnl +AC_SUBST(DL_EXT)dnl +AC_SUBST(DLLD)dnl +AC_SUBST(DLCFLAGS)dnl +AC_SUBST(DLLDFLAGS)dnl +AC_SUBST(EXTRA_LDFLAGS)dnl +AC_SUBST(L)dnl +AC_SUBST(RTLD_GLOBAL_OK)dnl + +real_no_create=$no_create +no_create=yes +AC_OUTPUT(Makefile Doc/Makefile Etc/Makefile Src/Makefile, \ +[test -z "$CONFIG_HEADERS" || echo > stamp-h]) + +dnl The standard config.status is missing some essential features. +dnl So add them now. +[( + echo '1,$s@^#( *ac_file_inputs=#).*$@#1`echo $ac_file_in | sed -e "s%^%:%" -e "s%:##([^!]##)% $ac_given_srcdir/##1%g" -e "s%:!% %"`@' + echo '/ac_sed_cmds=cat/+a' + echo '' + echo 'ac_sed_inc_cmds="' + quote_sed='s,\.,#.,g' + for name in `echo '' ${srcdir}/Config/*.mk | sed "s, ${srcdir}/Config/, ,g"`; do + echo '/^@@'`echo $name | sed -e "$quote_sed"`'@@#$/{r $ac_given_srcdir/Config/'$name + echo 'd;}' + done + echo '"' + echo '.' + echo '1,$s@^#( *#)#(sed -e "#$ac_comsub *#)$@#1sed -e "$ac_sed_inc_cmds" $ac_file_inputs | #2@' + echo '1,$s@^#( *"#) *$ac_file_inputs |@#1 |@' + echo 'w' + echo 'q' +) | tr '#' '\\' | ed $CONFIG_STATUS >/dev/null 2>/dev/null] + +test "$real_no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +eval "zshbin1=${bindir}" +eval "zshbin2=${zshbin1}" +eval "zshman=${mandir}" +eval "zshinfo=${infodir}" + +echo " +zsh configuration +----------------- +zsh version : ${VERSION} +host operating system : ${host_cpu}-${host_vendor}-${host_os} +source code location : ${srcdir} +compiler : ${CC} +executable compiler flags : ${CFLAGS}" +if test "$dynamic" = yes; then + echo "\ +module compiler flags : ${CFLAGS} ${DLCFLAGS}" +fi +echo "\ +executable linker flags : ${LDFLAGS} ${EXELDFLAGS} ${EXTRA_LDFLAGS}" +if test "$dynamic" = yes; then + echo "\ +module linker flags : ${LDFLAGS} ${LIBLDFLAGS} ${DLLDFLAGS}" +fi +echo "\ +library flags : ${LIBS} +binary install path : ${zshbin2} +man page install path : ${zshman} +info install path : ${zshinfo} +" diff --git a/install-sh b/install-sh new file mode 100755 index 000000000..58719246f --- /dev/null +++ b/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 000000000..0801ec2c9 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,32 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/patchlist.txt b/patchlist.txt new file mode 100644 index 000000000..fc471a727 --- /dev/null +++ b/patchlist.txt @@ -0,0 +1,41 @@ +This version of zsh is based on 3.1.5 and includes the following +patches. (The version number built into the shell has not been changed.) + + Old stuff: + +Zoli's AIX dynamic loading patch from 3933, slightly updated, without +some hunks which weren't needed on AIX 3.x so I don't know how to +update properly. + +My completion widgets patch + + Patches which have appeared since 3.1.5 (it's already a week, after + all...): + +Bart's addon collection 4473 (excluding the bit from 4105), 4475, 4476 + +My patch in 4477 to rename three functions to avoid clashes when +dynamic loading (particularly necessary on IRIX and AIX), including +the effect of Sven's additional fix in 4488 + +My patch 4513 for case-insensitive globbing via flags, plus fixlet 4552 + +Sven's magna opera patch-or 4510 and patch-match 4509 to add control of +alternative matches and arbitrary mapping between characters in the +command line and the matched, plus all known fixes 4526, 4527, 4534, +4555, 4557 + +My ~PWD patch 4533 + +My suggestion for fixing the suffix on a yank in 4564 + +Bart's deltochar patch including new flags to allow commands not to +interrupt cumulative effects in 4570 + +Bart's doc fiz 4574 + +Sven's latest word on the fixsuffix() horror in 4576, plus a +fixsuffix() added by hand in delcharorlist() which I've somehow missed +along the way + +My latest version of lete2ctl, not posted -- cgit 1.4.1