1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-03 22:27:13 +02:00

unposted: force latest version of files from vendor to main branch

This commit is contained in:
Peter Stephenson 2007-07-03 17:06:04 +00:00
parent 6fa964914d
commit 876fa2c44e
25 changed files with 310 additions and 194 deletions

View File

@ -1,3 +1,18 @@
2007-07-03 Peter Stephenson <pws@csr.com>
* unposted: Doc/Zsh/mod_cap.yo, Doc/Zsh/mod_complete.yo,
Doc/Zsh/mod_example.yo, Doc/Zsh/mod_files.yo,
Doc/Zsh/mod_mapfile.yo, Doc/Zsh/mod_zleparameter.yo, Doc/intro.ms,
Doc/zshzftpsys.yo, Etc/Makefile.in,
Functions/Prompts/prompt_adam1_setup,
Functions/Prompts/prompt_redhat_setup,
Functions/Prompts/prompt_suse_setup, Functions/Zftp/zfrglob,
Functions/Zftp/zftp_chpwd, Misc/.distfiles, Misc/bash2zshprompt,
Misc/c2z, Misc/compctl-examples, Misc/globtests.ksh,
Misc/job-control-tests, Misc/lete2ctl, Src/Zle/.distfiles,
Util/preconfig, aclocal.m4: jiggery pokery to force files
onto main branch (1.X) from vendor branch (1.1.1.X).
2007-07-03 Clint Adams <clint@zsh.org>
* 23645: Functions/Zftp/zfautocheck: use == instead of =.

View File

@ -1,107 +1,3 @@
The subdirectories contain code for the new function-based completion
system. Broadly speaking, this uses shell functions defined for each
command to determine how the arguments of a command should be completed.
You should copy all the files you need or want to a directory of your own,
which should be included in your autoload path as defined by $fpath. Then
in your .zshrc you should source the file which appears here in
Core/compinit. It is recommnded that you use the -d option, which outputs
a file containing the necessary variables, bindkeys etc., making later
loading much faster. For example,
[[ -f ~/completion/compinit ]] && . ~/completion/compinit -d
This will rebind any keys which do completion to use the new system.
For more detailed instructions, including how to add new completions, see
the top of Core/compinit .
The subdirectories contain:
Core:
The basic functions and files to be sourced. You will certainly need
these, and will most likely not feel like altering them (or, in some
cases, even reading them, unless you are a shell wizard). The files are:
compinit
As already described, this is not a function, but is sourced once
(with the `source' or `.' commands) to set up the completion system.
compdump
This dumps the completions status for faster initialisation. The
easiest way of doing this is to use the -d option to compinit rather
than calling compdump directly.
_comp_parts
Utility used for completing words with multiple separate parts, such as
`<user>@<host>'
_compalso
Utility for calling a function to add additional completions to an
already existing set.
_files
A frontend to _path_files which will default to any old file if the
specified file was not found.
_main_complete
The main entry point called by the key bindings which compinit sets
up (the main `completion widget' in zsh jargon).
_normal
The function called by _main_complete to handle the most common
cases, such as completing a command name or its arguments. This
function dispatches to the various other functions for individual
commands. (Actually, the system is fairly context-sensitive, so
it is wider than just command+argument.)
_path_files
The function usually called to complete filenames and directories. It
replaces the standard -f and -/ options for the basic completion
commands: it can do various extra tricks, such as expanding a whole
path at once, e.g. F/C/C/_p<TAB> -> Functions/Completion/Core/_path_files
Base:
You will almost certainly want these files, too, which handle standard
tasks like completing files. However, you may want to edit them for
your own particular setup. Files are:
_command_names
This handles completion of the command word, i.e. the first thing
on the command line. You may want to alter this, for example,
to complete parameters to assign to.
_condition
This handles completing inside [[ ... ]] .
_default
This handles completion of command arguments when no special function
exists. Usually this means completing files, but you can modify this
as you wish.
_match_pattern
_match_test
These are used by Base/_path_files (and hence also Base/_files) for
file completion with control over matching (whether to complete
case-insensitively, or to allow insertion before `.', etc.) See
_match_test for instructions. Note _path_files expects these files
to be present.
_precommand
Allows completion when the first word on the line has to be ignored,
for example `noglob ...' should ignore the noglob and just complete
as if it wasn't there. Add other such commands to the top line.
_redirect
Completes after `<' or `<': this version calls _files.
_subscript
For completion in subscripts of parameters, e.g $foo[...].
_vars
Completion for commands which need variables (so this could also be in
the Builtins directory), but also in math environments such as ((...)).
Builtins:
Define completions for various shell builtins. The top line of each file
says which builtins they apply to; in many cases you can guess from the
name. Note in particular that _zftp defines completions for all commands
beginning `zf', not just for the module command zftp. This is only
really useful if you use zftp with the zf* function suite (zfopen, zfget,
...).
User:
This contains a pot pourri of completions for various external commands.
Not all will work unmodified on your system.
Commands:
These functions define separate completion commands which do not use
the usual context information, and hence have to be bound separately
to keys. As they appear, they have bindings which you can change or
delete by altering the top line of the file. To bind a function
(strictly speaking, the corresponding completion widget) yourself
after completion is loaded, use `bindkey '<key-string>' <_function_name>'.
The files are:
_correct_filename, bound to \C-xc
Correct the word under the cursor as a filename. This is significantly
more powerful than the standard \e$ (spell-word) binding.
_most_recent_file, bound to \C-xm
Insert the name of the most recent file matching the pattern
so far on the command line.
The subdirectories contain code for a shell-based system of command-line
completion. This is considerably more powerful than the old `compctl'
method. For details, see the compsys(1) manual page (`man zshcompsys').

View File

@ -1,6 +1,7 @@
texinode(The cap Module)(The clone Module)()(Zsh Modules)
sect(The cap Module)
The tt(cap) module is used for manipulating POSIX.1e (POSIX.6) capability
COMMENT(!MOD!zsh/cap
Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.
!MOD!)
The tt(zsh/cap) module is used for manipulating POSIX.1e (POSIX.6) capability
sets. If the operating system does not support this interface, the
builtins defined by this module will do nothing.
The builtins in this module are:

View File

@ -1,6 +1,7 @@
texinode(The complete Module)(The compctl Module)(The clone Module)(Zsh Modules)
sect(The complete Module)
The tt(compctl) module makes available several builtin commands which
COMMENT(!MOD!zsh/complete
The basic completion code.
!MOD!)
The tt(zsh/complete) module makes available several builtin commands which
can be used in user-defined completion widgets, see
ifzman(zmanref(zshcompwid))\
ifnzman(noderef(Completion Widgets))\

View File

@ -1,6 +1,7 @@
texinode(The example Module)(The files Module)(The deltochar Module)(Zsh Modules)
sect(The example Module)
The tt(example) module makes available one builtin command:
COMMENT(!MOD!zsh/example
An example of how to write a module.
!MOD!)
The tt(zsh/example) module makes available one builtin command:
startitem()
findex(example)

View File

@ -1,9 +1,52 @@
texinode(The files Module)(The sched Module)(The example Module)(Zsh Modules)
sect(The files Module)
COMMENT(!MOD!zsh/files
Some basic file manipulation commands as builtins.
!MOD!)
cindex(files, manipulating)
The tt(files) module makes some standard commands available as builtins:
The tt(zsh/files) module makes some standard commands available as builtins:
startitem()
findex(chgrp)
item(tt(chgrp) [ tt(-Rs) ] var(group) var(filename) ...)(
Changes group of files specified. This is equivalent to tt(chown) with
a var(user-spec) argument of `tt(:)var(group)'.
)
findex(chown)
item(tt(chown) [ tt(-Rs) ] var(user-spec) var(filename) ...)(
Changes ownership and group of files specified.
The var(user-spec) can be in four forms:
startsitem()
sitem(var(user))(change owner to var(user); do not change group)
sitem(var(user)tt(::))(change owner to var(user); do not change group)
sitem(var(user)tt(:))(change owner to var(user); change group to var(user)'s primary group)
sitem(var(user)tt(:)var(group))(change owner to var(user); change group to var(group))
sitem(tt(:)var(group))(do not change owner; change group to var(group))
endsitem()
In each case, the `tt(:)' may instead be a `tt(.)'. The rule is that
if there is a `tt(:)' then the separator is `tt(:)', otherwise
if there is a `tt(.)' then the separator is `tt(.)', otherwise
there is no separator.
Each of var(user) and var(group) may be either a username (or group name, as
appropriate) or a decimal user ID (group ID). Interpretation as a name
takes precedence, if there is an all-numeric username (or group name).
The tt(-R) option causes tt(chown) to recursively descend into directories,
changing the ownership of all files in the directory after
changing the ownership of the directory itself.
The tt(-s) option is a zsh extension to tt(chown) functionality. It enables
paranoid behaviour, intended to avoid security problems involving
a tt(chown) being tricked into affecting files other than the ones
intended. It will refuse to follow symbolic links, so that (for example)
``tt(chown luser /tmp/foo/passwd)'' can't accidentally chown tt(/etc/passwd)
if tt(/tmp/foo) happens to be a link to tt(/etc). It will also check
where it is after leaving directories, so that a recursive chown of
a deep directory tree can't end up recursively chowning tt(/usr) as
a result of directories being moved up the tree.
)
findex(ln)
xitem(tt(ln) [ tt(-dfis) ] var(filename) var(dest))
item(tt(ln) [ tt(-dfis) ] var(filename) ... var(dir))(

View File

@ -1,7 +1,8 @@
texinode(The mapfile Module)(The parameter Module)(The files Module)(Zsh Modules)
sect(The mapfile Module)
COMMENT(!MOD!zsh/mapfile
Access to external files via a special associative array.
!MOD!)
cindex(parameter, file access via)
The tt(mapfile) module provides one special associative array parameter of
The tt(zsh/mapfile) module provides one special associative array parameter of
the same name.
startitem()
@ -34,11 +35,13 @@ handled, zsh's internal memory management may be arbitrarily baroque. Thus
it should not automatically be assumed that use of tt(mapfile) represents a
gain in efficiency over use of other mechanisms. Note in particular that
the whole contents of the file will always reside physically in memory when
accessed (possibly multiple times, due to standard parameter subsitution
operations).
accessed (possibly multiple times, due to standard parameter substitution
operations). In particular, this means handling of sufficiently long files
(greater than the machine's swap space, or than the range of the pointer
type) will be incorrect.
No errors are printed or flagged for non-existent, unreadable, or
unwriteable files, as the parameter mechanism is too low in the shell
unwritable files, as the parameter mechanism is too low in the shell
execution hierarchy to make this convenient.
It is unfortunate that the mechanism for loading modules does not yet allow

View File

@ -1,19 +1,20 @@
texinode(The zleparameter Module)()(The zle Module)(Zsh Modules)
sect(The zleparameter Module)
COMMENT(!MOD!zsh/zleparameter
Access to internals of the Zsh Line Editor via parameters.
!MOD!)
cindex(parameters, special)
The tt(zleparameter) module defines two special parameters that can be
The tt(zsh/zleparameter) module defines two special parameters that can be
used to access internal information of the Zsh Line Editor (see
ifzman(zmanref(zshzle))\
ifnzman(noderef(Zsh Line Editor))\
).
startitem()
vindex(zlekeymaps)
item(tt(zlekeymaps))(
vindex(keymaps)
item(tt(keymaps))(
This array contains the names of the keymaps currently defined.
)
vindex(zlewidgets)
item(tt(zlewidgets))(
vindex(widgets)
item(tt(widgets))(
This associative array contains one entry per widget defined. The name
of the widget is the key and the value gives information about the
widget. It is either the string `tt(builtin)' for builtin widgets, a

View File

@ -1,5 +1,10 @@
.nr PI 0
.nr LL 6.5i
.if \n(.g \{\
.if "\*(.T"ascii" .ftr C R
.if "\*(.T"latin1" .ftr C R
.nr De \n[.ss]
.\}
.de Ds
.DS I .5i
.ft C
@ -12,7 +17,8 @@
.ft R
.ps
.vs
.ss
.ie \n(.g .ss \n(De
.el .ss
..
.de Sh
.SH

View File

@ -0,0 +1,3 @@
manpage(ZSHZFTPSYS)(1)(date())(zsh version())
manpagename(zshzftpsys)(zftp function front-end)
includefile(Zsh/zftpsys.yo)

View File

@ -28,8 +28,15 @@ subdir = Etc
dir_top = ..
SUBDIRS =
@@version.mk@@
@@defs.mk@@
@VERSION_MK@
# source/build directories
VPATH = @srcdir@
sdir = @srcdir@
sdir_top = @top_srcdir@
INSTALL = @INSTALL@
@DEFS_MK@
# ========== DEPENDENCIES FOR BUILDING ==========
@ -43,7 +50,7 @@ FAQ.html: FAQ.yo
# ========== DEPENDENCIES FOR CLEANUP ==========
@@clean.mk@@
@CLEAN_MK@
mostlyclean-here:
rm -f FAQ.html
@ -56,4 +63,4 @@ realclean-here:
# ========== DEPENDENCIES FOR MAINTENANCE ==========
@@config.mk@@
@CONFIG_MK@

View File

@ -1,7 +1,30 @@
# adam1 prompt theme
prompt_adam1_help () {
cat <<'EOF'
This prompt is color-scheme-able. You can invoke it thus:
prompt adam1 [<color1> [<color2> [<color3>]]]
where the colors are for the user@host background, current working
directory, and current working directory if the prompt is split over
two lines respectively. The default colors are blue, cyan and green.
This theme works best with a dark background.
Recommended fonts for this theme: nexus or vga or similar. If you
don't have any of these, then specify the `plain' option to use 7-bit
replacements for the 8-bit characters.
And you probably thought adam1 was overkill.
EOF
}
prompt_adam1_setup () {
base_prompt="%{$bg_no_bold_blue%}%n@%m%{$reset_color%} "
prompt_adam1_color1=${1:-'blue'}
prompt_adam1_color2=${2:-'cyan'}
prompt_adam1_color3=${3:-'green'}
base_prompt="%{$bg_no_bold[$prompt_adam1_color1]%}%n@%m%{$reset_color%} "
post_prompt="%{$reset_color%}"
base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g")
@ -20,10 +43,10 @@ prompt_adam1_precmd () {
base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
prompt_length=${#base_prompt_etc}
if [[ $prompt_length -lt 40 ]]; then
path_prompt="%{$fg_bold_cyan%}%(4~|...|)%3~%{$fg_bold_white%}"
path_prompt="%{$fg_bold[$prompt_adam1_color2]%}%(4~|...|)%3~%{$fg_bold[white]%}"
else
space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
path_prompt="%{$fg_bold_green%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
path_prompt="%{$fg_bold[$prompt_adam1_color3]%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
fi
PS1="$base_prompt$path_prompt %# $post_prompt"
PS2="$base_prompt$path_prompt %_> $post_prompt"

View File

@ -6,6 +6,7 @@ prompt_redhat_setup () {
PS1="[%n@%m %1~]\\$ "
PS2="> "
prompt_opts=( cr percent )
precmd () { }
preexec () { }
}

View File

@ -6,6 +6,7 @@ prompt_suse_setup () {
PS1="%n@%m:%~/ > "
PS2="> "
prompt_opts=( cr percent )
precmd () { }
preexec () { }
}

View File

@ -9,7 +9,8 @@
# stick with a single directory. This is the default.
# (2) Use remote globbing, i.e. pass it to ls at the site.
# Faster, but only works with UNIX, and only basic globbing.
# We do this if $zfrglob is non-null.
# We do this if the remote-glob style (or $zfrglob for
# backward compatibility) is set.
# There is only one argument, the variable containing the
# pattern to be globbed. We set this back to an array containing
@ -18,7 +19,9 @@
emulate -L zsh
setopt extendedglob
local pat dir nondir files i
local pat dir nondir files i zfrglob
zstyle -t "$curcontext" remote-glob && zfrglob=1
eval pat=\$$1
@ -52,14 +55,10 @@ else
rm -f $tmpf
else
# we just have to do an ls and hope that's right
local fcache_name
zffcache
nondir=$pat
if (( $#zftp_fcache == 0 )); then
# Why does `zftp_fcache=($(zftp ls))' sometimes not work?
zftp ls >$tmpf
zftp_fcache=($(<$tmpf))
rm -f $tmpf
fi
files=($zftp_fcache)
files=(${(P)fcache_name})
fi
# now we want to see which of the $files match $nondir:
# ${...:/foo} deletes occurrences of foo matching a complete word,

View File

@ -1,13 +1,16 @@
# function zftp_chpwd {
# You may want to alter chpwd to call this when $ZFTP_USER is set.
# Cancel the filename cache for the current directory.
zftp_fcache=()
# ...and also empty the stored directory listing cache.
# As this function is called when we close the connection, this
# is the only place we need to do these two things.
[[ -n $zfcurdir && -f $zfcurdir ]] && rm -f $zfcurdir
zfotherargs=
# If the directory really changed...
if [[ $ZFTP_PWD != $zfconfig[lastdir_$ZFTP_SESSION] ]]; then
# ...and also empty the stored directory listing cache.
# As this function is called when we close the connection, this
# is the only place we need to do these two things.
local curdir=$zfconfig[curdir_$ZFTP_SESSION]
[[ -n $curdir && -f $curdir ]] && rm -f $curdir
zfconfig[otherargs_$ZFTP_SESSION]=
zffcache -d
fi
if [[ -z $ZFTP_USER ]]; then
# last call, after an FTP logout
@ -15,23 +18,23 @@ if [[ -z $ZFTP_USER ]]; then
# delete the non-current cached directory
[[ -n $zfotherdir && -f $zfotherdir ]] && rm -f $zfotherdir
# don't keep zflastdir between opens (do keep zflastsession)
zflastdir=
# don't keep lastdir between opens (do keep lastloc)
zfconfig[lastdir_$ZFTP_SESSION]=
# return the display to standard
# uncomment the following line if you have a chpwd which shows directories
# chpwd
zstyle -t ":zftp$curcontext" chpwd && chpwd
else
[[ -n $ZFTP_PWD ]] && zflastdir=$ZFTP_PWD
zflastsession="$ZFTP_HOST:$ZFTP_PWD"
[[ -n $ZFTP_PWD ]] && zfconfig[lastdir_$ZFTP_SESSION]=$ZFTP_PWD
zfconfig[lastloc_$ZFTP_SESSION]="$ZFTP_HOST:$ZFTP_PWD"
zfconfig[lastuser_$ZFTP_SESSION]="$ZFTP_USER"
local args
if [[ -t 1 && -t 2 ]]; then
local str=$zflastsession
if [[ -t 1 && -t 2 ]] && zstyle -t ":zftp$curcontext" titlebar; then
local str=$zfconfig[lastloc_$ZFTP_SESSION]
[[ ${#str} -lt 70 ]] && str="%m: %~ $str"
case $TERM in
sun-cmd) print -n -P "\033]l$str\033\\"
sun-cmd) print -Pn "\033]l$str\033\\"
;;
xterm) print -n -P "\033]2;$str\a"
*xterm*|rxvt|dtterm|Eterm|kterm) print -Pn "\033]2;$str\a"
;;
esac
fi

View File

@ -1,4 +1,6 @@
DISTFILES_SRC='
.distfiles
c2z compctl-examples globtests globtests.ksh lete2ctl
bash2zshprompt
c2z compctl-examples globtests globtests.ksh
job-control-tests lete2ctl make-zsh-urls
'

View File

@ -10,7 +10,7 @@ use strict;
my @colours = qw/grey red green yellow blue magenta cyan white/;
my @codes = ();
my %bold;
my %boldp;
my $out = '';
print "# Converted to zsh prompt theme by bash2zshprompt, written by <adam\@spiers.net>\n";
@ -25,7 +25,7 @@ while (<>) {
# UGH
elsif (! $seen_fn_end && $seen_fn) {
s/^\s*/ /;
s/^\s*}\s*$/\n precmd () { }\n preexec () { }\n}\n/ and $seen_fn_end++;
s/^\s*}\s*$/\n precmd () { setopt promptsubst }\n preexec () { }\n}\n/ and $seen_fn_end++;
}
s/\\\[/%{/g;
@ -44,6 +44,8 @@ while (<>) {
s/(?<!\\)\\#/%!/g; # hmmm
s/(?<!\\)\\n/\$prompt_newline/g;
s/(?<!\\)\\s/\$SHELL/g;
s/(?<!\\)\\v/\$ZSH_VERSION[1]/g;
s/(?<!\\)\\V/\${ZSH_VERSION%%-*}/g;
s/(?<!\\)\\w/%~/g;
s/(?<!\\)\\W/%1~/g;
s/(?<!\\)\\\$(?!\()/%\#/g;
@ -78,21 +80,22 @@ sub color {
($p[1] eq '4') ? 'bg' :
'???');
$bold{$fgbg} ||= '';
$boldp{$fgbg} ||= '';
if ($p[0] =~ /^0?0$/) {
$bold{$fgbg} = '';
$boldp{$fgbg} = '';
return '$reset_color';
}
if ($p[0] =~ /^0?1$/) {
$bold{$fgbg} = 'bold_';
$boldp{$fgbg} = 'bold_';
return '$bold_color';
}
return '$' .
"${fgbg}_$bold{$fgbg}" .
$colours[$p[2]];
"${fgbg}$boldp{$fgbg}\[" .
$colours[$p[2]] .
']';
}
sub split_codes {

View File

@ -3,6 +3,7 @@
# c2z - environment conversion tool
# Contributed by Bart Schaefer
# (Tweaked a bit by Paul Falstad)
# (Tweaked again by Bart Schaefer)
#
# This is a quick script to convert csh aliases to zsh aliases/functions.
# It also converts the csh environment and local variables to zsh. c2z
@ -81,7 +82,13 @@ grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3
sed -e "s/'/'"\\\\"''"/g \
-e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/alias -- \1='"'\2'/" \
/tmp/cz$$.3
sed -e 's/![:#]*/$/g' \
sed -e 's/>\(&*\)!/>\1|/g' \
-e 's/!\*:q/"$@"/g' \
-e 's/\(![:#]*[^'"$T"']*\):q/"\1"/g' \
-e 's/!\([-0-9][0-9]*\)\(:x\)*/$\2(fc -nl \1)/g' \
-e 's/\$:x(fc/$=(fc/g' \
-e 's/![:#]*\([^'"$T"']\)/$==\1/g' \
-e 's/\$=\(=[^'"$T"']*\):x/$\1/g' \
-e 's/\$cwd/$PWD/' \
-e 's/^\([^'"$T"']*\)'"$T"'\(.*\)$/\1 () { \2 }/' \
/tmp/cz$$.2
@ -92,6 +99,7 @@ exec < /tmp/cz$$.e
# Would be nice to deal with embedded newlines, e.g. in TERMCAP, but ...
sed -e '/^SHLVL/d' \
-e '/^PWD/d' \
-e '/^_=/d' \
-e "s/'/'"\\\\"''"/g \
-e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \
-e "s/$/'/"

View File

@ -11,15 +11,15 @@
# page.
#
#------------------------------------------------------------------------------
hosts=("${${(s: :)${(s: :)${${(f)$(</etc/hosts)}%%\#*}#*[ ]*}}:#}")
ports=( "${${${(f)$(</etc/services)}:#\#*}%%[ ]*}" )
hosts=( ${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}} )
ports=( "${(@)${(@)${(@f)$(</etc/services)}:#\#*}%%[ ]*}" )
# groups=( $(cut -d: -f1 /etc/group) )
# groups=( $(ypcat group.byname | cut -d: -f1) ) # if you use NIS
# It can be done without forking, but it used too much memory in old zsh's:
groups=( "${${(f)$(</etc/group)}%%:*}" )
#groups=( "${${(f)$(ypcat groups)}%%:*}" ) # if you use NIS
groups=( ${${(s: :)$(</etc/group)}%%:*} )
#groups=( ${${(s: :)$(ypcat groups)}%%:*} ) # if you use NIS
# Completion for zsh builtins.
compctl -z -P '%' bg
@ -251,7 +251,7 @@ compctl -k ftphosts ftp
# Note that 'r[-exec,;]' must come first
if [[ -r /proc/filesystems ]]; then
# Linux
filesystems='"${${(f)$(</proc/filesystems)}#* }"'
filesystems='"${(@)${(@f)$(</proc/filesystems)}#* }"'
else
filesystems='ufs 4.2 4.3 nfs tmp mfs S51K S52K'
fi
@ -563,7 +563,7 @@ cvsprefix() {
cvsentries() {
setopt localoptions nullglob unset
if [[ -f ${pref}CVS/Entries ]]; then
reply=( "${pref}${^${${${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}" )
reply=( "${pref}${(@)^${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D*}#/}%%/*}" )
fi
}
@ -574,7 +574,7 @@ cvstargets() {
}
cvsrevisions() {
reply=( "${${${(M)${(f)$(cvs -q status -vl .)}:# *}##[ ]##}%%[ ]*}" )
reply=( "${(@)${(@)${(@M)${(@f)$(cvs -q status -vl .)}:# *}##[ ]##}%%[ ]*}" )
}
cvsrepositories() {
@ -582,7 +582,7 @@ cvsrepositories() {
[[ -f CVS/Root ]] && root=$(<CVS/Root)
reply=(
$root/^CVSROOT(:t)
"${${(M)${(f)$(<$root/CVSROOT/modules)}:#[^#]*}%%[ ]*}"
"${(@)${(@M)${(@f)$(<$root/CVSROOT/modules)}:#[^#]*}%%[ ]*}"
)
}
@ -622,7 +622,7 @@ compctl -s '$(rpm -qa)' \
'c[-1,--rcfile]' -f - \
'p[1] s[-b]' -k '(p l c i b a)' - \
'c[-1,--queryformat] N[-1,{]' \
-s '"${${(f)$(rpm --querytags)}#RPMTAG_}"' -S '}' - \
-s '"${(@)${(@f)$(rpm --querytags)}#RPMTAG_}"' -S '}' - \
'W[1,-q*] C[-1,-([^-]*|)f*]' -f - \
'W[1,-i*], W[1,-q*] C[-1,-([^-]*|)p*]' \
-/g '*.rpm' + -f -- rpm
@ -635,7 +635,7 @@ compctl -K talkmatch talk ytalk ytalk3
function talkmatch {
local u
reply=($(users))
for u in "${${(f)$(rwho 2>/dev/null)}%%:*}"; do
for u in "${(@)${(@f)$(rwho 2>/dev/null)}%%:*}"; do
reply=($reply ${u%% *}@${u##* })
done
}

View File

@ -1,6 +1,6 @@
#!/usr/local/bin/zsh -f
setopt kshglob
setopt kshglob extendedglob
failed=0
while read res str pat; do
@ -68,6 +68,7 @@ t foobar !(foo)*
t moo.cow !(*.*).!(*.*)
f mad.moo.cow !(*.*).!(*.*)
f mucca.pazza mu!(*(c))?.pa!(*(z))?
f _foo~ _?(*[^~])
t fff !(f)
t fff *(!(f))
t fff +(!(f))
@ -87,5 +88,15 @@ t zoox @(!(z*)|*x)
t foo *(!(foo))
f foob !(foo)b*
t foobb !(foo)b*
t fooxx (#i)FOOXX
f fooxx (#l)FOOXX
t FOOXX (#l)fooxx
f fooxx (#i)FOO@(#I)X@(#i)X
t fooXx (#i)FOO@(#I)X@(#i)X
t fooxx @((#i)FOOX)x
f fooxx @((#i)FOOX)X
f BAR @(bar|(#i)foo)
t FOO @(bar|(#i)foo)
t Modules (#i)*m*
EOT
print "$failed tests failed."

View File

@ -29,3 +29,48 @@ while true; do sed -e 's/foo/bar/' Src/builtin.c >/dev/null; done
# ignoring the error messages from sed.
# ^Z is more of a problem since you have to catch the sed.
while true; do sed -e 's/foo/bar/' non-existent-file >/dev/null; done
# Try
# ^Z
# fg
# ^Z
# fg
fn() {
local a
while read a; do :; done
less "$@"
}
cat foo | fn bar
# Try
# ^Z
# fg
fn() {
cat builtin.c
}
fn | while read a; do :; done
# Try
# ^Z
# fg
# q
# ^Z
# fg
# q
fn() {
less builtin.c
echo done
}
x=2; while (( x-- )); do f; done
# Try
# ^C
# This won't work because zcat doesn't tell us that it received a signal.
# But
# ^Z
# fg
# ^C (probably a second ^C is needed: if the continued zcat is still running)
# works.
# (See also the file Etc/BUGS)
while true; do zcat foo.gz > /dev/null; done

View File

@ -9,6 +9,7 @@
# Runs as a filter. Should ignore anything which isn't a "complete".
# It expects each "complete" statement to be the first thing on a line.
# All the examples in the tcsh manual give sensible results.
# Author: Peter Stephenson <pws@ibmth.df.unipi.it>
#
# Option:
# -x (exact): only applies in the case of command disambiguation (is
@ -38,6 +39,11 @@
# (5) Make sure all command names with wildcards are processed together --
# they need to be lumped into one "compctl -C" or "compctl -D"
# statement for zsh.
# (6) Group completion (complete's g flag) is not built into zsh, so
# you need perl to be available to generate the groups. If this
# script is useful, I assume that's not a problem.
# (7) I don't know what `completing completions' means, so the X
# flag to complete is not handled.
# Handle options
if (@ARGV) {
@ -113,6 +119,13 @@ sub gettype {
# Nothing (n) can be handled by returning nothing. (C.f. King Lear, I.i.)
if ($c =~ /[abcjuv]/) {
$ret = "-$c";
} elsif ($c eq 'C') {
if (defined($glob)) {
$ret = "-W $glob -/g '*(.*)'";
undef($glob);
} else {
$ret = '-c';
}
} elsif ($c eq 'S') {
$ret = '-k signals';
} elsif ($c eq 'd') {
@ -121,18 +134,42 @@ sub gettype {
} else {
$ret = '-/';
}
} elsif ($c eq 'D') {
if (defined($glob)) {
$ret = "-W $glob -/";
undef($glob);
} else {
$ret = '-/';
}
} elsif ($c eq 'e') {
$ret = '-E';
} elsif ($c eq 'f' && !$glob) {
$ret = '-f';
} elsif ($c eq 'F') {
if (defined($glob)) {
$ret = "-W $glob -f";
undef($glob);
} else {
$ret = '-f';
}
} elsif ($c eq 'g') {
$ret = "-s '\$(perl -e '\\''while ((\$name) = getgrent)\n" .
"{ print \$name, \"\\n\"; }'\\'')'";
} elsif ($c eq 'l') {
$ret = q!-k "(`limit | awk '{print $1}'`)"!;
} elsif ($c eq 'p') {
$ret = "-W $glob -f", undef($glob) if defined($glob);
$ret = "-W $glob -f", undef($glob) if defined($glob);
} elsif ($c eq 's') {
$ret = '-p';
$ret = '-p';
} elsif ($c eq 't') {
$qual = '.';
} elsif ($c eq 'T') {
if (defined($glob)) {
$ret = "-W $glob -g '*(.)'";
undef($glob);
} else {
$ret = "-g '*(.)'";
}
} elsif ($c eq 'x') {
$glob =~ s/'/'\\''/g;
$ret = "-X '$glob'";
@ -190,7 +227,7 @@ $" = " - ";
while (<>) {
if (/^\s*complete\s/) {
undef(@stuff);
undef(@stuff);
$default = '';
$_ = $';
while (/\\$/) {
@ -211,7 +248,7 @@ while (<>) {
# Loop over remaining arguments to "complete".
$sep = substr($word,1,1);
$sep =~ s/(\W)/\\$1/g;
@split = split(/$sep/,$word);
@split = split(/$sep/,$word,4);
for ($i = 0; $i < 3; $i++) {
while ($split[$i] =~ /\\$/) {
substr($split[$i],-1,1) = "";
@ -225,7 +262,9 @@ while (<>) {
# The "complete" catch-all: treat this as compctl\'s
# default (requiring no pattern matching).
$default .= &gettype($type) . ' ';
defined($suffix) && ($defsuf .= $suffix);
defined($suffix) &&
(defined($defsuf) ? ($defsuf .= $suffix)
: ($defsuf = $suffix));
} else {
$pat = &getpat($pat,$arg);
$type = &gettype($type);

View File

@ -1,8 +1,12 @@
DISTFILES_SRC='
.cvsignore .distfiles .exrc
comp1.mdd comp.h comp1.c
compctl.mdd compctl.c
comp.h complete.mdd complete.c
compcore.c compmatch.c compresult.c
compctl.mdd compctl.c compctl.h
complist.mdd complist.c
computil.mdd computil.c
deltochar.mdd deltochar.c
zleparameter.mdd zleparameter.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

View File

@ -1,6 +1,6 @@
#! /bin/sh
find . \( -name '*.*' -prune \) -o \( -name .preconfig -print \) | (
find . -name '?*.*' -prune -o -name .preconfig -print | (
while read pre; do
cmd=`echo $pre | sed 's,^,cd ,;s,/\([^/]*\)$, \&\& ./\1,'`
echo >&2 "$cmd"