zsh-3.1.5-pws-21

This commit is contained in:
Tanaka Akira
1999-06-08 09:25:39 +00:00
parent f42e3fa8e6
commit 805381040d
89 changed files with 3171 additions and 474 deletions

1238
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
DISTFILES_SRC='
.distfiles README
.distfiles README Makefile.in
'

View File

@@ -1,6 +1,6 @@
DISTFILES_SRC='
.distfiles
_brace_parameter _command_names _condition _default _equal
_brace_parameter _command_names _condition _default _equal _first
_long_options _math _parameter _precommand _redirect _subscript
_tilde _vars
'

View File

@@ -1,9 +1,19 @@
#compdef -brace-parameter-
setopt localoptions extendedglob
local lp ls n q suf=''
if [[ "$SUFFIX" = *\}* ]]; then
ISUFFIX="${SUFFIX#*\}}$ISUFFIX"
SUFFIX="${SUFFIX%%\}*}"
_parameters -S '} ' -r '-:?#%+=[/'
else
_parameters -S '} ' -r '-:?#%+=[/'
suf='} '
fi
lp="$LBUFFER[1,-${#PREFIX}-1]"
ls="$RBUFFER[${#SUFFIX}+1,-1]"
n=${(M)#ls##\"#}
q=${(M)lp%%\"#}
_parameters -s "${q[1,-n-1]}" -S "$suf" -r '-:?#%+=[/'

63
Completion/Base/_first Normal file
View File

@@ -0,0 +1,63 @@
#compdef -first-
# This function is called at the very beginning before any other
# function for a specific context.
#
# This just gives some examples of things you might want to do here.
#
#
# If you use the vared builtin and want completion in there to act the
# way completion on the right hand side of assignments is done, add
# (or un-comment) this code:
#
# if [[ -n $compstate[vared] ]]; then
# if [[ $compstate[vared] = *\[* ]]; then
# # vared on an array-element
# compstate[parameter]=${compstate[vared]%%\[*}
# compstate[context]=value
# else
# # vared on a parameter, let's see if it is an array
# compstate[parameter]=$compstate[vared]
# if [[ ${(tP)compstate[vared]} = *(array|assoc)* ]]; then
# compstate[context]=array_value
# else
# compstate[context]=value
# fi
# fi
# return
# fi
#
#
#
# Other things you can do here is to complete different things if the
# word on the line matches a certain pattern. This example allows
# completion of words from the history by adding two commas at the end
# and hitting TAB.
#
# if [[ "$PREFIX" = *,, ]]; then
# local max i=1
#
# PREFIX="$PREFIX[1,-2]"
# # If a numeric prefix is given, we use it as the number of
# # lines (multiplied by ten below) in the history to search.
# if [[ NUMERIC -gt 1 ]]; then
# max=$NUMERIC
# NUMERIC=1
# else
# # The default is to search the last 100 lines.
# max=10
# fi
# # We first search in the last ten lines, then in the last
# # twenty lines, and so on...
# while [[ i -le max ]]; do
# if compgen -X "%Bhistory ($n):%b" -Q -H $(( i*10 )) ''; then
# # We have found at least one matching word, so we switch
# # on menu-completion and make sure that no other
# # completion function is called by setting _comp_skip.
# compstate[insert]=menu
# _comp_skip=1
# return
# fi
# (( i++ ))
# done
# fi

View File

@@ -7,11 +7,11 @@
# a command that does not support this option.
#
# For options that get an argument after a `=', the function also tries
# to automatically find out what should be complete as the argument.
# to automatically find out what should be completed as the argument.
# The possible completions for option-arguments can be described with
# the arguments to this function. This is done by giving pairs of
# patterns and actions as consecutive arguments. The actions specify
# what should be done to complete arguemts of those options that match
# what should be done to complete arguments of those options that match
# the pattern. The action may be a list of words in brackets or in
# parentheses, separated by spaces. A list in brackets denotes
# possible values for an optional argument, a list in parentheses
@@ -27,18 +27,18 @@
# This makes `yes' and `no' be completed as the argument of options
# whose description ends in a star, file names for options that
# contain the substring `=FILE' in the description, and paths for
# options whose description contains `=DIR'. Note the last two
# options whose description contains `=DIR'. Note that the last two
# patterns are not needed since this function always completes files
# for option descriptions containing `=FILE' and paths for option
# descriptions that contain `=DIR' or `=PATH'. These builtin patterns
# can be overridden by patterns given as arguments, though.
#
# This function accepts following options:
# This function accepts the following options:
#
# -t do completion only on words starting with two hyphens
#
# -i list of patterns. Options, matching these patterns, are ignored.
# The list may be given as array name or as literal list in braces.
# The list may be given as a array name or as a literal list in braces.
# E.g. _long_options -i '(--(enable|disable)-FEATURE*)' will ignore
# --enable-FEATURE, that is listed in configure help output
#

View File

@@ -1,7 +1,8 @@
DISTFILES_SRC='
.distfiles
_approximate _closequotes _compalso _complete _correct _expand _files
_list _main_complete _match _menu _multi_parts _normal _oldlist _options
_parameters _path_files _sep_parts _set_options _unset_options
_approximate _compalso _complete _correct _expand
_files _list _main_complete _match _menu _multi_parts
_normal _oldlist _options _parameters _path_files
_sep_parts _set_options _unset_options
compdump compinit compinstall
'

View File

@@ -1,9 +1,9 @@
#autoload
# This code will try to correct the string on the line based on the
# strings generated for the context if `compconfig[correct]' is set.
# These corrected strings will be shown in a list and one can
# cycle through them as in a menucompletion or get the corrected prefix.
# strings generated for the context. These corrected strings will be
# shown in a list and one can cycle through them as in a menucompletion
# or get the corrected prefix.
#
# Supported configuration keys:
#
@@ -64,7 +64,7 @@
local _comp_correct _correct_prompt comax
local cfgacc cfgorig cfgps cfgins
# Only if all global matchers hav been tried.
# Only if all global matchers have been tried.
[[ compstate[matcher] -ne compstate[total_matchers] ]] && return 1
@@ -153,7 +153,7 @@ compgen() {
_comp_correct=1
compstate[matcher]=-1
_correct_prompt="${cfgps//\%e/1}"
_correct_prompt="${cfgps//\\%e/1}"
# We also need to set `extendedglob' and make the completion
# code behave as if globcomplete were set.
@@ -188,7 +188,7 @@ while [[ _comp_correct -le comax ]]; do
[[ "${#:-$PREFIX$SUFFIX}" -le _comp_correct+1 ]] && break
(( _comp_correct++ ))
_correct_prompt="${cfgps//\%e/$_comp_correct}"
_correct_prompt="${cfgps//\\%e/$_comp_correct}"
done
compstate[matcher]="$compstate[total_matchers]"

View File

@@ -6,6 +6,15 @@
local comp name
# If we have a user-supplied context name, use only that.
if [[ -n "$compcontext" ]]; then
comp="$_comps[$compcontext]"
[[ -z "$comp" ]] || "$comp"
return
fi
# An entry for `-first-' is the replacement for `compctl -T'
# Completion functions may set `_compskip' to any value to make the
# main loops stop calling other completion functions.
@@ -20,6 +29,7 @@ if [[ ! -z "$comp" ]]; then
fi
fi
# For arguments and command names we use the `_normal' function.
if [[ "$compstate[context]" = command ]]; then

View File

@@ -1,8 +1,8 @@
#autoload
# This is mainly a wrapper around the more general `_approximate.
# This is mainly a wrapper around the more general `_approximate'.
# By setting `compstate[pattern_match]' to something unequal to `*' and
# then calling `_approximate, we get only corrections, not all strings
# then calling `_approximate', we get only corrections, not all strings
# with the corrected prefix and something after it.
#
# Supported configuration keys are the same as for `_approximate', only

View File

@@ -132,7 +132,7 @@ else
if [[ -z "$compconfig[expand_prompt]" ]]; then
compadd -UQ $group _expand - "$exp[@]"
else
compadd -UQ -X "${compconfig[expand_prompt]//\%o/$word}" \
compadd -UQ -X "${compconfig[expand_prompt]//\\%o/$word}" \
$group _expand - "$exp[@]"
fi
[[ "$compconfig[expand_menu]" != *last* &&

View File

@@ -1,7 +1,7 @@
#autoload
# Utility function for completing files of a given type or any file.
# In many cases you will want to call this one instead of _path_files().
# In many cases you will want to call this one instead of `_path_files'.
local nm=$compstate[nmatches] ret=1
@@ -12,9 +12,9 @@ if [[ $# -ne 0 && compstate[nmatches] -eq nm ]]; then
# We didn't get any matches for those types of files described by
# the `-g' or `-/' option. Now we try it again accepting all files.
# First we get those options that we have to use even if then. If
# we find out that the `-f' option was given, we already accepted
# all files and give up immediatly.
# First we get those options that we have to use even then. If we
# find out that the `-f' option was given, we already accepted all
# files and give up immediatly.
opts=()
while getopts "P:S:W:F:J:V:X:f/g:" opt; do

View File

@@ -1,8 +1,8 @@
#autoload
# This completer function makes the other completer functions used
# insert possible completions only after once the list has been
# shown.
# insert possible completions only after the list has been shown at
# least once.
#
# Configuration keys:
#

View File

@@ -3,7 +3,7 @@
local comp command cmd1 cmd2 pat val name i ret=1
# Completing in command position? If not we set up `cmd1' and `cmd2' as
# two strings we have search in the completion definition arrays (e.g.
# two strings we have to search in the completion definition arrays (e.g.
# a path and the last path name component).
command="$words[1]"

View File

@@ -1,8 +1,7 @@
#autoload
# This should be used to complete parameter names if you need some of the
# extra options of compadd. It first tries to complete only non-local
# parameters. All arguments are given to compadd.
# extra options of compadd. It completes only non-local parameters. All
# arguments are given to compadd.
compadd "$@" - "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }" ||
compadd "$@" - "${(@)${(@)${(@f)$(typeset)}%%\=*}##* }"
compadd "$@" - "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }"

View File

@@ -9,7 +9,7 @@
#
# _sep_parts '(foo bar)' @ hosts
#
# This will make this function complete the strings `foo' and `bar'
# This will make this function complete the strings `foo' and `bar'.
# If the string on the line contains a `@', the substring after it
# will be completed from the array `hosts'. Of course more arrays
# may be given, each preceded by another separator string.

View File

@@ -2,7 +2,7 @@
# functions and aliases. Everything else is split into different files that
# will automatically be made autoloaded (see the end of this file).
# The names of the files that will be considered for autoloading have to
# start with an underscores (like `_setopt).
# start with an underscores (like `_setopt').
# The first line of these files will be read and has to say what should be
# done with its contents:
#
@@ -50,11 +50,11 @@
_i_fdir=''
_i_dumpfile=''
_i_autodump=0
while [[ $1 = -[df] ]]; do
while [[ $# -gt 0 && $1 = -[df] ]]; do
if [[ "$1" = -d ]]; then
_i_autodump=1
shift
if [[ -n "$1" && "$1" != -[df] ]]; then
if [[ $# -gt 0 && "$1" != -[df] ]]; then
_i_dumpfile="$1"
shift
fi
@@ -91,13 +91,31 @@ elif [[ -n $_i_fdir ]]; then
# We were told what directory to use.
compconfig[dumpfile]="$_i_fdir/compinit.dump"
else
# Now we're stuck, but we'd better do something.
compconfig[dumpfile]="$HOME/.compinit.dump"
compconfig[dumpfile]=''
fi
compconfig[correct_accept]=2n
compconfig[correct_prompt]='correct to:'
compconfig[completer]=_complete
if [[ -n $compconfig[dumpfile] ]]; then
# Check the file is writeable. If it doesn't exist, the
# only safe way is to try and create it.
if [[ -f $compconfig[dumpfile] ]]; then
[[ -w $compconfig[dumpfile] ]] || compconfig[dumpfile]=''
elif touch $compconfig[dumpfile] >& /dev/null; then
rm -f $compconfig[dumpfile]
else
compconfig[dumpfile]=''
fi
fi
if [[ -z $compconfig[dumpfile] ]]; then
# If no dumpfile given, or it was not writeable, then use
# user's ZDOTDIR.
compconfig[dumpfile]="${ZDOTDIR:-$HOME}/.zcompdump"
fi
(( ${+compconfig[correct_accept]} )) || compconfig[correct_accept]=2n
(( ${+compconfig[correct_prompt]} )) ||
compconfig[correct_prompt]='correct to:'
(( ${+compconfig[completer]} )) || compconfig[completer]=_complete
# This function is used to register or delete completion functions. For
# registering completion functions, it is invoked with the name of the

86
Completion/Makefile.in Normal file
View File

@@ -0,0 +1,86 @@
#
# Makefile for Completion subdirectory
#
# Copyright (c) 1999 Peter Stephensons
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Peter Stephenson or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Peter Stephenson and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Peter Stephenson and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Peter Stephenson and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
subdir = Completion
dir_top = ..
SUBDIRS =
@VERSION_MK@
# source/build directories
VPATH = @srcdir@
sdir = @srcdir@
sdir_top = @top_srcdir@
INSTALL = @INSTALL@
@DEFS_MK@
# ========== DEPENDENCIES FOR BUILDING ==========
all:
# ========== DEPENDENCIES FOR INSTALLING ==========
install: install.fns
uninstall: uninstall.fns
# install functions, including those in subdirectories, creating
# install directory if necessary
install.fns:
if test x$(fndir) != x && test x$(fndir) != xno; then \
$(sdir_top)/mkinstalldirs $(fndir) || exit 1; \
for file in $(FUNCTIONS_INSTALL); do \
if test -f $$file; then \
$(INSTALL_DATA) $$file $(fndir) || exit 1; \
fi; \
done; \
fi; \
exit 0
uninstall.fns:
if test x$(fndir) != x && test x$(fndir) != xno; then \
for file in $(FUNCTIONS_INSTALL); do \
if test -f $$file; then \
rm -f "$(fndir)/`echo $$file | sed -e 's%^.*/%%'`"; \
fi; \
done; \
fi; \
exit 0
# ========== DEPENDENCIES FOR CLEANUP ==========
@CLEAN_MK@
mostlyclean-here:
distclean-here:
realclean-here:
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@CONFIG_MK@

View File

@@ -1,3 +1,4 @@
#compdef make gmake pmake
compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print \$1}' FS=: [mM]akefile /dev/null)"
compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" ||
_files

View File

@@ -57,7 +57,7 @@ else
# Generate sequences.
local foldnam folddir f ret
for f in $argv; do
for f in $words; do
[[ $f = [@+]* ]] && foldnam=$f
done
if [[ $foldnam = '+'* ]]; then

View File

@@ -1,4 +1,4 @@
DISTFILES_SRC='
.distfiles
.distfiles .cvsignore
clean.mk config.mk defs.mk.in version.mk
'

View File

@@ -25,7 +25,7 @@
#
config: Makefile
@subdir='$(SUBDIRS)'; for subdir in $$subdirs; do \
@subdirs='$(SUBDIRS)'; for subdir in $$subdirs; do \
(cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
done

View File

@@ -36,6 +36,7 @@ libdir = @libdir@
MODDIR = $(libdir)/zsh/$(VERSION)
infodir = @infodir@
mandir = @mandir@
fndir = @fndir@
# compilation
CC = @CC@
@@ -65,6 +66,9 @@ YODL2HTML = $(YODL)2html
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
# variables used in determining what to install
FUNCTIONS_INSTALL = @FUNCTIONS_INSTALL@
# flags passed to recursive makes in subdirectories
MAKEDEFS = \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
@@ -74,7 +78,8 @@ LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \
LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \
LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \
AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)'
AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' \
FUNCTIONS_INSTALL='$(FUNCTIONS_INSTALL)'
# override built-in suffix list
.SUFFIXES:

View File

@@ -27,5 +27,5 @@
# This must also serve as a shell script, so do not add spaces around the
# `=' signs.
VERSION=3.1.5-pws-20
VERSION_DATE='May 25, 1999'
VERSION=3.1.5-pws-21
VERSION_DATE='June 6, 1999'

View File

@@ -174,7 +174,7 @@ install.man: $(MAN)
# install info pages, creating install directory if necessary
install.info: zsh.info
$(sdir_top)/mkinstalldirs $(infodir)
for file in zsh.info zsh.info-[1-9]; do \
for file in zsh.info zsh.info-[1-9]*; do \
if test -f $$file; then \
$(INSTALL_DATA) $$file $(infodir); \
elif test -f $(sdir)/$$file; then \
@@ -198,7 +198,7 @@ uninstall.man:
# uninstall info pages
uninstall.info:
rm -f $(infodir)/zsh.info $(infodir)/zsh.info-[1-9]
rm -f $(infodir)/zsh.info $(infodir)/zsh.info-[1-9]*
# ========== DEPENDENCIES FOR CLEANUP ==========

View File

@@ -1,10 +1,12 @@
DISTFILES_SRC='
.distfiles
arith.yo builtins.yo compat.yo compctl.yo compwid.yo cond.yo exec.yo
expn.yo filelist.yo files.yo func.yo grammar.yo guide.yo index.yo intro.yo
invoke.yo jobs.yo metafaq.yo mod_cap.yo mod_clone.yo mod_comp1.yo
arith.yo builtins.yo compat.yo compctl.yo compsys.yo compwid.yo
cond.yo exec.yo expn.yo filelist.yo files.yo func.yo grammar.yo
guide.yo index.yo intro.yo invoke.yo jobs.yo metafaq.yo
mod_cap.yo mod_clone.yo mod_comp1.yo
mod_compctl.yo mod_deltochar.yo mod_example.yo mod_files.yo
mod_mapfile.yo mod_sched.yo mod_stat.yo mod_zftp.yo mod_zle.yo
mod_mapfile.yo mod_parameter.yo mod_sched.yo mod_stat.yo
mod_zftp.yo mod_zle.yo
modules.yo options.yo params.yo
prompt.yo redirect.yo restricted.yo seealso.yo zle.yo
prompt.yo redirect.yo restricted.yo seealso.yo zftpsys.yo zle.yo
'

View File

@@ -315,9 +315,9 @@ With the tt(-D) flag, tt(fc) prints elapsed times.
cindex(history, file)
cindex(file, history)
tt(fc -R) reads the history from the given file,
tt(fc -W) writes the history out to the given file,
and tt(fc -A) appends the history out to the given file.
`tt(fc -R)' reads the history from the given file,
`tt(fc -W)' writes the history out to the given file,
and `tt(fc -A)' appends the history out to the given file.
If no filename is specified, the tt($HISTFILE) is assumed.
If the tt(-I) option is added to tt(-R), only those events that are
not already contained within the internal history list are added.

View File

@@ -7,19 +7,15 @@ cindex(compatibility)
cindex(sh, compatibility)
cindex(ksh, compatibility)
Zsh tries to emulate bf(sh) or bf(ksh) when it is invoked as
tt(sh) or tt(ksh) respectively. More precisely, it looks at the first
letter of the name passed to it, which may not necessarily be the
name of the executable file, ignoring any initial `tt(-)' as well as
`tt(r)' (for restricted); an `tt(s)' or `tt(b)' will force
bf(sh) compatibility, while `tt(k)' will force bf(ksh) compatibility. An
exception is if the name excluding any `tt(-)' is tt(su), in which case
the environment variable tt(SHELL) will be used to test the emulation;
this is to workaround a problem under some operating systems where the
tt(su) command does not change the name when executing a user shell. Note
that, from within zsh itself, this mechanism can be invoked by `tt(ARGV0=sh
zsh ...)'.
tt(sh) or tt(ksh) respectively; more precisely, it looks at the first
letter of the name by which it was invoked, excluding any initial `tt(r)'
(assumed to stand for `restricted'), and if that is `tt(s)' or `tt(k)' it
will emulate bf(sh) or bf(ksh). Furthermore, if invoked as tt(su) (which
happens on certain systems when the shell is executed by the tt(su)
command), the shell will try to find an alternative name from the tt(SHELL)
environment variable and perform emulation based on that.
In this emulation mode, the following
In bf(sh) and bf(ksh) compatibility modes the following
parameters are not special and not initialized by the shell:
tt(ARGC),
tt(argv),

View File

@@ -128,7 +128,7 @@ list([ tt(-K) var(function) ] [ tt(-i) var(function) ])
list([ tt(-Q) ] [ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
list([ tt(-W) var(file-prefix) ] [ tt(-H) var(num pattern) ])
list([ tt(-q) ] [ tt(-X) var(explanation) ] [ tt(-Y) var(explanation) ])
list([ tt(-y) var(func-or-var) ] [ tt(-l) var(cmd) ] [ tt(-U) ])
list([ tt(-y) var(func-or-var) ] [ tt(-l) var(cmd) ] [ tt(-h) var(cmd) ] [ tt(-U) ])
list([ tt(-t) var(continue) ] [ tt(-J) var(name) ] [ tt(-V) var(name) ])
list([ tt(-M) var(match-spec) ])
endlist()
@@ -401,6 +401,15 @@ completes arguments between `tt(-exec)' and the following `tt(;)' (or the end
of the command line if there is no such string) as if they were
a separate command line.
)
item(tt(-h) var(cmd))(
Normally zsh completes quoted strings as a whole. With this option,
completion can be done separately on different parts of such
strings. It works like the tt(-l) option but makes the completion code
work on the parts of the current word that are separated by
spaces. These parts are completed as if they were arguments to the
given var(cmd). If var(cmd) is the empty string, the first part is
completed as a command name, as with tt(-l).
)
item(tt(-U))(
Use the whole list of possible completions, whether or not they
actually match the word on the command line. The word typed so far
@@ -631,6 +640,12 @@ omitted, it matches if the cursor is after a word with prefix var(str1).
item(tt(R[)var(str1)tt(,)var(str2)tt(])...)(
Like tt(r) but using pattern matching instead.
)
item(tt(q[)var(str)tt(])...)(
Matches the word currently being completed is in single quotes and the
var(str) begins with the letter `s', or if completion is done in
double quotes and var(str) starts with the letter `d', or if
completion is done in backticks and var(str) starts with a `b'.
)
enditem()
texinode(Matching Control)(Example)(Extended Completion)(Programmable Completion)

View File

@@ -89,9 +89,11 @@ To speed up the running of tt(compinit), it can be made to produce a dumped
configuration which will be read in on future invocations. The easiest way
to do this is by adding the option tt(-d) whenever tt(compinit) is sourced.
In this case the dumped file will have the same name as the sourced file,
but with tt(.dump) appended to the end; alternatively, an explicit file
name can be given following the tt(-d). On the next call to tt(compinit
-d), the dumped file will be read instead.
but with tt(.dump) appended to the end, or, if that is not writeable by the
user, the file tt(.zcompdump) in the same directory as the startup files
(i.e. tt($ZDOTDIR) or tt($HOME)); alternatively, an explicit file name can
be given following the tt(-d). On the next call to tt(compinit -d), the
dumped file will be read instead.
The other option accepted by tt(compinit) is tt(-f var(dir)), which gives
the directory in which tt(compinit) resides. If you source tt(compinit) by
@@ -331,6 +333,11 @@ Default implementations are supplied for each of these
contexts, in most cases named after the context itself
(e.g. completion for the `tt(-tilde-)' context is done by the function
named `tt(_tilde)').
Before trying to find a function for a specific context, tt(_complete)
checks if the parameter `tt(compcontext)' is set to a non-empty
value. If it is, the value is taken as the name of the context to use
and the function defined for that context will be called.
)
item(tt(_approximate))(
This completer function uses the tt(_complete) completer to generate
@@ -615,13 +622,6 @@ list of completions.
)
enditem()
)
item(tt(_closequotes))(
When a completion starts in quotes, this completer will recognise the fact
and insert a matching closing quote if there is not already one later on
the line. It should come earlier in the list of completers than any of the
completers which generate matches. It can be confused by some of the more
sophisticated forms of completion.
)
enditem()
texinode(Completion Functions)()(Control Functions)(Completion System)

View File

@@ -81,6 +81,13 @@ nofill(PREFIX=${PREFIX#*=})
causes the part of the prefix up to and including the first equal sign not
to be treated as part of a matched string.
)
item(tt(QIPREFIX))(
This parameter is read-only and contains the quoted string up to the
word being completed. E.g. when completing `tt("foo)', this parameter
contains the double quote. If the tt(-q) option of tt(compset) is used
(see below), and the original string was `tt("foo bar)' with the
cursor on the `tt(bar)', this parameter contains `tt("foo )'.
)
item(tt(SUFFIX))(
Initially this will be set to the part of the current word from the
cursor position to the end; it may be altered to give a common suffix for
@@ -93,6 +100,9 @@ As tt(IPREFIX), but for a suffix that should not be considered part
of the matches; note that the tt(ISUFFIX) string follows the tt(SUFFIX)
string.
)
item(tt(QISUFFIX))(
Like tt(QIPREFIX), but containing the suffix.
)
item(tt(compstate))(
This is an associative array with various keys and values that the
completion code uses to exchange information with the completion widget.
@@ -544,7 +554,8 @@ xitem(tt(compset -P) [ var(number) ] var(pattern))
xitem(tt(compset -s) var(number))
xitem(tt(compset -S) [ var(number) ] var(pattern))
xitem(tt(compset -n) var(begin) [ var(end) ])
item(tt(compset -N) var(beg-pat) [ var(end-pat) ])(
xitem(tt(compset -N) var(beg-pat) [ var(end-pat) ])
item(tt(compset -q))(
This command simplifies modification of the special parameters,
while its return value allows tests on them to be carried out.
@@ -607,6 +618,13 @@ matching tt(end-pat) are also removed from the tt(words)
array. If tt(words) contains no word matching var(end-pat), the
testing and modification is performed as if it were not given.
)
item(tt(-q))(
If the cursor is currently inside single or double quotes, the word
currenly being completed is split in separate words at the spaces. The
resulting words are stored in the tt(words) array, and tt(PREFIX),
tt(SUFFIX), tt(QIPREFIX), and tt(QISUFFIX) are modified to reflect the
word part that is completed.
)
enditem()
In all the above cases the return value is zero if the test succeded

View File

@@ -332,9 +332,9 @@ a letter, digit, or underscore that is not to be interpreted
as part of var(name). In addition, more complicated forms of substitution
usually require the braces to be present; exceptions, which only apply if
the option tt(KSH_ARRAYS) is not set, are a single subscript or any colon
modifiers appearing after the name, or any of the characters tt(^), tt(=),
tt(~), tt(#) or tt(+) appearing before the name, all of which work with or
without braces.
modifiers appearing after the name, or any of the characters `tt(^)',
`tt(=)', `tt(~)', `tt(#)' or `tt(+)' appearing before the name, all of
which work with or without braces.
If var(name) is an array parameter, then the value of each
element of var(name) is substituted, one element per word.
@@ -375,8 +375,8 @@ containing a colon, then the shell only checks whether
var(name) is set, not whether its value is null.
In the following expressions, when var(name) is an array and
the substitution is not quoted, or if the tt((@)) flag or the
`var(name)tt([@])' syntax is used, matching and replacement is
the substitution is not quoted, or if the `tt((@))' flag or the
var(name)tt([@]) syntax is used, matching and replacement is
performed on each array element separately.
startitem()
@@ -404,7 +404,7 @@ item(tt(${)var(name)tt(:#)var(pattern)tt(}))(
If the var(pattern) matches the value of var(name), then substitute
the empty string; otherwise, just substitute the value of var(name).
If var(name) is an array
the matching array elements are removed (use the tt((M)) flag to
the matching array elements are removed (use the `tt((M))' flag to
remove the non-matched elements).
)
xitem(tt(${)var(name)tt(/)var(pattern)tt(/)var(repl)tt(}))
@@ -412,15 +412,15 @@ item(tt(${)var(name)tt(//)var(pattern)tt(/)var(repl)tt(}))(
Replace by string var(repl), the longest possible match of
var(pattern) in the expansion of parameter var(name). The first form
replaces just the first occurrence, the second form all occurrences.
The var(pattern) may begin with a var(#), in which case the
var(pattern) must match at the start of the string, or var(%), in
The var(pattern) may begin with a `tt(#)', in which case the
var(pattern) must match at the start of the string, or `tt(%)', in
which case it must match at the end of the string. The var(repl) may
be an empty string, in which case the final tt(/) may also be omitted.
To quote the final tt(/) in other cases it should be preceded by two
be an empty string, in which case the final `tt(/)' may also be omitted.
To quote the final `tt(/)' in other cases it should be preceded by two
backslashes (i.e., a quoted backslash); this is not necessary if the
tt(/) occurs inside a substituted parameter.
`tt(/)' occurs inside a substituted parameter.
The first tt(/) may be preceded by a tt(:), in which case the match
The first `tt(/)' may be preceded by a `tt(:)', in which case the match
will only succeed if it matches the entire word. Note also the
effect of the tt(I) and tt(S) parameter expansion flags below; however,
the flags tt(M), tt(R), tt(B), tt(E) and tt(N) are not useful.
@@ -431,7 +431,7 @@ nofill(tt(foo="twinkle twinkle little star" sub="t*e" rep="spy")
tt(print ${foo//${~sub}/$rep})
tt(print ${(S)foo//${~sub}/$rep}))
Here, the tt(~) ensures that the text of tt($sub) is treated as a
Here, the `tt(~)' ensures that the text of tt($sub) is treated as a
pattern rather than a plain string. In the first case, the longest
match for tt(t*e) is substituted and the result is `tt(spy star)',
while in the second case, the shortest matches are taken and the
@@ -442,8 +442,8 @@ If var(spec) is one of the above substitutions, substitute
the length in characters of the result instead of
the result itself. If var(spec) is an array expression,
substitute the number of elements of the result.
Note that tt(^), tt(=), and tt(~), below, must appear
to the left of tt(#) when these forms are combined.
Note that `tt(^)', `tt(=)', and `tt(~)', below, must appear
to the left of `tt(#)' when these forms are combined.
)
item(tt(${^)var(spec)tt(}))(
pindex(RC_EXPAND_PARAM, use of)
@@ -452,7 +452,7 @@ cindex(rc, array expansion style)
Turn on the tt(RC_EXPAND_PARAM) option for the
evaluation of var(spec); if the `tt(^)' is doubled, turn it off.
When this option is set, array expansions of the form
`var(foo)tt(${)var(xx)tt(})var(bar)',
var(foo)tt(${)var(xx)tt(})var(bar),
where the parameter var(xx)
is set to tt(LPAR())var(a b c)tt(RPAR()), are substituted with
`var(fooabar foobbar foocbar)' instead of the default
@@ -498,10 +498,19 @@ tt($LPAR())...tt(RPAR()) type command substitution is used in place of
var(name) above, it is expanded first and the result is used as if
it were the value of var(name). Thus it is
possible to perform nested operations: tt(${${foo#head}%tail})
substitutes the value of tt($foo) with both tt(head) and tt(tail)
substitutes the value of tt($foo) with both `tt(head)' and `tt(tail)'
deleted. The form with tt($LPAR())...tt(RPAR()) is often useful in
combination with the flags described next; see the examples below.
Note that double quotes may appear around nested substitutions, in which
case only the part inside is treated as quoted; for example,
tt(${(f)"$(foo)"}) quotes the result of tt($(foo)), but the flag `tt((f))'
(see below) is applied using the rules for unquoted substitutions. Note
further that quotes are themselves nested in this context; for example, in
tt("${(@f)"$(foo)"}"), there are two sets of quotes, one surrounding the
whole expression, the other (redundant) surrounding the tt($(foo)) as
before.
subsect(Parameter Expansion Flags)
cindex(parameter expansion flags)
cindex(flags, parameter expansion)
@@ -526,8 +535,8 @@ when creating an associative array.
)
item(tt(@))(
In double quotes, array elements are put into separate words.
E.g., `tt("${(@)foo}")' is equivalent to `tt("${foo[@]}")' and
`tt("${(@)foo[1,2]}")' is the same as `tt("$foo[1]" "$foo[2]")'.
E.g., tt("${(@)foo}") is equivalent to tt("${foo[@]}") and
tt("${(@)foo[1,2]}") is the same as tt("$foo[1]" "$foo[2]").
)
item(tt(e))(
Perform em(parameter expansion), em(command substitution) and
@@ -541,7 +550,7 @@ type parameter expression or a tt($LPAR())...tt(RPAR()) type command
substitution in place of the parameter name this flag makes the result
of the expansion be taken as a parameter name which is then
used. E.g. if you have `tt(foo=bar)' and `tt(bar=baz)', the strings
`tt(${(P)foo})' and `tt(${(P)${foo}})' will be expanded to `tt(baz)'.
tt(${(P)foo}) and tt(${(P)${foo}}) will be expanded to `tt(baz)'.
)
item(tt(o))(
Sort the resulting words in ascending order.
@@ -722,7 +731,7 @@ outermost. The flags are not propagated up to enclosing
substitutions; the nested subsitution will return either a scalar or an
array as determined by the flags, possibly adjusted for quoting. All the
following steps take place where applicable at all levels of substitution.
Note that, unless the tt((P)) flag is present, the flags and any subscripts
Note that, unless the `tt((P))' flag is present, the flags and any subscripts
apply directly to the value of the nested substitution; for example, the
expansion tt(${${foo}}) behaves exactly the same as tt(${foo}).
)
@@ -749,57 +758,57 @@ arrays are not modified). If the tt((j)) flag is present, that is used for
joining instead of tt($IFS).
)
item(tt(5.) em(Nested Subscripting))(
Any remaining subscript (i.e. of a nested substitution) is evaluated at
this point, based on whether the value is an array or a scalar; if it was
an array, a second subscript for the character in the word may also appear.
Note that tt(${foo[2,4][2]}) is thus equivalent to tt(${${foo[2,4]}[2]})
and also to tt("${${(@)foo[2,4]}[2]}") (the nested substitution returns an
array in both cases), but not to tt("${${foo[2,4]}[2]}") (the nested
substitution returns a scalar because of the quotes).
Any remaining subscripts (i.e. of a nested substitution) are evaluated at
this point, based on whether the value is an array or a scalar. As with
tt(2.), multiple subscripts can appear. Note that tt(${foo[2,4][2]}) is
thus equivalent to tt(${${foo[2,4]}[2]}) and also to
tt("${${(@)foo[2,4]}[2]}") (the nested substitution returns an array in
both cases), but not to tt("${${foo[2,4]}[2]}") (the nested substitution
returns a scalar because of the quotes).
)
item(tt(6.) em(Modifiers))(
Any modifiers, as specified by a trailing tt(#), tt(%), tt(/)
Any modifiers, as specified by a trailing `tt(#)', `tt(%)', `tt(/)'
(possibly doubled) or by a set of modifiers of the form tt(:...) (see
noderef(Modifiers) in noderef(History Expansion)), are applied to the words
of the value at this level.
)
item(tt(7.) em(Forced Joining))(
If the tt((j)) flag is present, or no tt((j)) flag is present but
If the `tt((j))' flag is present, or no `tt((j))' flag is present but
the string is to be split as given by rules tt(8.) or tt(9.), and joining
did not take place at step tt(4.), any words in the value are joined
together using the given string or the first character of tt($IFS) if none.
Note that the tt((F)) flag implicitly supplies a string for joining in this
Note that the `tt((F))' flag implicitly supplies a string for joining in this
manner.
)
item(tt(8.) em(Forced Splitting))(
If one of the tt((s)) or tt((f)) flags are present, or the tt(=)
If one of the `tt((s))' or `tt((f))' flags are present, or the `tt(=)'
specifier was present (e.g. tt(${=)var(var)tt(})), the word is split on
occurrences of the specified string, or (for tt(=) with neither of the two
flags present) any of the characters in tt($IFS).
)
item(tt(9.) em(Shell Word Splitting))(
If no tt((s)), tt((f)) or tt(=) was given, but the word is not
If no `tt((s))', `tt((f))' or `tt(=)' was given, but the word is not
quoted and the option tt(SH_WORD_SPLIT) is set, the word is split on
occurrences of any of the characters in tt($IFS). Note this step, too,
take place at all levels of a nested substitution.
)
item(tt(10.) em(Re-Evaluation))(
Any tt((e)) flag is applied to the value, forcing it to be re-examined for
new parameter substitutions, but also for command and arithmetic
Any `tt((e))' flag is applied to the value, forcing it to be re-examined
for new parameter substitutions, but also for command and arithmetic
substitutions.
)
item(tt(11.) em(Padding))(
Any padding of the value by the tt(LPAR()l.)var(fill)tt(.RPAR()) or
tt(LPAR()r.)var(fill)tt(.RPAR()) flags is applied.
Any padding of the value by the `tt(LPAR()l.)var(fill)tt(.RPAR())' or
`tt(LPAR()r.)var(fill)tt(.RPAR())' flags is applied.
)
enditem()
subsect(Examples)
The flag tt(f) is useful to split a double-quoted substitution line by
line. For example, `tt("${(f)$LPAR()<)var(file)tt(RPAR()}")'
line. For example, tt("${(f)$LPAR()<)var(file)tt(RPAR()}")
substitutes the contents of var(file) divided so that each line is
an element of the resulting array. Compare this with the effect of
`tt($)tt(LPAR()<)var(file)tt(RPAR())' alone, which divides the file
tt($)tt(LPAR()<)var(file)tt(RPAR()) alone, which divides the file
up by words, or the same inside double quotes, which makes the entire
content of the file a single string.
@@ -811,19 +820,19 @@ item(tt("${(@)${foo}[1]}"))(
This produces the result tt(b). First, the inner substitution
tt("${foo}"), which has no array (tt(@)) flag, produces a single word
result tt("bar baz"). The outer substitution tt("${(@)...[1]}") detects
that this is a scalar, so that (despite the tt((@)) flag) the subscript
that this is a scalar, so that (despite the `tt((@))' flag) the subscript
picks the first character.
)
item(tt("${${(@)foo}[1]}"))(
The produces the result tt(bar). In this case, the inner substitution
tt("${(@)foo}") produces the array tt(LPAR()bar baz)tt(RPAR()). The outer
The produces the result `tt(bar)'. In this case, the inner substitution
tt("${(@)foo}") produces the array `tt(LPAR()bar baz)tt(RPAR())'. The outer
substitution tt("${...[1]}") detects that this is an array and picks the
first word. This is similar to the simple case tt("${foo[1]}").
)
enditem()
As an example of the rules for word splitting and joining, suppose tt($foo)
contains the array tt(LPAR()ax1 bx1)tt(RPAR()). Then
contains the array `tt(LPAR()ax1 bx1)tt(RPAR())'. Then
startitem()
item(tt(${(s/x/)foo}))(
@@ -1371,21 +1380,21 @@ be taken (e.g. `tt(u:foo:)' or `tt(u[foo])' for user `tt(foo)')
item(tt(g)var(id))(
like tt(u)var(id) but with group IDs or names
)
item(tt(a)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
files accessed exactly var(n) days ago. Files accessed within the
last var(n) days are selected using a negative value for var(n)
(tt(-)var(n)). Files accessed more than var(n) days ago are selected by a
positive var(n) value (tt(PLUS())var(n)). Optional unit specifiers `tt(M)',
`tt(w)', `tt(h)' or `tt(m)' (e.g. `tt(ah5)') cause the check to be
performed with months (of 30 days), weeks, hours, or minutes instead of
days, respectively. For instance, `tt(echo *(ah-5))' would echo files
accessed within the last five hours.
item(tt(a)[tt(Mwhms)][tt(-)|tt(PLUS())]var(n))(
files accessed exactly var(n) days ago. Files accessed within the last
var(n) days are selected using a negative value for var(n) (tt(-)var(n)).
Files accessed more than var(n) days ago are selected by a positive var(n)
value (tt(PLUS())var(n)). Optional unit specifiers `tt(M)', `tt(w)',
`tt(h)', `tt(m)' or `tt(s)' (e.g. `tt(ah5)') cause the check to be
performed with months (of 30 days), weeks, hours, minutes or seconds
instead of days, respectively. For instance, `tt(echo *(ah-5))' would
echo files accessed within the last five hours.
)
item(tt(m)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
item(tt(m)[tt(Mwhms)][tt(-)|tt(PLUS())]var(n))(
like the file access qualifier, except that it uses the file modification
time.
)
item(tt(c)[tt(Mwhm)][tt(-)|tt(PLUS())]var(n))(
item(tt(c)[tt(Mwhms)][tt(-)|tt(PLUS())]var(n))(
like the file access qualifier, except that it uses the file inode change
time.
)

View File

@@ -8,13 +8,12 @@ cindex(shutdown files)
pindex(NO_RCS, use of)
pindex(NO_GLOBAL_RCS, use of)
Commands are first read from tt(/etc/zshenv); this cannot be overridden.
If the tt(RCS) option is unset, no further files are read; changing this
option after this point has no effect on initialization files, but may
affect behaviour on logout. Subsequent behaviour is also modified by the
option tt(GLOBAL_RCS). If it is unset at any point during initialisation,
later files in the tt(/etc) directory will not be read. It is also
possible for a file in tt($ZDOTDIR) to re-enable tt(GLOBAL_RCS). Both
tt(RCS) and tt(GLOBAL_RCS) are set by default.
Subsequent behaviour is modified by the tt(RCS) and
tt(GLOBAL_RCS) options; the former affects all startup files, while the
second only affects those in the tt(/etc) directory. If one of the options
is unset at any point, the corresponding startup file(s) will not be read.
It is also possible for a file in tt($ZDOTDIR) to re-enable
tt(GLOBAL_RCS). Both tt(RCS) and tt(GLOBAL_RCS) are set by default.
Commands are then read from tt($ZDOTDIR/.zshenv).
pindex(LOGIN, use of)
@@ -31,6 +30,9 @@ via the tt(exit) or tt(logout) commands, or an implict exit by reading
end-of-file from the terminal. However, if the shell terminates due
to tt(exec)'ing another process, the logout files are not read.
These are also affected by the tt(RCS) and tt(GLOBAL_RCS) options.
Note also that the tt(RCS) option affects the saving of history files,
i.e. if tt(RCS) is unset when the shell exits, no history file will be
saved.
If tt(ZDOTDIR) is unset, tt(HOME) is used instead.
Those files listed above as being in tt(/etc) may be in another

View File

@@ -31,26 +31,26 @@ tt(http://www.zsh.org/pub/zsh/))
item(Australia)(
nofill(tt(ftp://ftp.zsh.org/pub/zsh/)
tt(http://www.zsh.org/pub/zsh/)
tt(ftp://ftp.ips.oz.au/pub/packages/zsh/) em((G)) em((H)))
tt(ftp://ftp.ips.gov.au/pub/packages/zsh/) em((G)) em((H)))
)
item(Denmark)(
nofill(tt(ftp://sunsite.auc.dk/pub/unix/shells/zsh/))
)
item(Finland)(
nofill(tt(ftp://ftp.funet.fi/pub/unix/shells/zsh/) em((H)))
nofill(tt(ftp://ftp.funet.fi/pub/unix/shells/zsh/))
)
item(France)(
nofill(tt(ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/))
)
item(Germany)(
nofill(tt(ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/) em((H))
tt(ftp://ftp.gmd.de/packages/zsh/) em((H))
tt(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/) em((H)))
tt(ftp://ftp.gmd.de/packages/zsh/)
tt(ftp://ftp.uni-trier.de/pub/unix/shell/zsh/))
)
item(Hungary)(
nofill(tt(ftp://ftp.cs.elte.hu/pub/zsh/)
tt(http://www.cs.elte.hu/pub/zsh/)
tt(ftp://ftp.kfki.hu/pub/packages/zsh/) em((H)))
tt(ftp://ftp.kfki.hu/pub/packages/zsh/))
)
item(Israel)(
nofill(tt(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
@@ -58,10 +58,11 @@ tt(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/))
)
item(Japan)(
nofill(tt(ftp://ftp.tohoku.ac.jp/mirror/zsh/) em((H))
tt(ftp://ftp.nis.co.jp/pub/shells/zsh/) em((H)))
tt(ftp://ftp.nisiq.net/pub/shells/zsh/) em((H))
tt(ftp://ftp.win.ne.jp/pub/shell/zsh/))
)
item(Norway)(
nofill(tt(ftp://ftp.uit.no/pub/unix/shells/zsh/) em((H)))
nofill(tt(ftp://ftp.uit.no/pub/unix/shells/zsh/))
)
item(Romania)(
nofill(tt(ftp://ftp.roedu.net/pub/mirrors/ftp.zsh.org/pub/zsh/))
@@ -70,17 +71,17 @@ item(Slovenia)(
nofill(tt(ftp://ftp.siol.net/pub/unix/shells/zsh/) em((H)))
)
item(Sweden)(
nofill(tt(ftp://ftp.lysator.liu.se/pub/unix/zsh/) em((H)))
nofill(tt(ftp://ftp.lysator.liu.se/pub/unix/zsh/))
)
item(UK)(
nofill(tt(ftp://ftp.net.lut.ac.uk/zsh/) em((H))
tt(ftp://sunsite.doc.ic.ac.uk/packages/unix/shells/zsh/) em((G)))
nofill(tt(ftp://ftp.net.lut.ac.uk/zsh/)
tt(ftp://sunsite.org.uk/packages/zsh/))
)
item(USA)(
nofill(tt(ftp://ftp.math.gatech.edu/pub/zsh/)
tt(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
tt(ftp://ftp.sterling.com/zsh/) em((G)) em((H))
tt(ftp://ftp.rge.com/pub/shells/zsh/) em((G)) em((H))
tt(ftp://ftp.rge.com/pub/shells/zsh/)
tt(ftp://foad.org/pub/zsh/)
tt(http://foad.org/zsh/))
)

View File

@@ -119,7 +119,8 @@ pindex(AUTO_REMOVE_SLASH)
cindex(slash, removing trailing)
item(tt(AUTO_REMOVE_SLASH))(
When the last character resulting from a completion is a slash and the next
character typed is a word delimiter or a slash, remove the slash.
character typed is a word delimiter, a slash, or a character that ends
a command (such as a semicolon or an ampersand), remove the slash.
)
pindex(AUTO_RESUME)
cindex(jobs, resuming automatically)
@@ -304,7 +305,8 @@ cindex(history, timestamping)
item(tt(EXTENDED_HISTORY))(
Save each command's beginning timestamp (in seconds since the epoch)
and the duration (in seconds) to the history file. The format of
this prefixed data is
this prefixed data is:
`tt(:)var(<beginning time>)tt(:)var(<elapsed seconds>)tt(:)var(<command>)'.
)
pindex(FLOW_CONTROL)
@@ -327,15 +329,14 @@ item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)))(
Perform filename generation (globbing).
(See noderef(Filename Generation).)
)
pindex(GLOBAL_RCS_FIRST)
cindex(startup files, changing order)
cindex(files, startup, changing order)
item(tt(GLOBAL_RCS_FIRST) (tt(-d)))(
If this option is set, and the tt(RCS) option is also set (as it is by
default), then the order in which startup files are sourced after
tt(/etc/zshenv) changes to tt(/etc/zprofile), tt(/etc/zshrc),
tt(/etc/zlogin), tt(.zshenv), tt(.zprofile), tt(.zshrc), tt(.zlogin).
The order of tt(.zlogout) and tt(/etc/zlogout) is not affected.
pindex(GLOBAL_RCS)
cindex(startup files, global, inhibiting)
cindex(files, global startup, inhibiting)
item(tt(GLOBAL_RCS) (tt(-d)))(
If this option is unset, the startup files tt(/etc/zprofile),
tt(/etc/zshrc), tt(/etc/zlogin) and tt(/etc/zlogout) will not be run. It
can be disabled and re-enabled at any time, including inside local startup
files (tt(.zshrc), etc.).
)
pindex(GLOB_ASSIGN)
item(tt(GLOB_ASSIGN))(
@@ -409,13 +410,13 @@ isn't there.
pindex(HIST_EXPIRE_DUPS_FIRST)
cindex(history, expiring duplicates)
item(tt(HIST_EXPIRE_DUPS_FIRST))(
If the history needs to be trimmed to add a new line, setting this
option will cause the oldest duplicate history line to be lost before
losing a unique line from the internal history list.
If the internal history needs to be trimmed to add a new line,
setting this option will cause the oldest duplicate history line to
be lost before losing a unique line from the list.
)
pindex(HIST_IGNORE_ALL_DUPS)
cindex(history, ignoring all duplicates)
item(tt(HIST_IGNORE_ALL_DUPS) (tt(-h)))(
item(tt(HIST_IGNORE_ALL_DUPS))(
If a new command line being added to the history list duplicates an
older one, the older command is removed from the list (even if it is
not the previous event).
@@ -482,11 +483,11 @@ to avoid the shell hanging if its tty goes away.
pindex(INC_APPEND_HISTORY)
cindex(history, incremental appending to a file)
item(tt(INC_APPEND_HISTORY))(
This options works like APPEND_HISTORY except that new history lines
are added to the tt($HISTFILE) when they finish running, rather than
waiting until the shell is killed. The file is periodically trimmed
to the number of lines specified by tt($SAVEHIST), but can exceed this
value between trimmings.
This options works like tt(APPEND_HISTORY) except that new history lines
are added to the tt($HISTFILE) incrementally (as soon as they are
entered), rather than waiting until the shell is killed.
The file is periodically trimmed to the number of lines specified by
tt($SAVEHIST), but can exceed this value between trimmings.
)
pindex(INTERACTIVE)
item(tt(INTERACTIVE) (tt(-i), ksh: tt(-i)))(
@@ -568,7 +569,8 @@ tt(XTRACE) and tt(PRINT_EXIT_VALUE) options are restored. Hence
if this is explicitly unset by a shell function the other options in
force at the point of return will remain so.
A shell function can also guarantee itself a known shell configuration
with a formulation like `tt(emulate zsh; setopt localoptions)'.
with a formulation like `tt(emulate -L zsh)'; the tt(-L) activates
tt(LOCAL_OPTIONS).
)
pindex(LOGIN)
item(tt(LOGIN) (tt(-l), ksh: tt(-l)))(
@@ -795,7 +797,10 @@ After tt(/etc/zshenv) is sourced on startup, source the
tt(.zshenv), tt(/etc/zprofile), tt(.zprofile),
tt(/etc/zshrc), tt(.zshrc), tt(/etc/zlogin), tt(.zlogin), and tt(.zlogout)
files, as described in noderef(Files).
If this option is unset, only the tt(/etc/zshenv) file is sourced.
If this option is unset, the tt(/etc/zshenv) file is still sourced, but any
of the others will not be; it can be set at any time to prevent the
remaining startup files after the currently executing one from
being sourced.
)
pindex(REC_EXACT)
cindex(completion, exact matches)
@@ -833,21 +838,22 @@ cindex(history, sharing)
item(tt(SHARE_HISTORY))(
This option both imports new commands from the history file, and also
causes your typed commands to be appended to the history file (like
specifiying tt(INCREMENTAL_APPEND_HISTORY)). The history lines are also
output with timestamps ala tt(EXTENDED_HISTORY) (which makes it easier to
find the spot where we left off reading the file after it gets re-written).
causes your typed commands to be appended to the history file (the
latter is like specifying tt(INC_APPEND_HISTORY)).
The history lines are also output with timestamps ala
tt(EXTENDED_HISTORY) (which makes it easier to find the spot where
we left off reading the file after it gets re-written).
By default, history movement commands visit the imported lines as well as
the local lines, but you can toggle this on and off with the
By default, history movement commands visit the imported lines as
well as the local lines, but you can toggle this on and off with the
set-local-history zle binding. It is also possible to create a zle
widget that will make some commands ignore imported commands, and some
include them.
widget that will make some commands ignore imported commands, and
some include them.
If you find that you want more control over when commands
get imported, you may wish to turn tt(SHARE_HISTORY) off,
tt(INCREMENTAL_APPEND_HISTORY) on, and then manually import
commands whenever you need them using `fc -RI'.
tt(INC_APPEND_HISTORY) on, and then manually import
commands whenever you need them using `tt(fc -RI)'.
)
pindex(SH_FILE_EXPANSION)
cindex(sh, expansion style)

View File

@@ -7,10 +7,10 @@ This describes the set of shell functions supplied with the source
distribution as an interface to the tt(zftp) builtin command, allowing you
to perform FTP operations from the shell command line or within functions
or scripts. The interface is similar to a traditional FTP client (e.g. the
manref(ftp)(1) command itself), but as it is entirely done within the shell
all the familar completion, editing and globbing features, and so on, are
present, and macros are particularly simple to write as they are just
ordinary shell functions.
tt(ftp) command itself, see manref(ftp)(1)), but as it is entirely done
within the shell all the familar completion, editing and globbing features,
and so on, are present, and macros are particularly simple to write as they
are just ordinary shell functions.
The prerequisite is that the tt(zftp) command, as described in
ifzman(\
@@ -20,11 +20,11 @@ ifnzman(\
noderef(The zftp Module)
), must be available in the
version of tt(zsh) installed at your site. If the shell is configured to
load new commands at run time, it probably is: typing tt(zmodload zftp)
load new commands at run time, it probably is: typing `tt(zmodload zftp)'
will make sure (if that runs silently, it has worked). If this is not the
case, it is possible tt(zftp) was linked into the shell anyway: to test
this, type tt(which zftp) and if tt(zftp) is available you will get the
message tt(zftp: shell built-in command).
this, type `tt(which zftp)' and if tt(zftp) is available you will get the
message `tt(zftp: shell built-in command)'.
Commands given directly with tt(zftp) builtin may be interspersed between
the functions in this suite; in a few cases, using tt(zftp) directly may
@@ -43,7 +43,7 @@ sect(Installation)
You should make sure all the functions from the tt(Functions/Zftp)
directory of the source distribution are available; they all begin with the
two letters tt(zf). They may already have been installed on your system;
two letters `tt(zf)'. They may already have been installed on your system;
otherwise, you will need to find them and copy them. The directory should
appear as one of the elements of the tt($fpath) array, and the functions
should be autoloaded. Finally, to initialise the use of the system you
@@ -93,13 +93,13 @@ described below.
Normally, the var(host), var(user) and var(password) are internally
recorded for later re-opening, either by a tt(zfopen) with no arguments, or
automatically (see below). With the option tt(-1), no information is
automatically (see below). With the option `tt(-1)', no information is
stored.
)
item(tt(zfanon [ -1 ] var(host)))(
Open a connection var(host) for anonymous FTP. The username used is
tt(anonymous). The password (which will be reported the first time) is
generated from var(user)tt(@)tt(host); this is then stored in the shell
generated as var(user)tt(@)var(host); this is then stored in the shell
parameter tt($EMAIL_ADDR) which can alternatively be set manually to a
suitable string.
)
@@ -114,9 +114,9 @@ Change the current directory on the remote server: this is implemented to
have many of the features of the shell builtin tt(cd).
In the first form with var(dir) present, change to the directory var(dir).
The command tt(zfcd ..) is treated specially, so is guaranteed to work on
The command `tt(zfcd ..)' is treated specially, so is guaranteed to work on
non-UNIX servers (note this is handled internall by tt(zftp)). If var(dir)
is omitted, has the effect of tt(zfcd ~).
is omitted, has the effect of `tt(zfcd ~)'.
The second form changes to the directory previously current.
@@ -125,22 +125,22 @@ first occurrence of the string var(old) with the string var(new) in the
current directory.
Note that in this command, and indeed anywhere a remote filename is
expected, the string which on the local host corresponds to tt(~) is
converted back to a tt(~) before being passed to the remote machine.
expected, the string which on the local host corresponds to `tt(~)' is
converted back to a `tt(~)' before being passed to the remote machine.
This is convenient because of the way expansion is performed on the command
line before tt(zfcd) receives a string. For example, suppose the command
is tt(zfcd ~/foo). The shell will expand this to a full path as in tt(zfcd
/home/user2/pws/foo). At this stage, tt(zfcd) recognises the initial path
as tt(~), and the directory sent to the remote host is tt(~/foo), so that
the tt(~) will be expanded by the server to the correct remote host
directory. Other named directories of the form tt(~name) are not treated
in this fashion.
is `tt(zfcd ~/foo)'. The shell will expand this to a full path as in
`tt(zfcd /home/user2/pws/foo)'. At this stage, tt(zfcd) recognises the
initial path as `tt(~)', and the directory sent to the remote host is
tt(~/foo), so that the `tt(~)' will be expanded by the server to the
correct remote host directory. Other named directories of the form
`tt(~name)' are not treated in this fashion.
)
item(tt(zfhere))(
Change directory on the remote server to the one corresponding to the
current local directory, with special handling of tt(~) as in tt(zfcd).
current local directory, with special handling of `tt(~)' as in tt(zfcd).
For example, if the current local directory is tt(~/foo/bar), then
tt(zfhere) performs the effect of tt(zfcd ~/foo/bar).
tt(zfhere) performs the effect of `tt(zfcd ~/foo/bar)'.
)
item(tt(zfdir [ -rfd ] [ - ] [ var(dir-options) ] [ var(dir) ]))(
Produce a long directory listing. The arguments var(dir-options) and
@@ -163,7 +163,7 @@ listing.
item(tt(zfls) [ var(ls-options) ] [ var(dir) ])(
List files on the remote server. With no arguments, this will produce a
simple list of file names for the current remote directory. Any arguments
are passed directory to the server. No pager and no caching is used.
are passed directly to the server. No pager and no caching is used.
)
enditem()
@@ -171,9 +171,9 @@ subsect(Status commands)
startitem()
item(tt(zftype) [ var(type) ])(
With no arguments, show the type of data to be transferred, usually ASCII
or binary. With an argument, change the type: the types tt(A) or
tt(ASCII) for ASCII data and tt(B) or tt(BINARY), tt(I) or tt(IMAGE) for
binary data are understood case-insensitively.
or binary. With an argument, change the type: the types `tt(A)' or
`tt(ASCII)' for ASCII data and `tt(B)' or `tt(BINARY)', `tt(I)' or
`tt(IMAGE)' for binary data are understood case-insensitively.
)
item(tt(zfstat) [ -v ])(
Show the status of the current or last connection, as well as the status of
@@ -266,9 +266,9 @@ A problem arises if you attempt to use tt(zfpcp) var(lfile1) var(rdir),
i.e. the second form of copying but with two arguments, as the command has
no simple way of knowing if var(rdir) corresponds to a directory or a
filename. It attempts to resolve this in various ways. First, if the
var(rdir) argument is tt(.) or tt(..) or ends in a slash, it is assumed to
be a directory. Secondly, if the operation of copying to a remote file in
the first form failed, and the remote server sends back the expected
var(rdir) argument is `tt(.)' or `tt(..)' or ends in a slash, it is assumed
to be a directory. Secondly, if the operation of copying to a remote file
in the first form failed, and the remote server sends back the expected
failure code 553 and a reply including the string `tt(Is a directory)',
then tt(zfpcp) will retry using the second form.
)

View File

@@ -33,7 +33,7 @@ COMMENT(--- emphasised text ---)
def(em)(1)(NOTRANS(@emph{)ARG1NOTRANS(}))
def(bf)(1)(NOTRANS(@cite{)ARG1NOTRANS(}))
def(tt)(1)(NOTRANS(@code{)ARG1NOTRANS(}))
def(tt)(1)(NOTRANS(@t{)ARG1NOTRANS(}))
def(var)(1)(NOTRANS(@var{)ARG1NOTRANS(}))
COMMENT(--- man page headers ---)

View File

@@ -1,5 +1,3 @@
DISTFILES_SRC='
.distfiles
acx cat cdmatch cdmatch2 checkmail cx harden mere multicomp proto
pushd randline run-help yp yu zed zls
.distfiles Makefile.in README.zftp
'

86
Functions/Makefile.in Normal file
View File

@@ -0,0 +1,86 @@
#
# Makefile for Functions subdirectory
#
# Copyright (c) 1999 Peter Stephensons
# All rights reserved.
#
# Permission is hereby granted, without written agreement and without
# license or royalty fees, to use, copy, modify, and distribute this
# software and to distribute modified versions of this software for any
# purpose, provided that the above copyright notice and the following
# two paragraphs appear in all copies of this software.
#
# In no event shall Peter Stephenson or the Zsh Development Group be liable
# to any party for direct, indirect, special, incidental, or consequential
# damages arising out of the use of this software and its documentation,
# even if Peter Stephenson and the Zsh Development Group have been advised of
# the possibility of such damage.
#
# Peter Stephenson and the Zsh Development Group specifically disclaim any
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose. The software
# provided hereunder is on an "as is" basis, and Peter Stephenson and the
# Zsh Development Group have no obligation to provide maintenance,
# support, updates, enhancements, or modifications.
#
subdir = Functions
dir_top = ..
SUBDIRS =
@VERSION_MK@
# source/build directories
VPATH = @srcdir@
sdir = @srcdir@
sdir_top = @top_srcdir@
INSTALL = @INSTALL@
@DEFS_MK@
# ========== DEPENDENCIES FOR BUILDING ==========
all:
# ========== DEPENDENCIES FOR INSTALLING ==========
install: install.fns
uninstall: uninstall.fns
# install functions, including those in subdirectories, creating
# install directory if necessary
install.fns:
if test x$(fndir) != x && test x$(fndir) != xno; then \
$(sdir_top)/mkinstalldirs $(fndir) || exit 1; \
for file in $(FUNCTIONS_INSTALL); do \
if test -f $$file; then \
$(INSTALL_DATA) $$file $(fndir) || exit 1; \
fi; \
done; \
fi; \
exit 0
uninstall.fns:
if test x$(fndir) != x && test x$(fndir) != xno; then \
for file in $(FUNCTIONS_INSTALL); do \
if test -f $$file; then \
rm -f "$(fndir)/`echo $$file | sed -e 's%^.*/%%'`"; \
fi; \
done; \
fi; \
exit 0
# ========== DEPENDENCIES FOR CLEANUP ==========
@CLEAN_MK@
mostlyclean-here:
distclean-here:
realclean-here:
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@CONFIG_MK@

View File

@@ -0,0 +1,6 @@
DISTFILES_SRC='
.distfiles
acx allopt cat cdmatch cdmatch2 checkmail cx harden mere multicomp
proto pushd randline run-help yp yu zed zless zls
'

6
Functions/Misc/acx Executable file
View File

@@ -0,0 +1,6 @@
#! /bin/sh
#
# zsh shell function to make its arguments 755
# also works as an sh script
#
chmod 755 $*

29
Functions/Misc/allopt Normal file
View File

@@ -0,0 +1,29 @@
# This function lists options with the no's in front removed for
# improved comprehension, i.e. `norcs off' becomes `rcs on'.
# The format is otherwise like that with `kshoptionprint' set,
# i.e. you can see all options whether on or off.
# It can take a list of option names or parts thereof to search for
# via egrep.
#
# Written by Sweth Chandramouli with hacks by Bart Schaefer.
listalloptions () {
emulate -R zsh
builtin setopt localoptions kshoptionprint
local OPT_NAME OPT_PAIR OPT_VALUE
for OPT_PAIR in "${(f)$(builtin setopt)}" ; do
OPT_VALUE=${OPT_PAIR##* }
OPT_NAME=${OPT_PAIR%% *}
if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
OPT_VALUE=${(L)${${OPT_VALUE:s/on/OFF}:s/off/on}} &&
OPT_NAME=${OPT_NAME#no};
fi;
echo ${(r:21:)OPT_NAME} ${OPT_VALUE}
done
}
if [[ -n $@ ]]; then
listalloptions | egrep "${(j.|.)@}"
else
listalloptions
fi

16
Functions/Misc/cat Normal file
View File

@@ -0,0 +1,16 @@
#! /usr/local/bin/zsh -f
local file
if ((! ARGC)) then
set -- -
fi
for file
do
if [[ "$file" == - ]] then
while read -u0ek 4096; do ; done
else
while read -u0ek 4096; do ; done < "$file"
fi
done

23
Functions/Misc/cdmatch Executable file
View File

@@ -0,0 +1,23 @@
# Start of cdmatch.
# Save in your functions directory and autoload, then do
# compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
# 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
#
# Completes directories for cd, pushd, ... anything which knows about cdpath.
# You do not have to include `.' in your cdpath.
#
# It works properly only if $ZSH_VERSION > 3.0-pre4. Remove `emulate -R zsh'
# for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions
# it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
emulate -R zsh
setopt localoptions
local narg pref cdp
read -nc narg
read -Ac pref
cdp=(. $cdpath)
reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )
return
# End of cdmatch.

15
Functions/Misc/cdmatch2 Normal file
View File

@@ -0,0 +1,15 @@
# This function should be called from compctl to complete the
# second argument of cd and pushd.
emulate -R zsh # Requires zsh 3.0-pre4 or later
setopt localoptions extendedglob
local from
read -Ac from
from="${from[2]}"
eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )"
reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" )
[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''"
return

26
Functions/Misc/checkmail Normal file
View File

@@ -0,0 +1,26 @@
#! /usr/local/bin/zsh
#
# This autoloadable function checks the folders specified as arguments
# for new mails. The arguments are interpeted in exactly the same way
# as the mailpath special zsh parameter (see zshparam(1)).
#
# If no arguments are given mailpath is used. If mailpath is empty, $MAIL
# is used and if that is also empty, /var/spool/mail/$LOGNAME is used.
# This function requires zsh-3.0.1 or newer.
#
local file message
for file in "${@:-${mailpath[@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}"
do
message="${${(M)file%%\?*}#\?}"
file="${file%%\?*}"
if [[ -d "$file" ]] then
file=( "$file"/**/*(.ND) )
if (($#file)) then
checkmail "${^file}\?$message"
fi
elif test -s "$file" -a -N "$file"; then # this also sets $_ to $file
print -r -- "${(e)message:-You have new mail.}"
fi
done

6
Functions/Misc/cx Executable file
View File

@@ -0,0 +1,6 @@
#! /bin/sh
#
# zsh shell function to make its arguments executable
# also works as a sh script
#
chmod +x $*

6
Functions/Misc/harden Normal file
View File

@@ -0,0 +1,6 @@
#! /bin/sh
# harden a link (convert it to a singly linked file)
cp $1 $1.foo
rm $1
mv $1.foo $1

3
Functions/Misc/mere Normal file
View File

@@ -0,0 +1,3 @@
#! /bin/sh
# read a man page in the current directory
nroff -man -Tman $1 | less -s

72
Functions/Misc/multicomp Executable file
View File

@@ -0,0 +1,72 @@
# multicomp() {
# Completes all manner of files given prefixes for each path segment.
# e.g. s/z/s -> src/zsh-2.4/src
#
# Usage: e.g.
# compctl -D -f + -U -Q -S '' -K multicomp
#
# Will expand glob patterns already in the word, but use complete-word,
# not TAB (expand-or-complete), or you will get ordinary glob expansion.
# Requires the -U option to compctl.
# Menucompletion is highly recommended for ambiguous matches.
# Liable to screw up escaped metacharacters royally.
# $fignore is not used: feel free to add your own bit.
emulate -R zsh # Requires zsh 3.0-pre4 or later
local pref head sofar origtop newtop globdir="(-/)" wild
setopt localoptions nullglob rcexpandparam globdots
unsetopt markdirs globsubst shwordsplit nounset
pref="${1}$2"
# Hack to allow programmable completion to select multicomp after a :
# (e.g.
# compctl -D -f -x 's[:]' -U -Q -S '' -K multicomp
# )
pref="${pref#:}"
sofar=('')
reply=('')
if [[ "$pref" = \~* ]]; then
# If the string started with ~, save the head and what it will become.
origtop="${pref%%/*}"
eval "newtop=$origtop"
# Save the expansion as the bit matched already
sofar=($newtop)
pref="${pref#$origtop}"
fi
while [[ -n "$pref" ]]; do
[[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}"
head="${pref%%/*}"
pref="${pref#$head}"
[[ -z "$pref" ]] && globdir=
# if path segment contains wildcards, don't add another.
if [[ "$head" = *[\[\(\*\?\$\~]* ]]; then
wild=$head
else
# Simulate case-insensitive globbing for ASCII characters
wild="[${(j(][))${(s())head:l}}]*" # :gs/a/[a]/ etc.
# The following could all be one expansion, but for readability:
wild=$wild:gs/a/aA/:gs/b/bB/:gs/c/cC/:gs/d/dD/:gs/e/eE/:gs/f/fF/
wild=$wild:gs/g/gG/:gs/h/hH/:gs/i/iI/:gs/j/jJ/:gs/k/kK/:gs/l/lL/
wild=$wild:gs/m/mM/:gs/n/nN/:gs/o/oO/:gs/p/pP/:gs/q/qQ/:gs/r/rR/
wild=$wild:gs/s/sS/:gs/t/tT/:gs/u/uU/:gs/v/vV/:gs/w/wW/:gs/x/xX/
wild=$wild:gs/y/yY/:gs/z/zZ/:gs/-/_/:gs/_/-_/:gs/[]//
# Expand on both sides of '.' (except when leading) as for '/'
wild="${${wild:gs/[.]/*.*/}#\*}"
fi
reply=(${sofar}"${wild}${globdir}")
reply=(${~reply})
[[ -z $reply[1] ]] && reply=() && break
[[ -n $pref ]] && sofar=($reply)
done
# Restore ~'s in front if there were any.
# There had better not be anything funny in $newtop.
[[ -n "$origtop" ]] && reply=("$origtop"${reply#$newtop})
# }

8
Functions/Misc/proto Executable file
View File

@@ -0,0 +1,8 @@
#! /bin/sh
# generate prototypes, if your style is the same as mine
for i
do
rm $i:r.pro 2>/dev/null
grep -v '[{};:#]' $i | grep '^[A-Za-z]' |
grep -v static | sed 's/$/;/' >! $i:r.pro
done

13
Functions/Misc/pushd Normal file
View File

@@ -0,0 +1,13 @@
# pushd function to emulate the old zsh behaviour. With this function
# pushd +/-n just lifts the selected element to the top of the stack
# instead of just cycling the stack.
emulate -R zsh
setopt localoptions
if [[ ARGC -eq 1 && "$1" == [+-]<-> ]] then
setopt pushdignoredups
builtin pushd ~$1
else
builtin pushd "$@"
fi

3
Functions/Misc/randline Executable file
View File

@@ -0,0 +1,3 @@
# get a random line from a file
integer z="$(wc -l <$1)"
sed -n $[RANDOM%z+1]p $1

72
Functions/Misc/run-help Normal file
View File

@@ -0,0 +1,72 @@
#!/usr/local/bin/zsh
#
# Figure out where to get the best help, and get it.
#
# Install this function by placing it in your FPATH and then
# adding to your .zshrc the lines:
# unalias run-help
# autoload run-help
#
emulate -R zsh
setopt localoptions
# Check whether Util/helpfiles has been used to generate zsh help
if [[ $1 == "-l" ]]
then
if [[ -n "${HELPDIR:-}" ]]
then
echo 'Here is a list of topics for which help is available:'
echo ""
print -rc $HELPDIR/*(:t)
else
echo 'There is no list of help topics available at this time'
fi
return 0
elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]]
then
${=PAGER:-more} $HELPDIR/$1
return $?
fi
# No zsh help, use "whence" to figure out where else we might look
local what places newline='
'
integer i=0 didman=0
places=( "${(@f)$(builtin whence -va $1)}" )
while ((i++ < $#places))
do
what=$places[$i]
builtin print -r $what
case $what in
(*( is an alias)*)
[[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t}
;;
(*( is a * function))
builtin functions ${what[(w)1]} | ${=PAGER:-more}
;;
(*( is a * builtin))
case ${what[(w)1]} in
(compctl) man zshcompctl;;
(bindkey) man zshzle;;
(*setopt) man zshoptions;;
(*) man zshbuiltins;;
esac
;;
(*( is hashed to *))
man ${what[(w)-1]:t}
;;
(*)
((! didman++)) && man $1
;;
esac
if ((i < $#places && ! didman))
then
builtin print -nP "%SPress any key for more help or q to quit%s"
builtin read -k what
[[ $what != $newline ]] && echo
[[ $what == [qQ] ]] && break
fi
done

2
Functions/Misc/yp Executable file
View File

@@ -0,0 +1,2 @@
#! /bin/sh
ypmatch $1 passwd

2
Functions/Misc/yu Executable file
View File

@@ -0,0 +1,2 @@
#! /bin/sh
ypmatch $1 passwd.byuid

65
Functions/Misc/zed Normal file
View File

@@ -0,0 +1,65 @@
#
# zed
#
# No other shell could do this.
# Edit small files with the command line editor.
# Use ^X^W to save, ^C to abort.
# Option -f: edit shell functions. (Also if called as fned.)
#
# Completion: use
# compctl -f -x 'w[1,-f]' -F -- zed
#
local var fun cleanup
# We do not want timeout while we are editing a file
integer TMOUT=0
[[ $1 = -f || $0 = fned ]] && fun=1
[[ $1 = -(|-|f) ]] && shift
[[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1
# catch interrupts
cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ"
echo "trap - INT EXIT"; trap)"
trap "return 130" INT
trap "$cleanup" EXIT
# don't mangle !'s
setopt localoptions nobanghist
bindkey "^M" self-insert-unmeta
# Depending on your stty's, you may be able to use ^J as accept-line, else:
bindkey -M emacs "^X^W" accept-line
bindkey -a "ZZ" accept-line
if ((fun)) then
var="$(functions $1)"
# If function is undefined but autoloadable, load it
if [[ $var = undefined* ]] then
local dir
for dir in $fpath; do
if [[ -f $dir/$1 ]] then
var="$1() {
$(<$dir/$1)
}"
break
fi
done
elif [[ -z $var ]] then
var="$1() {
}"
fi
vared var && eval function "$var"
else
[[ -f $1 ]] && var="$(<$1)"
while vared var
do
(print -r -- "$var" >| $1) && break
echo -n -e '\a'
done
fi
return 0
# End of zed

37
Functions/Misc/zless Normal file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/zsh -f
#
# zsh function script to run less on various inputs, decompressing as required.
# Author: Phil Pennock. zsh-hacks@athenaeum.demon.co.uk
# Modified by Bart Schaefer.
# Thanks to zefram@fysh.org for a great deal of help in sorting this out,
# ie wrt syntax for unsetting members of arrays and eval "$(...)" when I
# asked for something better than . =(...)
#
# Use -zforce to pass through a display-formatting command
# zless -zforce 'bzip2 -dc' foo-no-dotbz2
# zless -zforce 'od -hc' foo-binfile
#
# If you can understand all of this without reference to zshexpn(1)
# and zshparam(1) then you either have a photographic memory or you
# need to get out more.
#
emulate -R zsh
setopt localoptions
[[ $# -ge 1 ]] || return
local lessopts
set -A lessopts
integer i=1 loi=1
while ((i <= $#))
do
case $argv[i] in
-zforce) argv[i,i+2]=("=($argv[i+1] \"$argv[i+2]\")"); ((++i));;
-*) lessopts[loi++]=\"$argv[i]\"; argv[i]=(); continue;;
*.(gz|Z)) argv[i]="=(zcat \"$argv[i]\")";;
*.bz2) argv[i]="=(bzip2 -dc \"$argv[i]\")";;
*.bz) argv[i]="=(bzip -dc \"$argv[i]\")";;
esac
((++i))
done
eval command less $lessopts $*

72
Functions/Misc/zls Normal file
View File

@@ -0,0 +1,72 @@
# zls () {
# simple internal ls using the stat module
zmodload -i stat || return 1
emulate -R zsh
setopt localoptions
local f opts='' L=L mod=: dirs list
typeset -A stat
dirs=()
list=()
while getopts ailLFdtuc f
do
opts=$opts$f
if [[ $f == '?' ]] then
echo Usage: $0 [ -ailLFd ] [ filename ... ]
return 1
fi
done
shift OPTIND-1
[[ $opts == *L* ]] && L=''
[[ $opts == *F* ]] && mod=T$mod
[[ $opts == *a* ]] && setopt globdots
local time=mtime tmod=m
[[ $opts == *u* ]] && time=atime tmod=a
[[ $opts == *c* ]] && time=ctime tmod=c
if ((! ARGC)) then
if [[ $opts = *t* ]]; then
set *(o$tmod)
else
set *
fi
opts=d$opts
elif [[ $opts = *t* && $ARGC -gt 1 ]]; then
# another glaringly obvious zsh trick: reorder the argv list
# by time, without messing up metacharacters inside
local n='$1'
for (( f = 2; f <= $ARGC; f++ )); do
n="$n|\$$f"
done
eval "argv=(($n)(o$tmod))"
fi
for f in $*
do
stat -s$L -H stat -F "%b %e %H:%M" - $f || continue
if [[ $opts != *d* && $stat[mode] == d* ]] then
dirs=( $dirs $f )
elif [[ $opts == *l* ]] then
[[ $opts == *i* ]] && print -n "${(l:7:)stat[inode]} "
[[ -n $stat[link] ]] && f=( $f '->' $stat[link] ) || f=( $f($mod) )
print -r -- "$stat[mode] ${(l:3:)stat[nlink]} ${(r:8:)stat[uid]} " \
"${(r:8:)stat[gid]} ${(l:8:)stat[size]} $stat[$time] $f"
else
f=( $f($mod) )
list=( "$list[@]" "${${(M)opts:%*i*}:+${(l:7:)stat[inode]} }$f" )
fi
done
(($#list)) && print -cr -- "$list[@]"
while (($#dirs)) do
((ARGC > $#dirs)) && echo
((ARGC > 1)) && echo $dirs[1]:
(cd $dirs[1] && $0 -d$opts)
shift dirs
done
# }

4
Functions/README.zftp Normal file
View File

@@ -0,0 +1,4 @@
The Zftp directory contains a set of functions acting as a front end to the
zftp command, provided as an add-on module. They allow you to perform FTP
tasks from within the shell using as many of the shell's own facilities
as possible. For more information, see the zshzftpsys manual page.

View File

@@ -0,0 +1,7 @@
DISTFILES_SRC='
.distfiles
zfanon zfautocheck zfcd zfcd_match zfcget zfclose zfcput zfdir
zfgcp zfget zfget_match zfhere zfinit zfls zfopen zfparams
zfpcp zfput zfrglob zfrtime zfstat zftp_chpwd zftp_progress
zftype zfuget zfuput
'

32
INSTALL
View File

@@ -115,6 +115,10 @@ To install the dynamically-loadable modules, do the command:
To install the zsh man page, do the command:
make install.man
To install all the shell functions which come with the distribution, do the
command:
make install.fns
Or alternatively, you can install all the above with the command:
make install
@@ -202,6 +206,33 @@ Any startup/shutdown script can be disabled by giving the
--disable-scriptname option to "configure". The --disable-etcdir option
disables all startup/shutdown files which are not explicitely enabled.
Shell functions
---------------
By default, the shell functions which are installed with `make install' or
`make install.fns' go into the directory ${datadir}/zsh/functions, which
unless you have specified --datadir is the same as
${prefix}/share/zsh/functions ($prefix itself defaults to /usr/local, as
described below). This directory will also be compiled into the shell as
the default directory for the variable $fpath/$FPATH. You can override it
with --enable-fndir=directory; --disable-fndir or --enable-fndir=no will
turn off both installation of functions and the setting of a default value
for $fpath/$FPATH.
You can control the functions which get installed by setting
FUNCTIONS_INSTALL, either when running configure or when running `make
install' or `make install.fns'. It includes a list of files relative to
either the Completion or Functions subdirectories. By default, all the
functions for the Completion system will be installed (see the zshcompsys
manual page), i.e.
FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/*'
and if the --enable-dynamic option was given, the functions in
Functions/Zftp, which require the zftp module to be available (see the
zshzftpsys manual page), will be included as well. There are also some
miscellaneous functions with documentation in comments; the complete set
of functions can be installed with
FUNCTIONS_INSTALL='Core/* Base/* Builtins/* User/* Commands/* Misc/* Zftp/*'
Support for large files and integers
------------------------------------
@@ -269,5 +300,6 @@ Features:
zlogin=pathname # the full pathname of the global zlogin script
zprofile=pathname # the full pathname of the global zprofile script
zlogout=pathname # the full pathname of the global zlogout script
fns=directory # the directory where shell functions will go
dynamic # allow dynamically loaded binary modules
lfs # allow configure check for large files

View File

@@ -63,8 +63,8 @@ install-strip:
$(MAKE) install STRIPFLAGS="-s"
# install/uninstall everything (except info)
install: install.bin install.modules install.man
uninstall: uninstall.bin uninstall.modules uninstall.man
install: install.bin install.modules install.man install.fns
uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.fns
# install/uninstall just the binary
install.bin uninstall.bin:
@@ -78,6 +78,11 @@ install.modules uninstall.modules:
install.man uninstall.man:
@cd Doc && $(MAKE) $(MAKEDEFS) $@
# install/uninstall just the shell functions
install.fns uninstall.fns:
@cd Completion && $(MAKE) $(MAKEDEFS) $@
@cd Functions && $(MAKE) $(MAKEDEFS) $@
# install/uninstall just the info pages
install.info uninstall.info:
@cd Doc && $(MAKE) $(MAKEDEFS) $@

View File

@@ -1,5 +1,4 @@
DISTFILES_SRC='
.distfiles
c2z compctl-examples globtests globtests.ksh lete2ctl
new-completion-examples zftp-functions
'

View File

@@ -1,11 +1,12 @@
DISTFILES_SRC='
.cvsignore .distfiles .exrc .indent.pro
Makefile.in Makemod.in.in
ansi2knr.c
signames1.awk signames2.awk
ansi2knr.c modentry.c
builtin.c compat.c cond.c exec.c glob.c hashtable.c hashtable.h
hist.c init.c input.c jobs.c lex.c linklist.c loop.c main.c makepro.awk
math.c mem.c mkbltnmlst.sh mkmakemod.sh mkmodindex.sh
module.c options.c params.c parse.c prompt.c prototypes.h
signals.c signals.h signames.awk subst.c system.h text.c utils.c
watch.c xmods.conf zsh.h zsh.mdd ztype.h
signals.c signals.h subst.c system.h text.c utils.c
watch.c xmods.conf zsh.h zsh.mdd ztype.h zsh.export
'

View File

@@ -4,6 +4,7 @@ DISTFILES_SRC='
clone.mdd clone.c
example.mdd example.c
files.mdd files.c
mapfile.mdd mapfile.c
parameter.mdd parameter.c
stat.mdd stat.c
zftp.mdd zftp.c

View File

@@ -149,6 +149,7 @@ setpmmapfile(Param pm, char *value)
* pages. Honestly, I tried it without, and you need both.
*/
ftruncate(fd, len);
munmap(mmptr, len);
}
#else /* don't USE_MMAP */
/* can't be bothered to do anything too clever here */

View File

@@ -1,10 +1,10 @@
DISTFILES_SRC='
.cvsignore .distfiles .exrc
comp1.mdd comp.h comp1.c
comp1.mdd comp.h comp1.c comp1.export
compctl.mdd compctl.c
deltochar.mdd deltochar.c
zle.mdd iwidgets.list zle.h zle_bindings.c zle_hist.c
zle_keymap.c zle_main.c zle_misc.c zle_move.c zle_params.c
zle_refresh.c zle_things.sed zle_thingy.c zle_tricky.c
zle_utils.c zle_vi.c zle_widget.sed zle_word.c
zle_utils.c zle_vi.c zle_widget.sed zle_word.c zle.export
'

View File

@@ -91,6 +91,7 @@ struct compcond {
#define CCT_NUMWORDS 10
#define CCT_RANGESTR 11
#define CCT_RANGEPAT 12
#define CCT_QUOTE 13
/* Contains the real description for compctls */
@@ -107,6 +108,7 @@ struct compctl {
char *ylist; /* for -y (user-defined desc. for listing) */
char *prefix, *suffix; /* for -P and -S (prefix, suffix) */
char *subcmd; /* for -l (command name to use) */
char *substr; /* for -1 (command name to use) */
char *withd; /* for -w (with directory */
char *hpat; /* for -H (history pattern) */
int hnum; /* for -H (number of events to search) */
@@ -209,6 +211,7 @@ struct cmatch {
char *prpre; /* path prefix for opendir */
char *pre; /* prefix string from -P */
char *suf; /* suffix string from -S */
char autoq; /* closing quote to add automatically */
int flags; /* see CMF_* below */
int brpl; /* the place where to put the brace prefix */
int brsl; /* ...and the suffix */
@@ -297,42 +300,79 @@ struct cadata {
/* Flags for special parameters. */
#define CP_WORDS (1 << 0)
#define CP_CURRENT (1 << 1)
#define CP_PREFIX (1 << 2)
#define CP_SUFFIX (1 << 3)
#define CP_IPREFIX (1 << 4)
#define CP_ISUFFIX (1 << 5)
#define CP_COMPSTATE (1 << 6)
#define CPN_WORDS 0
#define CP_WORDS (1 << CPN_WORDS)
#define CPN_CURRENT 1
#define CP_CURRENT (1 << CPN_CURRENT)
#define CPN_PREFIX 2
#define CP_PREFIX (1 << CPN_PREFIX)
#define CPN_SUFFIX 3
#define CP_SUFFIX (1 << CPN_SUFFIX)
#define CPN_IPREFIX 4
#define CP_IPREFIX (1 << CPN_IPREFIX)
#define CPN_ISUFFIX 5
#define CP_ISUFFIX (1 << CPN_ISUFFIX)
#define CPN_QIPREFIX 6
#define CP_QIPREFIX (1 << CPN_QIPREFIX)
#define CPN_QISUFFIX 7
#define CP_QISUFFIX (1 << CPN_QISUFFIX)
#define CPN_COMPSTATE 8
#define CP_COMPSTATE (1 << CPN_COMPSTATE)
#define CP_REALPARAMS 7
#define CP_REALPARAMS 9
#define CP_ALLREALS ((unsigned int) 0x1ff)
#define CP_NMATCHES (1 << 7)
#define CP_MATCHER (1 << 8)
#define CP_MATCHERSTR (1 << 9)
#define CP_MATCHERTOT (1 << 10)
#define CP_CONTEXT (1 << 11)
#define CP_PARAMETER (1 << 12)
#define CP_REDIRECT (1 << 13)
#define CP_QUOTE (1 << 14)
#define CP_QUOTING (1 << 15)
#define CP_RESTORE (1 << 16)
#define CP_LIST (1 << 17)
#define CP_FORCELIST (1 << 18)
#define CP_INSERT (1 << 19)
#define CP_EXACT (1 << 20)
#define CP_EXACTSTR (1 << 21)
#define CP_PATMATCH (1 << 22)
#define CP_PATINSERT (1 << 23)
#define CP_UNAMBIG (1 << 24)
#define CP_UNAMBIGC (1 << 25)
#define CP_LISTMAX (1 << 26)
#define CP_LASTPROMPT (1 << 27)
#define CP_TOEND (1 << 28)
#define CP_OLDLIST (1 << 29)
#define CP_OLDINS (1 << 30)
#define CP_VARED (1 << 31)
#define CP_NUM 32
#define CPN_NMATCHES 0
#define CP_NMATCHES (1 << CPN_NMATCHES)
#define CPN_MATCHER 1
#define CP_MATCHER (1 << CPN_MATCHER)
#define CPN_MATCHERSTR 2
#define CP_MATCHERSTR (1 << CPN_MATCHERSTR)
#define CPN_MATCHERTOT 3
#define CP_MATCHERTOT (1 << CPN_MATCHERTOT)
#define CPN_CONTEXT 4
#define CP_CONTEXT (1 << CPN_CONTEXT)
#define CPN_PARAMETER 5
#define CP_PARAMETER (1 << CPN_PARAMETER)
#define CPN_REDIRECT 6
#define CP_REDIRECT (1 << CPN_REDIRECT)
#define CPN_QUOTE 7
#define CP_QUOTE (1 << CPN_QUOTE)
#define CPN_QUOTING 8
#define CP_QUOTING (1 << CPN_QUOTING)
#define CPN_RESTORE 9
#define CP_RESTORE (1 << CPN_RESTORE)
#define CPN_LIST 10
#define CP_LIST (1 << CPN_LIST)
#define CPN_FORCELIST 11
#define CP_FORCELIST (1 << CPN_FORCELIST)
#define CPN_INSERT 12
#define CP_INSERT (1 << CPN_INSERT)
#define CPN_EXACT 13
#define CP_EXACT (1 << CPN_EXACT)
#define CPN_EXACTSTR 14
#define CP_EXACTSTR (1 << CPN_EXACTSTR)
#define CPN_PATMATCH 15
#define CP_PATMATCH (1 << CPN_PATMATCH)
#define CPN_PATINSERT 16
#define CP_PATINSERT (1 << CPN_PATINSERT)
#define CPN_UNAMBIG 17
#define CP_UNAMBIG (1 << CPN_UNAMBIG)
#define CPN_UNAMBIGC 18
#define CP_UNAMBIGC (1 << CPN_UNAMBIGC)
#define CPN_LISTMAX 19
#define CP_LISTMAX (1 << CPN_LISTMAX)
#define CPN_LASTPROMPT 20
#define CP_LASTPROMPT (1 << CPN_LASTPROMPT)
#define CPN_TOEND 21
#define CP_TOEND (1 << CPN_TOEND)
#define CPN_OLDLIST 22
#define CP_OLDLIST (1 << CPN_OLDLIST)
#define CPN_OLDINS 23
#define CP_OLDINS (1 << CPN_OLDINS)
#define CPN_VARED 24
#define CP_VARED (1 << CPN_VARED)
#define CP_ALLMASK ((unsigned int) 0xffffffff)
#define CP_KEYPARAMS 25
#define CP_ALLKEYS ((unsigned int) 0xffffff)

View File

@@ -47,7 +47,7 @@ Cmlist cmatcher;
void (*makecompparamsptr) _((void));
/**/
void (*comp_setunsetptr) _((unsigned int, unsigned int));
void (*comp_setunsetptr) _((int, int, int, int));
/* pointers to functions required by compctl and defined by zle */
@@ -69,6 +69,9 @@ int (*makecomplistctlptr) _((int));
/**/
char *(*unambig_dataptr) _((int *));
/**/
int (*set_comp_sepptr) _((void));
/* Hash table for completion info for commands */
/**/
@@ -112,6 +115,8 @@ char **compwords,
*compsuffix,
*compiprefix,
*compisuffix,
*compqiprefix,
*compqisuffix,
*compmatcherstr,
*compcontext,
*compparameter,
@@ -133,7 +138,7 @@ char **compwords,
*compvared;
/**/
Param *comppms;
Param *comprpms, *compkpms;
/* The function rembslash() came from zle_tricky.c, but is now used *
* in compctl.c, too. */
@@ -193,6 +198,7 @@ freecompctl(Compctl cc)
zsfree(cc->hpat);
zsfree(cc->gname);
zsfree(cc->subcmd);
zsfree(cc->substr);
if (cc->cond)
freecompcond(cc->cond);
if (cc->ext) {
@@ -440,9 +446,10 @@ setup_comp1(Module m)
cc_first.refc = 10000;
cc_first.mask = 0;
cc_first.mask2 = CC_CCCONT;
comppms = NULL;
comprpms = compkpms = NULL;
compwords = NULL;
compprefix = compsuffix = compiprefix = compisuffix = compmatcherstr =
compprefix = compsuffix = compiprefix = compisuffix =
compqiprefix = compqisuffix = compmatcherstr =
compcontext = compparameter = compredirect = compquote =
compquoting = comprestore = complist = compinsert =
compexact = compexactstr = comppatmatch = comppatinsert =
@@ -450,6 +457,7 @@ setup_comp1(Module m)
compoldlist = compoldins = compvared = NULL;
makecompparamsptr = NULL;
comp_setunsetptr = NULL;
set_comp_sepptr = NULL;
return 0;
}
@@ -481,6 +489,8 @@ finish_comp1(Module m)
zsfree(compsuffix);
zsfree(compiprefix);
zsfree(compisuffix);
zsfree(compqiprefix);
zsfree(compqisuffix);
zsfree(compmatcherstr);
zsfree(compcontext);
zsfree(compparameter);

View File

@@ -19,6 +19,7 @@ compforcelist
compinsert
compiprefix
compisuffix
compkpms
complastprompt
complist
complistmax
@@ -34,9 +35,12 @@ comppatmatch
comppms
compprefix
compredirect
compqiprefix
compqisuffix
compquote
compquoting
comprestore
comprpms
comp_setunsetptr
comp_strptr
compsuffix
@@ -56,4 +60,5 @@ makecomplistctlptr
makecompparamsptr
patcomps
rembslash
set_comp_sepptr
unambig_dataptr

View File

@@ -688,6 +688,22 @@ get_compctl(char *name, char ***av, Compctl cc, int first, int isdef, int cl)
*argv = "" - 1;
}
break;
case 'h':
if (cl) {
zerrnam(name, "illegal option -%c", NULL, **argv);
return 1;
} else if ((*argv)[1]) {
cct.substr = (*argv) + 1;
*argv = "" - 1;
} else if (!argv[1]) {
zwarnnam(name, "command name expected after -%c", NULL,
**argv);
return 1;
} else {
cct.substr = *++argv;
*argv = "" - 1;
}
break;
case 'W':
if ((*argv)[1]) {
cct.withd = (*argv) + 1;
@@ -933,6 +949,9 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
t++;
/* First get the condition code */
switch (*t) {
case 'q':
c->type = CCT_QUOTE;
break;
case 's':
c->type = CCT_CURSUF;
break;
@@ -1017,7 +1036,8 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
c->u.r.a = (int *)zcalloc(n * sizeof(int));
c->u.r.b = (int *)zcalloc(n * sizeof(int));
} else if (c->type == CCT_CURSUF ||
c->type == CCT_CURPRE)
c->type == CCT_CURPRE ||
c->type == CCT_QUOTE)
c->u.s.s = (char **)zcalloc(n * sizeof(char *));
else if (c->type == CCT_RANGESTR ||
@@ -1059,7 +1079,8 @@ get_xcompctl(char *name, char ***av, Compctl cc, int isdef)
c->u.r.b[l] = atoi(tt);
}
} else if (c->type == CCT_CURSUF ||
c->type == CCT_CURPRE) {
c->type == CCT_CURPRE ||
c->type == CCT_QUOTE) {
/* -s[..] or -S[..]: single string expected */
for (; *t && *t != '\200'; t++)
if (*t == '\201')
@@ -1218,6 +1239,7 @@ cc_assign(char *name, Compctl *ccptr, Compctl cct, int reass)
zsfree(cc->prefix);
zsfree(cc->suffix);
zsfree(cc->subcmd);
zsfree(cc->substr);
zsfree(cc->withd);
zsfree(cc->hpat);
zsfree(cc->gname);
@@ -1239,6 +1261,7 @@ cc_assign(char *name, Compctl *ccptr, Compctl cct, int reass)
cc->prefix = ztrdup(cct->prefix);
cc->suffix = ztrdup(cct->suffix);
cc->subcmd = ztrdup(cct->subcmd);
cc->substr = ztrdup(cct->substr);
cc->withd = ztrdup(cct->withd);
cc->gname = ztrdup(cct->gname);
cc->hpat = ztrdup(cct->hpat);
@@ -1366,7 +1389,7 @@ printcompctl(char *s, Compctl cc, int printflags, int ispat)
{
Compctl cc2;
char *css = "fcqovbAIFpEjrzBRGudeNOZUnQmw/";
char *mss = " pcCwWsSnNmrR";
char *mss = " pcCwWsSnNmrRq";
unsigned long t = 0x7fffffff;
unsigned long flags = cc->mask, flags2 = cc->mask2;
unsigned long oldshowmask;
@@ -1448,6 +1471,7 @@ printcompctl(char *s, Compctl cc, int printflags, int ispat)
printif(cc->glob, 'g');
printif(cc->str, 's');
printif(cc->subcmd, 'l');
printif(cc->substr, 'h');
printif(cc->withd, 'W');
if (cc->hpat) {
printf(" -H %d ", cc->hnum);
@@ -1484,6 +1508,7 @@ printcompctl(char *s, Compctl cc, int printflags, int ispat)
break;
case CCT_CURSUF:
case CCT_CURPRE:
case CCT_QUOTE:
printqt(c->u.s.s[i]);
break;
case CCT_RANGESTR:
@@ -2067,6 +2092,9 @@ bin_compset(char *name, char **argv, char *ops, int func)
case 'P': test = CVT_PREPAT; break;
case 's': test = CVT_SUFNUM; break;
case 'S': test = CVT_SUFPAT; break;
case 'q': return !(compquote && *compquote &&
(*compquote == '\'' || *compquote == '"') &&
!set_comp_sepptr());
default:
zerrnam(name, "bad option -%c", NULL, argv[0][1]);
return 1;
@@ -2135,19 +2163,25 @@ bin_compcall(char *name, char **argv, char *ops, int func)
* order of the CP_* bits in comp.h */
#define VAL(X) ((void *) (&(X)))
static struct compparam {
struct compparam {
char *name;
int type;
void *var, *set, *get;
} compparams[] = {
};
static struct compparam comprparams[] = {
{ "words", PM_ARRAY, VAL(compwords), NULL, NULL },
{ "CURRENT", PM_INTEGER, VAL(compcurrent), NULL, NULL },
{ "PREFIX", PM_SCALAR, VAL(compprefix), NULL, NULL },
{ "SUFFIX", PM_SCALAR, VAL(compsuffix), NULL, NULL },
{ "IPREFIX", PM_SCALAR, VAL(compiprefix), NULL, NULL },
{ "ISUFFIX", PM_SCALAR, VAL(compisuffix), NULL, NULL },
{ NULL, 0, NULL, NULL, NULL },
{ "QIPREFIX", PM_SCALAR | PM_READONLY, VAL(compqiprefix), NULL, NULL },
{ "QISUFFIX", PM_SCALAR | PM_READONLY, VAL(compqisuffix), NULL, NULL },
{ NULL, 0, NULL, NULL, NULL }
};
static struct compparam compkparams[] = {
{ "nmatches", PM_INTEGER, VAL(compnmatches), NULL, NULL },
{ "matcher", PM_INTEGER, VAL(compmatcher), NULL, NULL },
{ "matcher_string", PM_SCALAR, VAL(compmatcherstr), NULL, NULL },
@@ -2155,8 +2189,8 @@ static struct compparam {
{ "context", PM_SCALAR, VAL(compcontext), NULL, NULL },
{ "parameter", PM_SCALAR, VAL(compparameter), NULL, NULL },
{ "redirect", PM_SCALAR, VAL(compredirect), NULL, NULL },
{ "quote", PM_SCALAR, VAL(compquote), NULL, NULL },
{ "quoting", PM_SCALAR, VAL(compquoting), NULL, NULL },
{ "quote", PM_SCALAR | PM_READONLY, VAL(compquote), NULL, NULL },
{ "quoting", PM_SCALAR | PM_READONLY, VAL(compquoting), NULL, NULL },
{ "restore", PM_SCALAR, VAL(comprestore), NULL, NULL },
{ "list", PM_SCALAR, VAL(complist), NULL, NULL },
{ "force_list", PM_SCALAR, VAL(compforcelist), NULL, NULL },
@@ -2179,11 +2213,9 @@ static struct compparam {
#define COMPSTATENAME "compstate"
static struct compparam *
addcompparams(struct compparam *cp)
static void
addcompparams(struct compparam *cp, Param *pp)
{
Param *pp = comppms + (cp - compparams);
for (; cp->name; cp++, pp++) {
Param pm = createparam(cp->name, cp->type | PM_SPECIAL | PM_REMOVABLE);
if (!pm)
@@ -2214,31 +2246,29 @@ addcompparams(struct compparam *cp)
}
pm->unsetfn = compunsetfn;
}
return cp;
}
/**/
void
makecompparams(void)
{
struct compparam *cp;
Param cpm;
HashTable tht;
cp = addcompparams(compparams);
addcompparams(comprparams, comprpms);
if (!(cpm = createparam(COMPSTATENAME, PM_SPECIAL|PM_REMOVABLE|PM_HASHED)))
cpm = (Param) paramtab->getnode(paramtab, COMPSTATENAME);
DPUTS(!cpm, "param not set in makecompparams");
comppms[cp - compparams] = cpm;
comprpms[CPN_COMPSTATE] = cpm;
tht = paramtab;
cpm->level = locallevel;
cpm->gets.hfn = get_compstate;
cpm->sets.hfn = set_compstate;
cpm->unsetfn = compunsetfn;
cpm->u.hash = paramtab = newparamtable(17, COMPSTATENAME);
addcompparams(cp + 1);
cpm->u.hash = paramtab = newparamtable(31, COMPSTATENAME);
addcompparams(compkparams, compkpms);
paramtab = tht;
}
@@ -2262,8 +2292,8 @@ set_compstate(Param pm, HashTable ht)
for (i = 0; i < ht->hsize; i++)
for (hn = ht->nodes[i]; hn; hn = hn->next)
for (cp = compparams + CP_REALPARAMS,
pp = comppms + CP_REALPARAMS; cp->name; cp++, pp++)
for (cp = compkparams,
pp = compkpms; cp->name; cp++, pp++)
if (!strcmp(hn->nam, cp->name)) {
v.isarr = v.inv = v.a = 0;
v.b = -1;
@@ -2318,20 +2348,25 @@ compunsetfn(Param pm, int exp)
/**/
void
comp_setunset(unsigned int set, unsigned int unset)
comp_setunset(int rset, int runset, int kset, int kunset)
{
Param *p;
if (!comppms)
return;
set &= CP_ALLMASK;
unset &= CP_ALLMASK;
for (p = comppms; set || unset; set >>= 1, unset >>= 1, p++) {
if (set & 1)
(*p)->flags &= ~PM_UNSET;
if (unset & 1)
(*p)->flags |= PM_UNSET;
if (comprpms && (rset >= 0 || runset >= 0)) {
for (p = comprpms; rset || runset; rset >>= 1, runset >>= 1, p++) {
if (rset & 1)
(*p)->flags &= ~PM_UNSET;
if (runset & 1)
(*p)->flags |= PM_UNSET;
}
}
if (comprpms && (kset >= 0 || kunset >= 0)) {
for (p = compkpms; kset || kunset; kset >>= 1, kunset >>= 1, p++) {
if (kset & 1)
(*p)->flags &= ~PM_UNSET;
if (kunset & 1)
(*p)->flags |= PM_UNSET;
}
}
}
@@ -2343,16 +2378,19 @@ comp_wrapper(List list, FuncWrap w, char *name)
return 1;
else {
char *orest, *opre, *osuf, *oipre, *oisuf, **owords;
char *oqipre, *oqisuf, *oq, *oqi;
zlong ocur;
unsigned int unset = 0, m, sm;
unsigned int runset = 0, kunset = 0, m, sm;
Param *pp;
m = CP_WORDS | CP_CURRENT | CP_PREFIX | CP_SUFFIX |
CP_IPREFIX | CP_ISUFFIX | CP_RESTORE;
for (pp = comppms, sm = 1; m; pp++, m >>= 1, sm <<= 1) {
CP_IPREFIX | CP_ISUFFIX | CP_QIPREFIX | CP_QISUFFIX;
for (pp = comprpms, sm = 1; m; pp++, m >>= 1, sm <<= 1) {
if ((m & 1) && ((*pp)->flags & PM_UNSET))
unset |= sm;
runset |= sm;
}
if (compkpms[CPN_RESTORE]->flags & PM_UNSET)
kunset = CP_RESTORE;
orest = comprestore;
comprestore = ztrdup("auto");
ocur = compcurrent;
@@ -2360,6 +2398,10 @@ comp_wrapper(List list, FuncWrap w, char *name)
osuf = dupstring(compsuffix);
oipre = dupstring(compiprefix);
oisuf = dupstring(compisuffix);
oqipre = dupstring(compqiprefix);
oqisuf = dupstring(compqisuffix);
oq = dupstring(compquote);
oqi = dupstring(compquoting);
HEAPALLOC {
owords = arrdup(compwords);
@@ -2377,18 +2419,27 @@ comp_wrapper(List list, FuncWrap w, char *name)
compiprefix = ztrdup(oipre);
zsfree(compisuffix);
compisuffix = ztrdup(oisuf);
zsfree(compqiprefix);
compqiprefix = ztrdup(oqipre);
zsfree(compqisuffix);
compqisuffix = ztrdup(oqisuf);
zsfree(compquote);
compquote = ztrdup(oq);
zsfree(compquoting);
compquoting = ztrdup(oqi);
freearray(compwords);
PERMALLOC {
compwords = arrdup(owords);
} LASTALLOC;
comp_setunset(CP_COMPSTATE |
(~unset & (CP_WORDS | CP_CURRENT | CP_PREFIX |
(~runset & (CP_WORDS | CP_CURRENT | CP_PREFIX |
CP_SUFFIX | CP_IPREFIX | CP_ISUFFIX |
CP_RESTORE)),
unset);
CP_QIPREFIX | CP_QISUFFIX)),
(runset & CP_ALLREALS),
(~kunset & CP_RESTORE), (kunset & CP_ALLKEYS));
} else
comp_setunset(CP_COMPSTATE | (~unset & CP_RESTORE),
(unset & CP_RESTORE));
comp_setunset(CP_COMPSTATE, 0, (~kunset & CP_RESTORE),
(kunset & CP_RESTORE));
zsfree(comprestore);
comprestore = orest;

View File

@@ -76,7 +76,8 @@ forget_edits(void)
void
uphistory(void)
{
if (!zle_goto_hist(histline, -zmult) && isset(HISTBEEP))
int nodups = isset(HISTIGNOREDUPS);
if (!zle_goto_hist(histline, -zmult, nodups) && isset(HISTBEEP))
feep();
}
@@ -267,7 +268,8 @@ acceptlineanddownhistory(void)
void
downhistory(void)
{
if (!zle_goto_hist(histline, zmult) && isset(HISTBEEP))
int nodups = isset(HISTIGNOREDUPS);
if (!zle_goto_hist(histline, zmult, nodups) && isset(HISTBEEP))
feep();
}
@@ -370,7 +372,7 @@ beginningofbufferorhistory(void)
void
beginningofhistory(void)
{
if (!zle_goto_hist(firsthist(), 0) && isset(HISTBEEP))
if (!zle_goto_hist(firsthist(), 0, 0) && isset(HISTBEEP))
feep();
}
@@ -388,7 +390,7 @@ endofbufferorhistory(void)
void
endofhistory(void)
{
zle_goto_hist(curhist, 0);
zle_goto_hist(curhist, 0, 0);
}
/**/
@@ -472,9 +474,14 @@ setlocalhistory(void)
/**/
int
zle_goto_hist(int ev, int n)
zle_goto_hist(int ev, int n, int skipdups)
{
Histent he = movehistent(quietgethist(ev), n, hist_skip_flags);
if (skipdups && n) {
n = n < 0? -1 : 1;
while (he && !metadiffer(ZLETEXT(he), (char *) line, ll))
he = movehistent(he, n, hist_skip_flags);
}
if (!he)
return 0;
zle_setline(he);
@@ -906,7 +913,7 @@ vifetchhistory(void)
return;
}
}
if (!zle_goto_hist((zmod.flags & MOD_MULT) ? zmult : curhist, 0) &&
if (!zle_goto_hist((zmod.flags & MOD_MULT) ? zmult : curhist, 0, 0) &&
isset(HISTBEEP))
feep();
}

View File

@@ -640,7 +640,7 @@ execzlefunc(Thingy func)
zsfree(msg);
feep();
} else {
int osc = sfcontext;
int osc = sfcontext, osi = movefd(0);
startparamscope();
makezleparams(0);
@@ -650,6 +650,7 @@ execzlefunc(Thingy func)
endparamscope();
lastcmd = 0;
r = 1;
redup(osi, 0);
}
}
if (r) {
@@ -952,6 +953,7 @@ setup_zle(Module m)
makecomplistcallptr = makecomplistcall;
makecomplistctlptr = makecomplistctl;
unambig_dataptr = unambig_data;
set_comp_sepptr = set_comp_sep;
/* initialise the thingies */
init_thingies();
@@ -1027,6 +1029,7 @@ finish_zle(Module m)
makecomplistcallptr = NULL;
makecomplistctlptr = NULL;
unambig_dataptr = NULL;
set_comp_sepptr = NULL;
return 0;
}

View File

@@ -127,6 +127,7 @@ killwholeline(void)
for (i = cs; i != ll && line[i] != '\n'; i++);
forekill(i - cs + (i != ll), fg);
}
clearlist = 1;
}
/**/
@@ -787,7 +788,9 @@ static char *suffixfunc;
void
makesuffix(int n)
{
suffixlen[256] = suffixlen[' '] = suffixlen['\t'] = suffixlen['\n'] = n;
suffixlen[256] = suffixlen[' '] = suffixlen['\t'] = suffixlen['\n'] =
suffixlen[';'] = suffixlen['|'] = suffixlen['&'] =
suffixlen['<'] = suffixlen['>'] = n;
}
/* Set up suffix for parameter names: the last n characters are a suffix *

View File

@@ -476,7 +476,7 @@ vigotomark(void)
feep();
return;
}
if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0)) {
if (curhist != vimarkline[ch] && !zle_goto_hist(vimarkline[ch], 0, 0)) {
vimarkline[ch] = 0;
feep();
return;

View File

@@ -268,10 +268,13 @@ zrefresh(void)
if (clearlist && listshown) {
if (tccan(TCCLEAREOD)) {
int ovln = vln, ovcs = vcs;
char *nb = nbuf[vln];
nbuf[vln] = obuf[vln];
moveto(nlnct, 0);
tcout(TCCLEAREOD);
moveto(ovln, ovcs);
nbuf[vln] = nb;
} else {
invalidatelist();
moveto(0, 0);

File diff suppressed because it is too large Load Diff

View File

@@ -97,6 +97,7 @@ typedef struct stat *Statptr; /* This makes the Ultrix compiler happy. Go figu
#define TT_MINS 2
#define TT_WEEKS 3
#define TT_MONTHS 4
#define TT_SECONDS 5
#define TT_BYTES 0
#define TT_POSIX_BLOCKS 1
@@ -1615,6 +1616,8 @@ glob(LinkList list, LinkNode np)
units = TT_WEEKS, ++s;
else if (*s == 'M')
units = TT_MONTHS, ++s;
else if (*s == 's')
units = TT_SECONDS, ++s;
}
/* See if it's greater than, equal to, or less than */
if ((range = *s == '+' ? 1 : *s == '-' ? -1 : 0))

View File

@@ -58,8 +58,8 @@ int excs, exlast;
* the line does not get added to the list until hend(), if at all.
* However, curhist is incremented to reflect the current line anyway
* and a temporary history entry is inserted while the user is editing.
* If the resulting line was not added to the list, curhist is
* decremented in hend().
* If the resulting line was not added to the list, a flag is set so
* that curhist will be decremented in hbegin().
*/
/**/
@@ -984,6 +984,8 @@ hend(void)
void
remhist(void)
{
if (hist_ring == &curline)
return;
if (!(histactive & HA_ACTIVE)) {
if (!(histactive & HA_JUNKED)) {
freehistnode((HashNode)hist_ring);

View File

@@ -550,7 +550,11 @@ setupvals(void)
cdpath = mkarray(NULL);
manpath = mkarray(NULL);
fignore = mkarray(NULL);
#ifdef FUNCTION_DIR
fpath = mkarray(ztrdup(FUNCTION_DIR));
#else
fpath = mkarray(NULL);
#endif
mailpath = mkarray(NULL);
watch = mkarray(NULL);
psvar = mkarray(NULL);
@@ -758,33 +762,31 @@ run_init_scripts(void)
#ifdef GLOBAL_ZSHENV
source(GLOBAL_ZSHENV);
#endif
if (isset(RCS)) {
if (unset(PRIVILEGED))
sourcehome(".zshenv");
if (islogin) {
if (isset(RCS) && unset(PRIVILEGED))
sourcehome(".zshenv");
if (islogin) {
#ifdef GLOBAL_ZPROFILE
if (isset(GLOBALRCS))
if (isset(RCS) && isset(GLOBALRCS))
source(GLOBAL_ZPROFILE);
#endif
if (unset(PRIVILEGED))
sourcehome(".zprofile");
}
if (interact) {
if (isset(RCS) && unset(PRIVILEGED))
sourcehome(".zprofile");
}
if (interact) {
#ifdef GLOBAL_ZSHRC
if (isset(GLOBALRCS))
source(GLOBAL_ZSHRC);
if (isset(RCS) && isset(GLOBALRCS))
source(GLOBAL_ZSHRC);
#endif
if (unset(PRIVILEGED))
sourcehome(".zshrc");
}
if (islogin) {
if (isset(RCS) && unset(PRIVILEGED))
sourcehome(".zshrc");
}
if (islogin) {
#ifdef GLOBAL_ZLOGIN
if (isset(GLOBALRCS))
source(GLOBAL_ZLOGIN);
if (isset(RCS) && isset(GLOBALRCS))
source(GLOBAL_ZLOGIN);
#endif
if (unset(PRIVILEGED))
sourcehome(".zlogin");
}
if (isset(RCS) && unset(PRIVILEGED))
sourcehome(".zlogin");
}
}
noerrexit = 0;

View File

@@ -138,6 +138,7 @@ execselect(Cmd cmd)
LinkNode n;
int i;
FILE *inp;
size_t more;
node = cmd->u.forcmd;
args = cmd->args;
@@ -154,7 +155,7 @@ execselect(Cmd cmd)
lastval = 0;
pushheap();
inp = fdopen(dup((SHTTY == -1) ? 0 : SHTTY), "r");
selectlist(args);
more = selectlist(args, 0);
for (;;) {
for (;;) {
if (empty(bufstack)) {
@@ -181,7 +182,7 @@ execselect(Cmd cmd)
*s = '\0';
if (*str)
break;
selectlist(args);
more = selectlist(args, more);
}
setsparam("REPLY", ztrdup(str));
i = atoi(str);
@@ -217,8 +218,8 @@ execselect(Cmd cmd)
/* And this is used to print select lists. */
/**/
static void
selectlist(LinkList l)
size_t
selectlist(LinkList l, size_t start)
{
size_t longest = 1, fct, fw = 0, colsz, t0, t1, ct;
LinkNode n;
@@ -245,7 +246,7 @@ selectlist(LinkList l)
else
fw = (columns - 1) / fct;
colsz = (ct + fct - 1) / fct;
for (t1 = 0; t1 != colsz; t1++) {
for (t1 = start; t1 != colsz && t1 - start < lines - 2; t1++) {
ap = arr + t1;
do {
int t2 = strlen(*ap) + 2, t3;
@@ -271,6 +272,8 @@ selectlist(LinkList l)
}
while (*ap);*/
fflush(stderr);
return t1 < colsz ? t1 : 0;
}
/**/

View File

@@ -45,12 +45,24 @@ main(int argc, char **argv)
for (t = argv; *t; *t = metafy(*t, -1, META_ALLOC), t++);
if (!(zsh_name = strrchr(argv[0], '/')))
zsh_name = argv[0];
else
zsh_name++;
if (*zsh_name == '-')
zsh_name++;
zsh_name = argv[0];
do {
char *arg0 = zsh_name;
if (!(zsh_name = strrchr(arg0, '/')))
zsh_name = arg0;
else
zsh_name++;
if (*zsh_name == '-')
zsh_name++;
if (strcmp(zsh_name, "su") == 0) {
char *sh = zgetenv("SHELL");
if (sh && *sh && arg0 != sh)
zsh_name = sh;
else
break;
} else
break;
} while (zsh_name);
fdtable_size = OPEN_MAX;
fdtable = zcalloc(fdtable_size);

View File

@@ -438,17 +438,6 @@ emulate(const char *zsh_name, int fully)
{
char ch = *zsh_name;
if (!strcmp("su", zsh_name)) {
/* We haven't set up the paramtable yet, so just use zgetenv */
char *ptr = zgetenv("SHELL");
if (ptr && *ptr) {
zsh_name = ptr;
if ((ptr = strrchr(zsh_name, '/')))
zsh_name = ptr+1;
ch = *zsh_name;
} else
ch = 'z';
}
if (ch == 'r')
ch = zsh_name[1];

View File

@@ -976,7 +976,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
zerr("bad substitution", NULL, 0);
return NULL;
}
} else if (INULL(*s))
} else if (inbrace && INULL(*s))
s++;
else
break;
@@ -984,7 +984,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
globsubst = globsubst && !qt;
idbeg = s;
if ((subexp = (s[-1] && isstring(*s) &&
if ((subexp = (inbrace && s[-1] && isstring(*s) &&
(s[1] == Inbrace || s[1] == Inpar)))) {
int sav;
int quoted = *s == Qstring;
@@ -1168,6 +1168,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
}
idend = s;
if (inbrace)
while (INULL(*s))
s++;
if ((colf = *s == ':'))
s++;
@@ -1484,6 +1487,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
val = dupstring("");
isarr = 0;
} else if (isarr && aval && aval[0] && !aval[1]) {
/* treat a one-element array as a scalar for purposes of *
* concatenation with surrounding text (some${param}thing) *
* and rc_expand_param handling. Note: mult_isarr (above) *
* propagates the true array type from nested expansions. */
val = aval[0];
isarr = 0;
}
@@ -1500,8 +1507,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
val = aval[0];
else
isarr = 2;
mult_isarr = isarr;
}
mult_isarr = isarr;
}
if (casmod) {
if (isarr) {
@@ -1665,7 +1672,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
return NULL;
xlen = strlen(x);
*str = strcatsub(&y, ostr, aptr, x, xlen, fstr, globsubst);
if (qt && !*y && isarr != 2)
if (qt && !*y)
y = dupstring(nulstring);
setdata(n, (void *) y);
}

View File

@@ -145,6 +145,7 @@ metadiffer
metafy
metalen
mode_to_octal
movefd
movehistent
mypgrp
mypid
@@ -194,6 +195,7 @@ quietgethist
quotedzputs
readoutput
realparamtab
redup
refreshptr
remlpaths
remnulargs

View File

@@ -30,6 +30,9 @@ version.h: $(sdir_top)/Config/version.mk
zshpaths.h: FORCE Makemod
@echo '#define MODULE_DIR "'$(MODDIR)'"' > zshpaths.h.tmp
@if test x$(fndir) != xno; then \
echo '#define FUNCTION_DIR "'$(fndir)'"' >> zshpaths.h.tmp; \
fi
@if cmp -s zshpaths.h zshpaths.h.tmp; then \
rm -f zshpaths.h.tmp; \
echo "\`zshpaths.h' is up to date." ; \

View File

@@ -17,12 +17,13 @@ Patches
* Send all patches to the mailing list rather than directly to me.
* Send only context diffs "diff -c oldfile newfile". They are much
easier to read and understand while also allowing the patch program
to patch more intelligently. Please make sure the filenames in
the diff header are relative to the top-level directory of the zsh
distribution; for example, it should say "Src/init.c" rather than
"init.c" or "zsh/Src/init.c".
* Send only context diffs "diff -c oldfile newfile" or unified diffs
"diff -u oldfile newfile". They are much easier to read and
understand while also allowing the patch program to patch more
intelligently. Please make sure the filenames in the diff header
are relative to the top-level directory of the zsh distribution; for
example, it should say "Src/init.c" rather than "init.c" or
"zsh/Src/init.c".
* Please put only one bug fix or feature enhancement in a single patch and
only one patch per mail message. This helps me to multiplex the many

View File

@@ -104,7 +104,7 @@ AC_ARG_ENABLE(lfs,
[ --enable-lfs turn on support for large files])
dnl Pathnames for global zsh scripts
undefine([zshenv])dnl
undefine([etcdir])dnl
AC_ARG_ENABLE(etcdir,
[ --enable-etcdir=directory default directory for global zsh scripts],
[etcdir="$enableval"], [etcdir=/etc])
@@ -201,6 +201,21 @@ fi],
AC_DEFINE(RESTRICTED_R)
)
undefine([fndir])dnl
AC_ARG_ENABLE(fndir,
[ --enable-fndir=DIR where functions go (default DATADIR/zsh-fns)],
[fndir="$enableval"], [fndir=${datadir}/zsh/functions])
if test x${FUNCTIONS_INSTALL+set} != xset; then
FUNCTIONS_INSTALL="Core/* Base/* Builtins/* User/* Commands/*"
if test $dynamic != no; then
FUNCTIONS_INSTALL="${FUNCTIONS_INSTALL} Zftp/*"
fi
fi
AC_SUBST(fndir)dnl
AC_SUBST(FUNCTIONS_INSTALL)dnl
dnl ------------------
dnl CHECK THE COMPILER
dnl ------------------
@@ -1293,7 +1308,8 @@ AC_SUBST_FILE(VERSION_MK)dnl
real_no_create=$no_create
no_create=yes
AC_OUTPUT(Config/defs.mk Makefile Doc/Makefile Etc/Makefile Src/Makefile, \
AC_OUTPUT(Config/defs.mk Makefile Doc/Makefile Etc/Makefile Src/Makefile \
Completion/Makefile Functions/Makefile, \
[test -z "$CONFIG_HEADERS" || echo > stamp-h])
dnl The standard config.status is missing some essential features.