Sophie

Sophie

distrib > Mandriva > 8.1 > i586 > by-pkgid > 628e26a49117deea42e952d5b0d0f0d7 > files > 57

zsh-doc-4.0.2-2mdk.i586.rpm

<HTML>
<HEAD>
<!-- Created by texi2html 1.56k from ./zsh.texi on 26 June 2001 -->

<TITLE>zsh - Zsh Modules</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="zsh_1.html">first</A>, <A HREF="zsh_20.html">previous</A>, <A HREF="zsh_22.html">next</A>, <A HREF="zsh_29.html">last</A> section, <A HREF="zsh_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC130" HREF="zsh_toc.html#TOC130">Zsh Modules</A></H1>
<P>
<A NAME="IDX1334"></A>




<H2><A NAME="SEC131" HREF="zsh_toc.html#TOC131">Description</A></H2>
<P>
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 that
are bundled with the zsh distribution are:


<P>
<DL COMPACT>

<DT><TT>zsh/cap</TT>
<DD>
Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.

<DT><TT>zsh/clone</TT>
<DD>
A builtin that can clone a running shell onto another terminal.

<DT><TT>zsh/compctl</TT>
<DD>
The <TT>compctl</TT> builtin for controlling completion.

<DT><TT>zsh/complete</TT>
<DD>
The basic completion code.

<DT><TT>zsh/complist</TT>
<DD>
Completion listing extensions.

<DT><TT>zsh/computil</TT>
<DD>
A module with utility builtins needed for the shell function based
completion system.

<DT><TT>zsh/deltochar</TT>
<DD>
A ZLE function duplicating EMACS' <TT>zap-to-char</TT>.

<DT><TT>zsh/example</TT>
<DD>
An example of how to write a module.

<DT><TT>zsh/files</TT>
<DD>
Some basic file manipulation commands as builtins.

<DT><TT>zsh/mapfile</TT>
<DD>
Access to external files via a special associative array.

<DT><TT>zsh/mathfunc</TT>
<DD>
Standard scientific functions for use in mathematical evaluations.

<DT><TT>zsh/parameter</TT>
<DD>
Access to internal hash tables via special associative arrays.

<DT><TT>zsh/sched</TT>
<DD>
A builtin that provides a timed execution facility within the shell.

<DT><TT>zsh/stat</TT>
<DD>
A builtin command interface to the <TT>stat</TT> system call.

<DT><TT>zsh/termcap</TT>
<DD>
Interface to the termcap database.

<DT><TT>zsh/terminfo</TT>
<DD>
Interface to the terminfo database.

<DT><TT>zsh/zftp</TT>
<DD>
A builtin FTP client.

<DT><TT>zsh/zle</TT>
<DD>
The Zsh Line Editor, including the <TT>bindkey</TT> and <TT>vared</TT> builtins.

<DT><TT>zsh/zleparameter</TT>
<DD>
Access to internals of the Zsh Line Editor via parameters.

<DT><TT>zsh/zprof</TT>
<DD>
A module allowing profiling for shell functions.

<DT><TT>zsh/zpty</TT>
<DD>
A builtin for starting a command in a pseudo-terminal.

<DT><TT>zsh/zutil</TT>
<DD>
Some utility builtins, e.g. the one for supporting configuration via 
styles.

</DL>



<H2><A NAME="SEC132" HREF="zsh_toc.html#TOC132">The zsh/cap Module</A></H2>
<P>


<P>
The <TT>zsh/cap</TT> 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:


<P>
<DL COMPACT>

<DT><TT>cap</TT> [ <VAR>capabilities</VAR> ]
<DD>
<A NAME="IDX1335"></A>
 <A NAME="IDX1336"></A>
 
Change the shell's process capability sets to the specified <VAR>capabilities</VAR>,
otherwise display the shell's current capabilities.

<A NAME="IDX1337"></A>
<A NAME="IDX1338"></A>
<DT><TT>getcap</TT> <VAR>filename</VAR> ...
<DD>
This is a built-in implementation of the POSIX standard utility.  It displays
the capability sets on each specified <VAR>filename</VAR>.

<A NAME="IDX1339"></A>
<A NAME="IDX1340"></A>
<DT><TT>setcap</TT> <VAR>capabilities</VAR> <VAR>filename</VAR> ...
<DD>
This is a built-in implementation of the POSIX standard utility.  It sets
the capability sets on each specified <VAR>filename</VAR> to the specified
<VAR>capabilities</VAR>.

</DL>



<H2><A NAME="SEC133" HREF="zsh_toc.html#TOC133">The zsh/clone Module</A></H2>
<P>


<P>
The <TT>zsh/clone</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>clone</TT> <VAR>tty</VAR>
<DD>
<A NAME="IDX1341"></A>
 <A NAME="IDX1342"></A>
 <A NAME="IDX1343"></A>
 <A NAME="IDX1344"></A>
 
Creates a forked instance of the current shell, attached to the specified
<VAR>tty</VAR>.  In the new shell, the <TT>PID</TT>, <TT>PPID</TT> and <TT>TTY</TT> special
parameters are changed appropriately.  <TT>$!</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.

</DL>



<H2><A NAME="SEC134" HREF="zsh_toc.html#TOC134">The zsh/compctl Module</A></H2>
<P>


<P>
The <TT>zsh/compctl</TT> module makes available two builtin commands. <TT>compctl</TT>,
is the old, deprecated way to control completions for ZLE.  See
section <A HREF="zsh_20.html#SEC119">Completion Using compctl</A>.
The other builtin command, <TT>compcall</TT> can be used in user-defined
completion widgets, see
section <A HREF="zsh_18.html#SEC98">Completion Widgets</A>.




<H2><A NAME="SEC135" HREF="zsh_toc.html#TOC135">The zsh/complete Module</A></H2>
<P>


<P>
The <TT>zsh/complete</TT> module makes available several builtin commands which
can be used in user-defined completion widgets, see
section <A HREF="zsh_18.html#SEC98">Completion Widgets</A>.




<H2><A NAME="SEC136" HREF="zsh_toc.html#TOC136">The zsh/complist Module</A></H2>
<P>


<P>
<A NAME="IDX1345"></A>
<A NAME="IDX1346"></A>
<A NAME="IDX1347"></A>
The <TT>zsh/complist</TT> module offers three extensions to completion listings:
the ability to highlight matches in such a list, the ability to
scroll through long lists and a different style of menu completion.


<P>




<H3><A NAME="SEC137" HREF="zsh_toc.html#TOC137">Colored completion listings</A></H3>
<P>
Whenever one of the parameters <TT>ZLS_COLORS</TT> or <TT>ZLS_COLOURS</TT> is set 
and the <TT>zsh/complist</TT> module is loaded or linked into the shell,
completion lists will be colored.  Note, however, that <TT>complist</TT> will
not automatically be loaded if it is not linked in:  on systems with
dynamic loading, `<TT>zmodload zsh/complist</TT>' is required.


<P>
<A NAME="IDX1348"></A>
<A NAME="IDX1349"></A>
The parameters <TT>ZLS_COLORS</TT> and <TT>ZLS_COLOURS</TT> describe how matches
are highlighted.  To turn on highlighting an empty value suffices, in
which case all the default values given below will be used.  The format of
the value of these parameters is the same as used by the GNU version of the
<TT>ls</TT> command: a colon-separated list of specifications of the form
`<VAR>name</VAR>=<VAR>value</VAR>'.  The <VAR>name</VAR> may be one of the following strings,
most of which specify file types for which the <VAR>value</VAR> will be used.
The strings and their default values are:


<P>
<DL COMPACT>

<DT><TT>no 0</TT>
<DD>
for normal text (i.e. when displaying something other than a matched file)

<DT><TT>fi 0</TT>
<DD>
for regular files

<DT><TT>di 32</TT>
<DD>
for directories

<DT><TT>ln 36</TT>
<DD>
for symbolic links

<DT><TT>pi 31</TT>
<DD>
for named pipes (FIFOs)

<DT><TT>so 33</TT>
<DD>
for sockets

<DT><TT>bd 44;37</TT>
<DD>
for block devices

<DT><TT>cd 44;37</TT>
<DD>
for character devices

<DT><TT>ex 35</TT>
<DD>
for executable files

<DT><TT>mi</TT> <VAR>none</VAR>
<DD>
for a non-existent file (default is the value defined for <TT>fi</TT>)

<DT><TT>lc \e[</TT>
<DD>
for the left code (see below)

<DT><TT>rc m</TT>
<DD>
for the right code

<DT><TT>tc 0</TT>
<DD>
for the character indicating the file type  printed after filenames if
the <TT>LIST_TYPES</TT> option is set

<DT><TT>sp 0</TT>
<DD>
for the spaces printed after matches to align the next column

<DT><TT>ec</TT> <VAR>none</VAR>
<DD>
for the end code

</DL>

<P>
Apart from these strings, the <VAR>name</VAR> may also be an asterisk
(`<TT>*</TT>') followed by any string. The <VAR>value</VAR> given for such a
string will be used for all files whose name ends with the string.
The <VAR>name</VAR> may also be an equals sign (`<TT>=</TT>') followed by a
pattern.  The <VAR>value</VAR> given for this pattern will be used for all
matches (not just filenames) whose display string are matched by
the pattern.  Definitions for both of these take precedence over the
values defined for file types and the form with the leading asterisk 
takes precedence over the form with the leading equal sign.


<P>
The last form also allows different parts of the displayed
strings to be colored differently.  For this, the pattern has to use the
`<TT>(#b)</TT>' globbing flag and pairs of parentheses surrounding the
parts of the strings that are to be colored differently.  In this case 
the <VAR>value</VAR> may consist of more than one color code separated by
equal signs.  The first code will be used for all parts for which no
explicit code is specified and the following codes will be used for
the parts matched by the sub-patterns in parentheses.  For example,
the specification `<TT>=(#b)(?)*(?)=0=3=7</TT>' will be used for all
matches which are at least two characters long and will use
the code `<TT>3</TT>' for the first character, `<TT>7</TT>' for the last
character and `<TT>0</TT>' for the rest.


<P>
All three forms of <VAR>name</VAR> may be preceded by a pattern in
parentheses.  If this is given, the <VAR>value</VAR> will be used
only for matches in groups whose names are matched by the pattern
given in the parentheses.  For example, `<TT>(g*)m*=43</TT>' highlights all
matches beginning with `<TT>m</TT>' in groups whose names  begin with
`<TT>g</TT>' using the color code `<TT>43</TT>'.  In case of the `<TT>lc</TT>',
`<TT>rc</TT>', and `<TT>ec</TT>' codes, the group pattern is ignored.


<P>
Note also that all patterns are tried in the order in which they
appear in the parameter value until the first one matches which is
then used.


<P>
When printing a match, the code prints the value of <TT>lc</TT>, the value
for the file-type or the last matching specification with a `<TT>*</TT>',
the value of <TT>rc</TT>, the string to display for the match itself, and
then the value of <TT>ec</TT> if that is defined or the values of <TT>lc</TT>,
<TT>no</TT>, and <TT>rc</TT> if <TT>ec</TT> is not defined.


<P>
The default values are ISO 6429 (ANSI) compliant and can be used on
vt100 compatible terminals such as <TT>xterm</TT>s.  On monochrome terminals
the default values will have no visible effect.  The <TT>colors</TT>
function from the contribution can be used to get associative arrays
containing the codes for ANSI terminals (see
section <A HREF="zsh_23.html#SEC193">Other Functions</A>).  For example, after loading <TT>colors</TT>, one could use
`<TT>$colors[red]</TT>' to get the code for foreground color red and
`<TT>$colors[bg-green]</TT>' for the code for background color green.


<P>
If the completion system invoked by compinit is used, these
parameters should not be set directly because the system controls them 
itself.  Instead, the <TT>list-colors</TT> style should be used (see
section <A HREF="zsh_19.html#SEC111">Completion System Configuration</A>).


<P>




<H3><A NAME="SEC138" HREF="zsh_toc.html#TOC138">Scrolling in completion listings</A></H3>
<P>
To enable scrolling through a completion list, the <TT>LISTPROMPT</TT>
parameter must be set.  Its value will be used as the prompt; if it
is the empty string, a default prompt will be used.  The value may
contain escapes of the form `<TT>%x</TT>'.  It supports the escapes
`<TT>%B</TT>', `<TT>%b</TT>', `<TT>%S</TT>', `<TT>%s</TT>', `<TT>%U</TT>', `<TT>%u</TT>' and
`<TT>%{...%}</TT>' used also in shell prompts as well as three pairs of
additional sequences: a `<TT>%l</TT>' or `<TT>%L</TT>' is replaced by the number
of the last line shown and the total number of lines in the form
`<VAR>number</VAR><TT>/</TT><VAR>total</VAR>'; a `<TT>%m</TT>' or `<TT>%M</TT>' is replaced with
the number of the last match shown and the total number of matches; and 
`<TT>%p</TT>' or `<TT>%P</TT>' is replaced with `<TT>Top</TT>', `<TT>Bottom</TT>' or the
position of the first line shown in percent of the total number of
lines, respectively.  In each of these cases the form with the uppercase
letter will be replaced with a string of fixed width, padded to the
right with spaces, while the lowercase form will not be padded.


<P>
If the parameter <TT>LISTPROMPT</TT> is set, the completion code will not ask if
the list should be shown.  Instead it immediately starts displaying the
list, stopping after the first screenful, showing the prompt at the bottom,
waiting for a keypress after temporarily switching to the <TT>listscroll</TT>
keymap.  Some of the zle functions have a special meaning while scrolling
lists:


<P>
<DL COMPACT>

<DT><TT>send-break</TT>
<DD>
stops listing discarding the key pressed

<DT><TT>accept-line</TT>, <TT>down-history</TT>, <TT>down-line-or-history</TT>
<DD>
<DT><TT>down-line-or-search</TT>, <TT>vi-down-line-or-history</TT>
<DD>
scrolls forward one line

<DT><TT>complete-word</TT>, <TT>menu-complete</TT>, <TT>expand-or-complete</TT>
<DD>
<DT><TT>expand-or-complete-prefix</TT>, <TT>menu-complete-or-expand</TT>
<DD>
scrolls forward one screenful

</DL>

<P>
Every other character stops listing and immediately processes the key
as usual.  Any key that is not bound in the <TT>listscroll</TT> keymap or
that is bound to <TT>undefined-key</TT> is looked up in the keymap
currently selected.


<P>
As for the <TT>ZLS_COLORS</TT> and <TT>ZLS_COLOURS</TT> parameters,
<TT>LISTPROMPT</TT> should not be set directly when using the shell
function based completion system.  Instead, the <TT>list-prompt</TT> style
should be used.


<P>




<H3><A NAME="SEC139" HREF="zsh_toc.html#TOC139">Menu selection</A></H3>
<P>
<A NAME="IDX1350"></A>
<A NAME="IDX1351"></A>
<A NAME="IDX1352"></A>
The <TT>zsh/complist</TT> module also offers an alternative style of selecting
matches from a list, called menu selection, which can be used if the
shell is set up to return to the last prompt after showing a
completion list (see the <TT>ALWAYS_LAST_PROMPT</TT> option in
section <A HREF="zsh_15.html#SEC75">Options</A>).  It can be invoked directly by
the widget <TT>menu-select</TT> defined by the module.  Alternatively,
the parameter <TT>MENUSELECT</TT> can be set to an integer, which gives the
minimum number of matches that must be present before menu selection is
automatically turned on.  This second method requires that menu completion
be started, either directly from a widget such as <TT>menu-complete</TT>, or due
to one of the options <TT>MENU_COMPLETE</TT> or <TT>AUTO_MENU</TT> being set.  If
<TT>MENUSELECT</TT> is set, but is 0, 1 or empty, menu selection will always be
started during an ambiguous menu completion.


<P>
When using the completion system based on shell functions, the
<TT>MENUSELECT</TT> parameter should not be used (like the <TT>ZLS_COLORS</TT>
and <TT>ZLS_COLOURS</TT> parameters described above).  Instead, the <TT>menu</TT> 
style should be used with the <TT>select=</TT><VAR>...</VAR> keyword.


<P>
After menu selection is started, the matches will be listed. If there
are more matches than fit on the screen, only the first screenful is
shown.  The
matches to insert into the command line can be selected from this
list.  In the list one match is highlighted using the value for <TT>ma</TT>
from the <TT>ZLS_COLORS</TT> or <TT>ZLS_COLOURS</TT> parameter.  The default
value for this is `<TT>7</TT>' which forces the selected match to be
highlighted using standout mode on a vt100-compatible terminal.  If
neither <TT>ZLS_COLORS</TT> nor <TT>ZLS_COLOURS</TT> is set, the same terminal
control sequence as for the `<TT>%S</TT>' escape in prompts is used.


<P>
If there are more matches than fit on the screen and the parameter
<TT>MENUPROMPT</TT> is set, its value will be shown below the matches.  It
supports the same escape sequences as <TT>LISTPROMPT</TT>, but the number
of the match or line shown will be that of the one where the mark is
placed.  If its value is the empty string, a default prompt will be
used.


<P>
The <TT>MENUSCROLL</TT> parameter can be used to specify how the list is
scrolled.  If the parameter is unset, this is done line by line, if it
is set to `<TT>0</TT>' (zero), the list will scroll half the number of
lines of the screen.  If the value is positive, it gives the number of
lines to scroll and if it is negative, the list will be scrolled
the number of lines of the screen minus the (absolute) value.


<P>
As for the <TT>ZLS_COLORS</TT>, <TT>ZLS_COLOURS</TT> and <TT>LISTPROMPT</TT>
parameters, neither <TT>MENUPROMPT</TT> nor <TT>MENUSCROLL</TT> should be
set directly when using the shell function based completion
system.  Instead, the <TT>select-prompt</TT> and <TT>select-scroll</TT> styles
should be used.


<P>
The completion code sometimes decides not to show all of the matches
in the list.  These hidden matches are either matches for which the
completion function which added them explicitly requested that they
not appear in the list (using the <TT>-n</TT> option of the <TT>compadd</TT>
builtin command) or they are matches which duplicate a string already
in the list (because they differ only in things like prefixes or
suffixes that are not displayed).  In the list used for menu selection,
however, even these matches are shown so that it is possible to select
them.  To highlight such matches the <TT>hi</TT> and <TT>du</TT> capabilities in
the <TT>ZLS_COLORS</TT> and <TT>ZLS_COLOURS</TT> parameters are supported for
hidden matches of the first and second kind, respectively.


<P>
Selecting matches is done by moving the mark around using the zle movement
functions.  When not all matches can be shown on the screen at the same 
time, the list will scroll up and down when crossing the top or
bottom line.  The following zle functions have special meaning during
menu selection:


<P>
<DL COMPACT>

<DT><TT>accept-line</TT>
<DD>
accepts the current match and leaves menu selection

<DT><TT>send-break</TT>
<DD>
leaves menu selection and restores the previous contents of the
command line

<DT><TT>redisplay</TT>, <TT>clear-screen</TT>
<DD>
execute their normal function without leaving menu selection

<DT><TT>accept-and-hold</TT>, <TT>accept-and-menu-complete</TT>
<DD>
accept the currently inserted match and continue selection allowing to 
select the next match to insert into the line

<DT><TT>accept-and-infer-next-history</TT>
<DD>
accepts the current match and then tries completion with
menu selection again;  in the case of files this allows one to select
a directory and immediately attempt to complete files in it;  if there 
are no matches, a message is shown and one can use <TT>undo</TT> to go back 
to completion on the previous level, every other key leaves menu
selection (including the other zle functions which are otherwise
special during menu selection)

<DT><TT>undo</TT>
<DD>
removes matches inserted during the menu selection by one of the three 
functions before

<DT><TT>down-history</TT>, <TT>down-line-or-history</TT>
<DD>
<DT><TT>vi-down-line-or-history</TT>,  <TT>down-line-or-search</TT>
<DD>
moves the mark one line down

<DT><TT>up-history</TT>, <TT>up-line-or-history</TT>
<DD>
<DT><TT>vi-up-line-or-history</TT>, <TT>up-line-or-search</TT>
<DD>
moves the mark one line up

<DT><TT>forward-char</TT>, <TT>vi-forward-char</TT>
<DD>
moves the mark one column right

<DT><TT>backward-char</TT>, <TT>vi-backward-char</TT>
<DD>
moves the mark one column left

<DT><TT>forward-word</TT>, <TT>vi-forward-word</TT>
<DD>
<DT><TT>vi-forward-word-end</TT>, <TT>emacs-forward-word</TT>
<DD>
moves the mark one screenful down

<DT><TT>backward-word</TT>, <TT>vi-backward-word</TT>, <TT>emacs-backward-word</TT>
<DD>
moves the mark one screenful up

<DT><TT>vi-forward-blank-word</TT>, <TT>vi-forward-blank-word-end</TT>
<DD>
moves the mark to the first line of the next group of matches

<DT><TT>vi-backward-blank-word</TT>
<DD>
moves the mark to the last line of the previous group of matches

<DT><TT>beginning-of-history</TT>
<DD>
moves the mark to the first line

<DT><TT>end-of-history</TT>
<DD>
moves the mark to the last line

<DT><TT>beginning-of-buffer-or-history</TT>, <TT>beginning-of-line</TT>
<DD>
<DT><TT>beginning-of-line-hist</TT>, <TT>vi-beginning-of-line</TT>
<DD>
moves the mark to the leftmost column

<DT><TT>end-of-buffer-or-history</TT>, <TT>end-of-line</TT>
<DD>
<DT><TT>end-of-line-hist</TT>, <TT>vi-end-of-line</TT>
<DD>
moves the mark to the rightmost column

<DT><TT>complete-word</TT>, <TT>menu-complete</TT>, <TT>expand-or-complete</TT>
<DD>
<DT><TT>expand-or-complete-prefix</TT>, <TT>menu-expand-or-complete</TT>
<DD>
moves the mark to the next match

<DT><TT>reverse-menu-complete</TT>
<DD>
moves the mark to the previous match

</DL>

<P>
All movement functions wrap around at the edges; any other zle function not
listed leaves menu selection and executes that function.  It is possible to
make widgets in the above list do the same by using the form of the widget
with a `<TT>.</TT>' in front.  For example, the widget `<TT>.accept-line</TT>' has
the effect of leaving menu selection and accepting the entire command line.


<P>
During this selection the widget uses the keymap <TT>menuselect</TT>.  Any
key that is not defined in this keymap or that is bound to
<TT>undefined-key</TT> is looked up in the keymap currently selected.  This
is used to ensure that the most important keys used during selection
(namely the cursor keys, return, and TAB) have sensible defaults.  However,
keys in the <TT>menuselect</TT> keymap can be modified directly using the
<TT>bindkey</TT> builtin command (see
section <A HREF="zsh_21.html#SEC157">The zsh/zle Module</A>). For example, to make the return key leave menu selection without
accepting the match currently selected one could call


<P>

<BLOCKQUOTE>
<P>
<TT>bindkey -M menuselect '^M' send-break</TT>
</BLOCKQUOTE>

<P>
after loading the <TT>zsh/complist</TT> module.




<H2><A NAME="SEC140" HREF="zsh_toc.html#TOC140">The zsh/computil Module</A></H2>
<P>


<P>
<A NAME="IDX1353"></A>
The <TT>zsh/computil</TT> module adds several builtin commands that are used by
some of the completion functions in the completion system based on shell
functions (see 
section <A HREF="zsh_19.html#SEC105">Completion System</A>
).  Except for <TT>compquote</TT> these builtin commands are very
specialised and thus not very interesting when writing your own
completion functions.  In summary, these builtin commands are:


<P>
<DL COMPACT>

<DT><TT>comparguments</TT>
<DD>
<A NAME="IDX1354"></A>
 
This is used by the <TT>_arguments</TT> function to do the argument and
command line parsing.  Like <TT>compdescribe</TT> it has an option <TT>-i</TT> to 
do the parsing and initialize some internal state and various options
to access the state information to decide what should be completed.

<A NAME="IDX1355"></A>
<DT><TT>compdescribe</TT>
<DD>
This is used by the <TT>_describe</TT> function to build the displays for
the matches and to get the strings to add as matches with their
options.  On the first call one of the options <TT>-i</TT> or <TT>-I</TT> should be
supplied as the first argument.  In the first case, display strings without
the descriptions will be generated, in the second case, the string used to
separate the matches from their descriptions must be given as the
second argument and the descriptions (if any) will be shown.  All other 
arguments are like the definition arguments to <TT>_describe</TT> itself.

Once <TT>compdescribe</TT> has been called with either the <TT>-i</TT> or the
<TT>-I</TT> option, it can be repeatedly called with the <TT>-g</TT> option and
the names of five arrays as its arguments.  This will step through the
different sets of matches and store the options in the first array,
the strings with descriptions in the second, the matches for these in
the third, the strings without descriptions in the fourth, and the
matches for them in the fifth array.  These are then directly given to
<TT>compadd</TT> to register the matches with the completion code.

<A NAME="IDX1356"></A>
<DT><TT>compfiles</TT>
<DD>
Used by the <TT>_path_files</TT> function to optimize complex recursive
filename generation (globbing).  It does three things.  With the
<TT>-p</TT> and <TT>-P</TT> options it builds the glob patterns to use,
including the paths already handled and trying to optimize the
patterns with respect to the prefix and suffix from the line and the
match specification currently used.  The <TT>-i</TT> option does the
directory tests for the <TT>ignore-parents</TT> style and the <TT>-r</TT> option 
tests if a component for some of the matches are equal to the string
on the line and removes all other matches if that is true.

<A NAME="IDX1357"></A>
<DT><TT>compgroups</TT>
<DD>
Used by the <TT>_tags</TT> function to implement the internals of the
<TT>group-order</TT> style.  This only takes its arguments as names of
completion groups and creates the groups for it (all six types: sorted 
and unsorted, both without removing duplicates, with removing all
duplicates and with removing consecutive duplicates).

<A NAME="IDX1358"></A>
<DT><TT>compquote</TT> [ <TT>-p</TT> ] <VAR>names</VAR> ...
<DD>
There may be reasons to write completion functions that have to add
the matches using the <TT>-Q</TT> option to <TT>compadd</TT> and perform quoting
themselves.  Instead of interpreting the first character of the
<TT>all_quotes</TT> key of the <TT>compstate</TT> special association and using
the <TT>q</TT> flag for parameter expansions, one can use this builtin
command.  The arguments are the names of scalar or array parameters
and the values of these parameters are quoted as needed for the
innermost quoting level.  If the <TT>-p</TT> option is given, quoting is
done as if there is some prefix before the values of the parameters,
so that a leading equal sign will not be quoted.

The return value is non-zero in case of an error and zero otherwise.

<A NAME="IDX1359"></A>
<A NAME="IDX1360"></A>
<DT><TT>comptags</TT>
<DD>
<DT><TT>comptry</TT>
<DD>
These implement the internals of the tags mechanism.

<A NAME="IDX1361"></A>
<DT><TT>compvalues</TT>
<DD>
Like <TT>comparguments</TT>, but for the <TT>_values</TT> function.

</DL>



<H2><A NAME="SEC141" HREF="zsh_toc.html#TOC141">The zsh/deltochar Module</A></H2>
<P>


<P>
The <TT>zsh/deltochar</TT> module makes available two ZLE functions:


<P>
<DL COMPACT>

<DT><TT>delete-to-char</TT>
<DD>
<A NAME="IDX1362"></A>
 
Read a character from the keyboard, and
delete from the cursor position up to and including the next
(or, with repeat count <VAR>n</VAR>, the <VAR>n</VAR>th) instance of that character.
Negative repeat counts mean delete backwards.

<A NAME="IDX1363"></A>
<DT><TT>zap-to-char</TT>
<DD>
This behaves like <TT>delete-to-char</TT>, except that the final occurrence of
the character itself is not deleted.

</DL>



<H2><A NAME="SEC142" HREF="zsh_toc.html#TOC142">The zsh/example Module</A></H2>
<P>


<P>
The <TT>zsh/example</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>example</TT> [ <TT>-flags</TT> ] [ <VAR>args</VAR> ... ]
<DD>
<A NAME="IDX1364"></A>
 <A NAME="IDX1365"></A>
 <A NAME="IDX1366"></A>
 <A NAME="IDX1367"></A>
 
Displays the flags and arguments it is invoked with.

</DL>

<P>
The purpose of the module is to serve as an example of how to write a
module.




<H2><A NAME="SEC143" HREF="zsh_toc.html#TOC143">The zsh/files Module</A></H2>
<P>


<P>
<A NAME="IDX1368"></A>
The <TT>zsh/files</TT> module makes some standard commands available as builtins:


<P>
<DL COMPACT>

<DT><TT>chgrp</TT> [ <TT>-Rs</TT> ] <VAR>group</VAR> <VAR>filename</VAR> ...
<DD>
<A NAME="IDX1369"></A>
 
Changes group of files specified.  This is equivalent to <TT>chown</TT> with
a <VAR>user-spec</VAR> argument of `<TT>:</TT><VAR>group</VAR>'.

<A NAME="IDX1370"></A>
<DT><TT>chown</TT> [ <TT>-Rs</TT> ] <VAR>user-spec</VAR> <VAR>filename</VAR> ...
<DD>
Changes ownership and group of files specified.

The <VAR>user-spec</VAR> can be in four forms:

<DL COMPACT>

<DT><VAR>user</VAR>
<DD>
change owner to <VAR>user</VAR>; do not change group
<DT><VAR>user</VAR><TT>::</TT>
<DD>
change owner to <VAR>user</VAR>; do not change group
<DT><VAR>user</VAR><TT>:</TT>
<DD>
change owner to <VAR>user</VAR>; change group to <VAR>user</VAR>'s primary group
<DT><VAR>user</VAR><TT>:</TT><VAR>group</VAR>
<DD>
change owner to <VAR>user</VAR>; change group to <VAR>group</VAR>
<DT><TT>:</TT><VAR>group</VAR>
<DD>
do not change owner; change group to <VAR>group</VAR>
</DL>

In each case, the `<TT>:</TT>' may instead be a `<TT>.</TT>'.  The rule is that
if there is a `<TT>:</TT>' then the separator is `<TT>:</TT>', otherwise
if there is a `<TT>.</TT>' then the separator is `<TT>.</TT>', otherwise
there is no separator.

Each of <VAR>user</VAR> and <VAR>group</VAR> may be either a username (or group name, as
appropriate) or a decimal user ID (group ID).  Interpretation as a name
takes precedence, if there is an all-numeric username (or group name).

The <TT>-R</TT> option causes <TT>chown</TT> to recursively descend into directories,
changing the ownership of all files in the directory after
changing the ownership of the directory itself.

The <TT>-s</TT> option is a zsh extension to <TT>chown</TT> functionality.  It enables
paranoid behaviour, intended to avoid security problems involving
a <TT>chown</TT> being tricked into affecting files other than the ones
intended.  It will refuse to follow symbolic links, so that (for example)
``<TT>chown luser /tmp/foo/passwd</TT>'' can't accidentally chown <TT>/etc/passwd</TT>
if <TT>/tmp/foo</TT> happens to be a link to <TT>/etc</TT>.  It will also check
where it is after leaving directories, so that a recursive chown of
a deep directory tree can't end up recursively chowning <TT>/usr</TT> as
a result of directories being moved up the tree.

<A NAME="IDX1371"></A>
<DT><TT>ln</TT> [ <TT>-dfis</TT> ] <VAR>filename</VAR> <VAR>dest</VAR>
<DD>
<DT><TT>ln</TT> [ <TT>-dfis</TT> ] <VAR>filename</VAR> ... <VAR>dir</VAR>
<DD>
Creates hard (or, with <TT>-s</TT>, symbolic) links.  In the first form, the
specified <VAR>dest</VAR>ination is created, as a link to the specified
<VAR>filename</VAR>.  In the second form, each of the <VAR>filename</VAR>s is
taken in turn, and linked to a pathname in the specified <VAR>dir</VAR>ectory
that has the same last pathname component.

Normally, <TT>ln</TT> will not attempt to create hard links to
directories.  This check can be overridden using the <TT>-d</TT> 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</TT> option causes the user to be queried about replacing
existing files.  The <TT>-f</TT> option causes existing files to be
silently deleted, without querying.  <TT>-f</TT> takes precedence.

<A NAME="IDX1372"></A>
<DT><TT>mkdir</TT> [ <TT>-p</TT> ] [ <TT>-m</TT> <VAR>mode</VAR> ] <VAR>dir</VAR> ...
<DD>
Creates directories.  With the <TT>-p</TT> option, non-existing parent
directories are first created if necessary, and there will be
no complaint if the directory already exists.
The <TT>-m</TT> 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</TT> (see man page umask(2)) is used.

<A NAME="IDX1373"></A>
<DT><TT>mv</TT> [ <TT>-fi</TT> ] <VAR>filename</VAR> <VAR>dest</VAR>
<DD>
<DT><TT>mv</TT> [ <TT>-fi</TT> ] <VAR>filename</VAR> ... <VAR>dir</VAR>
<DD>
Moves files.  In the first form, the specified <VAR>filename</VAR> is moved
to the specified <VAR>dest</VAR>ination.  In the second form, each of the
<VAR>filename</VAR>s is
taken in turn, and moved to a pathname in the specified <VAR>dir</VAR>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</TT> option causes the user to be queried about replacing
any existing files.  The <TT>-f</TT> option causes any existing files to be
silently deleted, without querying.  <TT>-f</TT> takes precedence.

Note that this <TT>mv</TT> will not move files across devices.
Historical versions of <TT>mv</TT>, when actual renaming is impossible,
fall back on copying and removing files; if this behaviour is desired,
use <TT>cp</TT> and <TT>rm</TT> manually.  This may change in a future version.

<A NAME="IDX1374"></A>
<DT><TT>rm</TT> [ <TT>-dfirs</TT> ] <VAR>filename</VAR> ...
<DD>
Removes files and directories specified.

Normally, <TT>rm</TT> will not remove directories (except with the <TT>-r</TT>
option).  The <TT>-d</TT> option causes <TT>rm</TT> to try removing directories
with <TT>unlink</TT> (see man page unlink(2)), the same method used for files.
Typically only the super-user can actually succeed in unlinking
directories in this way.
<TT>-d</TT> takes precedence over <TT>-r</TT>.

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</TT> option causes the user to be queried about removing
any files.  The <TT>-f</TT> option causes files to be
silently deleted, without querying, and suppresses all error indications.
<TT>-f</TT> takes precedence.

The <TT>-r</TT> option causes <TT>rm</TT> to recursively descend into directories,
deleting all files in the directory before removing the directory with
the <TT>rmdir</TT> system call (see man page rmdir(2)).

The <TT>-s</TT> option is a zsh extension to <TT>rm</TT> functionality.  It enables
paranoid behaviour, intended to avoid common security problems involving
a root-run <TT>rm</TT> 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</TT>'' can't accidentally remove <TT>/etc/passwd</TT>
if <TT>/tmp/foo</TT> happens to be a link to <TT>/etc</TT>.  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</TT> as
a result of directories being moved up the tree.

<A NAME="IDX1375"></A>
<DT><TT>rmdir</TT> <VAR>dir</VAR> ...
<DD>
Removes empty directories specified.

<A NAME="IDX1376"></A>
<DT><TT>sync</TT>
<DD>
Calls the system call of the same name (see man page sync(2)), which
flushes dirty buffers to disk.  It might return before the I/O has
actually been completed.

</DL>



<H2><A NAME="SEC144" HREF="zsh_toc.html#TOC144">The zsh/mapfile Module</A></H2>
<P>


<P>
<A NAME="IDX1377"></A>
The <TT>zsh/mapfile</TT> module provides one special associative array parameter of
the same name.


<P>
<DL COMPACT>

<DT><TT>mapfile</TT>
<DD>
<A NAME="IDX1378"></A>
 
This associative array takes as keys the names of files; the resulting
value is the content of the file.  The value is treated identically to any
other text coming from a parameter.  The value may also be assigned to, in
which case the file in question is written (whether or not it originally
existed); or an element may be unset, which will delete the file in
question.  For example, `<TT>vared mapfile[myfile]</TT>' works as expected,
editing the file `<TT>myfile</TT>'.

When the array is accessed as a whole, the keys are the names of files in
the current directory, and the values are empty (to save a huge overhead in
memory).  Thus <TT>${(k)mapfile}</TT> has the same affect as the glob operator
<TT>*(D)</TT>, since files beginning with a dot are not special.  Care must be
taken with expressions such as <TT>rm ${(k)mapfile}</TT>, which will delete
every file in the current directory without the usual `<TT>rm *</TT>' test.

The parameter <TT>mapfile</TT> may be made read-only; in that case, files
referenced may not be written or deleted.

</DL>

<P>




<H3><A NAME="SEC145" HREF="zsh_toc.html#TOC145">Limitations</A></H3>
<P>


<P>
Although reading and writing of the file in question is efficiently
handled, zsh's internal memory management may be arbitrarily baroque.  Thus
it should not automatically be assumed that use of <TT>mapfile</TT> represents a
gain in efficiency over use of other mechanisms.  Note in particular that
the whole contents of the file will always reside physically in memory when
accessed (possibly multiple times, due to standard parameter substitution
operations).  In particular, this means handling of sufficiently long files
(greater than the machine's swap space, or than the range of the pointer
type) will be incorrect.


<P>
No errors are printed or flagged for non-existent, unreadable, or
unwritable files, as the parameter mechanism is too low in the shell
execution hierarchy to make this convenient.


<P>
It is unfortunate that the mechanism for loading modules does not yet allow
the user to specify the name of the shell parameter to be given the special
behaviour.




<H2><A NAME="SEC146" HREF="zsh_toc.html#TOC146">The zsh/mathfunc Module</A></H2>
<P>


<P>
<A NAME="IDX1379"></A>
<A NAME="IDX1380"></A>
The <TT>zsh/mathfunc</TT> module provides standard
mathematical functions for use when
evaluating mathematical formulae.  The syntax agrees with normal C and
FORTRAN conventions, for example,


<P>

<PRE>
(( f = sin(0.3) ))
</PRE>

<P>
assigns the sine of 0.3 to the parameter f.


<P>
Most functions take floating point arguments and return a floating point
value.  However, any necessary conversions from or to integer type will be
performed automatically by the shell.  Apart from <TT>atan</TT> with a second
argument and the <TT>abs</TT>, <TT>int</TT> and <TT>float</TT> functions, all functions
behave as noted in the manual page for the corresponding C function,
except that any arguments out of range for the function in question will be
detected by the shell and an error reported.


<P>
The following functions take a single floating point argument: <TT>acos</TT>,
<TT>acosh</TT>, <TT>asin</TT>, <TT>asinh</TT>, <TT>atan</TT>, <TT>atanh</TT>, <TT>cbrt</TT>, <TT>ceil</TT>,
<TT>cos</TT>, <TT>cosh</TT>, <TT>erf</TT>, <TT>erfc</TT>, <TT>exp</TT>, <TT>expm1</TT>, <TT>fabs</TT>,
<TT>floor</TT>, <TT>gamma</TT>, <TT>j0</TT>, <TT>j1</TT>, <TT>lgamma</TT>, <TT>log</TT>, <TT>log10</TT>,
<TT>log1p</TT>, <TT>logb</TT>, <TT>sin</TT>, <TT>sinh</TT>, <TT>sqrt</TT>, <TT>tan</TT>, <TT>tanh</TT>,
<TT>y0</TT>, <TT>y1</TT>.  The <TT>atan</TT> function can optionally take a second
argument, in which case it behaves like the C function <TT>atan2</TT>.
The <TT>ilogb</TT> function takes a single floating point argument, but
returns an integer.


<P>
The function <TT>signgam</TT> takes no arguments, and returns an integer, which
is the C variable of the same name, as described in man page gamma(3).  Note
that it is therefore only useful immediately after a call to <TT>gamma</TT> or
<TT>lgamma</TT>.  Note also that `<TT>signgam()</TT>' and `<TT>signgam</TT>' are distinct
expressions.


<P>
The following functions take two floating point arguments: <TT>copysign</TT>,
<TT>fmod</TT>, <TT>hypot</TT>, <TT>nextafter</TT>.


<P>
The following take an integer first argument and a floating point second
argument: <TT>jn</TT>, <TT>yn</TT>.


<P>
The following take a floating point first argument and an integer second
argument: <TT>ldexp</TT>, <TT>scalb</TT>.


<P>
The function <TT>abs</TT> does not convert the type of its single argument; it
returns the absolute value of either a floating point number or an
integer.  The functions <TT>float</TT> and <TT>int</TT> convert their arguments into
a floating point or integer value (by truncation) respectively.


<P>
Note that the C <TT>pow</TT> function is available in ordinary math evaluation
as the `<TT>**</TT>' operator and is not provided here.




<H2><A NAME="SEC147" HREF="zsh_toc.html#TOC147">The zsh/parameter Module</A></H2>
<P>


<P>
<A NAME="IDX1381"></A>
The <TT>zsh/parameter</TT> module gives access to some of the internal hash
tables used by the shell by defining some special parameters.


<P>
<DL COMPACT>

<DT><TT>options</TT>
<DD>
<A NAME="IDX1382"></A>
 
The keys for this associative array are the names of the options that
can be set and unset using the <TT>setopt</TT> and <TT>unsetopt</TT>
builtins. The value of each key is either the string <TT>on</TT> if the
option is currently set, or the string <TT>off</TT> if the option is unset.
Setting a key to one of these strings is like setting or unsetting
the option, respectively. Unsetting a key in this array is like
setting it to the value <TT>off</TT>.

<A NAME="IDX1383"></A>
<DT><TT>commands</TT>
<DD>
This array gives access to the command hash table. The keys are the
names of external commands, the values are the pathnames of the files
that would be executed when the command would be invoked. Setting a
key in this array defines a new entry in this table in the same way as
with the <TT>hash</TT> builtin. Unsetting a key as in `<TT>unset
"commands[foo]"</TT>' removes the entry for the given key from the command 
hash table.

<A NAME="IDX1384"></A>
<DT><TT>functions</TT>
<DD>
This associative array maps names of enabled functions to their
definitions. Setting a key in it is like defining a function with the
name given by the key and the body given by the value. Unsetting a key
removes the definition for the function named by the key.

<A NAME="IDX1385"></A>
<DT><TT>dis_functions</TT>
<DD>
Like <TT>functions</TT> but for disabled functions.

<A NAME="IDX1386"></A>
<DT><TT>builtins</TT>
<DD>
This associative array gives information about the builtin commands
currently enabled. The keys are the names of the builtin commands and
the values are either `<TT>undefined</TT>' for builtin commands that will
automatically be loaded from a module if invoked or `<TT>defined</TT>' for
builtin commands that are already loaded.

<A NAME="IDX1387"></A>
<DT><TT>dis_builtins</TT>
<DD>
Like <TT>builtins</TT> but for disabled builtin commands.

<A NAME="IDX1388"></A>
<DT><TT>reswords</TT>
<DD>
This array contains the enabled reserved words.

<A NAME="IDX1389"></A>
<DT><TT>dis_reswords</TT>
<DD>
Like <TT>reswords</TT> but for disabled reserved words.

<A NAME="IDX1390"></A>
<DT><TT>aliases</TT>
<DD>
This maps the names of the regular aliases currently enabled to their
expansions.

<A NAME="IDX1391"></A>
<DT><TT>dis_aliases</TT>
<DD>
Like <TT>raliases</TT> but for disabled regular aliases.

<A NAME="IDX1392"></A>
<DT><TT>galiases</TT>
<DD>
Like <TT>raliases</TT>, but for global aliases.

<A NAME="IDX1393"></A>
<DT><TT>dis_galiases</TT>
<DD>
Like <TT>galiases</TT> but for disabled global aliases.

<A NAME="IDX1394"></A>
<DT><TT>parameters</TT>
<DD>
The keys in this associative array are the names of the parameters
currently defined. The values are strings describing the type of the
parameter, in the same format used by the <TT>t</TT> parameter flag, see
section <A HREF="zsh_13.html#SEC48">Parameter Expansion</A>
.
Setting or unsetting keys in this array is not possible.

<A NAME="IDX1395"></A>
<DT><TT>modules</TT>
<DD>
An associative array giving information about modules. The keys are the names
of the modules loaded, registered to be autoloaded, or aliased. The
value says which state the named module is in and is one of the
strings `<TT>loaded</TT>', `<TT>autoloaded</TT>', or `<TT>alias:</TT><VAR>name</VAR>',
where <VAR>name</VAR> is the name the module is aliased to.

Setting or unsetting keys in this array is not possible.

<A NAME="IDX1396"></A>
<DT><TT>dirstack</TT>
<DD>
A normal array holding the elements of the directory stack. Note that
the output of the <TT>dirs</TT> builtin command includes one more
directory, the current working directory.

<A NAME="IDX1397"></A>
<DT><TT>history</TT>
<DD>
This associative array maps history event numbers to the full history lines.

<A NAME="IDX1398"></A>
<DT><TT>historywords</TT>
<DD>
A special array containing the words stored in the history.

<A NAME="IDX1399"></A>
<DT><TT>jobdirs</TT>
<DD>
This associative array maps job numbers to the directories from which the
job was started (which may not be the current directory of the job).

<A NAME="IDX1400"></A>
<DT><TT>jobtexts</TT>
<DD>
This associative array maps job numbers to the texts of the command lines
that were used to start the jobs.

<A NAME="IDX1401"></A>
<DT><TT>jobstates</TT>
<DD>
This associative array gives information about the states of the jobs
currently known. The keys are the job numbers and the values are
strings of the form
`<VAR>job-state</VAR>:<VAR>mark</VAR>:<VAR>pid</VAR><TT>=</TT><VAR>state</VAR><TT>...</TT>'. The
<VAR>job-state</VAR> gives the state the whole job is currently in, one of
`<TT>running</TT>', `<TT>suspended</TT>', or `<TT>done</TT>'. The <VAR>mark</VAR> is
`<TT>+</TT>' for the current job, `<TT>-</TT>' for the previous job and empty
otherwise. This is followed by one `<VAR>pid</VAR><TT>=</TT><VAR>state</VAR>' for every
process in the job. The <VAR>pid</VAR>s are, of course, the process IDs and
the <VAR>state</VAR> describes the state of that process.

<A NAME="IDX1402"></A>
<DT><TT>nameddirs</TT>
<DD>
This associative array maps the names of named directories to the pathnames
they stand for.

<A NAME="IDX1403"></A>
<DT><TT>userdirs</TT>
<DD>
This associative array maps user names to the pathnames of their home
directories.

<A NAME="IDX1404"></A>
<DT><TT>funcstack</TT>
<DD>
This array contains the names of the functions currently being
executed. The first element is the name of the function using the
parameter.

</DL>



<H2><A NAME="SEC148" HREF="zsh_toc.html#TOC148">The zsh/sched Module</A></H2>
<P>


<P>
The <TT>zsh/sched</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>sched</TT> [<TT>+</TT>]<VAR>hh</VAR><TT>:</TT><VAR>mm</VAR> <VAR>command</VAR> ...
<DD>
<A NAME="IDX1405"></A>
 <A NAME="IDX1406"></A>
 <A NAME="IDX1407"></A>
 
<DT><TT>sched</TT> [ <TT>-</TT><VAR>item</VAR> ]
<DD>
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>-</TT><VAR>item</VAR>', removes the given item
from the list.

</DL>



<H2><A NAME="SEC149" HREF="zsh_toc.html#TOC149">The zsh/stat Module</A></H2>
<P>


<P>
The <TT>zsh/stat</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>stat</TT> [ <TT>-gnNolLtTrs</TT> ] [ <TT>-f</TT> <VAR>fd</VAR> ] [ <TT>-H</TT> <VAR>hash</VAR> ] [ <TT>-A</TT> <VAR>array</VAR> ] [ <TT>-F</TT> <VAR>fmt</VAR> ] [ <TT>+</TT><VAR>element</VAR> ] [ <VAR>file</VAR> ... ]
<DD>
<A NAME="IDX1408"></A>
 <A NAME="IDX1409"></A>
 <A NAME="IDX1410"></A>
 
The command acts as a front end to the <TT>stat</TT> system call (see
man page stat(2)).
If the <TT>stat</TT> call fails, the appropriate system error message
printed and status 1 is returned.
The fields of <TT>struct stat</TT> give information about
the files provided as arguments to the command.  In addition to those
available from the <TT>stat</TT> call, an extra element `<TT>link</TT>' is provided.
These elements are:

<DL COMPACT>

<DT><TT>device</TT>
<DD>
The number of the device on which the file resides.

<DT><TT>inode</TT>
<DD>
The unique number of the file on this device (`<EM>inode</EM>' number).

<DT><TT>mode</TT>
<DD>
The mode of the file; that is, the file's type and access permissions.
With the <TT>-s</TT> option, this will
be returned as a string corresponding to the first column in the
display of the <TT>ls -l</TT> command.

<DT><TT>nlink</TT>
<DD>
The number of hard links to the file.

<DT><TT>uid</TT>
<DD>
The user ID of the owner of the file.  With the <TT>-s</TT>
option, this is displayed as a user name.

<DT><TT>gid</TT>
<DD>
The group ID of the file.  With the <TT>-s</TT> option, this
is displayed as a group name.

<DT><TT>rdev</TT>
<DD>
The raw device number.  This is only useful for special devices.

<DT><TT>size</TT>
<DD>
The size of the file in bytes.

<DT><TT>atime</TT>
<DD>
<DT><TT>mtime</TT>
<DD>
<DT><TT>ctime</TT>
<DD>
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</TT> option,
these are printed as strings for the local time zone; the format
can be altered with the <TT>-F</TT> option, and with the <TT>-g</TT>
option the times are in GMT.

<DT><TT>blksize</TT>
<DD>
The number of bytes in one allocation block on the
device on which the file resides.

<DT><TT>block</TT>
<DD>
The number of disk blocks used by the file.

<DT><TT>link</TT>
<DD>
If the file is a link and the <TT>-L</TT> 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 +link</TT>'')
then the <TT>-L</TT> option is automatically used.

</DL>

A particular element may be selected by including its name
preceded by a `<TT>+</TT>' 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:

<DL COMPACT>

<DT><TT>-A</TT> <VAR>array</VAR>
<DD>
Instead of displaying the results on standard
output, assign them to an <VAR>array</VAR>, one <TT>struct stat</TT> element per array
element for each file in order.  In this case neither the name
of the element nor the name of the files appears in <VAR>array</VAR> unless the
<TT>-t</TT> or <TT>-n</TT> options were given, respectively.  If <TT>-t</TT> is given,
the element name appears as a prefix to the
appropriate array element; if <TT>-n</TT> is given, the file name
appears as a separate array element preceding all the others.
Other formatting options are respected.

<DT><TT>-H</TT> <VAR>hash</VAR>
<DD>
Similar to <TT>-A</TT>, but instead assign the values to <VAR>hash</VAR>.  The keys
are the elements listed above.  If the <TT>-n</TT> option is provided then the
name of the file is included in the hash with key <TT>name</TT>.

<DT><TT>-f</TT> <VAR>fd</VAR>
<DD>
Use the file on file descriptor <VAR>fd</VAR> instead of
named files; no list of file names is allowed in this case.

<DT><TT>-F</TT> <VAR>fmt</VAR>
<DD>
Supplies a <TT>strftime</TT> (see man page strftime(3)) string for the
formatting of the time elements.  The <TT>-s</TT> option is implied.

<DT><TT>-g</TT>
<DD>
Show the time elements in the GMT time zone.  The
<TT>-s</TT> option is implied.

<DT><TT>-l</TT>
<DD>
List the names of the type elements (to standard
output or an array as appropriate) and return immediately;
options other than <TT>-A</TT> and arguments are ignored.

<DT><TT>-L</TT>
<DD>
Perform an <TT>lstat</TT> (see man page lstat(2)) rather than a <TT>stat</TT>
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</TT> element useful.

<DT><TT>-n</TT>
<DD>
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.

<DT><TT>-N</TT>
<DD>
Never show the names of files.

<DT><TT>-o</TT>
<DD>
If a raw file mode is printed, show it in octal, which is more useful for
human consumption than the default of decimal.  A leading zero will be
printed in this case.  Note that this does not affect whether a raw or
formatted file mode is shown, which is controlled by the <TT>-r</TT> and <TT>-s</TT>
options, nor whether a mode is shown at all.

<DT><TT>-r</TT>
<DD>
Print raw data (the default format) alongside string
data (the <TT>-s</TT> format); the string data appears in parentheses
after the raw data.

<DT><TT>-s</TT>
<DD>
Print <TT>mode</TT>, <TT>uid</TT>, <TT>gid</TT> and the three time
elements as strings instead of numbers.  In each case the format
is like that of <TT>ls -l</TT>.

<DT><TT>-t</TT>
<DD>
Always show the type names for the elements of
<TT>struct stat</TT>.  Usually these are only shown when output is to
standard output and no individual element has been selected.

<DT><TT>-T</TT>
<DD>
Never show the type names of the <TT>struct stat</TT> elements.

</DL>

</DL>



<H2><A NAME="SEC150" HREF="zsh_toc.html#TOC150">The zsh/termcap Module</A></H2>
<P>


<P>
The <TT>zsh/termcap</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>echotc</TT> <VAR>cap</VAR> [ <VAR>arg</VAR> ... ]
<DD>
<A NAME="IDX1411"></A>
 <A NAME="IDX1412"></A>
 
Output the termcap value corresponding to the capability
<VAR>cap</VAR>, with optional arguments.

</DL>

<P>
The <TT>zsh/termcap</TT> module makes available one parameter:


<P>
<DL COMPACT>

<DT><TT>termcap</TT>
<DD>
<A NAME="IDX1413"></A>
 
An associative array that maps termcap capability codes to
their values.

</DL>



<H2><A NAME="SEC151" HREF="zsh_toc.html#TOC151">The zsh/terminfo Module</A></H2>
<P>


<P>
The <TT>zsh/terminfo</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>echoti</TT> <VAR>cap</VAR>
<DD>
<A NAME="IDX1414"></A>
 <A NAME="IDX1415"></A>
 
Output the terminfo value corresponding to the capability
<VAR>cap</VAR>.

</DL>

<P>
The <TT>zsh/terminfo</TT> module makes available one parameter:


<P>
<DL COMPACT>

<DT><TT>terminfo</TT>
<DD>
<A NAME="IDX1416"></A>
 
An associative array that maps terminfo capability names to
their values.

</DL>



<H2><A NAME="SEC152" HREF="zsh_toc.html#TOC152">The zsh/zftp Module</A></H2>
<P>


<P>
The <TT>zsh/zftp</TT> module makes available one builtin command:


<P>
<DL COMPACT>

<DT><TT>zftp</TT> <VAR>subcommand</VAR> [ <VAR>args</VAR> ]
<DD>
<A NAME="IDX1417"></A>
 <A NAME="IDX1418"></A>
 <A NAME="IDX1419"></A>
 
The <TT>zsh/zftp</TT> 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 a more powerful interface; a set is
provided with the <TT>zsh</TT> distribution and is described in
section <A HREF="zsh_22.html#SEC162">Zftp Function System</A>.  However, the <TT>zftp</TT> command is entirely usable in its
own right.

All commands consist of the command name <TT>zftp</TT> 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</TT> for
more information on how responses from the server may be printed.

</DL>

<P>




<H3><A NAME="SEC153" HREF="zsh_toc.html#TOC153">Subcommands</A></H3>
<P>
<A NAME="IDX1420"></A>


<P>
<DL COMPACT>

<DT><TT>open</TT> <VAR>host</VAR> [ <VAR>user</VAR> [ <VAR>password</VAR> [ <VAR>account</VAR> ] ] ]
<DD>
<A NAME="IDX1421"></A>
 
Open a new FTP session to <VAR>host</VAR>, 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</TT> subcommand.  Note that
if no arguments beyond <VAR>host</VAR> are supplied, <TT>open</TT> will <EM>not</EM>
automatically call <TT>login</TT>.  If no arguments at all are supplied,
<TT>open</TT> will use the parameters set by the <TT>params</TT> subcommand.

After a successful open, the shell variables <TT>ZFTP_HOST</TT>,
<TT>ZFTP_IP</TT> and <TT>ZFTP_SYSTEM</TT> are available; see `Variables'
below.

<DT><TT>login</TT> [ <VAR>name</VAR> [ <VAR>password</VAR> [ <VAR>account</VAR> ] ] ]
<DD>
<DT><TT>user</TT> [ <VAR>name</VAR> [ <VAR>password</VAR> [ <VAR>account</VAR> ] ] ]
<DD>
Login the user <VAR>name</VAR> with parameters <VAR>password</VAR> and <VAR>account</VAR>.
Any of the parameters can be omitted, and will be read from standard
input if needed (<VAR>name</VAR> is always needed).  If 
standard input is a terminal, a prompt for each one will be printed on
standard error and <VAR>password</VAR> 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>,
<TT>ZFTP_ACCOUNT</TT> and <TT>ZFTP_PWD</TT> 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.

<DT><TT>params</TT> [ <VAR>host</VAR> [ <VAR>user</VAR> [ <VAR>password</VAR> [ <VAR>account</VAR> ] ] ] ]
<DD>
<DT><TT>params</TT> <TT>-</TT>
<DD>
Store the given parameters for a later <TT>open</TT> command with no
arguments.  Only those given on the command line will be remembered.
If no arguments are given, the parameters currently set are printed,
although the password will appear as a line of stars; the return value is
one if no parameters were set, zero otherwise.

Any of the parameters may be specified as a `<TT>?</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</TT> subcommand, including special handling of <VAR>password</VAR>.  If the
`<TT>?</TT>' is followed by a string, that is used as the prompt for reading the
parameter instead of the default message (any necessary punctuation and
whitespace should be included at the end of the prompt).  The first letter
of the parameter (only) may be quoted with a `<TT>\</TT>'; hence an argument
<TT>"\\$word"</TT> guarantees that the string from the shell parameter <TT>$word</TT>
will be treated literally, whether or not it begins with a `<TT>?</TT>'.

If instead a single `<TT>-</TT>' is given, the existing parameters, if any,
are deleted.  In that case, calling <TT>open</TT> with no arguments will
cause an error.

The list of parameters is not deleted after a <TT>close</TT>, however it
will be deleted if the <TT>zsh/zftp</TT> module is unloaded.

For example,


<PRE>
zftp params ftp.elsewhere.xx juser '?Password for juser: '
</PRE>

will store the host <TT>ftp.elsewhere.xx</TT> and the user <TT>juser</TT> and
then prompt the user for the corresponding password with the given prompt.

<DT><TT>test</TT>
<DD>
Test the connection; if the server has reported
that it has closed the connection (maybe due to a timeout), return
status 2; if no connection was open anyway, return status 1; else
return status 0.  The <TT>test</TT> subcommand is
silent, apart from messages printed by the <TT>$ZFTP_VERBOSE</TT>
mechanism, or error messages if the connection closes.  There is no
network overhead for this test.

The test is only supported on systems with either the <TT>select(2)</TT> or
<TT>poll(2)</TT> system calls; otherwise the message `<TT>not
supported on this system</TT>' is printed instead.

The <TT>test</TT> subcommand will automatically be called at the start of any
other subcommand for the current session when a connection is open.

<DT><TT>cd</TT> <VAR>directory</VAR>
<DD>
Change the remote directory to <VAR>directory</VAR>.  Also alters the shell
variable <TT>ZFTP_PWD</TT>.

<DT><TT>cdup</TT>
<DD>
Change the remote directory to the one higher in the directory tree.
Note that <TT>cd ..</TT> will also work correctly on non-UNIX systems.

<DT><TT>dir</TT> [ <VAR>args...</VAR> ]
<DD>
Give a (verbose) listing of the remote directory.  The <VAR>args</VAR> are
passed directly to the server. The command's behaviour is implementation
dependent, but a UNIX server will typically interpret <VAR>args</VAR> as
arguments to the <TT>ls</TT> command and with no arguments return the
result of `<TT>ls -l</TT>'. The directory is listed to standard output.

<DT><TT>ls</TT> [ <VAR>args</VAR> ]
<DD>
Give a (short) listing of the remote directory.  With no <VAR>args</VAR>,
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</TT>.

<DT><TT>type</TT> [ <VAR>type</VAR> ]
<DD>
Change the type for the transfer to <VAR>type</VAR>, or print the current type
if <VAR>type</VAR> is absent.  The allowed values are `<TT>A</TT>' (ASCII),
`<TT>I</TT>' (Image, i.e. binary), or `<TT>B</TT>' (a synonym for `<TT>I</TT>').

The FTP default for a transfer is ASCII.  However, if <TT>zftp</TT> 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</TT>.  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.

<DT><TT>ascii</TT>
<DD>
The same as <TT>type A</TT>.

<DT><TT>binary</TT>
<DD>
The same as <TT>type I</TT>.

<DT><TT>mode</TT> [ <TT>S</TT> | <TT>B</TT> ]
<DD>
Set the mode type to stream (<TT>S</TT>) or block (<TT>B</TT>).  Stream mode is
the default; block mode is not widely supported.

<DT><TT>remote</TT> <VAR>files...</VAR>
<DD>
<DT><TT>local</TT> [ <VAR>files...</VAR> ]
<DD>
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</TT> 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>[[</TT> builtin's <TT>&#60;</TT> and <TT>&#62;</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</TT> command will print nothing and return
status 2, compared with status 1 for a file not found.

The <TT>local</TT> command (but not <TT>remote</TT>) 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</TT> command
with no further redirection.

<DT><TT>get</TT> <VAR>file</VAR> [...]
<DD>
Retrieve all <VAR>file</VAR>s from the server, concatenating them
and sending them to standard output.

<DT><TT>put</TT> <VAR>file</VAR> [...]
<DD>
For each <VAR>file</VAR>, read a file from standard input and send that to
the remote host with the given name.

<DT><TT>append</TT> <VAR>file</VAR> [...]
<DD>
As <TT>put</TT>, but if the remote <VAR>file</VAR> already exists, data is
appended to it instead of overwriting it.

<DT><TT>getat</TT> <VAR>file</VAR> <VAR>point</VAR>
<DD>
<DT><TT>putat</TT> <VAR>file</VAR> <VAR>point</VAR>
<DD>
<DT><TT>appendat</TT> <VAR>file</VAR> <VAR>point</VAR>
<DD>
Versions of <TT>get</TT>, <TT>put</TT> and <TT>append</TT> which will start the
transfer at the given <VAR>point</VAR> in the remote <VAR>file</VAR>.  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).

<DT><TT>delete</TT> <VAR>file</VAR> [...]
<DD>
Delete the list of files on the server.

<DT><TT>mkdir</TT> <VAR>directory</VAR>
<DD>
Create a new directory <VAR>directory</VAR> on the server.

<DT><TT>rmdir</TT> <VAR>directory</VAR>
<DD>
Delete the directory <VAR>directory</VAR>  on the server.

<DT><TT>rename</TT> <VAR>old-name</VAR> <VAR>new-name</VAR>
<DD>
Rename file <VAR>old-name</VAR> to <VAR>new-name</VAR> on the server.

<DT><TT>site</TT> <VAR>args...</VAR>
<DD>
Send a host-specific command to the server.  You will probably
only need this if instructed by the server to use it.

<DT><TT>quote</TT> <VAR>args...</VAR>
<DD>
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 commands may include <TT>STAT</TT> and <TT>HELP</TT>.  Note also
the mechanism for returning messages as described for the variable
<TT>ZFTP_VERBOSE</TT> below, in particular that all messages from the
control connection are sent to standard error.

<DT><TT>close</TT>
<DD>
<DT><TT>quit</TT>
<DD>
Close the current data connection.  This unsets the shell parameters
<TT>ZFTP_HOST</TT>, <TT>ZFTP_IP</TT>, <TT>ZFTP_SYSTEM</TT>, <TT>ZFTP_USER</TT>,
<TT>ZFTP_ACCOUNT</TT>, <TT>ZFTP_PWD</TT>, <TT>ZFTP_TYPE</TT> and <TT>ZFTP_MODE</TT>.

<DT><TT>session</TT> [ <VAR>sessname</VAR> ]
<DD>
Allows multiple FTP sessions to be used at once.  The name of the session
is an arbitrary string of characters; the default session is called
`<TT>default</TT>'.  If this command is called without an argument, it will list
all the current sessions; with an argument, it will either switch to the
existing session called <VAR>sessname</VAR>, or create a new session of that name.

Each session remembers the status of the connection, the set of
connection-specific shell parameters (the same set as are unset when a
connection closes, as given in the description of <TT>close</TT>), and any user
parameters specified with the <TT>params</TT> subcommand.  Changing to a
previous session restores those values; changing to a new session
initialises them in the same way as if <TT>zftp</TT> had just been loaded.  The
name of the current session is given by the parameter <TT>ZFTP_SESSION</TT>.

<DT><TT>rmsession</TT> [ <VAR>sessname</VAR> ]
<DD>
Delete a session; if a name is not given, the current session is deleted.
If the current session is deleted, the earliest existing session becomes
the new current session, otherwise the current session is not changed.
If the session being deleted is the only one, a new session called
`<TT>default</TT>' is created and becomes the current session; note that this is
a new session even if the session being deleted is also called
`<TT>default</TT>'. It is recommended that sessions not be deleted while
background commands which use <TT>zftp</TT> are still active.

</DL>

<P>




<H3><A NAME="SEC154" HREF="zsh_toc.html#TOC154">Parameters</A></H3>
<P>
<A NAME="IDX1422"></A>
The following shell parameters are used by <TT>zftp</TT>.  Currently none
of them are special.


<P>
<DL COMPACT>

<DT><TT>ZFTP_TMOUT</TT>
<DD>
<A NAME="IDX1423"></A>
 
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.

<A NAME="IDX1424"></A>
<DT><TT>ZFTP_IP</TT>
<DD>
Readonly.  The IP address of the current connection in dot notation.

<A NAME="IDX1425"></A>
<DT><TT>ZFTP_HOST</TT>
<DD>
Readonly.  The hostname of the current remote server.  If the host was
opened as an IP number, <TT>ZFTP_HOST</TT> contains that instead; this
saves the overhead for a name lookup, as IP numbers are most commonly
used when a nameserver is unavailable.

<A NAME="IDX1426"></A>
<DT><TT>ZFTP_SYSTEM</TT>
<DD>
Readonly.  The system type string returned by the server in response
to an FTP <TT>SYST</TT> request.  The most interesting case is a string
beginning <TT>"UNIX Type: L8"</TT>, which ensures maximum compatibility
with a local UNIX host.

<A NAME="IDX1427"></A>
<DT><TT>ZFTP_TYPE</TT>
<DD>
Readonly.  The type to be used for data transfers , either `<TT>A</TT>' or
`<TT>I</TT>'.   Use the <TT>type</TT> subcommand to change this.

<A NAME="IDX1428"></A>
<DT><TT>ZFTP_USER</TT>
<DD>
Readonly.  The username currently logged in, if any.

<A NAME="IDX1429"></A>
<DT><TT>ZFTP_ACCOUNT</TT>
<DD>
Readonly.  The account name of the current user, if any.  Most servers
do not require an account name.

<A NAME="IDX1430"></A>
<DT><TT>ZFTP_PWD</TT>
<DD>
Readonly.  The current directory on the server.

<A NAME="IDX1431"></A>
<DT><TT>ZFTP_CODE</TT>
<DD>
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, and
is not changed when the current session changes.

<A NAME="IDX1432"></A>
<DT><TT>ZFTP_REPLY</TT>
<DD>
Readonly.  The last line of the last reply sent by the server.  This
can still be read after the connection is closed, and is not changed when
the current session changes.

<A NAME="IDX1433"></A>
<DT><TT>ZFTP_SESSION</TT>
<DD>
Readonly.  The name of the current FTP session; see the description of the
<TT>session</TT> subcommand.

<A NAME="IDX1434"></A>
<DT><TT>ZFTP_PREFS</TT>
<DD>
A string of preferences for altering aspects of <TT>zftp</TT>'s behaviour.
Each preference is a single character.  The following are defined:

<DL COMPACT>

<DT><TT>P</TT>
<DD>
Passive:  attempt to make the remote server initiate data transfers.
This is slightly more efficient than sendport mode.  If the letter
<TT>S</TT> occurs later in the string, <TT>zftp</TT> will use sendport mode if
passive mode is not available.

<DT><TT>S</TT>
<DD>
Sendport:  initiate transfers by the FTP <TT>PORT</TT> command.  If this
occurs before any <TT>P</TT> in the string, passive mode will never be
attempted.

<DT><TT>D</TT>
<DD>
Dumb:  use only the bare minimum of FTP commands.  This prevents
the variables <TT>ZFTP_SYSTEM</TT> and <TT>ZFTP_PWD</TT> from being set, and
will mean all connections default to ASCII type.  It may prevent
<TT>ZFTP_SIZE</TT> from being set during a transfer if the server
does not send it anyway (many servers do).

</DL>

If <TT>ZFTP_PREFS</TT> is not set when <TT>zftp</TT> is loaded, it will be set to a
default of `<TT>PS</TT>', i.e. use passive mode if available, otherwise
fall back to sendport mode.

<A NAME="IDX1435"></A>
<DT><TT>ZFTP_VERBOSE</TT>
<DD>
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:

<DL COMPACT>

<DT>1.
<DD>
A positive preliminary reply.

<DT>2.
<DD>
A positive completion reply.

<DT>3.
<DD>
A positive intermediate reply.

<DT>4.
<DD>
A transient negative completion reply.

<DT>5.
<DD>
A permanent negative completion reply.

</DL>

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</TT> is not set when <TT>zftp</TT> is loaded, it will be
set to the default value <TT>450</TT>, 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.

</DL>

<P>




<H3><A NAME="SEC155" HREF="zsh_toc.html#TOC155">Functions</A></H3>
<P>
<A NAME="IDX1436"></A>


<P>
<DL COMPACT>

<DT><TT>zftp_chpwd</TT>
<DD>
<A NAME="IDX1437"></A>
 
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</TT>
will be unset; otherwise it will reflect the new directory.

<A NAME="IDX1438"></A>
<DT><TT>zftp_progress</TT>
<DD>
If this function is set by the user, it will be called during
a <TT>get</TT>, <TT>put</TT> or <TT>append</TT> operation each time sufficient data
has been received from the host.  During a <TT>get</TT>, 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</EM> to standard
output.

When it is called with a transfer in progress, the following
additional shell parameters are set:

<DL COMPACT>

<DT><TT>ZFTP_FILE</TT>
<DD>
<A NAME="IDX1439"></A>
 
The name of the remote file being transferred from or to.

<A NAME="IDX1440"></A>
<DT><TT>ZFTP_TRANSFER</TT>
<DD>
A <TT>G</TT> for a <TT>get</TT> operation and a <TT>P</TT> for a <TT>put</TT> operation.

<A NAME="IDX1441"></A>
<DT><TT>ZFTP_SIZE</TT>
<DD>
The total size of the complete file being transferred:
the same as the first value provided by the
<TT>remote</TT> and <TT>local</TT> 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.

<A NAME="IDX1442"></A>
<DT><TT>ZFTP_COUNT</TT>
<DD>
The amount of data so far transferred; a number between zero and
<TT>$ZFTP_SIZE</TT>, if that is set.  This number is always available.

</DL>

The function is initially called with <TT>ZFTP_TRANSFER</TT> set
appropriately and <TT>ZFTP_COUNT</TT> set to zero.  After the transfer is
finished, the function will be called one more time with
<TT>ZFTP_TRANSFER</TT> set to <TT>GF</TT> or <TT>PF</TT>, in case it wishes to tidy
up.  It is otherwise never called twice with the same value of
<TT>ZFTP_COUNT</TT>.

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</TT> when necessary.

</DL>

<P>




<H3><A NAME="SEC156" HREF="zsh_toc.html#TOC156">Problems</A></H3>
<P>
<A NAME="IDX1443"></A>


<P>
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</TT>.  Other status changes in subshells will not be
reflected by changes to the variables (but should be otherwise harmless).


<P>
Deleting sessions while a <TT>zftp</TT> command is active in the background can
have unexpected effects, even if it does not use the session being deleted.
This is because all shell subprocesses share information on the state of
all connections, and deleting a session changes the ordering of that
information.


<P>
On some operating systems, the control connection is not valid after a
fork(), so that operations in subshells, on the left hand side of a
pipeline, or in the background are not possible, as they should be.  This
is presumably a bug in the operating system.




<H2><A NAME="SEC157" HREF="zsh_toc.html#TOC157">The zsh/zle Module</A></H2>
<P>


<P>
The <TT>zsh/zle</TT> module contains the Zsh Line Editor.  See
section <A HREF="zsh_17.html#SEC84">Zsh Line Editor</A>.




<H2><A NAME="SEC158" HREF="zsh_toc.html#TOC158">The zsh/zleparameter Module</A></H2>
<P>


<P>
<A NAME="IDX1444"></A>
The <TT>zsh/zleparameter</TT> module defines two special parameters that can be 
used to access internal information of the Zsh Line Editor (see
section <A HREF="zsh_17.html#SEC84">Zsh Line Editor</A>).


<P>
<DL COMPACT>

<DT><TT>keymaps</TT>
<DD>
<A NAME="IDX1445"></A>
 
This array contains the names of the keymaps currently defined.

<A NAME="IDX1446"></A>
<DT><TT>widgets</TT>
<DD>
This associative array contains one entry per widget defined. The name 
of the widget is the key and the value gives information about the
widget. It is either the string `<TT>builtin</TT>' for builtin widgets, a
string of the form `<TT>user:</TT><VAR>name</VAR>' for user-defined widgets,
where <VAR>name</VAR> is the name of the shell function implementing the
widget, or it is a string of the form
`<TT>completion:</TT><VAR>type</VAR><TT>:</TT><VAR>name</VAR>', for completion widgets. In
the last case <VAR>type</VAR> is the name of the builtin widgets the
completion widget imitates in its behavior and <VAR>name</VAR> is the name
of the shell function implementing the completion widget.

</DL>



<H2><A NAME="SEC159" HREF="zsh_toc.html#TOC159">The zsh/zprof Module</A></H2>
<P>


<P>
<A NAME="IDX1447"></A>
When loaded, the <TT>zsh/zprof</TT> causes shell functions to be profiled.
The profiling results can be obtained with the <TT>zprof</TT>
builtin command made available by this module.  There is no way to turn 
profiling off other than unloading the module.


<P>
<DL COMPACT>

<DT><TT>zprof</TT> [ <TT>-c</TT> ]
<DD>
<A NAME="IDX1448"></A>
 
Without the <TT>-c</TT> option, <TT>zprof</TT> lists profiling results to
standard output.  The format is comparable to that of commands like
<TT>gprof</TT>.

At the top there is a summary listing all functions that were called
at least once.  This summary is sorted in decreasing order of the
amount of time spent in each.  The lines contain
the number of the function in order, which is used in 
other parts of the list in suffixes of the form
`<TT>[</TT><VAR>num</VAR><TT>]</TT>', then the number of calls made to the function.
The next three columns list the time in
milliseconds spent in the function and its descendents, the average
time in milliseconds spent in the function and its descendents per
call and the percentage of time spent in all shell functions used in
this function and its descendents.  The following three columns give
the same information, but counting only the time spent in the function 
itself.  The final column shows the name of the function.

After the summary, detailed information about every function that was
invoked is listed, sorted in decreasing order of the amount of time spent
in each function and its descendents.  Each of these entries consists of
descriptions for the functions that called the function described, the
function itself, and the functions that were called from it.  The
description for the function itself has the same format as in the summary
(and shows the same information).  The other lines don't show the number of
the function at the beginning and have their function named indented to
make it easier to distinguish the line showing the function described in
the section from the surrounding lines.

The information shown in this case is almost the same as in the summary,
but only refers to the call hierarchy being displayed.  For example, for a
calling function the column showing the total running time lists the time
spent in the described function and its descendents only for the times when
it was called from that particular calling function.  Likewise, for a
called function, this columns lists the total time spent in the called
function and its descendents only for the times when it was called from the
function described.

Also in this case, the column showing the number of calls to a function
also shows a slash and then the total number of invocations made to the
called function.

As long as the <TT>zsh/zprof</TT> module is loaded, profiling will be done and
multiple invocations of the <TT>zprof</TT> builtin command will show the
times and numbers of calls since the module was loaded.  With the
<TT>-c</TT> option, the <TT>zprof</TT> builtin command will reset its internal
counters and will not show the listing.
)
</DL>



<H2><A NAME="SEC160" HREF="zsh_toc.html#TOC160">The zsh/zpty Module</A></H2>
<P>


<P>
The <TT>zsh/zpty</TT> module offers one builtin:


<P>
<DL COMPACT>

<DT><TT>zpty</TT> [ <TT>-e</TT> ] [ <TT>-b</TT> ] <VAR>name</VAR> [ <VAR>arg ...</VAR> ]
<DD>
<A NAME="IDX1449"></A>
 
The arguments following <VAR>name</VAR> are concatenated with spaces between,
then executed as a command, as if passed to the <TT>eval</TT> builtin.  The
command runs under a newly assigned pseudo-terminal; this is useful for
running commands non-interactively which expect an interactive
environment.  The <VAR>name</VAR> is not part of the command, but is used to
refer to this command in later calls to <TT>zpty</TT>.

With the <TT>-e</TT> option, the pseudo-terminal is set up so that input
characters are echoed.

With the <TT>-b</TT> option, input to and output from the pseudo-terminal are
made non-blocking.

<DT><TT>zpty</TT> <TT>-d</TT> [ <VAR>names</VAR> ... ]
<DD>
The second form, with the <TT>-d</TT> option, is used to delete commands
previously started, by supplying a list of their <VAR>name</VAR>s.  If no
<VAR>names</VAR> are given, all commands are deleted.  Deleting a command causes
the HUP signal to be sent to the corresponding process.

<DT><TT>zpty</TT> <TT>-w</TT> [ <TT>-n</TT> ] <VAR>name</VAR> [ <VAR>strings ...</VAR> ]
<DD>
The <TT>-w</TT> option can be used to send the to command <VAR>name</VAR> the given
<VAR>strings</VAR> as input (separated by spaces).  If the <TT>-n</TT> option is
<EM>not</EM> given, a newline is added at the end.

If no <VAR>strings</VAR> are provided, the standard input is copied to the
pseudo-terminal; this may stop before copying the full input if the
pseudo-terminal is non-blocking.

Note that the command under the pseudo-terminal sees this input as if it
were typed, so beware when sending special tty driver characters such as
word-erase, line-kill, and end-of-file.

<DT><TT>zpty</TT> <TT>-r</TT> [ <TT>-t</TT> ] <VAR>name</VAR> [ <VAR>param</VAR> [ <VAR>pattern</VAR> ] ]
<DD>
The <TT>-r</TT> option can be used to read the output of the command <VAR>name</VAR>.
With only a <VAR>name</VAR> argument, the output read is copied to the standard
output.  Unless the pseudo-terminal is non-blocking, copying continues
until the command under the pseudo-terminal exits; when non-blocking, only
as much output as is immediately available is copied.  The return value is
zero if any output is copied.

When also given a <VAR>param</VAR> argument, at most one line is read and stored
in the parameter named <VAR>param</VAR>.  Less than a full line may be read if
the pseudo-terminal is non-blocking.  The return value is zero if at least
one character is stored in <VAR>param</VAR>.

If a <VAR>pattern</VAR> is given as well, output is read until the whole string
read matches the <VAR>pattern</VAR>, even in the non-blocking case.  The return
value is zero if the string read matches the pattern, or if the command
has exited but at least one character could still be read.  As of this
writing, a maximum of one megabyte of output can be consumed this way; if
a full megabyte is read without matching the pattern, the return value is
non-zero.

In all cases, the return value is non-zero if nothing could be read, and
is <TT>2</TT> if this is because the command has finished.

If the <TT>-r</TT> option is combined with the <TT>-t</TT> option, <TT>zpty</TT> tests
whether output is available before trying to read.  If no output is
available, <TT>zpty</TT> immediately returns the value <TT>1</TT>.

<DT><TT>zpty</TT> <TT>-t</TT> <VAR>name</VAR>
<DD>
The <TT>-t</TT> option without the <TT>-r</TT> option can be used to test
whether the command <VAR>name</VAR> is still running.  It returns a zero
value if the command is running and a non-zero value otherwise.

<DT><TT>zpty</TT> [ <TT>-L</TT> ]
<DD>
The last form, without any arguments, is used to list the commands
currently defined.  If the <TT>-L</TT> option is given, this is done in the
form of calls to the <TT>zpty</TT> builtin.

</DL>



<H2><A NAME="SEC161" HREF="zsh_toc.html#TOC161">The zsh/zutil Module</A></H2>
<P>


<P>
<A NAME="IDX1450"></A>
The <TT>zsh/zutil</TT> module only adds some builtins:


<P>
<DL COMPACT>

<DT><TT>zstyle</TT> [ <TT>-L</TT> ]
<DD>
<A NAME="IDX1451"></A>
 
<DT><TT>zstyle</TT> [ <TT>-e</TT> | <TT>-</TT> | <TT>-</TT><TT>-</TT> ] <VAR>pattern</VAR> <VAR>style</VAR> <VAR>strings</VAR> ...
<DD>
<DT><TT>zstyle -d</TT> [ <VAR>pattern</VAR> [ <VAR>styles</VAR> ... ] ]
<DD>
<DT><TT>zstyle -g</TT> <VAR>name</VAR> [ <VAR>pattern</VAR> [ <VAR>style</VAR> ] ]
<DD>
<DT><TT>zstyle -abs</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>name</VAR> [ <VAR>sep</VAR> ]
<DD>
<DT><TT>zstyle -Tt</TT> <VAR>context</VAR> <VAR>style</VAR> [ <VAR>strings</VAR> ...]
<DD>
<DT><TT>zstyle -m</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>pattern</VAR>
<DD>
This builtin command is used to define and lookup styles.  Styles are
pairs of names and values, where the values consist of any number of
strings.  They are stored together with patterns and lookup is done by
giving a string, called the `context', which is compared to the
patterns.  The definition stored for the first matching pattern will be 
returned.

For ordering of comparisons, patterns are searched from most specific to
least specific, and patterns that are equally specific keep the order in 
which they were defined.  A pattern is considered to be more specific
than another if it contains more components (substrings separated by
colons) or if the patterns for the components are more specific, where 
simple strings are considered to be more specific than patterns and
complex patterns are considered to be more specific than the pattern
`<TT>*</TT>'.

The first form (without arguments) lists the definitions in the order
<TT>zstyle</TT> will test them. If the <TT>-L</TT> option is given, listing is
done in the form of calls to <TT>zstyle</TT>.  Forms with arguments:

<DL COMPACT>

<DT><TT>zstyle</TT> [ <TT>-</TT> | <TT>-</TT><TT>-</TT> | <TT>-e</TT> ] <VAR>pattern</VAR> <VAR>style</VAR> <VAR>strings</VAR> ...
<DD>
<A NAME="IDX1452"></A>
Defines the given <VAR>style</VAR> for the <VAR>pattern</VAR> with the <VAR>strings</VAR> as
the value.  If the <TT>-e</TT> option is given, the <VAR>strings</VAR> will be
concatenated (separated by spaces) and the resulting string will be
evaluated (in the same way as it is done by the <TT>eval</TT> builtin
command) when the style is looked up.  In this case the parameter
`<TT>reply</TT>' must be assigned to set the strings returned after the
evaluation.  Before evaluating the value, <TT>reply</TT> is unset, and
if it is still unset after the evaluation, the style is treated as if
it were not set.

<DT><TT>zstyle -d</TT> [ <VAR>pattern</VAR> [ <VAR>styles</VAR> ... ] ]
<DD>
Delete style definitions. Without arguments all definitions are deleted,
with a <VAR>pattern</VAR> all definitions for that pattern are deleted and if
any <VAR>styles</VAR> are given, then only those styles are deleted for the
<VAR>pattern</VAR>.

<DT><TT>zstyle -g</TT> <VAR>name</VAR> [ <VAR>pattern</VAR> [ <VAR>style</VAR> ] ]
<DD>
Retrieve a style definition. The <VAR>name</VAR> is
used as the name of an array in which the results are stored. Without
any further arguments, all <VAR>patterns</VAR> defined are returned. With a
<VAR>pattern</VAR> the styles defined for that pattern are returned and with 
both a <VAR>pattern</VAR> and a <VAR>style</VAR>, the value strings of that
combination is returned.

</DL>

The other forms can be used to look up or test patterns.

<DL COMPACT>

<DT><TT>zstyle -s</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>name</VAR> [ <VAR>sep</VAR> ]
<DD>
The parameter <VAR>name</VAR> is set to the value of the style interpreted as a
string.  If the value contains several strings they are concatenated with
spaces (or with the <VAR>sep</VAR> string if that is given) between them.

<DT><TT>zstyle -b</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>name</VAR>
<DD>
The value is stored in <VAR>name</VAR> as a boolean, i.e. as the string
`<TT>yes</TT>' if the value has only one string and that string is equal to one
of `<TT>yes</TT>', `<TT>true</TT>', `<TT>on</TT>', or `<TT>1</TT>'. If the value is any other
string or has more than one string, the parameter is set to `<TT>no</TT>'.

<DT><TT>zstyle -a</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>name</VAR>
<DD>
The value is stored in <VAR>name</VAR> as an array. If <VAR>name</VAR> is declared 
as an associative array,  the first, third, etc. strings are used as the
keys and the other strings are used as the values.

<DT><TT>zstyle -t</TT> <VAR>context</VAR> <VAR>style</VAR> [ <VAR>strings</VAR> ...]
<DD>
<DT><TT>zstyle -T</TT> <VAR>context</VAR> <VAR>style</VAR> [ <VAR>strings</VAR> ...]
<DD>
Test the value of a style, i.e. the <TT>-t</TT> option only returns a status
(sets <TT>$?</TT>).  Without any <VAR>strings</VAR> the return status is zero if the
style is defined for at least one matching pattern, has only one string in
its value, and that is equal to one of `<TT>true</TT>', `<TT>yes</TT>', `<TT>on</TT>' or
`<TT>1</TT>'. If any <VAR>strings</VAR> are given the status is zero if and only if
at least one of the <VAR>strings</VAR> is equal to at least one of the strings
in the value. If the style is not defined, the status is <TT>2</TT>.

The <TT>-T</TT> option tests the values of the style like <TT>-t</TT>, but it
returns zero (rather than <TT>2</TT>) if the style is not defined for any
matching pattern.

<DT><TT>zstyle -m</TT> <VAR>context</VAR> <VAR>style</VAR> <VAR>pattern</VAR>
<DD>
Match a value. Returns status zero if the 
<VAR>pattern</VAR> matches at least one of the strings in the value.

</DL>

<A NAME="IDX1453"></A>
<DT><TT>zformat -f</TT> <VAR>param</VAR> <VAR>format</VAR> <VAR>specs</VAR> ...
<DD>
<DT><TT>zformat -a</TT> <VAR>array</VAR> <VAR>sep</VAR> <VAR>specs</VAR> ...
<DD>
This builtin provides two different forms of formatting. The first form 
is selected with the <TT>-f</TT> option. In this case the <VAR>format</VAR>
string will be modified by replacing sequences starting with a percent 
sign in it with strings from the <VAR>specs</VAR>.  Each <VAR>spec</VAR> should be
of the form `<VAR>char</VAR><TT>:</TT><VAR>string</VAR>' which will cause every
appearance of the sequence `<TT>%</TT><VAR>char</VAR>' in <VAR>format</VAR> to be replaced 
by the <VAR>string</VAR>.  The `<TT>%</TT>' sequence may also contain optional
minimum and maximum field width specifications between the `<TT>%</TT>' and 
the `<VAR>char</VAR>' in the form `<TT>%</TT><VAR>min</VAR><TT>.</TT><VAR>max</VAR><TT>c</TT>',
i.e. the minimum field width is given first and if the maximum field
width is used, it has to be preceded by a dot.  Specifying a minimum field
width makes the result be padded with spaces to the right if the
<VAR>string</VAR> is shorter than the requested width.  Padding to the left
can be achieved by giving a negative minimum field width.  If a maximum 
field width is specified, the <VAR>string</VAR> will be truncated after that
many characters.  After all `<TT>%</TT>' sequences for the given <VAR>specs</VAR>
have been processed, the resulting string is stored in the parameter
<VAR>param</VAR>.

The second form, using the <TT>-a</TT> option, can be used for aligning
strings.  Here, the <VAR>specs</VAR> are of the form
`<VAR>left</VAR><TT>:</TT><VAR>right</VAR>' where `<VAR>left</VAR>' and `<VAR>right</VAR>' are
arbitrary strings.  These strings are modified by replacing the colons
by the <VAR>sep</VAR> string and padding the <VAR>left</VAR> strings with spaces 
to the right so that the <VAR>sep</VAR> strings in the result (and hence the 
<VAR>right</VAR> strings after them) are all aligned if the strings are
printed below each other.  All strings without a colon are left
unchanged and all strings with an empty <VAR>right</VAR> string have the
trailing colon removed.  In both cases the lengths of the strings
are not used to determine how the other strings are to be aligned.
The resulting strings are stored in the <VAR>array</VAR>.

<A NAME="IDX1454"></A>
<DT><TT>zregexparse</TT>
<DD>
This implements some internals of the <TT>_regex_arguments</TT> function.

<A NAME="IDX1455"></A>
<DT><TT>zparseopts</TT> [ <TT>-D</TT> ] [ <TT>-K</TT> ] [ <TT>-E</TT> ] [ <TT>-a</TT> <VAR>array</VAR> ] [ <TT>-A</TT> <VAR>assoc</VAR> ] <VAR>specs</VAR>
<DD>
This builtin simplifies the parsing of options in positional parameters,
i.e. the set of arguments given by <TT>$*</TT>.  Each <VAR>spec</VAR> describes one
option and must be of the form `<VAR>opt</VAR>[<TT>=</TT><VAR>array</VAR>]'.  If an option
described by <VAR>opt</VAR> is found in the positional parameters it is copied
into the <VAR>array</VAR> specified with the <TT>-a</TT> option; if the optional
`<TT>=</TT><VAR>array</VAR>' is given, it is instead copied into that array.

Note that it is an error to give any <VAR>spec</VAR> without an
`<TT>=</TT><VAR>array</VAR>' unless one of the <TT>-a</TT> or <TT>-A</TT> options is used.

Unless the <TT>-E</TT> option is given, parsing stops at the first string
that isn't described by one of the <VAR>specs</VAR>.  Even with <TT>-E</TT>,
parsing always stops at a positional parameter equal to `<TT>-</TT>' or
`<TT>-</TT><TT>-</TT>'.

The <VAR>opt</VAR> description must be one of the following.  Any of the special
characters can appear in the option name provided it is preceded by a
backslash.

<DL COMPACT>

<DT><VAR>name</VAR>
<DD>
<DT><VAR>name</VAR><TT>+</TT>
<DD>
The <VAR>name</VAR> is the name of the option without the leading `<TT>-</TT>'.  To
specify a GNU-style long option, one of the usual two leading `<TT>-</TT>' must
be included in <VAR>name</VAR>; for example, a `<TT>--file</TT>' option is
represented by a <VAR>name</VAR> of `<TT>-file</TT>'.

If a `<TT>+</TT>' appears after <VAR>name</VAR>, the option is appended to <VAR>array</VAR>
each time it is found in the positional parameters; without the `<TT>+</TT>'
only the <EM>last</EM> occurrence of the option is preserved.

If one of these forms is used, the option takes no argument, so parsing
stops if the next positional parameter does not also begin with `<TT>-</TT>'
(unless the <TT>-E</TT> option is used).

<DT><VAR>name</VAR><TT>:</TT>
<DD>
<DT><VAR>name</VAR><TT>:-</TT>
<DD>
<DT><VAR>name</VAR><TT>::</TT>
<DD>
If one or two colons are given, the option takes an argument; with one
colon, the argument is mandatory and with two colons it is optional.  The
argument is appended to the <VAR>array</VAR> after the option itself.

An optional argument is put into the same array element as the option name
(note that this makes empty strings as arguments indistinguishable).  A
mandatory argument is added as a separate element unless the `<TT>:-</TT>' form
is used, in which case the argument is put into the same element.

A `<TT>+</TT>' as described above may appear between the <VAR>name</VAR> and the
first colon.

</DL>

The options of <TT>zparseopts</TT> itself are:

<DL COMPACT>

<DT><TT>-a</TT> <VAR>array</VAR>
<DD>
As described above, this names the default array in which to store the
recognised options.

<DT><TT>-A</TT> <VAR>assoc</VAR>
<DD>
If this is given, the options and their values are also put into an
associative array with the option names as keys and the arguments (if any)
as the values.

<DT><TT>-D</TT>
<DD>
If this option is given, all options found are removed from the positional
parameters of the calling shell or shell function, up to but not including
any not described by the <VAR>specs</VAR>.  This is similar to using the <TT>shift</TT>
builtin.

<DT><TT>-K</TT>
<DD>
With this option, the arrays specified with the <TT>-a</TT> and <TT>-A</TT>
options and with the `<TT>=</TT><VAR>array</VAR>' forms are kept unchanged when none
of the <VAR>specs</VAR> for them is used.  This allows assignment of default
values to them before calling <TT>zparseopts</TT>.

<DT><TT>-E</TT>
<DD>
This changes the parsing rules to <EM>not</EM> stop at the first string
that isn't described by one of the <VAR>spec</VAR>s.  It can be used to test
for or (if used together with <TT>-D</TT>) extract options and their
arguments, ignoring all other options and arguments that may be in the
positional parameters.

</DL>

For example,


<PRE>
set -- -a -bx -c y -cz baz -cend
zparseopts a=foo b:=bar c+:=bar
</PRE>

will have the effect of


<PRE>
foo=(-a)
bar=(-b x -c y -c z)
</PRE>

The arguments from `<TT>baz</TT>' on will not be used.

As an example for the <TT>-E</TT> option, consider:


<PRE>
set -- -a x -b y -c z arg1 arg2
zparseopts -E -D b:=bar
</PRE>

will have the effect of


<PRE>
bar=(-b y)
set -- -a x -c z arg1 arg2
</PRE>

I.e., the option <TT>-b</TT> and its arguments are taken from the
positional parameters and put into the array <TT>bar</TT>.

</DL>

<P><HR><P>
Go to the <A HREF="zsh_1.html">first</A>, <A HREF="zsh_20.html">previous</A>, <A HREF="zsh_22.html">next</A>, <A HREF="zsh_29.html">last</A> section, <A HREF="zsh_toc.html">table of contents</A>.
</BODY>
</HTML>