diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-12 22:59:04 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-12 22:59:04 +0000 |
commit | 8d1b4b1358db02d6c9426e4bb3553583e11bf112 (patch) | |
tree | a3095364536d55f8356ac99559e440cc91f33eb1 | |
parent | 5714953c514a5fea35dcd819caf1afef4d92a13b (diff) | |
download | zsh-8d1b4b1358db02d6c9426e4bb3553583e11bf112.tar.gz zsh-8d1b4b1358db02d6c9426e4bb3553583e11bf112.tar.xz zsh-8d1b4b1358db02d6c9426e4bb3553583e11bf112.zip |
Sync up with zsh-3_1_6-pws-1.
169 files changed, 0 insertions, 4700 deletions
diff --git a/.lastloc b/.lastloc deleted file mode 100644 index c927e76e2..000000000 --- a/.lastloc +++ /dev/null @@ -1,5 +0,0 @@ -(("/home/user2/pws/src/zsh-3.1.5/patchlist.txt" . 861) - ("/home/user2/pws/src/zsh-3.1.5/patch-match" . 74776) - ("/home/user2/pws/src/zsh-3.1.5/sven_fix2.dif" . 6081) - ("/home/user2/pws/src/zsh-3.1.5/ci_notes.txt" . 1267) - ("/home/user2/pws/src/zsh-3.1.5/configure.in" . 28530)) diff --git a/Completion/Base/_match_pattern b/Completion/Base/_match_pattern deleted file mode 100644 index c5debc0b9..000000000 --- a/Completion/Base/_match_pattern +++ /dev/null @@ -1,31 +0,0 @@ -#autoload - -# This function is called from functions that do matching whenever they -# need to build a pattern that is used to match possible completions. -# It gets the name of the calling function and two names of parameters -# as arguments. The first one is used in the calling function to build -# the pattern used for matching possible completions. The content of this -# parameter on entry to this function is the string taken from the line. -# Here it parameter should be changed to a pattern that matches words as -# the match specs currently in use do. -# In the calling function this pattern may be changed again or used only -# in parts. The second parameter whose name is given as the third argument -# allows to give pattern flags liek `(#l)' that are to be used whenever -# matching is done. -# -# As an example, if you have global match specifications like: -# -# compctl -M 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z} r:|[.-]=* r:|=*' -# -# This function would look like: -# -# eval "${3}='(#l)'" -# [[ MATCHER -eq 2 ]] && eval "$1='${(P)2:gs/./*./:gs/-/*-/}'" -# -# The first line makes sure that matching is done case-insensitive as -# specified by `m:{a-z}={A-Z}'. The second line replaces dots and hyphens -# in the given string by patterns matching any characters before them, -# like the `r:|[.-]=* r:|=*'. To make this work, the function `_match_test' -# would have to be changed to `(( MATCHERS <= 2 ))' -# -# The default implementation of this function is empty. diff --git a/Completion/Base/_match_test b/Completion/Base/_match_test deleted file mode 100644 index e8b6e6424..000000000 --- a/Completion/Base/_match_test +++ /dev/null @@ -1,15 +0,0 @@ -#autoload - -# This function is called at the beginning of functions that do matching in -# shell code. It should test the value of the `MATCHER' special parameter -# and return non-zero if the calling function should try to generate matches -# for the global match specification in use. -# -# This function gets one argument, the name of the function calling it. -# -# If you have a global match specification with more than one set of patterns -# you may want to modify this function to return non-zero for all of your -# match specifications and modify the function `_match_pattern' to build the -# pattern to use in the calling function. - -(( MATCHER == 1 )) diff --git a/Completion/Core/_comp_parts b/Completion/Core/_comp_parts deleted file mode 100644 index 7c24fd19d..000000000 --- a/Completion/Core/_comp_parts +++ /dev/null @@ -1,147 +0,0 @@ -#autoload - -# This function can be used to separately complete parts of strings -# where each part may be one of a set of matches and different parts -# have different sets. -# Arguments are alternatingly arrays and separator strings. Arrays may -# be given by name or literally as words separated by white space in -# parentheses, e.g.: -# -# _comp_parts '(foo bar)' @ hosts -# -# This will make this function complete the strings in the array -# `friends'. 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. -# -# This function understands the `-J group', `-V group', and -# `-X explanation' options. -# -# This function does part of the matching itself and calls the functions -# `_match_test' and `_match_pattern' for this. - -local str arr sep test testarr tmparr prefix suffixes matchers autosuffix -local matchflags opt group expl - -# Test if we should use this function for the global matcher in use. - -_match_test _comp_parts || return - -# Get the options. - -group=() -expl=() -while getopts "J:V:X:" opt; do - case "$opt" in - [JV]) group=("-$opt" "$OPTARG");; - X) expl=(-X "$OPTARG");; - esac -done -shift OPTIND-1 - -# Get the string from the line. - -str="$PREFIX$SUFFIX" -prefix="" - -# Walk through the arguments to find the longest unambiguous prefix. - -while [[ $# -gt 1 ]]; do - # Get the next array and separator. - arr="$1" - sep="$2" - - if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr - fi - # Is the separator on the line? - [[ "$str" != *${sep}* ]] && break - - # Build a pattern matching the possible matches and get all these - # matches in an array. - test="${str%%${sep}*}" - matchflags="" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - testarr=( "${(@M)${(@P)arr}:#${~test}*}" ) - - # If there are no matches we give up. If there is more than one - # match, this is the part we will complete. - (( $#testarr )) || return - [[ $#testarr -gt 1 ]] && break - - # Only one match, add it to the prefix and skip over it in `str', - # continuing with the next array and separator. - prefix="${prefix}${testarr[1]}${sep}" - str="${str#*${sep}}" - shift 2 -done - -# Get the array to work upon. -arr="$1" -if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr -fi -if [[ $# -le 1 || "$str" != *${2}* ]]; then - # No more separators, build the matches. - matchflags="" - test="$str" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - testarr=( "${(@M)${(@P)arr}:#${~test}*}" ) -fi - -[[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return - -# Now we build the suffixes to give to the completion code. -shift -matchers=() -suffixes=("") -autosuffix=() - -while [[ $# -gt 0 && "$str" == *${1}* ]]; do - # Remove anything up to the the suffix. - str="${str#*${1}}" - - # Again, we get the string from the line up to the next separator - # and build a pattern from it. - if [[ $# -gt 2 ]]; then - test="${str%%${3}*}" - else - test="$str" - fi - matchflags="" - _match_pattern _comp_parts test matchflags - test="${matchflags}${test}" - - # We incrementally add suffixes by appending to them the seperators - # and the strings from the next array that match the pattern we built. - - arr="$2" - if [[ "$arr[1]" == '(' ]]; then - tmparr=( ${=arr[2,-2]} ) - arr=tmparr - fi - suffixes=("${^suffixes[@]}${1}${(@M)^${(@P)arr}:#${~test}*}") - - # We want the completion code to generate the most specific suffix - # for us, so we collect matching specifications that allow partial - # word matching before the separators on the fly. - matchers=("$matchers[@]" "r:|${1}=*") - shift 2 -done - -# If we were given at least one more separator we make the completion -# code offer it by appending it as a autoremovable suffix. -(( $# )) && autosuffix=(-qS "$1") - -# If we have collected matching specifications, we build an array -# from it that can be used as arguments to `compadd'. -[[ $#matchers -gt 0 ]] && matchers=(-M "$matchers") - -# Add the matches for each of the suffixes. -for i in "$suffixes[@]"; do - compadd "$group[@]" "$expl[@]" "$matchers[@]" "$autosuffix[@]" -p "$prefix" -s "$i" - "$testarr[@]" -done diff --git a/Completion/User/_colors b/Completion/User/_colors deleted file mode 100644 index 4e9ee2030..000000000 --- a/Completion/User/_colors +++ /dev/null @@ -1,24 +0,0 @@ -#autoload - -if (( ! $+_color_cache )); then - local file - - # Cache of color names doesn't exist yet, create it. - - if [[ -f /usr/lib/X11/rgb.txt ]]; then - file=/usr/lib/X11/rgb.txt - elif [[ -f /usr/local/lib/X11/rgb.txt ]]; then - file=/usr/local/lib/X11/rgb.txt - fi - - if [[ -n "$file" ]]; then - _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) - else - - # Stupid default value. - - _color_cache=(white black gray red blue green) - fi -fi - -compadd - "$_color_cache[@]" diff --git a/Completion/User/_pbm b/Completion/User/_pbm deleted file mode 100644 index 1e5cb16cb..000000000 --- a/Completion/User/_pbm +++ /dev/null @@ -1,13 +0,0 @@ -#compdef -p p[bgpn]m* - -local pat - -_compskip=1 - -if [[ "$words[1]" = pnm* ]]; then - pat='*.(#i)p[bgp]m' -else - pat="*.(#i)${words[1][1,3]}" -fi - -_path_files -g "$pat" || _files -g '*.(#i)p[bgp]m' diff --git a/Completion/User/_pspdf b/Completion/User/_pspdf deleted file mode 100644 index 014d81ce3..000000000 --- a/Completion/User/_pspdf +++ /dev/null @@ -1,6 +0,0 @@ -#compdef gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii ghostview gv gview mgv ggv pstoedit pstotgif - -# ghostscript: -# gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii - -_files -g '*.(#i)(ps|eps|pdf)' diff --git a/Config/defs.mk b/Config/defs.mk deleted file mode 100644 index 42cad5740..000000000 --- a/Config/defs.mk +++ /dev/null @@ -1,83 +0,0 @@ -# -# Basic Makefile definitions -# -# Copyright (c) 1995-1997 Richard Coleman -# All rights reserved. -# -# Permission is hereby granted, without written agreement and without -# license or royalty fees, to use, copy, modify, and distribute this -# software and to distribute modified versions of this software for any -# purpose, provided that the above copyright notice and the following -# two paragraphs appear in all copies of this software. -# -# In no event shall Richard Coleman or the Zsh Development Group be liable -# to any party for direct, indirect, special, incidental, or consequential -# damages arising out of the use of this software and its documentation, -# even if Richard Coleman and the Zsh Development Group have been advised of -# the possibility of such damage. -# -# Richard Coleman and the Zsh Development Group specifically disclaim any -# warranties, including, but not limited to, the implied warranties of -# merchantability and fitness for a particular purpose. The software -# provided hereunder is on an "as is" basis, and Richard Coleman and the -# Zsh Development Group have no obligation to provide maintenance, -# support, updates, enhancements, or modifications. -# - -# fundamentals -SHELL = /bin/sh -@SET_MAKE@ - -# source/build directories -VPATH = @srcdir@ -sdir = @srcdir@ -sdir_top = @top_srcdir@ - -# installation directories -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -MODDIR = $(libdir)/zsh/$(VERSION) -infodir = @infodir@ -mandir = @mandir@ - -# compilation -CC = @CC@ -CPPFLAGS = @CPPFLAGS@ -DEFS = @DEFS@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ -DLCFLAGS = @DLCFLAGS@ -DLLDFLAGS = @DLLDFLAGS@ -LIBLDFLAGS = @LIBLDFLAGS@ -EXELDFLAGS = @EXELDFLAGS@ -LIBS = @LIBS@ -DL_EXT = @DL_EXT@ -DLLD = @DLLD@ - -# utilities -AWK = @AWK@ -YODL = @YODL@ -YODL2TXT = $(YODL)2txt -YODL2HTML = $(YODL)2html - -# install utility -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -# flags passed to recursive makes in subdirectories -MAKEDEFS = \ -prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \ -libdir='$(libdir)' MODDIR='$(MODDIR)' infodir='$(infodir)' mandir='$(mandir)' \ -CC='$(CC)' CPPFLAGS='$(CPPFLAGS)' DEFS='$(DEFS)' CFLAGS='$(CFLAGS)' \ -LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \ -DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \ -LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \ -LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \ -AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' - -# override built-in suffix list -.SUFFIXES: diff --git a/Doc/Zsh/.lastloc b/Doc/Zsh/.lastloc deleted file mode 100644 index 8b1a784a8..000000000 --- a/Doc/Zsh/.lastloc +++ /dev/null @@ -1 +0,0 @@ -(("/home/user2/pws/src/zsh-3.1.5/Doc/Zsh/expn.yo" . 33735)) diff --git a/Functions/Completion/.distfiles b/Functions/Completion/.distfiles deleted file mode 100644 index 12621da29..000000000 --- a/Functions/Completion/.distfiles +++ /dev/null @@ -1,11 +0,0 @@ -DISTFILES_SRC=' - .distfiles - __aliases __arrays __autoload __bg_jobs __bindkey __builtin __cd __command - __command_names __compress __condition __configure __dd __default __dirs - __disable __dvi __echotc __enable __fc __files __find __functions __gunzip - __gzip __hash __hosts __jobs __kill __kill_helper __limits __main_complete - __main_key_complete __make __man __mh __most_recent_file __normal __path_files - __pdf __precommand __ps __rcs __rlogin __sched __set __setopt __source __strip - __stty __subscript __tar __tex __trap __uncompress __unhash __unsetopt __vars - __vars_eq __wait __which __x_options __xfig __zle __zmodload init -' diff --git a/Functions/Completion/__aliases b/Functions/Completion/__aliases deleted file mode 100644 index cbf204e51..000000000 --- a/Functions/Completion/__aliases +++ /dev/null @@ -1,2 +0,0 @@ -#array unalias -__aliases=(-a) diff --git a/Functions/Completion/__arrays b/Functions/Completion/__arrays deleted file mode 100644 index 3f6ec8abe..000000000 --- a/Functions/Completion/__arrays +++ /dev/null @@ -1,2 +0,0 @@ -#array shift -__arrays=(-A) diff --git a/Functions/Completion/__autoload b/Functions/Completion/__autoload deleted file mode 100644 index 9c3bb1f4f..000000000 --- a/Functions/Completion/__autoload +++ /dev/null @@ -1,2 +0,0 @@ -#array autoload -__autoload=(-s '${^fpath}/*(N:t)') diff --git a/Functions/Completion/__bg_jobs b/Functions/Completion/__bg_jobs deleted file mode 100644 index 90e3b7ee0..000000000 --- a/Functions/Completion/__bg_jobs +++ /dev/null @@ -1,2 +0,0 @@ -#array bg -__bg_jobs=(-z -P '%') diff --git a/Functions/Completion/__bindkey b/Functions/Completion/__bindkey deleted file mode 100644 index c9005347a..000000000 --- a/Functions/Completion/__bindkey +++ /dev/null @@ -1,7 +0,0 @@ -#function bindkey - -if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then - complist -s '$(bindkey -l)' -else - complist -b -fi diff --git a/Functions/Completion/__builtin b/Functions/Completion/__builtin deleted file mode 100644 index 5b4c777f5..000000000 --- a/Functions/Completion/__builtin +++ /dev/null @@ -1,7 +0,0 @@ -#function builtin - -if [[ -position 2 -1 ]]; then - compsub -else - complist -eB -fi diff --git a/Functions/Completion/__cd b/Functions/Completion/__cd deleted file mode 100644 index ad5e36386..000000000 --- a/Functions/Completion/__cd +++ /dev/null @@ -1,3 +0,0 @@ -#function cd - -__files -W cdpath -g '*(-/)' diff --git a/Functions/Completion/__command b/Functions/Completion/__command deleted file mode 100644 index deaabdb1f..000000000 --- a/Functions/Completion/__command +++ /dev/null @@ -1,7 +0,0 @@ -#function command - -if [[ -position 2 -1 ]]; then - compsub -else - complist -em -fi diff --git a/Functions/Completion/__command_names b/Functions/Completion/__command_names deleted file mode 100644 index 7a28fa527..000000000 --- a/Functions/Completion/__command_names +++ /dev/null @@ -1,2 +0,0 @@ -#array --command-- -__command_names=(-c) diff --git a/Functions/Completion/__compress b/Functions/Completion/__compress deleted file mode 100644 index d4e71f531..000000000 --- a/Functions/Completion/__compress +++ /dev/null @@ -1,3 +0,0 @@ -#function compress - -__files -g '*~*.Z' diff --git a/Functions/Completion/__condition b/Functions/Completion/__condition deleted file mode 100644 index 8ceb969b8..000000000 --- a/Functions/Completion/__condition +++ /dev/null @@ -1,10 +0,0 @@ -#function --condition-- - -if [[ -current -1 -o ]]; then - complist -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -elif [[ -current -1 -nt || -current -1 -ot || -current -1 -ef ]]; then - files -else - files - complist -v -fi diff --git a/Functions/Completion/__configure b/Functions/Completion/__configure deleted file mode 100644 index a4d00e0f2..000000000 --- a/Functions/Completion/__configure +++ /dev/null @@ -1,11 +0,0 @@ -#function configure -if [[ $PREFIX = *=* ]]; then - # Complete filenames after e.g. --prefix= - IPREFIX=${PREFIX%%=*}= - PREFIX=${PREFIX#*=} - complist -f -else - # Generate a list of options from configure --help - complist -s '$($COMMAND --help | - sed -n -e '\''s/^ *\(--[-a-z0-9]*\)[ =,].*$/\1/p'\'')' -fi diff --git a/Functions/Completion/__dd b/Functions/Completion/__dd deleted file mode 100644 index c0e04de75..000000000 --- a/Functions/Completion/__dd +++ /dev/null @@ -1,13 +0,0 @@ -#function dd - -if [[ -iprefix conv= ]]; then - # If there's a comma present, ignore up to the last one. The - # test alone will have that effect. - [[ -string , ]] - complist -S, -q \ - -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)' -elif [[ -iprefix 'if=' || -iprefix 'of=' ]]; then - __files -else - complist -S '=' -k '(if of ibs obs bs cbs skip files seek count conv)' -fi diff --git a/Functions/Completion/__default b/Functions/Completion/__default deleted file mode 100644 index cabe14a36..000000000 --- a/Functions/Completion/__default +++ /dev/null @@ -1,13 +0,0 @@ -#function --default-- - -# We first try the `compctl's. This is without first (-T) and default (-D) -# completion. If you want them add `-T' and/or `-D' to this command. -# If there is a `compctl' for the command we are working on, we return -# immediatly. If you want to use new style completion anyway, remove the -# `|| return'. Also, you may want to use new style completion if the -# `compctl' didn't produce any matches. In that case remove the `|| return' -# and at the line `[[ -nmatches 0 ]] || return' after `compcall'. - -compcall || return - -__files diff --git a/Functions/Completion/__dirs b/Functions/Completion/__dirs deleted file mode 100644 index a838168bc..000000000 --- a/Functions/Completion/__dirs +++ /dev/null @@ -1,3 +0,0 @@ -#function rmdir df du dircmp - -__files -/ '*(-/)' diff --git a/Functions/Completion/__disable b/Functions/Completion/__disable deleted file mode 100644 index c56ffb7f7..000000000 --- a/Functions/Completion/__disable +++ /dev/null @@ -1,6 +0,0 @@ -#function disable - -[[ -mcurrent -1 -*a* ]] && complist -ea -[[ -mcurrent -1 -*f* ]] && complist -eF -[[ -mcurrent -1 -*r* ]] && complist -ew -[[ ! -mcurrent -1 -* ]] && complist -eB diff --git a/Functions/Completion/__dvi b/Functions/Completion/__dvi deleted file mode 100644 index 873d5812a..000000000 --- a/Functions/Completion/__dvi +++ /dev/null @@ -1,3 +0,0 @@ -#function xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype - -__files -g '*.(dvi|DVI)' diff --git a/Functions/Completion/__echotc b/Functions/Completion/__echotc deleted file mode 100644 index d9b7029c1..000000000 --- a/Functions/Completion/__echotc +++ /dev/null @@ -1,2 +0,0 @@ -#array echotc -__echotc=(-k '(al dc dl do le up al bl cd ce cl cr dc dl do ho is le ma nd nl se so up)') diff --git a/Functions/Completion/__enable b/Functions/Completion/__enable deleted file mode 100644 index b315611df..000000000 --- a/Functions/Completion/__enable +++ /dev/null @@ -1,6 +0,0 @@ -#function enable - -[[ -mcurrent -1 -*a* ]] && complist -da -[[ -mcurrent -1 -*f* ]] && complist -dF -[[ -mcurrent -1 -*r* ]] && complist -dw -[[ ! -mcurrent -1 -* ]] && complist -dB diff --git a/Functions/Completion/__fc b/Functions/Completion/__fc deleted file mode 100644 index 9185312b0..000000000 --- a/Functions/Completion/__fc +++ /dev/null @@ -1,7 +0,0 @@ -#function fc - -if [[ -mcurrent -1 -*e ]]; then - complist -c -elif [[ -mcurrent -1 -[ARWI]## ]]; then - __files -fi diff --git a/Functions/Completion/__files b/Functions/Completion/__files deleted file mode 100644 index dfade8c7f..000000000 --- a/Functions/Completion/__files +++ /dev/null @@ -1,10 +0,0 @@ -#helper - -# 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(). - -local nm=$NMATCHES - -__path_files "$@" - -[[ $# -ne 0 && -nmatches nm ]] && __path_files diff --git a/Functions/Completion/__find b/Functions/Completion/__find deleted file mode 100644 index b16bb09c7..000000000 --- a/Functions/Completion/__find +++ /dev/null @@ -1,24 +0,0 @@ -#function find - -compsave - -if [[ -mbetween -(ok|exec) \\\; ]]; then - compsub -elif [[ -iprefix - ]]; then - complist -s 'daystart {max,min,}depth follow noleaf version xdev \ -{a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ -{i,}{l,}name {no,}{user,group} path perm regex size true uid used \ -exec {f,}print{f,0,} ok prune ls' - compreset -elif [[ -position 1 ]]; then - complist -g '. ..' - __files -g '(-/)' -elif [[ -mcurrent -1 -((a|c|)newer|fprint(|0|f)) ]]; then - __files -elif [[ -current -1 -fstype ]]; then - complist -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' -elif [[ -current -1 -group ]]; then - complist -k groups -elif [[ -current -1 -user ]]; then - complist -u -fi diff --git a/Functions/Completion/__functions b/Functions/Completion/__functions deleted file mode 100644 index 4fd24e379..000000000 --- a/Functions/Completion/__functions +++ /dev/null @@ -1,2 +0,0 @@ -#array unfunction -__functions=(-F) diff --git a/Functions/Completion/__gunzip b/Functions/Completion/__gunzip deleted file mode 100644 index f14803c62..000000000 --- a/Functions/Completion/__gunzip +++ /dev/null @@ -1,3 +0,0 @@ -#function gunzip zcat - -__files -g '*.[gG][z]' diff --git a/Functions/Completion/__gzip b/Functions/Completion/__gzip deleted file mode 100644 index ce4e0787a..000000000 --- a/Functions/Completion/__gzip +++ /dev/null @@ -1,3 +0,0 @@ -#function gzip - -__files -g '*~*.[gG][zZ]' diff --git a/Functions/Completion/__hash b/Functions/Completion/__hash deleted file mode 100644 index bd43eb967..000000000 --- a/Functions/Completion/__hash +++ /dev/null @@ -1,13 +0,0 @@ -#function hash - -if [[ -mword 1 -*d* ]]; then - if [[ -string 1 '=' ]]; then - pfiles -g '*(-/)' - else - complist -n -q -S '=' - fi -elif [[ -string 1 '=' ]]; then - files -g '*(*)' '*(-/)' -else - complist -m -q -S '=' -fi diff --git a/Functions/Completion/__hosts b/Functions/Completion/__hosts deleted file mode 100644 index a91251581..000000000 --- a/Functions/Completion/__hosts +++ /dev/null @@ -1,2 +0,0 @@ -#array ftp ncftp ping rwho rup xping traceroute nslookup -__hosts=(-k hosts) diff --git a/Functions/Completion/__jobs b/Functions/Completion/__jobs deleted file mode 100644 index d3e0d7776..000000000 --- a/Functions/Completion/__jobs +++ /dev/null @@ -1,2 +0,0 @@ -#array fg jobs -__jobs=(-j -P '%') diff --git a/Functions/Completion/__kill b/Functions/Completion/__kill deleted file mode 100644 index 09ba248dc..000000000 --- a/Functions/Completion/__kill +++ /dev/null @@ -1,8 +0,0 @@ -#function kill - -if [[ -iprefix '-' ]]; then - complist -k "($signals[1,-3])" -else - complist -P '%' -j - complist -y __kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' -fi diff --git a/Functions/Completion/__kill_helper b/Functions/Completion/__kill_helper deleted file mode 100644 index e1d286938..000000000 --- a/Functions/Completion/__kill_helper +++ /dev/null @@ -1,3 +0,0 @@ -#helper - -reply=( "$(ps 2>/dev/null)" ) diff --git a/Functions/Completion/__limits b/Functions/Completion/__limits deleted file mode 100644 index e3f97155d..000000000 --- a/Functions/Completion/__limits +++ /dev/null @@ -1,2 +0,0 @@ -#array limit unlimit -__limits=(-k "(${(j: :)${(f)$(limit)}%% *})") diff --git a/Functions/Completion/__main_complete b/Functions/Completion/__main_complete deleted file mode 100644 index 48f2338de..000000000 --- a/Functions/Completion/__main_complete +++ /dev/null @@ -1,48 +0,0 @@ -#helper - -# The main loop of the completion code. This is what is called when -# completion is attempted from the command line. -# The completion code gives us the special variables and the arguments -# from the command line are given as positional parameters. - -local comp name - -setopt localoptions nullglob rcexpandparam globdots -unsetopt markdirs globsubst shwordsplit nounset - -# An entry for `--first--' is the replacement for `compctl -T' -# The `|| return 1' is used throughout: if a function producing matches -# returns non-zero this is interpreted as `do not try to produce more matches' -# (this is the replacement for `compctl -t'). - -comp="$comps[--first--]" -[[ -z "$comp" ]] || callcomplete comps --first-- "$@" || return 1 - -# For arguments we use the `__normal' function called via the convenience -# alias `compsub'. - -if [[ $CONTEXT == argument || $CONTEXT == command ]]; then - compsub -else - # Let's see if we have a special completion definition for the other - # possible contexts. - - comp='' - - case $CONTEXT in - redirect) name=--redirect--;; - math) name=--math--;; - subscript) name=--subscript--;; - value) name=--value--;; - condition) name=--condition--;; - esac - - # If not, we use default completion, if any. - - comp="$comps[$name]" - if [[ -z "$comp" ]]; then - name=--default-- - comp="$comps[--default--]" - fi - [[ -z "$comp" ]] || callcomplete comps "$name" "$@" || return 1 -fi diff --git a/Functions/Completion/__main_key_complete b/Functions/Completion/__main_key_complete deleted file mode 100644 index 35fa1a0a3..000000000 --- a/Functions/Completion/__main_key_complete +++ /dev/null @@ -1,6 +0,0 @@ -#helper - -# The widget name looks like `__complete_key_<num>' where <num> can be -# used as an index into the `keycomps' array to get at the definition. - -callcomplete keycomps "$WIDGET" "$@" diff --git a/Functions/Completion/__make b/Functions/Completion/__make deleted file mode 100644 index 4a2c5a7c8..000000000 --- a/Functions/Completion/__make +++ /dev/null @@ -1,3 +0,0 @@ -#function make gmake pmake - -complist -s "\$(awk '/^[a-zA-Z0-9][^/ ]+:/ {print \$1}' FS=: [mM]akefile)" diff --git a/Functions/Completion/__man b/Functions/Completion/__man deleted file mode 100644 index a0f00f58b..000000000 --- a/Functions/Completion/__man +++ /dev/null @@ -1,11 +0,0 @@ -#function man -setopt localoptions rcexpandparam - -local rep -if [[ $2 = (<->*|ln) ]]; then - rep=( $manpath/(man|cat)$2/$PREFIX*$SUFFIX.<->*(N:t:r) ) -else - rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) -fi - -(( $#rep )) && compadd -m $rep diff --git a/Functions/Completion/__mh b/Functions/Completion/__mh deleted file mode 100644 index 2e4738e17..000000000 --- a/Functions/Completion/__mh +++ /dev/null @@ -1,70 +0,0 @@ -#function folder comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhpatch - -# Completion for all possible MH commands. -# Alter the following two to your own mh directory and the directory -# where standard mh library files live. (It works anyway, but this -# will save a little time.) -local mymhdir=~/Mail -local mhlib=/usr/lib/mh - -# To be on the safe side, check this exists and if not, get it anyway. -[[ -d $mymhdir ]] || mymhdir=$(mhpath +) - -if [[ -iprefix - ]]; then - # get list of options, which MH commands can generate themselves - # awk is just too icky to use for this, sorry. send me one if - # you come up with it. - compadd -m $($COMMAND -help | perl -ne 'if (/^\s*-\(?(\S+)/) { - $n = $1; - $n =~ s/\)//g; - print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; - }') - return -elif [[ -iprefix '+' || -iprefix '@' || -current -1 -draftfolder ]]; then - # Complete folder names. - local mhpath - if [[ $IPREFIX != '@' ]]; then - [[ $IPREFIX = '+' ]] || IPREFIX=+ - mhpath=$mymhdir - else - mhpath=$(mhpath) - fi - - # painless, or what? - complist -W mhpath -/ -elif [[ -mcurrent -1 -(editor|(whatnow|rmm|show|more)proc) ]]; then - complist -c -elif [[ -current -1 -file ]]; then - complist -f -elif [[ -mcurrent -1 -(form|audit|filter) ]]; then - # Need some MH template file, which may be in our own MH directory - # or with the standard library. - local mhfpath - # This is the only place we need mhlib, so leave the test till here. - [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } - mhfpath=($mymhdir $mhlib) - - complist -W mhfpath -g '*(.)' -elif [[ -mcurrent -1 -(no|)cc ]]; then - compadd -m all to cc me -elif [[ -mcurrent -1 -[rw]cache ]]; then - compadd -m public private never ask -else - # Generate sequences. - local foldnam folddir f - for f in $argv; do - [[ $f = [@+]* ]] && foldnam=$f - done - if [[ $foldnam = '+'* ]]; then - folddir=$mymhdir/${foldnam#+} - elif [[ $foldnam = '@'* ]]; then - folddir=$(mhpath)/${foldnam#@} - else - folddir=$(mhpath) - # leaving foldnam empty works here - fi - - complist -s '$(mark $foldnam | awk -F: '\''{ print $1 }'\'')' - compadd -m reply next cur prev first last all unseen - complist -W folddir -g '<->' -fi diff --git a/Functions/Completion/__most_recent_file b/Functions/Completion/__most_recent_file deleted file mode 100644 index cf1f83282..000000000 --- a/Functions/Completion/__most_recent_file +++ /dev/null @@ -1,2 +0,0 @@ -#key-array expand-or-complete \C-xm -__most_recent_file=(-g '*(om[1])') diff --git a/Functions/Completion/__normal b/Functions/Completion/__normal deleted file mode 100644 index 7750563d1..000000000 --- a/Functions/Completion/__normal +++ /dev/null @@ -1,54 +0,0 @@ -#helper - -local comp cmd1 cmd2 pat val name - -# 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. -# a path and the last path name component). - -if [[ $CONTEXT == command ]]; then - comp="$comps[--command--]" - [[ -z "$comp" ]] || callcomplete comps --command-- "$@" || return 1 - return 0 -elif [[ "$COMMAND[1]" == '=' ]]; then - eval cmd1\=$COMMAND - cmd2="$COMMAND[2,-1]" -elif [[ "$COMMAND" == */* ]]; then - cmd1="$COMMAND" - cmd2="${COMMAND:t}" -else - cmd1="$COMMAND" - eval cmd2=$(whence -p $COMMAND) -fi - -# See if there are any matching pattern completions. - -if (( $#patcomps )); then - for i in "$patcomps[@]"; do - pat="${i% *}" - val="${i#* }" - if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then - callcomplete patcomps "$pat" "$@" || return 1 - fi - done -fi - -# Now look up the two names in the normal completion array. - -name="$cmd1" -comp="$comps[$cmd1]" - -if [[ -z "$comp" ]]; then - name="$cmd2" - comp="$comps[$cmd2]" -fi - -# And generate the matches, probably using default completion. - -if [[ -z "$comp" ]]; then - name=--default-- - comp="$comps[--default--]" -fi -[[ -z "$comp" ]] || callcomplete comps "$name" "$@" || return 1 - -return 0 diff --git a/Functions/Completion/__path_files b/Functions/Completion/__path_files deleted file mode 100644 index f9e7c631a..000000000 --- a/Functions/Completion/__path_files +++ /dev/null @@ -1,272 +0,0 @@ -#helper - -# Utility function for in-path completion. -# First argument should be an complist-option (e.g. -f, -/, -g). The other -# arguments should be glob patterns, one per argument. -# -# E.g.: __path_files -g '*.tex' '*.texi' -# -# This is intended as a replacement for `complist -f', `complist -/', and -# `complist -g ...' (but don't use it with other options). -# -# You may also give the `-W <spec>' option as with `compctl' and `complist', -# but only as the first argument. -# -# This function also accepts an optional `-F <string>' option as its first -# argument or just after the `-W <spec>'. This can be used to define file -# name extension (a la `fignore'). Files with such an extension will not -# be considered possible completions. -# -# This function behaves as if you have a matcher definition like: -# compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' \ -# 'm:{a-z}={A-Z} l:|=* r:|=*' -# so you may want to modify this. - -local nm prepaths str linepath realpath donepath patstr prepath testpath rest -local tmp1 collect tmp2 suffixes i ignore - -setopt localoptions nullglob rcexpandparam globdots extendedglob -unsetopt markdirs globsubst shwordsplit nounset - -# Get the optional `-W' option and its argument. -if [[ "$1" = -W ]]; then - tmp1="$2" - if [[ "$tmp1[1]" = '(' ]]; then - prepaths=( $tmp1[2,-2]/ ) - else - prepaths=( ${(P)${tmp1}} ) - [[ $#prepaths -eq 0 ]] && prepaths=( $tmp1/ ) - fi - [[ $#prepaths -eq 0 ]] && prepaths=( '' ) - shift 2 -else - prepaths=( '' ) -fi - -# Get the optional `-F' option and its argument. -if [[ "$1" = -F ]]; then - ignore=(-F "$2") - shift 2 -else - ignore='' -fi - -# str holds the whole string from the command line with a `*' between -# the prefix and the suffix. - -str="${PREFIX:q}*${SUFFIX:q}" - -# We will first try normal completion called with `complist', but only if we -# weren't given a `-F' option. - -if [[ -z "$ignore" ]]; then - # First build an array containing the `-W' option, if there is any and we - # want to use it. We don't want to use it if the string from the command line - # is a absolute path or relative to the current directory. - - if [[ -z "$tmp1[1]" || "$str[1]" = [~/] || "$str" = (.|..)/* ]]; then - tmp1=() - else - tmp1=(-W "( $ppres )") - fi - - # Now call complist. - - nm=$NMATCHES - if [[ $# -eq 0 ]]; then - complist "$tmp1[@]" -f - elif [[ "$1" = -g ]]; then - complist "$tmp1[@]" -g "$argv[2,-1]" - shift - else - complist "$tmp1[@]" $1 - shift - fi - - # If this generated any matches, we don't wnat to do in-path completion. - - [[ -nmatches nm ]] || return - - # No `-F' option, so we want to use `fignore'. - - ignore=(-F fignore) -fi - -# If we weren't given any file patterns as arguments, we trick ourselves -# into believing that we were given the pattern `*'. This is just to simplify -# the following code. - -[[ -z "$1" ]] && 1='*' - -# Now let's have a closer look at the string to complete. - -if [[ "$str[1]" = \~ ]]; then - # It begins with `~', so remember anything before the first slash to be able - # to report it to the completion code. Also get an expanded version of it - # (in `realpath'), so that we can generate the matches. Then remove that - # prefix from the string to complete, set `donepath' to build the correct - # paths and make sure that the loop below is run only once with an empty - # prefix path by setting `prepaths'. - - linepath="${str%%/*}/" - eval realpath\=path - str="${str#*/}" - donepath='' - prepaths=( '' ) -else - # If the string does not start with a `~' we don't remove a prefix from the - # string. - - liniepath='' - realpath='' - - if [[ "$str[1]" = / ]]; then - # If it is a absolut path name, we remove the first slash and put it in - # `donepath' meaning that we treat it as the path that was already handled. - # Also, we don't use the paths from `-W'. - - str="$str[2,-1]" - donepath='/' - prepaths=( '' ) - else - # The common case, we just use the string as it is, unless it begins with - # `./' or `../' in which case we don't use the paths from `-W'. - - [[ "$str" = (.|..)/* ]] && prepaths=( '' ) - donepath='' - fi -fi - -# First we skip over all pathname components in `str' which really exist in -# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and -# `lib5'. Pathname components skipped this way are taken from `str' and added -# to `donepath'. - -while [[ "$str" = */* ]] do - [[ -e "$realpath$donepath${str%%/*}" ]] || break - donepath="$donepath${str%%/*}/" - str="${str#*/}" -done - -# Now build the glob pattern. As noted above, this function behaves as if -# a global matcher with two matching specifications are given. - -if [[ -matcher 1 ]]; then - patstr="$str:gs/,/*,/:gs/_/*_/:gs./.*/.:gs/-/*[-_]/:gs/./*[.,]/:gs-*[.,]*[.,]*/-../-:gs.**.*." -else - patstr="${str%/*}/*${str##*/}*" - patstr="$patstr:gs./.*/.:gs.**.*." -fi - -# Finally, generate the matches. First we loop over all the paths from `-W'. -# Note that in this loop `str' is used as a modifyable version of `patstr' -# and `testpath' is a modifyable version of `donepath'. - -for prepath in "$prepaths[@]"; do - str="$patstr" - testpath="$donepath" - - # The second loop tests the components of the path in `str' to get the - # possible matches. - - while [[ "$str" = */* ]] do - # `rest' is the pathname after the first slash that is left. In `tmp1' - # we get the globbing matches for the pathname component currently - # handled. - - rest="${str#*/}" - tmp1="${prepath}${realpath}${testpath}(#l)${str%%/*}(-/)" - tmp1=( $~tmp1 ) - - if [[ $#tmp1 -eq 0 ]]; then - # If this didn't produce any matches, we don't need to test this path - # any further, so continue with the next `-W' path, if any. - - continue 2 - elif [[ $#tmp1 -gt 1 ]]; then - # If it produced more than one match, we want to remove those which - # don't have possible following pathname components matching the - # rest of the string we are completing. (The case with only one - # match is handled below.) - # In `collect' we will collect those of the produced pathnames that - # have a matching possible path-suffix. In `suffixes' we build an - # array containing strings build from the rest of the string to - # complete and the glob patterns we were given as arguments. - - collect=() - suffixes=( $rest$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - - # In the loop the prefixes from the `tmp1' array produced above and - # the suffixes we just built are used to produce possible matches - # via globbing. - - for i in $tmp1; do - tmp2=( $~i/(#l)$~suffixes ) - [[ $#tmp2 -ne 0 ]] && collect=( $collect $i ) - done - - # If this test showed that none of the matches from the glob in `tmp1' - # has a possible sub-path matching what's on the line, we give up and - # continue with the next `-W' path. - - if [[ $#collect -eq 0 ]]; then - continue 2 - elif [[ $#collect -ne 1 ]]; then - # If we have more than one possible match, this means that the - # pathname component currently handled is ambiguous, so we give - # it to the completion code. - # First we build the full path prefix in `tmp1'. - - tmp1="$prepath$realpath$testpath" - - # Now produce all matching pathnames in `collect'. - - collect=( $~collect/(#l)$~suffixes ) - - # And then remove the common path prefix from all these matches. - - collect=( ${collect#$tmp1} ) - - # Finally, we add all these matches with the common (unexpanded) - # pathprefix (the `-p' option), the path-prefix (the `-W' option) - # to allow the completion code to test file type, and the path- - # suffix (the `-s' option). We also tell the completion code that - # these are file names and that `fignore' should be used as usual - # (the `-f' and `-F' options). - - for i in $collect; do - compadd -p "$linepath$testpath" -W "$tmp1" -s "/${i#*/}" -f "$ignore[@]" -- "${i%%/*}" - done - - # We have just finished handling all the matches from above, so we - # can continue with the next `-W' path. - - continue 2 - fi - # We reach this point if only one of the path prefixes in `tmp1' - # has a existing path-suffix matching the string from the line. - # In this case we accept this match and continue with the next - # path-name component. - - tmp1=( "$collect[1]" ) - fi - # This is also reached if the first globbing produced only one match - # in this case we just continue with the next pathname component, too. - - tmp1="$tmp1[1]" - testpath="$testpath${tmp1##*/}/" - str="$rest" - done - - # We are here if all pathname components except the last one (which is still - # not tested) are unambiguous. So we add matches with the full path prefix, - # no path suffix, the `-W' we are currently handling, all the matches we - # can produce in this directory, if any. - - tmp1="$prepath$realpath$testpath" - suffixes=( $str$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - tmp2=( $~tmp1(#l)$~suffixes ) - compadd -p "$linepath$testpath" -W "$prepath$realpath$testpath" -f "$ignore[@]" -- ${tmp2#$tmp1} -done diff --git a/Functions/Completion/__pdf b/Functions/Completion/__pdf deleted file mode 100644 index 97f656f40..000000000 --- a/Functions/Completion/__pdf +++ /dev/null @@ -1,3 +0,0 @@ -function acroread - -__files -g '*.(pdf|PDF)' diff --git a/Functions/Completion/__precommand b/Functions/Completion/__precommand deleted file mode 100644 index a07cae96a..000000000 --- a/Functions/Completion/__precommand +++ /dev/null @@ -1,15 +0,0 @@ -#function - nohup nice eval time rusage noglob nocorrect exec - -# We just change the special completion parameters, to make the first -# argument be treated as the command name and removing it from the -# positional parameters. - -COMMAND="$1" -shift -(( CURRENT-- )) -if [[ CURRENT -eq 0 ]]; then - CONTEXT=command -else - CONTEXT=argument -fi -compsub diff --git a/Functions/Completion/__ps b/Functions/Completion/__ps deleted file mode 100644 index fa7395113..000000000 --- a/Functions/Completion/__ps +++ /dev/null @@ -1,3 +0,0 @@ -#function gs ghostview gview psnup psselect pswrap pstops pstruct lpr - -__files -g '*([pP][sS]|eps)' diff --git a/Functions/Completion/__rcs b/Functions/Completion/__rcs deleted file mode 100644 index 8d55cc470..000000000 --- a/Functions/Completion/__rcs +++ /dev/null @@ -1,9 +0,0 @@ -#function co ci rcs - -[[ $COMMAND = ci || $COMMAND = rcs ]] && __files - -if [[ $NMATCHES -eq 0 && -d RCS && $COMMAND != ci ]]; then - local rep - rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && compadd -m $rep -fi diff --git a/Functions/Completion/__rlogin b/Functions/Completion/__rlogin deleted file mode 100644 index 69fdebe13..000000000 --- a/Functions/Completion/__rlogin +++ /dev/null @@ -1,9 +0,0 @@ -#function rlogin rsh ssh - -if [[ -position 1 ]]; then - complist -k hosts -elif [[ -position 2 ]]; then - complist -k '(-l)' -else - complist -u -fi diff --git a/Functions/Completion/__sched b/Functions/Completion/__sched deleted file mode 100644 index dcd7385e1..000000000 --- a/Functions/Completion/__sched +++ /dev/null @@ -1,3 +0,0 @@ -#function sched - -[[ -position 2 -1 ]] && compsub diff --git a/Functions/Completion/__set b/Functions/Completion/__set deleted file mode 100644 index e9db6c43a..000000000 --- a/Functions/Completion/__set +++ /dev/null @@ -1,7 +0,0 @@ -#function set - -if [[ -mcurrent -1 [-+]o ]]; then - complist -o -elif [[ -current -1 -A ]]; then - complist -A -fi diff --git a/Functions/Completion/__setopt b/Functions/Completion/__setopt deleted file mode 100644 index 8a97befc7..000000000 --- a/Functions/Completion/__setopt +++ /dev/null @@ -1,7 +0,0 @@ -#function setopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/__source b/Functions/Completion/__source deleted file mode 100644 index 3478c9f38..000000000 --- a/Functions/Completion/__source +++ /dev/null @@ -1,7 +0,0 @@ -#function source - -if [[ -position 2 -1 ]]; then - compsub -else - __files -fi diff --git a/Functions/Completion/__strip b/Functions/Completion/__strip deleted file mode 100644 index 9abd38b63..000000000 --- a/Functions/Completion/__strip +++ /dev/null @@ -1,2 +0,0 @@ -#function strip -__files -g '*(*)' diff --git a/Functions/Completion/__stty b/Functions/Completion/__stty deleted file mode 100644 index ebf0de68f..000000000 --- a/Functions/Completion/__stty +++ /dev/null @@ -1,16 +0,0 @@ -#function stty - -if [[ -mcurrent -1 \ - (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]] -then - compadd -m -Q '^-' '^h' '^?' '^c' '^u' -else - [[ -string '-' || -string '+' ]] - compadd -m rows columns intr quit erase kill eof eol \ - eol2 start stop susp dsusp reprint discard werase lnext \ - parenb parodd cs8 cstopb hupcl cread clocal parext \ - ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl iuclc \ - ixon ixany ixoff imaxbel isig icanon xcase echo echoe echok \ - echonl noflsh tostop echoctl echoprt echoke flusho pending iexten \ - opost olcuc onlcr ocrnl onocr onlret ofill ofdel -fi diff --git a/Functions/Completion/__subscript b/Functions/Completion/__subscript deleted file mode 100644 index a10b1202b..000000000 --- a/Functions/Completion/__subscript +++ /dev/null @@ -1,4 +0,0 @@ -#function --subscript-- - -compalso --math-- "$@" -[[ ${(Pt)${COMMAND}} = assoc* ]] && complist -k "( ${(kP)${COMMAND}} )" diff --git a/Functions/Completion/__tar b/Functions/Completion/__tar deleted file mode 100644 index 4f8b51a00..000000000 --- a/Functions/Completion/__tar +++ /dev/null @@ -1,14 +0,0 @@ -#function tar - -local nm=$NMATCHES tf="$2" -compsave - -if [[ ( -mword 1 *t*f* || -mword 1 *x*f* ) && -position 3 100000 ]]; then - complist -k "( $(tar tf $tf) )" - compreset -elif [[ -mword 1 *c*f* && -position 3 100000 ]]; then - __files - compreset -elif [[ -mcurrent -1 *f* && -position 2 ]]; then - __files -g '*.(tar|TAR)' -fi diff --git a/Functions/Completion/__tex b/Functions/Completion/__tex deleted file mode 100644 index 7331bb794..000000000 --- a/Functions/Completion/__tex +++ /dev/null @@ -1,3 +0,0 @@ -#function tex latex slitex - -__files -g '*.(tex|TEX|texinfo|texi)' diff --git a/Functions/Completion/__trap b/Functions/Completion/__trap deleted file mode 100644 index 0171bdc2b..000000000 --- a/Functions/Completion/__trap +++ /dev/null @@ -1,7 +0,0 @@ -#function trap - -if [[ -position 1 ]]; then - complist -c -else - complist -k signals -fi diff --git a/Functions/Completion/__uncompress b/Functions/Completion/__uncompress deleted file mode 100644 index 91343521e..000000000 --- a/Functions/Completion/__uncompress +++ /dev/null @@ -1,3 +0,0 @@ -#function uncompress zmore - -__files -g '*.Z' diff --git a/Functions/Completion/__unhash b/Functions/Completion/__unhash deleted file mode 100644 index 73196ca1b..000000000 --- a/Functions/Completion/__unhash +++ /dev/null @@ -1,6 +0,0 @@ -#function unhash - -[[ -mword 1 -*d* ]] && complist -n -[[ -mword 1 -*a* ]] && complist -a -[[ -mword 1 -*f* ]] && complist -F -[[ ! -mword 1 -* ]] && complist -m diff --git a/Functions/Completion/__unsetopt b/Functions/Completion/__unsetopt deleted file mode 100644 index c9a074d9b..000000000 --- a/Functions/Completion/__unsetopt +++ /dev/null @@ -1,7 +0,0 @@ -#function unsetopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/__vars b/Functions/Completion/__vars deleted file mode 100644 index 649e347fa..000000000 --- a/Functions/Completion/__vars +++ /dev/null @@ -1,2 +0,0 @@ -#array --math-- getopts read unset vared -__vars=(-v) diff --git a/Functions/Completion/__vars_eq b/Functions/Completion/__vars_eq deleted file mode 100644 index e0b5d9ae5..000000000 --- a/Functions/Completion/__vars_eq +++ /dev/null @@ -1,2 +0,0 @@ -#array declare export integer local readonly typeset -__varseq=(-v -q -S '=') diff --git a/Functions/Completion/__wait b/Functions/Completion/__wait deleted file mode 100644 index 1c04108f6..000000000 --- a/Functions/Completion/__wait +++ /dev/null @@ -1,4 +0,0 @@ -#function wait - -complist -P '%' -j -complist -y __kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' diff --git a/Functions/Completion/__which b/Functions/Completion/__which deleted file mode 100644 index 32b95b9c5..000000000 --- a/Functions/Completion/__which +++ /dev/null @@ -1,2 +0,0 @@ -#array which whence where type -__which=(-caF) diff --git a/Functions/Completion/__x_options b/Functions/Completion/__x_options deleted file mode 100644 index d5f85ea36..000000000 --- a/Functions/Completion/__x_options +++ /dev/null @@ -1,5 +0,0 @@ -#pattern-function '*/X11/*' - -# A simple pattern completion, just as an example. - -complist -J options -k '(-display -name -xrm)' diff --git a/Functions/Completion/__xfig b/Functions/Completion/__xfig deleted file mode 100644 index 7f17c2e42..000000000 --- a/Functions/Completion/__xfig +++ /dev/null @@ -1,3 +0,0 @@ -#function xfig - -__files -g '*.fig' diff --git a/Functions/Completion/__zle b/Functions/Completion/__zle deleted file mode 100644 index f677374c8..000000000 --- a/Functions/Completion/__zle +++ /dev/null @@ -1,7 +0,0 @@ -#function zle - -if [[ -word 1 -N && -position 3 ]]; then - complist -F -else - complist -b -fi diff --git a/Functions/Completion/__zmodload b/Functions/Completion/__zmodload deleted file mode 100644 index 78c7393a3..000000000 --- a/Functions/Completion/__zmodload +++ /dev/null @@ -1,9 +0,0 @@ -#function zmodload - -if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then - complist -B -elif [[ -mword 1 -*u* ]]; then - complist -s '$(zmodload)' -else - complist -s '${^module_path}/*(N:t:r)' -fi diff --git a/Functions/Completion/_aliases b/Functions/Completion/_aliases deleted file mode 100644 index 1038a726e..000000000 --- a/Functions/Completion/_aliases +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp unalias - -complist -a diff --git a/Functions/Completion/_arrays b/Functions/Completion/_arrays deleted file mode 100644 index cbeac7118..000000000 --- a/Functions/Completion/_arrays +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp shift - -complist -A diff --git a/Functions/Completion/_autoload b/Functions/Completion/_autoload deleted file mode 100644 index 4f506baeb..000000000 --- a/Functions/Completion/_autoload +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp autoload - -complist -s '${^fpath}/*(N:t)' diff --git a/Functions/Completion/_bg_jobs b/Functions/Completion/_bg_jobs deleted file mode 100644 index 511bb8308..000000000 --- a/Functions/Completion/_bg_jobs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp bg - -complist -z -P '%' diff --git a/Functions/Completion/_bindkey b/Functions/Completion/_bindkey deleted file mode 100644 index 8eddeb2a8..000000000 --- a/Functions/Completion/_bindkey +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp bindkey - -if [[ -mword 1 -*[DAN]* || -mcurrent -1 -*M ]]; then - complist -s '$(bindkey -l)' -else - complist -b -fi diff --git a/Functions/Completion/_builtin b/Functions/Completion/_builtin deleted file mode 100644 index d2b11226b..000000000 --- a/Functions/Completion/_builtin +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp builtin - -if [[ -position 2 -1 ]]; then - compsub -else - complist -eB -fi diff --git a/Functions/Completion/_cd b/Functions/Completion/_cd deleted file mode 100644 index f3ce67ec7..000000000 --- a/Functions/Completion/_cd +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp cd - -_files -W cdpath -g '*(-/)' diff --git a/Functions/Completion/_command b/Functions/Completion/_command deleted file mode 100644 index b2812de25..000000000 --- a/Functions/Completion/_command +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp command - -if [[ -position 2 -1 ]]; then - _normal "$@" -else - complist -em -fi diff --git a/Functions/Completion/_command_names b/Functions/Completion/_command_names deleted file mode 100644 index d3b8a109a..000000000 --- a/Functions/Completion/_command_names +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp -command- - -complist -c diff --git a/Functions/Completion/_compress b/Functions/Completion/_compress deleted file mode 100644 index 860aeb5b0..000000000 --- a/Functions/Completion/_compress +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp compress - -_files -g '*~*.Z' diff --git a/Functions/Completion/_condition b/Functions/Completion/_condition deleted file mode 100644 index 3e45e1b8f..000000000 --- a/Functions/Completion/_condition +++ /dev/null @@ -1,10 +0,0 @@ -#defcomp -condition- - -if [[ -current -1 -o ]]; then - complist -o -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -elif [[ -current -1 -nt || -current -1 -ot || -current -1 -ef ]]; then - _files -else - _files - complist -v -fi diff --git a/Functions/Completion/_configure b/Functions/Completion/_configure deleted file mode 100644 index de8d5fba5..000000000 --- a/Functions/Completion/_configure +++ /dev/null @@ -1,12 +0,0 @@ -#defcomp configure - -if [[ $PREFIX = *=* ]]; then - # Complete filenames after e.g. --prefix= - IPREFIX=${PREFIX%%=*}= - PREFIX=${PREFIX#*=} - complist -f -else - # Generate a list of options from configure --help - complist -s '$($COMMAND --help | - sed -n -e '\''s/^ *\(--[-a-z0-9]*\)[ =,].*$/\1/p'\'')' -fi diff --git a/Functions/Completion/_dd b/Functions/Completion/_dd deleted file mode 100644 index 2458541ea..000000000 --- a/Functions/Completion/_dd +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp dd - -if [[ -iprefix conv= ]]; then - # If there's a comma present, ignore up to the last one. The - # test alone will have that effect. - [[ -string , ]] - complist -S, -q \ - -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)' -elif [[ -iprefix 'if=' || -iprefix 'of=' ]]; then - _files -else - complist -S '=' -k '(if of ibs obs bs cbs skip files seek count conv)' -fi diff --git a/Functions/Completion/_default b/Functions/Completion/_default deleted file mode 100644 index 8bcf14f6a..000000000 --- a/Functions/Completion/_default +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp -default- - -# We first try the `compctl's. This is without first (-T) and default (-D) -# completion. If you want them add `-T' and/or `-D' to this command. -# If there is a `compctl' for the command we are working on, we return -# immediatly. If you want to use new style completion anyway, remove the -# `|| return'. Also, you may want to use new style completion if the -# `compctl' didn't produce any matches. In that case remove the `|| return' -# and at the line `[[ -nmatches 0 ]] || return' after `compcall'. - -compcall || return - -_files diff --git a/Functions/Completion/_dirs b/Functions/Completion/_dirs deleted file mode 100644 index c79080d58..000000000 --- a/Functions/Completion/_dirs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp rmdir df du dircmp - -_files -/ '*(-/)' diff --git a/Functions/Completion/_disable b/Functions/Completion/_disable deleted file mode 100644 index 063b65a7d..000000000 --- a/Functions/Completion/_disable +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp disable - -[[ -mcurrent -1 -*a* ]] && complist -ea -[[ -mcurrent -1 -*f* ]] && complist -eF -[[ -mcurrent -1 -*r* ]] && complist -ew -[[ ! -mcurrent -1 -* ]] && complist -eB diff --git a/Functions/Completion/_dvi b/Functions/Completion/_dvi deleted file mode 100644 index bb2fc293e..000000000 --- a/Functions/Completion/_dvi +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype - -_files -g '*.(dvi|DVI)' diff --git a/Functions/Completion/_echotc b/Functions/Completion/_echotc deleted file mode 100644 index 85ebb97ce..000000000 --- a/Functions/Completion/_echotc +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp echotc - -complist -k '(al dc dl do le up al bl cd ce cl cr dc dl do ho is le ma nd nl se so up)' diff --git a/Functions/Completion/_enable b/Functions/Completion/_enable deleted file mode 100644 index 22ff53ee7..000000000 --- a/Functions/Completion/_enable +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp enable - -[[ -mcurrent -1 -*a* ]] && complist -da -[[ -mcurrent -1 -*f* ]] && complist -dF -[[ -mcurrent -1 -*r* ]] && complist -dw -[[ ! -mcurrent -1 -* ]] && complist -dB diff --git a/Functions/Completion/_fc b/Functions/Completion/_fc deleted file mode 100644 index f0d2c03fd..000000000 --- a/Functions/Completion/_fc +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp fc - -if [[ -mcurrent -1 -*e ]]; then - complist -c -elif [[ -mcurrent -1 -[ARWI]## ]]; then - _files -fi diff --git a/Functions/Completion/_files b/Functions/Completion/_files deleted file mode 100644 index ab3006e39..000000000 --- a/Functions/Completion/_files +++ /dev/null @@ -1,10 +0,0 @@ -#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(). - -local nm=$NMATCHES - -_path_files "$@" - -[[ $# -ne 0 && -nmatches nm ]] && _path_files diff --git a/Functions/Completion/_find b/Functions/Completion/_find deleted file mode 100644 index ca4f79908..000000000 --- a/Functions/Completion/_find +++ /dev/null @@ -1,21 +0,0 @@ -#defcomp find - -if [[ -mbetween -(ok|exec) \\\; ]]; then - _normal "$@" -elif [[ -iprefix - ]]; then - complist -s 'daystart {max,min,}depth follow noleaf version xdev \ - {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ - {i,}{l,}name {no,}{user,group} path perm regex size true uid used \ - exec {f,}print{f,0,} ok prune ls' -elif [[ -position 1 ]]; then - complist -g '. ..' - _files -g '(-/)' -elif [[ -mcurrent -1 -((a|c|)newer|fprint(|0|f)) ]]; then - _files -elif [[ -current -1 -fstype ]]; then - complist -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' -elif [[ -current -1 -group ]]; then - complist -k groups -elif [[ -current -1 -user ]]; then - complist -u -fi diff --git a/Functions/Completion/_functions b/Functions/Completion/_functions deleted file mode 100644 index 8a352ea08..000000000 --- a/Functions/Completion/_functions +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp unfunction - -complist -F diff --git a/Functions/Completion/_gunzip b/Functions/Completion/_gunzip deleted file mode 100644 index 35a27e774..000000000 --- a/Functions/Completion/_gunzip +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gunzip zcat - -_files -g '*.[gG][z]' diff --git a/Functions/Completion/_gzip b/Functions/Completion/_gzip deleted file mode 100644 index 3cda1e4ed..000000000 --- a/Functions/Completion/_gzip +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gzip - -_files -g '*~*.[gG][zZ]' diff --git a/Functions/Completion/_hash b/Functions/Completion/_hash deleted file mode 100644 index a6109563d..000000000 --- a/Functions/Completion/_hash +++ /dev/null @@ -1,13 +0,0 @@ -#defcomp hash - -if [[ -mword 1 -*d* ]]; then - if [[ -string 1 '=' ]]; then - _path_files -g '*(-/)' - else - complist -n -q -S '=' - fi -elif [[ -string 1 '=' ]]; then - _files -g '*(*)' '*(-/)' -else - complist -m -q -S '=' -fi diff --git a/Functions/Completion/_hosts b/Functions/Completion/_hosts deleted file mode 100644 index 3acc327ac..000000000 --- a/Functions/Completion/_hosts +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp ftp ncftp ping rwho rup xping traceroute nslookup - -complist -k hosts diff --git a/Functions/Completion/_jobs b/Functions/Completion/_jobs deleted file mode 100644 index 018883c61..000000000 --- a/Functions/Completion/_jobs +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp fg jobs - -complist -j -P '%' diff --git a/Functions/Completion/_kill b/Functions/Completion/_kill deleted file mode 100644 index bf0e1d3f8..000000000 --- a/Functions/Completion/_kill +++ /dev/null @@ -1,8 +0,0 @@ -#defcomp kill - -if [[ -iprefix '-' ]]; then - complist -k "($signals[1,-3])" -else - complist -P '%' -j - complist -y _kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' -fi diff --git a/Functions/Completion/_kill_helper b/Functions/Completion/_kill_helper deleted file mode 100644 index d3e9aaf4a..000000000 --- a/Functions/Completion/_kill_helper +++ /dev/null @@ -1,3 +0,0 @@ -#autoload - -reply=( "$(ps 2>/dev/null)" ) diff --git a/Functions/Completion/_limits b/Functions/Completion/_limits deleted file mode 100644 index 35ccbe07e..000000000 --- a/Functions/Completion/_limits +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp limit unlimit - -complist -k "(${(j: :)${(f)$(limit)}%% *})" diff --git a/Functions/Completion/_main_complete b/Functions/Completion/_main_complete deleted file mode 100644 index 003a01785..000000000 --- a/Functions/Completion/_main_complete +++ /dev/null @@ -1,48 +0,0 @@ -#autoload - -# The main loop of the completion code. This is what is called when -# completion is attempted from the command line. -# The completion code gives us the special variables and the arguments -# from the command line are given as positional parameters. - -local comp name - -setopt localoptions nullglob rcexpandparam globdots -unsetopt markdirs globsubst shwordsplit nounset - -# 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. - -comp="$comps[-first-]" -if [[ ! -z "$comp" ]]; then - "$comp" "$@" - if (( $+COMPSKIP )); then - unset COMPSKIP - return - fi -fi - -# For arguments we use the `_normal function. - -if [[ $CONTEXT == argument || $CONTEXT == command ]]; then - _normal "$@" -else - # Let's see if we have a special completion definition for the other - # possible contexts. - - comp='' - - case $CONTEXT in - redirect) comp="$comps[-redirect-]";; - math) comp="$comps[-math-]";; - subscript) comp="$comps[-subscript-]";; - value) comp="$comps[-value-]";; - condition) comp="$comps[-condition-]";; - esac - - # If not, we use default completion, if any. - - [[ -z "$comp" ]] && comp="$comps[-default-]" - [[ -z "$comp" ]] || "$comp" "$@" -fi diff --git a/Functions/Completion/_make b/Functions/Completion/_make deleted file mode 100644 index d576b0308..000000000 --- a/Functions/Completion/_make +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp make gmake pmake - -complist -s "\$(awk '/^[a-zA-Z0-9][^/ ]+:/ {print \$1}' FS=: [mM]akefile)" diff --git a/Functions/Completion/_man b/Functions/Completion/_man deleted file mode 100644 index 8204fba0b..000000000 --- a/Functions/Completion/_man +++ /dev/null @@ -1,11 +0,0 @@ -#defcomp man -setopt localoptions rcexpandparam - -local rep -if [[ $2 = (<->*|ln) ]]; then - rep=( $manpath/(man|cat)$2/$PREFIX*$SUFFIX.<->*(N:t:r) ) -else - rep=( $manpath/(man|cat)*/$PREFIX*$SUFFIX.<->*(N:t:r) ) -fi - -(( $#rep )) && compadd -m $rep diff --git a/Functions/Completion/_mh b/Functions/Completion/_mh deleted file mode 100644 index 67ce49fd2..000000000 --- a/Functions/Completion/_mh +++ /dev/null @@ -1,70 +0,0 @@ -#defcomp folder comp inc mark refile repl scan show next prev rmm pick whom mhn mhpath mhpatch - -# Completion for all possible MH commands. -# Alter the following two to your own mh directory and the directory -# where standard mh library files live. (It works anyway, but this -# will save a little time.) -local mymhdir=~/Mail -local mhlib=/usr/lib/mh - -# To be on the safe side, check this exists and if not, get it anyway. -[[ -d $mymhdir ]] || mymhdir=$(mhpath +) - -if [[ -iprefix - ]]; then - # get list of options, which MH commands can generate themselves - # awk is just too icky to use for this, sorry. send me one if - # you come up with it. - compadd -m $($COMMAND -help | perl -ne 'if (/^\s*-\(?(\S+)/) { - $n = $1; - $n =~ s/\)//g; - print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n"; - }') - return -elif [[ -iprefix '+' || -iprefix '@' || -current -1 -draftfolder ]]; then - # Complete folder names. - local mhpath - if [[ $IPREFIX != '@' ]]; then - [[ $IPREFIX = '+' ]] || IPREFIX=+ - mhpath=$mymhdir - else - mhpath=$(mhpath) - fi - - # painless, or what? - complist -W mhpath -/ -elif [[ -mcurrent -1 -(editor|(whatnow|rmm|show|more)proc) ]]; then - complist -c -elif [[ -current -1 -file ]]; then - complist -f -elif [[ -mcurrent -1 -(form|audit|filter) ]]; then - # Need some MH template file, which may be in our own MH directory - # or with the standard library. - local mhfpath - # This is the only place we need mhlib, so leave the test till here. - [[ -d $mhlib ]] || { mhlib=$(mhparam mhlproc); mhlib=$mhlib:h; } - mhfpath=($mymhdir $mhlib) - - complist -W mhfpath -g '*(.)' -elif [[ -mcurrent -1 -(no|)cc ]]; then - compadd -m all to cc me -elif [[ -mcurrent -1 -[rw]cache ]]; then - compadd -m public private never ask -else - # Generate sequences. - local foldnam folddir f - for f in $argv; do - [[ $f = [@+]* ]] && foldnam=$f - done - if [[ $foldnam = '+'* ]]; then - folddir=$mymhdir/${foldnam#+} - elif [[ $foldnam = '@'* ]]; then - folddir=$(mhpath)/${foldnam#@} - else - folddir=$(mhpath) - # leaving foldnam empty works here - fi - - complist -s '$(mark $foldnam | awk -F: '\''{ print $1 }'\'')' - compadd -m reply next cur prev first last all unseen - complist -W folddir -g '<->' -fi diff --git a/Functions/Completion/_most_recent_file b/Functions/Completion/_most_recent_file deleted file mode 100644 index 69900e6ff..000000000 --- a/Functions/Completion/_most_recent_file +++ /dev/null @@ -1,3 +0,0 @@ -#defkeycomp expand-or-complete \C-xm - -complist -g '*(om[1])' diff --git a/Functions/Completion/_normal b/Functions/Completion/_normal deleted file mode 100644 index 22cc1decf..000000000 --- a/Functions/Completion/_normal +++ /dev/null @@ -1,56 +0,0 @@ -#autoload - -local comp cmd1 cmd2 pat val name - -# 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. -# a path and the last path name component). - -if [[ $CONTEXT == command ]]; then - comp="$comps[-command-]" - [[ -z "$comp" ]] || "$comp" "$@" - return -elif [[ "$COMMAND[1]" == '=' ]]; then - eval cmd1\=$COMMAND - cmd2="$COMMAND[2,-1]" -elif [[ "$COMMAND" == */* ]]; then - cmd1="$COMMAND" - cmd2="${COMMAND:t}" -else - cmd1="$COMMAND" - eval cmd2=$(whence -p $COMMAND) -fi - -# See if there are any matching pattern completions. - -if (( $#patcomps )); then - for i in "$patcomps[@]"; do - pat="${i% *}" - val="${i#* }" - if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then - "$val" "$@" - if (( $+COMPSKIP )); then - unset COMPSKIP - return - fi - fi - done -fi - -# Now look up the two names in the normal completion array. - -name="$cmd1" -comp="$comps[$cmd1]" - -if [[ -z "$comp" ]]; then - name="$cmd2" - comp="$comps[$cmd2]" -fi - -# And generate the matches, probably using default completion. - -if [[ -z "$comp" ]]; then - name=-default- - comp="$comps[-default-]" -fi -[[ -z "$comp" ]] || "$comp" "$@" diff --git a/Functions/Completion/_path_files b/Functions/Completion/_path_files deleted file mode 100644 index 7db364b7d..000000000 --- a/Functions/Completion/_path_files +++ /dev/null @@ -1,272 +0,0 @@ -#autoload - -# Utility function for in-path completion. -# First argument should be an complist-option (e.g. -f, -/, -g). The other -# arguments should be glob patterns, one per argument. -# -# E.g.: _path_files -g '*.tex' '*.texi' -# -# This is intended as a replacement for `complist -f', `complist -/', and -# `complist -g ...' (but don't use it with other options). -# -# You may also give the `-W <spec>' option as with `compctl' and `complist', -# but only as the first argument. -# -# This function also accepts an optional `-F <string>' option as its first -# argument or just after the `-W <spec>'. This can be used to define file -# name extension (a la `fignore'). Files with such an extension will not -# be considered possible completions. -# -# This function behaves as if you have a matcher definition like: -# compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' \ -# 'm:{a-z}={A-Z} l:|=* r:|=*' -# so you may want to modify this. - -local nm prepaths str linepath realpath donepath patstr prepath testpath rest -local tmp1 collect tmp2 suffixes i ignore - -setopt localoptions nullglob rcexpandparam globdots extendedglob -unsetopt markdirs globsubst shwordsplit nounset - -# Get the optional `-W' option and its argument. -if [[ "$1" = -W ]]; then - tmp1="$2" - if [[ "$tmp1[1]" = '(' ]]; then - prepaths=( $tmp1[2,-2]/ ) - else - prepaths=( ${(P)${tmp1}} ) - [[ $#prepaths -eq 0 ]] && prepaths=( $tmp1/ ) - fi - [[ $#prepaths -eq 0 ]] && prepaths=( '' ) - shift 2 -else - prepaths=( '' ) -fi - -# Get the optional `-F' option and its argument. -if [[ "$1" = -F ]]; then - ignore=(-F "$2") - shift 2 -else - ignore='' -fi - -# str holds the whole string from the command line with a `*' between -# the prefix and the suffix. - -str="${PREFIX:q}*${SUFFIX:q}" - -# We will first try normal completion called with `complist', but only if we -# weren't given a `-F' option. - -if [[ -z "$ignore" ]]; then - # First build an array containing the `-W' option, if there is any and we - # want to use it. We don't want to use it if the string from the command line - # is a absolute path or relative to the current directory. - - if [[ -z "$tmp1[1]" || "$str[1]" = [~/] || "$str" = (.|..)/* ]]; then - tmp1=() - else - tmp1=(-W "( $prepaths )") - fi - - # Now call complist. - - nm=$NMATCHES - if [[ $# -eq 0 ]]; then - complist "$tmp1[@]" -f - elif [[ "$1" = -g ]]; then - complist "$tmp1[@]" -g "$argv[2,-1]" - shift - else - complist "$tmp1[@]" $1 - shift - fi - - # If this generated any matches, we don't wnat to do in-path completion. - - [[ -nmatches nm ]] || return - - # No `-F' option, so we want to use `fignore'. - - ignore=(-F fignore) -fi - -# If we weren't given any file patterns as arguments, we trick ourselves -# into believing that we were given the pattern `*'. This is just to simplify -# the following code. - -[[ -z "$1" ]] && 1='*' - -# Now let's have a closer look at the string to complete. - -if [[ "$str[1]" = \~ ]]; then - # It begins with `~', so remember anything before the first slash to be able - # to report it to the completion code. Also get an expanded version of it - # (in `realpath'), so that we can generate the matches. Then remove that - # prefix from the string to complete, set `donepath' to build the correct - # paths and make sure that the loop below is run only once with an empty - # prefix path by setting `prepaths'. - - linepath="${str%%/*}/" - eval realpath\=path - str="${str#*/}" - donepath='' - prepaths=( '' ) -else - # If the string does not start with a `~' we don't remove a prefix from the - # string. - - liniepath='' - realpath='' - - if [[ "$str[1]" = / ]]; then - # If it is a absolut path name, we remove the first slash and put it in - # `donepath' meaning that we treat it as the path that was already handled. - # Also, we don't use the paths from `-W'. - - str="$str[2,-1]" - donepath='/' - prepaths=( '' ) - else - # The common case, we just use the string as it is, unless it begins with - # `./' or `../' in which case we don't use the paths from `-W'. - - [[ "$str" = (.|..)/* ]] && prepaths=( '' ) - donepath='' - fi -fi - -# First we skip over all pathname components in `str' which really exist in -# the file-system, so that `/usr/lib/l<TAB>' doesn't offer you `lib' and -# `lib5'. Pathname components skipped this way are taken from `str' and added -# to `donepath'. - -while [[ "$str" = */* ]] do - [[ -e "$realpath$donepath${str%%/*}" ]] || break - donepath="$donepath${str%%/*}/" - str="${str#*/}" -done - -# Now build the glob pattern. As noted above, this function behaves as if -# a global matcher with two matching specifications are given. - -if [[ -matcher 1 ]]; then - patstr="$str:gs/,/*,/:gs/_/*_/:gs./.*/.:gs/-/*[-_]/:gs/./*[.,]/:gs-*[.,]*[.,]*/-../-:gs.**.*." -else - patstr="${str%/*}/*${str##*/}*" - patstr="$patstr:gs./.*/.:gs.**.*." -fi - -# Finally, generate the matches. First we loop over all the paths from `-W'. -# Note that in this loop `str' is used as a modifyable version of `patstr' -# and `testpath' is a modifyable version of `donepath'. - -for prepath in "$prepaths[@]"; do - str="$patstr" - testpath="$donepath" - - # The second loop tests the components of the path in `str' to get the - # possible matches. - - while [[ "$str" = */* ]] do - # `rest' is the pathname after the first slash that is left. In `tmp1' - # we get the globbing matches for the pathname component currently - # handled. - - rest="${str#*/}" - tmp1="${prepath}${realpath}${testpath}(#l)${str%%/*}(-/)" - tmp1=( $~tmp1 ) - - if [[ $#tmp1 -eq 0 ]]; then - # If this didn't produce any matches, we don't need to test this path - # any further, so continue with the next `-W' path, if any. - - continue 2 - elif [[ $#tmp1 -gt 1 ]]; then - # If it produced more than one match, we want to remove those which - # don't have possible following pathname components matching the - # rest of the string we are completing. (The case with only one - # match is handled below.) - # In `collect' we will collect those of the produced pathnames that - # have a matching possible path-suffix. In `suffixes' we build an - # array containing strings build from the rest of the string to - # complete and the glob patterns we were given as arguments. - - collect=() - suffixes=( $rest$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - - # In the loop the prefixes from the `tmp1' array produced above and - # the suffixes we just built are used to produce possible matches - # via globbing. - - for i in $tmp1; do - tmp2=( $~i/(#l)$~suffixes ) - [[ $#tmp2 -ne 0 ]] && collect=( $collect $i ) - done - - # If this test showed that none of the matches from the glob in `tmp1' - # has a possible sub-path matching what's on the line, we give up and - # continue with the next `-W' path. - - if [[ $#collect -eq 0 ]]; then - continue 2 - elif [[ $#collect -ne 1 ]]; then - # If we have more than one possible match, this means that the - # pathname component currently handled is ambiguous, so we give - # it to the completion code. - # First we build the full path prefix in `tmp1'. - - tmp1="$prepath$realpath$testpath" - - # Now produce all matching pathnames in `collect'. - - collect=( $~collect/(#l)$~suffixes ) - - # And then remove the common path prefix from all these matches. - - collect=( ${collect#$tmp1} ) - - # Finally, we add all these matches with the common (unexpanded) - # pathprefix (the `-p' option), the path-prefix (the `-W' option) - # to allow the completion code to test file type, and the path- - # suffix (the `-s' option). We also tell the completion code that - # these are file names and that `fignore' should be used as usual - # (the `-f' and `-F' options). - - for i in $collect; do - compadd -p "$linepath$testpath" -W "$tmp1" -s "/${i#*/}" -f "$ignore[@]" - "${i%%/*}" - done - - # We have just finished handling all the matches from above, so we - # can continue with the next `-W' path. - - continue 2 - fi - # We reach this point if only one of the path prefixes in `tmp1' - # has a existing path-suffix matching the string from the line. - # In this case we accept this match and continue with the next - # path-name component. - - tmp1=( "$collect[1]" ) - fi - # This is also reached if the first globbing produced only one match - # in this case we just continue with the next pathname component, too. - - tmp1="$tmp1[1]" - testpath="$testpath${tmp1##*/}/" - str="$rest" - done - - # We are here if all pathname components except the last one (which is still - # not tested) are unambiguous. So we add matches with the full path prefix, - # no path suffix, the `-W' we are currently handling, all the matches we - # can produce in this directory, if any. - - tmp1="$prepath$realpath$testpath" - suffixes=( $str$@ ) - suffixes=( "${(@)suffixes:gs.**.*.}" ) - tmp2=( $~tmp1(#l)$~suffixes ) - compadd -p "$linepath$testpath" -W "$prepath$realpath$testpath" -f "$ignore[@]" - ${tmp2#$tmp1} -done diff --git a/Functions/Completion/_pdf b/Functions/Completion/_pdf deleted file mode 100644 index 7d7756c3e..000000000 --- a/Functions/Completion/_pdf +++ /dev/null @@ -1,3 +0,0 @@ -function acroread - -_files -g '*.(pdf|PDF)' diff --git a/Functions/Completion/_precommand b/Functions/Completion/_precommand deleted file mode 100644 index 2cf661147..000000000 --- a/Functions/Completion/_precommand +++ /dev/null @@ -1,5 +0,0 @@ -#defcomp - nohup nice eval time rusage noglob nocorrect exec - -[[ -position 1 -1 ]] - -_normal "$@" diff --git a/Functions/Completion/_ps b/Functions/Completion/_ps deleted file mode 100644 index 6bc0643b2..000000000 --- a/Functions/Completion/_ps +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp gs ghostview gview psnup psselect pswrap pstops pstruct lpr - -_files -g '*([pP][sS]|eps)' diff --git a/Functions/Completion/_rcs b/Functions/Completion/_rcs deleted file mode 100644 index 537db6278..000000000 --- a/Functions/Completion/_rcs +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp co ci rcs - -[[ $COMMAND = ci || $COMMAND = rcs ]] && _files - -if [[ $NMATCHES -eq 0 && -d RCS && $COMMAND != ci ]]; then - local rep - rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//)) - (( $#rep )) && compadd -m $rep -fi diff --git a/Functions/Completion/_rlogin b/Functions/Completion/_rlogin deleted file mode 100644 index e36554f23..000000000 --- a/Functions/Completion/_rlogin +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp rlogin rsh ssh - -if [[ -position 1 ]]; then - complist -k hosts -elif [[ -position 2 ]]; then - complist -k '(-l)' -else - complist -u -fi diff --git a/Functions/Completion/_sched b/Functions/Completion/_sched deleted file mode 100644 index ee785879b..000000000 --- a/Functions/Completion/_sched +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp sched - -[[ -position 2 -1 ]] && compsub diff --git a/Functions/Completion/_set b/Functions/Completion/_set deleted file mode 100644 index e3069f134..000000000 --- a/Functions/Completion/_set +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp set - -if [[ -mcurrent -1 [-+]o ]]; then - complist -o -elif [[ -current -1 -A ]]; then - complist -A -fi diff --git a/Functions/Completion/_setopt b/Functions/Completion/_setopt deleted file mode 100644 index 4abb3ccee..000000000 --- a/Functions/Completion/_setopt +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp setopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/_source b/Functions/Completion/_source deleted file mode 100644 index 94e3fbeb1..000000000 --- a/Functions/Completion/_source +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp source - -if [[ -position 2 -1 ]]; then - compsub -else - _files -fi diff --git a/Functions/Completion/_strip b/Functions/Completion/_strip deleted file mode 100644 index 6962ac455..000000000 --- a/Functions/Completion/_strip +++ /dev/null @@ -1,2 +0,0 @@ -#defcomp strip -_files -g '*(*)' diff --git a/Functions/Completion/_stty b/Functions/Completion/_stty deleted file mode 100644 index 6b54b5007..000000000 --- a/Functions/Completion/_stty +++ /dev/null @@ -1,16 +0,0 @@ -#defcomp stty - -if [[ -mcurrent -1 \ - (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]] -then - compadd -m -Q '^-' '^h' '^?' '^c' '^u' -else - [[ -string '-' || -string '+' ]] - compadd -m rows columns intr quit erase kill eof eol \ - eol2 start stop susp dsusp reprint discard werase lnext \ - parenb parodd cs8 cstopb hupcl cread clocal parext \ - ignbrk brkint ignpar parmrk inpck istrip inlcr igncr icrnl iuclc \ - ixon ixany ixoff imaxbel isig icanon xcase echo echoe echok \ - echonl noflsh tostop echoctl echoprt echoke flusho pending iexten \ - opost olcuc onlcr ocrnl onocr onlret ofill ofdel -fi diff --git a/Functions/Completion/_subscript b/Functions/Completion/_subscript deleted file mode 100644 index 2b827a117..000000000 --- a/Functions/Completion/_subscript +++ /dev/null @@ -1,4 +0,0 @@ -#defcomp -subscript- - -_compalso -math- "$@" -[[ ${(Pt)${COMMAND}} = assoc* ]] && complist -k "( ${(kP)${COMMAND}} )" diff --git a/Functions/Completion/_tar b/Functions/Completion/_tar deleted file mode 100644 index 91767e44d..000000000 --- a/Functions/Completion/_tar +++ /dev/null @@ -1,11 +0,0 @@ -#defcomp tar - -local nm=$NMATCHES tf="$2" - -if [[ ( -mword 1 *t*f* || -mword 1 *x*f* ) && -position 3 100000 ]]; then - complist -k "( $(tar tf $tf) )" -elif [[ -mword 1 *c*f* && -position 3 100000 ]]; then - _files -elif [[ -mcurrent -1 *f* && -position 2 ]]; then - _files -g '*.(tar|TAR)' -fi diff --git a/Functions/Completion/_tex b/Functions/Completion/_tex deleted file mode 100644 index 1f645e2a2..000000000 --- a/Functions/Completion/_tex +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp tex latex slitex - -_files -g '*.(tex|TEX|texinfo|texi)' diff --git a/Functions/Completion/_trap b/Functions/Completion/_trap deleted file mode 100644 index 59e81c589..000000000 --- a/Functions/Completion/_trap +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp trap - -if [[ -position 1 ]]; then - complist -c -else - complist -k signals -fi diff --git a/Functions/Completion/_uncompress b/Functions/Completion/_uncompress deleted file mode 100644 index e25805d50..000000000 --- a/Functions/Completion/_uncompress +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp uncompress zmore - -_files -g '*.Z' diff --git a/Functions/Completion/_unhash b/Functions/Completion/_unhash deleted file mode 100644 index fe40c25a2..000000000 --- a/Functions/Completion/_unhash +++ /dev/null @@ -1,6 +0,0 @@ -#defcomp unhash - -[[ -mword 1 -*d* ]] && complist -n -[[ -mword 1 -*a* ]] && complist -a -[[ -mword 1 -*f* ]] && complist -F -[[ ! -mword 1 -* ]] && complist -m diff --git a/Functions/Completion/_unsetopt b/Functions/Completion/_unsetopt deleted file mode 100644 index 90d642b51..000000000 --- a/Functions/Completion/_unsetopt +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp unsetopt - -local nm=$NMATCHES - -complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \ - -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' -[[ -nmatches nm ]] && complist -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o diff --git a/Functions/Completion/_vars b/Functions/Completion/_vars deleted file mode 100644 index 7153b6f38..000000000 --- a/Functions/Completion/_vars +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp -math- getopts read unset vared - -complist -v diff --git a/Functions/Completion/_vars_eq b/Functions/Completion/_vars_eq deleted file mode 100644 index fcbb0148c..000000000 --- a/Functions/Completion/_vars_eq +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp declare export integer local readonly typeset - -complist -v -q -S '=' diff --git a/Functions/Completion/_wait b/Functions/Completion/_wait deleted file mode 100644 index 34bc53ee3..000000000 --- a/Functions/Completion/_wait +++ /dev/null @@ -1,4 +0,0 @@ -#defcomp wait - -complist -P '%' -j -complist -y _kill_helper -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' diff --git a/Functions/Completion/_which b/Functions/Completion/_which deleted file mode 100644 index 324256e3d..000000000 --- a/Functions/Completion/_which +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp which whence where type - -complist -caF diff --git a/Functions/Completion/_x_options b/Functions/Completion/_x_options deleted file mode 100644 index cc469286d..000000000 --- a/Functions/Completion/_x_options +++ /dev/null @@ -1,5 +0,0 @@ -#defpatcomp */X11/* - -# A simple pattern completion, just as an example. - -complist -J options -k '(-display -name -xrm)' diff --git a/Functions/Completion/_xfig b/Functions/Completion/_xfig deleted file mode 100644 index fcd2bba9f..000000000 --- a/Functions/Completion/_xfig +++ /dev/null @@ -1,3 +0,0 @@ -#defcomp xfig - -_files -g '*.fig' diff --git a/Functions/Completion/_zftp b/Functions/Completion/_zftp deleted file mode 100644 index 4ff707cc6..000000000 --- a/Functions/Completion/_zftp +++ /dev/null @@ -1,50 +0,0 @@ -#defpatcomp zf* - -# Don't try any more completion after this. -COMPSKIP=1 - -# Completion for zftp builtin and zf* functions. The functions -# zfcd_match and zfget_match (used for old-style completion) -# need to be installed for remote file and directory completion to work. - -local subcom - -if [[ $COMMAND = zftp ]]; then - if [[ $CURRENT -eq 1 ]]; then - compadd -m open params user login type ascii binary mode put \ - putat get getat append appendat ls dir local remote mkdir rmdir - return - fi - subcom=$1 -else - subcom=$COMMAND -fi - -case $subcom in - *(cd|ls|dir)) - # complete remote directories; we could be smarter about hiding prefixes - zfcd_match $PREFIX $SUFFIX - (( $#reply )) && compadd -m -S/ -q $reply - ;; - - *(get(|at)|gcp|delete|remote)) - # complete remote files - zfget_match $PREFIX $SUFFIX - (( $#reply )) && compadd -F fignore -m $reply - ;; - - *(put(|at)|pcp)) - # complete local files - _files - ;; - - *(open|anon|params)) - # complete hosts: should do cleverer stuff with user names - complist -k hosts - ;; - - *) - # dunno... try ordinary completion after all. - unset COMPSKIP - ;; -esac diff --git a/Functions/Completion/_zle b/Functions/Completion/_zle deleted file mode 100644 index bb1102e74..000000000 --- a/Functions/Completion/_zle +++ /dev/null @@ -1,7 +0,0 @@ -#defcomp zle - -if [[ -word 1 -N && -position 3 ]]; then - complist -F -else - complist -b -fi diff --git a/Functions/Completion/_zmodload b/Functions/Completion/_zmodload deleted file mode 100644 index 112acb57c..000000000 --- a/Functions/Completion/_zmodload +++ /dev/null @@ -1,9 +0,0 @@ -#defcomp zmodload - -if [[ -mword 1 -*(a*u|u*a)* || -mword 1 -*a* && -position 3 -1 ]]; then - complist -B -elif [[ -mword 1 -*u* ]]; then - complist -s '$(zmodload)' -else - complist -s '${^module_path}/*(N:t:r)' -fi diff --git a/Functions/Completion/dump b/Functions/Completion/dump deleted file mode 100644 index ad5547bea..000000000 --- a/Functions/Completion/dump +++ /dev/null @@ -1,89 +0,0 @@ -# This is a file to be sourced to dump the definitions for new-style -# completion defined by 'init' in the same directory. For best results, -# it should be run immediately after init, before any of the completions -# have been autoloaded. The output should be directed into the "init.dump" -# in the same directory as init. If you rename init, just stick .dump onto -# the end of whatever you have called it and put it in the same directory. -# -# You will need to update the dump every time you add a new completion. -# To do this, simply remove the .dump file, start a new shell, and -# create the .dump file as before. -# -# It relies on KSH_ARRAYS not being set. - -# Print the number of files used for completion. This is used in init -# to see if auto-dump should re-dump the dump-file. - -_d_file=${COMPDUMP-${0:h}/init.dump} - -_d_files=( ${^~fpath}/_*~*~ ) - -print "#files: $#_d_files" > $_d_file - -unset _d_files - -# First dump the arrays comps and patcomps. The quoting hieroglyphyics -# ensure that a single quote inside a variable is itself correctly quoted. - -print "comps=(" >> $_d_file -for _d_f in ${(k)comps}; do - print -r - "'${_d_f//\'/'\\''}'" "'${comps[$_d_f]//\'/'\\''}'" -done >> $_d_file -print ")" >> $_d_file - -if (( $#patcomps )); then - print "\npatcomps=(" >> $_d_file - for _d_f in "$patcomps[@]"; do - print -r - "'${_d_f//\'/'\\''}'" - done >> $_d_file - print ")" >> $_d_file -fi - -print >> $_d_file - -# Now dump the key bindings. We dump all bindings for zle widgets -# whose names start with a underscore. -# We need both the zle -C's and the bindkey's to recreate. - -_d_bks=() -zle -lL | - while read -rA _d_line; do - if [[ ${_d_line[5]} = _* ]]; then - print -r - ${_d_line} - _d_bks=($_d_bks ${_d_line[3]}) - fi - done >> $_d_file -bindkey | - while read -rA _d_line; do - if [[ ${_d_line[2]} = (${(j.|.)~_d_bks}) ]]; then - print -r "bindkey '${_d_line[1][2,-2]}' ${_d_line[2]}" - fi - done >> $_d_file - -print >> $_d_file - - -# Autoloads: whence -w produces "_d_foo: function", so look for -# all functions beginning with `_'. - -_d_als=($(whence -wm '_*' | -while read -rA _d_line; do - [[ ${_d_line[2]} = function ]] && print -r - ${_d_line[1]%:} -done)) - -# print them out: about six to a line looks neat - -while (( $#_d_als )); do - print -n autoload - for (( _i = 0; _i < 6; _i++ )); do - if (( $#_d_als )); then - print -n " $_d_als[1]" - shift _d_als - fi - done - print -done >> $_d_file - -print >> $_d_file - -unset _d_line _d_zle _d_bks _d_als _d_f _f_file diff --git a/Functions/Completion/init b/Functions/Completion/init deleted file mode 100644 index a40c5f61b..000000000 --- a/Functions/Completion/init +++ /dev/null @@ -1,253 +0,0 @@ -# Initialisation for new style completion. This mainly contains some helper -# function and aliases. Everything else is split into different files in this -# directory 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 two underscores (like `__setopt). -# The first line of these files will be read and has to say what should be -# done with its contents: -# -# `#function <names ...>' -# if the first line looks like this, the file is -# autoloaded as a function and that function will -# be called to generate the matches when completing -# for one of the commands whose <name> is given -# -# `#array <names ...>' -# with a first line like this, the filename is taken as -# the name of an array; when trying to generate matches -# for the command <name>, the file will be sourced and -# should define this array, the builtin `complist' will -# then be called with the elements of this array as its -# arguments; this is intended for simple definitions -# for which you don't need a shell function -# -# `#pattern-function <pattern>' -# this defines a function that should be called to generate -# matches for commands whose name matches <pattern>; note -# that only one pattern may be given -# -# `#pattern-array <pattern>' -# like `#pattern-function' but defining an array -# -# `#key-function <style> [ <key-sequence> ... ] -# this is used to bind special completions to all the given -# <key-sequence>(s). The <style> is the name of one of the built-in -# completion widgets (complete-word, delete-char-or-list, -# expand-or-complete, expand-or-complete-prefix, list-choices, -# menu-complete, menu-expand-or-complete, or reverse-menu-complete). -# This creates a widget behaving like <style> so that the -# completions are chosen as given in the the rest of the file, -# rather than by the context. The widget has the same name as -# the autoload file and can be bound using bindkey in the normal way. -# -# `#key-array <style> [ <key-sequence> ... ] -# like `#key-function', but defining an array instead -# -# `#helper' -# this is for helper functions that are not used to -# generate matches, but should automatically be loaded -# when they are called -# -# Note that no white space is allowed between the `#' and the rest of -# the string. - - -# An associative array for completions definitions. The keys of the entries -# are the names of the command, the values are names of functions or variables -# that are to be used to generate the matches. -# Pattern completions will be stored in an normal array named `patcomps'. -# Completion definitions bound directly to keys are stored in an assoc array -# named `keycomps'. - -typeset -A comps -typeset -A keycomps - - -# This may be used to define completion handlers. The first argument is the -# name of the function or variable containing the definition, the other -# arguments are the command names for which this definition should be used. -# With only one argument the function/variable-name __$1 is used. -# If given the `-a' option, the function is defined as being autoloaded. - -defcomp() { - local name autol='' - - if [[ "$1" = -a ]]; then - shift - autol=yes - fi - if [[ $# -eq 1 ]]; then - comps[$1]="__$1" - [[ -z "$autol" ]] || autoload "__$1" - else - name="$1" - shift - for i; do - comps[$i]="$name" - done - [[ -z "$autol" ]] || autoload "$name" - fi -} - - -# Almost like `defcomp', but this always gets two arguments: the name of a -# variable or function describing what should be completed and the pattern -# that will be compared to the command names for which completion is attempted. - -defpatcomp() { - if [[ "$1" = -a ]]; then - shift - autoload "$1" - fi - if (( $+patcomps )) then - patcomps=("$patcomps[@]" "$2 $1" ) - else - patcomps=( "$2 $1" ) - fi -} - - -# This is used to define completion handlers directly bound to keys. The -# first argument is as for `defcomp', giving the handler. The second -# argument is the name of one of the built-in completion widgets. Any -# remaining arguments are used as key sequences to bind the widget. -# Typing that key sequence will complete the word the cursor is on -# according to the completion definition given and will behave as if the -# built-in completion widget was used. - -defkeycomp() { - local name - - if [[ "$1" = -a ]]; then - shift - autoload "$1" - name="$1" - elif [[ "${1[1]}" = ' ' ]]; then - name="${1:t}" - else - name="$1" - fi - keycomps[$name]="$1" - shift - zle -C "$name" "$1" __main_key_complete - shift - while (( $# )); do - bindkey "$1" "$name" - shift - done -} - -# These can be used to easily save and restore the state of the special -# variables used by the completion code. - -alias compsave='local _oprefix _oiprefix _oargv _ocurrent; \ - _oprefix="$PREFIX"; \ - _oiprefix="$IPREFIX"; \ - _oargv=( "$@" ); \ - _ocurrent="$CURRENT"' -alias compreset='PREFIX="$_oprefix"; \ - IPREFIX="$_oiprefix"; \ - argv=( "$_oargv[@]" ); \ - CURRENT="$_ocur"' - - -# This is an easy way to get completion for sub-commands. - -alias compsub='__normal "$@" || return 1' - - -# This searches $1 in the array for normal completions and calls the result. - -compalso() { - local tmp - - tmp="$comps[$1]" - [[ -z "$tmp" ]] || callcomplete comps "$1" "$@" -} - - -# This generates matches. The first argument is the name of one of the -# arrays containing completion definitions. The second argument is the index -# into this array. The other arguments are the positional parameters to give -# to the completion function (containing the arguments from the command line). - -callcomplete() { - local file def - - # Get the definition from the array. - - eval "def=\$${1}[${2}]" - - # If the definition starts with a space then this means that we should - # source a file to get the definition for an array. - - if [[ "$def[1]" = ' ' ]]; then - # The definition starts with a space, so source the file and change - # the definition. - - file="$def[2,-1]" - builtin . "$file" - def="${file:t}" - eval "${1}[${2}]=$def" - fi - - # Get rid of the array-name and -index. - - shift 2 - if [[ ${(P)+def} -eq 1 ]]; then - # It is a parameter name, call complist directly. - - complist "${(@P)def}" - else - # Otherwise it's a function name, call this function. - - "$def" "$@" - fi -} - - -# Now we make the files automatically autoloaded. - -local dir file line func - -for dir in $fpath; do - [[ $dir = . ]] && continue - for file in $dir/__*~*~(N); do - read -rA line < $file - func=$line[1] - shift line - if [[ $func = '#function' ]]; then - defcomp -a ${file:t} "${line[@]}" - elif [[ $func = '#array' ]]; then - defcomp " $file" "${line[@]}" - elif [[ $func = '#pattern-function' ]]; then - defpatcomp -a ${file:t} "${line[@]}" - elif [[ $func = '#pattern-array' ]]; then - defcomp " $file" "${line[@]}" - elif [[ $func = '#key-function' ]]; then - defkeycomp -a "${file:t}" "${line[@]}" - elif [[ $func = '#key-array' ]]; then - defkeycomp " $file" "${line[@]}" - elif [[ $func = '#helper' ]]; then - autoload ${file:t} - fi - done -done - - -# Finally we make all this be called by changing the key bindings. - -bindkey | while read -A line; do - if [[ "$line[2]" = complete-word || - "$line[2]" = delete-char-or-list || - "$line[2]" = expand-or-complete || - "$line[2]" = expand-or-complete-prefix || - "$line[2]" = list-choices || - "$line[2]" = menu-complete || - "$line[2]" = menu-expand-or-complete || - "$line[2]" = reverse-menu-complete ]]; then - zle -C __complete_$line[2] $line[2] __main_complete - bindkey "${line[1][2,-2]}" __complete_$line[2] - fi - done diff --git a/Functions/Zftp/README b/Functions/Zftp/README deleted file mode 100644 index 794bff292..000000000 --- a/Functions/Zftp/README +++ /dev/null @@ -1,4 +0,0 @@ -This 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. diff --git a/Functions/acx b/Functions/acx deleted file mode 100755 index f7c680bb0..000000000 --- a/Functions/acx +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -# -# zsh shell function to make its arguments 755 -# also works as an sh script -# -chmod 755 $* diff --git a/Functions/allopt b/Functions/allopt deleted file mode 100644 index 604e76198..000000000 --- a/Functions/allopt +++ /dev/null @@ -1,29 +0,0 @@ -# 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 diff --git a/Functions/cat b/Functions/cat deleted file mode 100644 index 612deac03..000000000 --- a/Functions/cat +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/local/bin/zsh -f - -local file - -if ((! ARGC)) then - set -- - -fi - -for file -do - if [[ "$file" == - ]] then - while read -u0ek 4096; do ; done - else - while read -u0ek 4096; do ; done < "$file" - fi -done diff --git a/Functions/cdmatch b/Functions/cdmatch deleted file mode 100755 index 7c4bb9ae7..000000000 --- a/Functions/cdmatch +++ /dev/null @@ -1,23 +0,0 @@ -# Start of cdmatch. -# Save in your functions directory and autoload, then do -# compctl -x 'S[/][~][./][../]' -g '*(-/)' - \ -# 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd -# -# Completes directories for cd, pushd, ... anything which knows about cdpath. -# You do not have to include `.' in your cdpath. -# -# It works properly only if $ZSH_VERSION > 3.0-pre4. Remove `emulate -R zsh' -# for all other values of $ZSH_VERSION > 2.6-beta2. For earlier versions -# it still works if RC_EXPAND_PARAM is not set or when cdpath is empty. -emulate -R zsh -setopt localoptions -local narg pref cdp - -read -nc narg -read -Ac pref - -cdp=(. $cdpath) -reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) ) - -return -# End of cdmatch. diff --git a/Functions/cdmatch2 b/Functions/cdmatch2 deleted file mode 100644 index c70357a34..000000000 --- a/Functions/cdmatch2 +++ /dev/null @@ -1,15 +0,0 @@ -# This function should be called from compctl to complete the -# second argument of cd and pushd. - -emulate -R zsh # Requires zsh 3.0-pre4 or later -setopt localoptions -local from - -read -Ac from -from="${from[2]}" - -eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )" -reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" ) -[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''" - -return diff --git a/Functions/checkmail b/Functions/checkmail deleted file mode 100644 index 9cc743db4..000000000 --- a/Functions/checkmail +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/local/bin/zsh -# -# This autoloadable function checks the folders specified as arguments -# for new mails. The arguments are interpeted in exactly the same way -# as the mailpath special zsh parameter (see zshparam(1)). -# -# If no arguments are given mailpath is used. If mailpath is empty, $MAIL -# is used and if that is also empty, /var/spool/mail/$LOGNAME is used. -# This function requires zsh-3.0.1 or newer. -# - -local file message - -for file in "${@:-${mailpath[@]:-${MAIL:-/var/spool/mail/$LOGNAME}}}" -do - message="${${(M)file%%\?*}#\?}" - file="${file%%\?*}" - if [[ -d "$file" ]] then - file=( "$file"/**/*(.ND) ) - if (($#file)) then - checkmail "${^file}\?$message" - fi - elif test -s "$file" -a -N "$file"; then # this also sets $_ to $file - print -r -- "${(e)message:-You have new mail.}" - fi -done diff --git a/Functions/cx b/Functions/cx deleted file mode 100755 index a0b34a4f0..000000000 --- a/Functions/cx +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -# -# zsh shell function to make its arguments executable -# also works as a sh script -# -chmod +x $* diff --git a/Functions/harden b/Functions/harden deleted file mode 100755 index c02689362..000000000 --- a/Functions/harden +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -# harden a link (convert it to a singly linked file) -cp $1 $1.foo -rm $1 -mv $1.foo $1 - diff --git a/Functions/mere b/Functions/mere deleted file mode 100755 index cf8d8ad14..000000000 --- a/Functions/mere +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# read a man page in the current directory -nroff -man -Tman $1 | less -s diff --git a/Functions/multicomp b/Functions/multicomp deleted file mode 100755 index ab206de0d..000000000 --- a/Functions/multicomp +++ /dev/null @@ -1,80 +0,0 @@ -# multicomp() { -# Completes all manner of files given prefixes for each path segment. -# e.g. s/z/s -> src/zsh-2.4/src -# -# Usage: e.g. -# compctl -D -f + -U -Q -S '' -K multicomp -# -# Note that exactly matched directories are not expanded, e.g. -# s/zsh-2.4/s<TAB> will not expand to src/zsh-2.4old/src. -# Will expand glob patterns already in the word, but use complete-word, -# not TAB (expand-or-complete), or you will get ordinary glob expansion. -# Requires the -U option to compctl. -# Menucompletion is highly recommended for ambiguous matches. -# Liable to screw up escaped metacharacters royally. -# $fignore is not used: feel free to add your own bit. - -emulate -R zsh # Requires zsh 3.0-pre4 or later -local pref head sofar origtop newtop globdir="(-/)" wild -setopt localoptions nullglob rcexpandparam globdots -unsetopt markdirs globsubst shwordsplit nounset - -pref="${1}$2" -# Hack to allow programmable completion to select multicomp after a : -# (e.g. -# compctl -D -f -x 's[:]' -U -Q -S '' -K multicomp -# ) -pref="${pref#:}" - -sofar=('') -reply=('') - -if [[ "$pref" = \~* ]]; then - # If the string started with ~, save the head and what it will become. - origtop="${pref%%/*}" - eval "newtop=$origtop" - # Save the expansion as the bit matched already - sofar=($newtop) - pref="${pref#$origtop}" -fi - -while [[ -n "$pref" ]]; do - [[ "$pref" = /* ]] && sofar=(${sofar}/) && pref="${pref#/}" - head="${pref%%/*}" - pref="${pref#$head}" - if [[ -n "$pref" && -z $sofar[2] && -d "${sofar}$head" ]]; then - # Exactly matched directory: don't try to glob - reply=("${sofar}$head") - else - [[ -z "$pref" ]] && globdir= - # if path segment contains wildcards, don't add another. - if [[ "$head" = *[\[\(\*\?\$\~]* || -z "$head" ]]; then - wild=$head - else - # Simulate case-insensitive globbing for ASCII characters - wild="[${(j(][))${(s())head:l}}]*" # :gs/a/[a]/ etc. - # The following could all be one expansion, but for readability: - wild=$wild:gs/a/aA/:gs/b/bB/:gs/c/cC/:gs/d/dD/:gs/e/eE/:gs/f/fF/ - wild=$wild:gs/g/gG/:gs/h/hH/:gs/i/iI/:gs/j/jJ/:gs/k/kK/:gs/l/lL/ - wild=$wild:gs/m/mM/:gs/n/nN/:gs/o/oO/:gs/p/pP/:gs/q/qQ/:gs/r/rR/ - wild=$wild:gs/s/sS/:gs/t/tT/:gs/u/uU/:gs/v/vV/:gs/w/wW/:gs/x/xX/ - wild=$wild:gs/y/yY/:gs/z/zZ/:gs/-/_/:gs/_/-_/:gs/[]// - - # Expand on both sides of '.' (except when leading) as for '/' - wild="${${wild:gs/[.]/*.*/}#\*}" - fi - - reply=(${sofar}"${wild}${globdir}") - reply=(${~reply}) - fi - - [[ -z $reply[1] ]] && reply=() && break - [[ -n $pref ]] && sofar=($reply) -done - -# Restore ~'s in front if there were any. -# There had better not be anything funny in $newtop. -[[ -n "$origtop" ]] && reply=("$origtop"${reply#$newtop}) - -# } - diff --git a/Functions/proto b/Functions/proto deleted file mode 100755 index df1826506..000000000 --- a/Functions/proto +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -# generate prototypes, if your style is the same as mine -for i -do - rm $i:r.pro 2>/dev/null - grep -v '[{};:#]' $i | grep '^[A-Za-z]' | - grep -v static | sed 's/$/;/' >! $i:r.pro -done diff --git a/Functions/pushd b/Functions/pushd deleted file mode 100644 index 965c774bf..000000000 --- a/Functions/pushd +++ /dev/null @@ -1,13 +0,0 @@ -# pushd function to emulate the old zsh behaviour. With this function -# pushd +/-n just lifts the selected element to the top of the stack -# instead of just cycling the stack. - -emulate -R zsh -setopt localoptions - -if [[ ARGC -eq 1 && "$1" == [+-]<-> ]] then - setopt pushdignoredups - builtin pushd ~$1 -else - builtin pushd "$@" -fi diff --git a/Functions/randline b/Functions/randline deleted file mode 100755 index 9af714fa2..000000000 --- a/Functions/randline +++ /dev/null @@ -1,3 +0,0 @@ -# get a random line from a file -integer z=$(wc -l <$1) -sed -n $[RANDOM%z+1]p $1 diff --git a/Functions/run-help b/Functions/run-help deleted file mode 100755 index a8109e3ea..000000000 --- a/Functions/run-help +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/local/bin/zsh -# -# Figure out where to get the best help, and get it. -# -# Install this function by placing it in your FPATH and then -# adding to your .zshrc the lines: -# unalias run-help -# autoload run-help -# - -emulate -R zsh -setopt localoptions - -# Check whether Util/helpfiles has been used to generate zsh help -if [[ $1 == "-l" ]] -then - if [[ -n "${HELPDIR:-}" ]] - then - echo 'Here is a list of topics for which help is available:' - echo "" - print -rc $HELPDIR/*(:t) - else - echo 'There is no list of help topics available at this time' - fi - return 0 -elif [[ -n "${HELPDIR:-}" && -r $HELPDIR/$1 && $1 != compctl ]] -then - ${=PAGER:-more} $HELPDIR/$1 - return $? -fi - -# No zsh help, use "whence" to figure out where else we might look -local what places newline=' -' -integer i=0 didman=0 - -places=( "${(@f)$(builtin whence -va $1)}" ) - -while ((i++ < $#places)) -do - what=$places[$i] - builtin print -r $what - case $what in - (*( is an alias)*) - [[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t} - ;; - (*( is a * function)) - builtin functions ${what[(w)1]} | ${=PAGER:-more} - ;; - (*( is a * builtin)) - case ${what[(w)1]} in - (compctl) man zshcompctl;; - (bindkey) man zshzle;; - (*setopt) man zshoptions;; - (*) man zshbuiltins;; - esac - ;; - (*( is hashed to *)) - man ${what[(w)-1]:t} - ;; - (*) - ((! didman++)) && man $1 - ;; - esac - if ((i < $#places && ! didman)) - then - builtin print -nP "%SPress any key for more help or q to quit%s" - builtin read -k what - [[ $what != $newline ]] && echo - [[ $what == [qQ] ]] && break - fi -done diff --git a/Functions/yp b/Functions/yp deleted file mode 100755 index 7e09613ef..000000000 --- a/Functions/yp +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -ypmatch $1 passwd diff --git a/Functions/yu b/Functions/yu deleted file mode 100755 index 3c5f170cf..000000000 --- a/Functions/yu +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -ypmatch $1 passwd.byuid diff --git a/Functions/zed b/Functions/zed deleted file mode 100755 index e8e7212ef..000000000 --- a/Functions/zed +++ /dev/null @@ -1,65 +0,0 @@ -# -# zed -# -# No other shell could do this. -# Edit small files with the command line editor. -# Use ^X^W to save, ^C to abort. -# Option -f: edit shell functions. (Also if called as fned.) -# -# Completion: use -# compctl -f -x 'w[1,-f]' -F -- zed -# - -local var fun cleanup -# We do not want timeout while we are editing a file -integer TMOUT=0 - -[[ $1 = -f || $0 = fned ]] && fun=1 -[[ $1 = -(|-|f) ]] && shift - -[[ -z "$1" ]] && echo 'Usage: "zed filename" or "zed -f function"' && return 1 - -# catch interrupts -cleanup="$(bindkey -L "^M"; bindkey -L -M emacs "^X^W"; bindkey -aL "ZZ" - echo "trap - INT EXIT"; trap)" -trap "return 130" INT -trap "$cleanup" EXIT - -# don't mangle !'s -setopt localoptions nobanghist - -bindkey "^M" self-insert-unmeta -# Depending on your stty's, you may be able to use ^J as accept-line, else: -bindkey -M emacs "^X^W" accept-line -bindkey -a "ZZ" accept-line - -if ((fun)) then - var="$(functions $1)" - # If function is undefined but autoloadable, load it - if [[ $var = undefined* ]] then - local dir - for dir in $fpath; do - if [[ -f $dir/$1 ]] then - var="$1() { -$(<$dir/$1) -}" - break - fi - done - elif [[ -z $var ]] then - var="$1() { -}" - fi - vared var && eval function "$var" -else - [[ -f $1 ]] && var="$(<$1)" - while vared var - do - (print -r -- "$var" >| $1) && break - echo -n -e '\a' - done -fi - -return 0 - -# End of zed diff --git a/Functions/zless b/Functions/zless deleted file mode 100644 index 809ce35c7..000000000 --- a/Functions/zless +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 $* diff --git a/Functions/zls b/Functions/zls deleted file mode 100644 index da6eff856..000000000 --- a/Functions/zls +++ /dev/null @@ -1,55 +0,0 @@ -# zls () { -# simple internal ls using the stat module - -zmodload -i stat || return 1 - -emulate -R zsh -setopt localoptions - -local f stat opts='' L=L mod=: dirs list - -dirs=() -list=() - -while getopts ailLFd f -do - opts=$opts$f - if [[ $f == '?' ]] then - echo Usage: $0 [ -ailLFd ] [ filename ... ] - return 1 - fi -done -shift OPTIND-1 - -[[ $opts == *L* ]] && L='' -[[ $opts == *F* ]] && mod=T$mod -[[ $opts == *a* ]] && setopt globdots - -if ((! ARGC)) then - set * - opts=d$opts -fi - -for f in $* -do - stat -s$L -A stat -F "%b %e %H:%M" - $f || continue - if [[ $opts != *d* && $stat[3] == d* ]] then - dirs=( $dirs $f ) - elif [[ $opts == *l* ]] then - [[ $opts == *i* ]] && print -n "${(l:7:)stat[2]} " - [[ -n $stat[14] ]] && f=( $f '->' $stat[14] ) || f=( $f($mod) ) - print -r -- "$stat[3] ${(l:3:)stat[4]} ${(r:8:)stat[5]} " \ - "${(r:8:)stat[6]} ${(l:8:)stat[8]} $stat[10] $f" - else - f=( $f($mod) ) - list=( "$list[@]" "${${(M)opts:%*i*}:+${(l:7:)stat[2]} }$f" ) - fi -done -(($#list)) && print -cr -- "$list[@]" -while (($#dirs)) do - ((ARGC > $#dirs)) && echo - ((ARGC > 1)) && echo $dirs[1]: - (cd $dirs[1] && $0 -d$opts) - shift dirs -done -# } diff --git a/Misc/.lastloc b/Misc/.lastloc deleted file mode 100644 index 8ba7dd946..000000000 --- a/Misc/.lastloc +++ /dev/null @@ -1,2 +0,0 @@ -(("/home/user2/pws/src/zsh-3.1.5/Misc/globtests.ksh" . 2763) - ("/home/user2/pws/src/zsh-3.1.5/Misc/globtests" . 3123)) diff --git a/Misc/new-completion-examples b/Misc/new-completion-examples deleted file mode 100644 index 659679891..000000000 --- a/Misc/new-completion-examples +++ /dev/null @@ -1,453 +0,0 @@ -# Define a new widget behaving like `expand-or-complete' but calling the -# function `main-complete' to generate matches. - -zle -c my-comp expand-or-complete main-complete - -bindkey '\C-i' my-comp - - -# Below is a proposed main loop and the things it needs. - -# One associative array for normal completions and one for patterns. - -typeset -A comps - - -# These may be used to define completion handlers. First argument is the -# name of the function/variable containing the definition, the other -# arguments are the command names for which this definition should be used. -# With only one argument the function/variable-name __$1 is used. - -defcomp() { - local v - - if [[ $# -eq 1 ]] then - comps[$1]="__$1" - else - v="$1" - shift - for i; do - comps[$i]="$v" - done - fi -} - -defpatcomp() { - if [[ ${+patcomps} == 1 ]] then - patcomps=("$patcomps[@]" "$2 $1" ) - else - patcomps=( "$2 $1" ) - fi -} - - -# These can be used to easily save and restore the state of the special -# variables used by the completion code. - -alias compsave='local _opre _oipre _oargs _ocur;_opre="$PREFIX";_oipre="$IPREFIX";_oargs=( "$@" );_ocur="$CURRENT"' -alias compreset='PREFIX="$_opre";IPREFIX="$_oipre";argv=( "$_oargs[@]" );CURRENT="$_ocur"' - -# This is an easy way to get completion for sub-commands. - -alias compsub='do-complete "$@" || return 1' - -# This searches $1 in the array for normal completions and calls the result. - -compalso() { - 1="$comps[$1]" - [[ -z "$1" ]] || call-complete "$@" -} - -# This generates matches. The first argument is something we got from one -# of the associative arrays above. This is expected to be either the name -# of a variable in which case we use its value as arguments to complist, -# or it is the name of a function in which case we call this function with -# the arguments from the command line as its arguments. - -call-complete() { - local var - - eval var\=\$\{\+$1\} - if [[ "$var" == 0 ]] then - "$@" - else - eval complist \$\{${1}\[\@\]\} - fi -} - -# The main loop of the competion code. This is what is called when TAB is -# pressed. The completion code gives us the special variables and the -# arguments from the command line are gives as positional parameters. - -main-complete() { - emulate -R zsh - local comp - setopt localoptions nullglob rcexpandparam globdots - unsetopt markdirs globsubst shwordsplit nounset - - # An entry for `--first--' is the replacement for `compctl -T' - # The `|| return 1' is used throughout: if a function producing matches - # returns non-zero this is interpreted as `do not try to produce more matches' - # (this is the replacement for `compctl -t'). - - comp="$comps[--first--]" - [[ -z "$comp" ]] || call-complete "$comp" "$@" || return 1 - - # For arguments we use the `do-complete' function below called via the - # convenience alias `compsub'. - - if [[ $CONTEXT == argument || $CONTEXT == command ]] then - compsub - else - # Let's see if we have a special completion definition for the other - # possible contexts. - - comp='' - - case $CONTEXT in - redirect) comp="$comps[--redir--]";; - math) comp="$comps[--math--]";; - subscript) comp="$comps[--subscr--]";; - value) comp="$comps[--value--]";; - condition) comp="$comps[--cond--]";; - esac - - # If not, we use default completion, if any. - - [[ -z "$comp" ]] && comp="$comps[--default--]" - [[ -z "$comp" ]] || call-complete "$comp" "$@" || return 1 - fi -} - -# This does completion for a command (in command position and for the -# arguments). - -do-complete() { - local comp cmd1 cmd2 pat val - - # 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. - # a path and the last path name component). - - if [[ $CONTEXT == command ]] then - comp="$comps[--command--]" - [[ -z "$comp" ]] || call-complete "$comp" "$@" || return 1 - return 0 - elif [[ "$COMMAND[1]" == '=' ]] then - eval cmd1\=$COMMAND - cmd2="$COMMAND[2,-1]" - elif [[ "$COMMAND" == */* ]] then - cmd1="$COMMAND" - cmd2="${COMMAND:t}" - else - cmd1="$COMMAND" - eval cmd2=$(whence -p $COMMAND) - fi - - # See if there are any matching pattern completions. - - for i in "$patcomps[@]"; do - pat="${i% *}" - val="${i#* }" - if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]] then - call-complete "$val" "$@" || return 1 - fi - done - - # Now look up the two names in the normal completion array. - - comp="${comps[$cmd1]:-$comps[$cmd2]}" - - # And generate the matches, probably using default completion. - - [[ -z "$comp" ]] && comp="$comps[--default--]" - [[ -z "$comp" ]] || call-complete "$comp" "$@" || return 1 -} - -# Do sub-completion for pre-command modifiers. - -defcomp __precmd - noglob nocorrect exec command builtin -__precmd() { - COMMAND="$1" - shift - (( CURRENT-- )) - if [[ CURRENT -eq 0 ]] then - CONTEXT=command - else - CONTEXT=argument - fi - compsub -} - -# Utility function for in-path completion. -# First argument should be an complist-option (e.g. -f, -/, -g). The other -# arguments should be glob patterns, one per argument. -# E.g.: files -g '*.tex' '*.texi' -# This is intended as a replacement for `complist -f', `complist -/', and -# `complist -g ...' (but don't use it with other options). -# This function behaves as if you have a matcher definition like: -# compctl -M 'r:|[-.,_/]=* r:|=* m:{a-z}={A-Z} m:-=_ m:.=,' -# so you may want to modify this. - -pfiles() { - local nm str pa pre epre a b c s rest - - setopt localoptions nullglob rcexpandparam globdots extendedglob - unsetopt markdirs globsubst shwordsplit nounset - - nm=$NMATCHES - if [[ $# -eq 0 ]] then - complist -f - elif [[ "$1" = -g ]] then - complist -g "$argv[2,-1]" - shift - else - complist $1 - shift - fi - [[ -nmatches nm ]] || return - - str="$PREFIX*$SUFFIX" - - [[ -z "$1" ]] && 1='*' - if [[ $str[1] = \~ ]] then - pre="${str%%/*}/" - eval epre\=$pre - str="${str#*/}" - pa='' - else - pre='' - epre='' - if [[ $str[1] = / ]] then - str="$str[2,-1]" - pa='/' - else - pa='' - fi - fi - str="$str:gs/,/*,/:gs/_/*_/:gs./.*/.:gs/-/*[-_]/:gs/./*[.,]/:gs-*[.,]*[.,]*/-../-:gs.**.*." - while [[ "$str" = */* ]] do - rest="${str#*/}" - a="${epre}${pa}(#l)${str%%/*}(-/)" - a=( $~a ) - if [[ $#a -eq 0 ]] then - return - elif [[ $#a -gt 1 ]] then - c=() - s=( $rest$@ ) - s=( "${(@)s:gs.**.*.}" ) - for i in $a; do - b=( $~i/(#l)$~s ) - eval b\=\( \$\{b:/\*\(${(j:|:)fignore}\)\} \) - [[ $#b -ne 0 ]] && c=( $c $i ) - done - if [[ $#c -eq 0 ]] then - return - elif [[ $#c -ne 1 ]] then - a="$epre$pa" - c=( $~c/(#l)$~s ) - eval c\=\( \$\{c:/\*\(${(j:|:)fignore}\)\} \) - c=( ${c#$a} ) - for i in $c; do - compadd -p "$pre$pa" -W "$a" -s "/${i#*/}" -f "${i%%/*}" - done - return - fi - a=( "$c[1]" ) - fi - a="$a[1]" - pa="$pa${a##*/}/" - str="$rest" - done - a="$epre$pa" - s=( $str$@ ) - s=( "${(@)s:gs.**.*.}" ) - b=( $~a(#l)$~s ) - eval b\=\( \$\{b:/\*\(${(j:|:)fignore}\)\} \) - compadd -p "$pre$pa" -W "$epre$pa" -f ${b#$a} -} - -# Utility function for completing files of a given type or any file. -# In many cases you will want to call this one instead of pfiles(). - -files() { - local nm - - nm=$NMATCHES - pfiles "$@" - - [[ $# -ne 0 && -nmatches nm ]] && pfiles -} - -# Simple default, command, and math completion defined with variables. - -defcomp __default --default-- -__default() { - files -} - -defcomp __command --command-- -__command=( -c ) - -defcomp __math --math-- -__math=( -v ) - -defcomp __subscr --subscr-- -__subscr() { - compalso --math-- "$@" - # ...probably other stuff -} - -# A simple pattern completion, just as an example. - -defpatcomp __x_options '*/X11/*' -__x_options() { - complist -J options -k '(-display -name -xrm)' -} - -# A better example: completion for `find'. - -defcomp find -__find() { - compsave - - if [[ -mbetween -(ok|exec) \\\; ]] then - compsub - elif [[ -iprefix - ]] then - complist -s 'daystart {max,min,}depth follow noleaf version xdev \ - {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \ - {i,}{l,}name {no,}{user,group} path perm regex size true uid used \ - exec {f,}print{f,0,} ok prune ls' - compreset - elif [[ -position 1 ]] then - complist -g '. ..' - files -g '(-/)' - elif [[ -mcurrent -1 -((a|c|)newer|fprint(|0|f)) ]] then - files - elif [[ -current -1 -fstype ]] then - complist -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)' - elif [[ -current -1 -group ]] then - complist -k groups - elif [[ -current -1 -user ]] then - complist -u - fi -} - -# Various completions... - -defcomp __gunzip gunzip zcat -__gunzip() { - files -g '*.[gG][z]' -} - -defcomp gzip -__gzip() { - files -g '*~*.[gG][zZ]' -} - -defcomp xfig -__xfig() { - files -g '*.fig' -} - -defcomp __make make gmake -__make() { - complist -s "\$(awk '/^[a-zA-Z0-9][^/ ]+:/ {print \$1}' FS=: [mM]akefile)" -} - -defcomp __ps gs ghostview gview psnup psselect pswrap pstops pstruct lpr -__ps() { - files -g '*([pP][sS]|eps)' -} - -defcomp __which which whence -__which=( -caF ) - -defcomp __rlogin rlogin rsh ssh -__rlogin() { - if [[ -position 1 ]] then - complist -k hosts - elif [[ -position 2 ]] then - complist -k '(-l)' - elif [[ -position 3 && -word 1 artus ]] then - complist -k '(puck root)' - fi -} - -defcomp __dvi xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype -__dvi() { - files -g '*.(dvi|DVI)' -} - -defcomp __dirs rmdir df du dircmp cd -__dirs() { - files -/ '*(-/)' -} - -defcomp __jobs fg bg jobs -__jobs=(-j -P '%?') - -defcomp kill -__kill() { - if [[ -iprefix '-' ]] then - complist -k signals - else - complist -P '%?' -j - fi -} - -defcomp __uncompress uncompress zmore -__uncompress() { - files -g '*.Z' -} - -defcomp compress -__compress() { - files -g '*~*.Z' -} - -defcomp __tex tex latex glatex slitex gslitex -__tex() { - files -g '*.(tex|TEX|texinfo|texi)' -} - -defcomp __options setopt unsetopt -__options=(-M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o) - -defcomp __funcs unfunction -__funcs=(-F) - -defcomp __aliases unalias -__aliases=(-a) - -defcomp __vars unset -__vars=(-v) - -defcomp __enabled disable -__enabled=(-FBwa) - -defcomp __disabled enable -__disabled=(-dFBwa) - -defcomp __pdf acroread -__pdf() { - files -g '*.(pdf|PDF)' -} - -defcomp tar -__tar() { - local nm tf - compsave - - tf="$2" - nm=$NMATCHES - if [[ ( -mword 1 *t*f* || -mword 1 *x*f* ) && -position 3 100000 ]] then - complist -k "( $(tar tf $tf) )" - compreset - elif [[ -mword 1 *c*f* && -position 3 100000 ]] then - files - compreset - elif [[ -mcurrent -1 *f* && -position 2 ]] then - files -g '*.(tar|TAR)' - fi -} diff --git a/Misc/zftp-functions b/Misc/zftp-functions deleted file mode 100644 index a07e46d72..000000000 --- a/Misc/zftp-functions +++ /dev/null @@ -1,1281 +0,0 @@ -# zftp is a loadable module implementing an FTP client as a builtin -# command so that you can use the shell command language and line -# editing to make life easier. If your system has dynamically -# load libraries and zsh was compiled to use them, it is probably -# somewhere where it can be loaded at run time. Otherwise, it depends -# whether the shell was compiled with zftp already built into it. -# -# Here is a suite of functions, plus assorted other code, to make -# zftp work smoothly. -# -# Completion is implemented in a fairly natural way, except that -# very little support has been provided for non-UNIX remote hosts. -# On such machines, the safest thing to do is only try to complete -# files in the current directory; this should be OK. -# -# Remote globbing for commands which retrieve files is also -# implemented. This can be done in two different ways. The default -# is for zsh to do the globbing locally. The advantage is that full -# zsh pattern matching (respecting the setting of extendedglob) is -# possible, and no assumption (apart from the restrictions on -# directory handling noted above) is made about the behaviour of the -# server. The disadvantage is that the entire filename list for the -# current directory must be retrieved, and then zsh must laboriously -# do pattern matching against every file, so it is potentially slow -# for large directories. Only the non-directory part of file names is -# globbed. -# -# The alternative will be used if $zfrglob has non-zero length. -# Zsh then sends the pattern to the server for globbing. Best of -# luck. -# -# To support remote globbing, some functions have been aliased -# with 'noglob' in front. Currently, this has a dire effect on -# completion unless the completeinaliases option is set, so -# it is set below. This can conceivably cause you problems -# if you expect completion for aliases automatically to give you -# completion for the base command. I suspect that most people -# don't even know that happens. -# -# The following functions are provided. -# -# General status changing and displaying functions: -# zfparams -# Simple front end to `zftp params', except it will automatically -# query host, user and password. These are then stored to be -# used with a `zfopen' with no arguments. -# zfopen [ host [ user ... ] ] -# Open a connection and login. Unless the option -1 (once) -# is given, will store the parameters for the open (including -# a password which is prompted for and not echoed) so that -# if you call zfopen subsequently without arguments it will -# reopen the same connection. -# zfanon anonftphost -# Open a connection for anonymous FTP. Tries to guess an -# email address to use as the password, unless $EMAIL_ADDR is -# already set. The first time, will tell you what it has guessed. -# It's rude to set EMAIL_ADDR=mozilla. -# zfcd [ dir | old new ] -# Change directory on the server. This tries to mimic the behaviour -# of the shell's cd. In particular, -# zfcd change to '~' on server, if it interprets it -# zfcd - change to previous directory of current connection -# zfcd OLD NEW change directory from fooOLDbar to fooNEWbar -# One piece of magic is builtin: an initial part of the directory -# matching $HOME is translated back to `~'. Most UNIX servers -# recognise the usual shell convention. So things like `zfcd $PWD' -# is useful provide you are under your home directory and the -# structure on the remote machine mirrors that on the local. -# zfhere -# Synonym for `zfcd $PWD', see above. -# zfdir [args] -# Show a long diretory list of the remote connection. Any -# arguments are passed on to the server, apart from options. -# Currently this always uses a pager to show the directory -# list. Caching is implemented: zfdir on its own always shows -# the current diretory, which is cached; zfdir with some other -# directory arguments shows that, which is cached separately -# and can be reviewed with `zfdir -r'. Other options: -# -f force reget, overriding the cache, in case something's changed -# -d delete the cache, but don't show anything. -# To pass options to the server, use e.g. `zfdir -- -C'. -# This also has the zfcd ~ hack. -# zfls [args] -# Short list of the long directory, depending on what [args] -# do to the server. No options, no caching, no pager. -# zftype [ a[scii] | i[mage] | b[inary] ] -# Set or display the transfer type; currently only ASCII -# and image (same as binary) types are supported. -# zfclose -# Close the connection. -# zfstat -# Print the zftp status from local variables; doesn't do any network -# operations unless -v is supplied, in which case the server is -# asked for its views on the status, too. -# -# Functions for retrieving data: -# All accept the following options: -# -G Don't do remote globbing (see above); the default is to do it. -# -t Try to set local files to the same time as the remote ones. -# Unfortunately we only know the remote time in GMT, so it's -# a little tricky and you need perl 5 (installed as `perl') -# for this to work. Suggestions welcome. -# zfget file1 file2 ... -# Retrieve each file from the server. The remote file is the -# full name given, the local file is the non-directory part of that -# (assuming UNIX file paths). -# zfuget file1 file2 .. -# Get with update. Check remote and local sizes and times and -# retrieve files which are newer on the server. Will query -# hard cases, which are where the remote file is newer but a -# different size, or is older but the same size. With option -s -# (silent) assumes it's best to retrieve the files in both those -# cases. With -v (may be combined with -s), print the information -# about the files being considered. -# zfcget file1 ... -# Assuming file1 was incompletely retrieved, try to get the rest of -# it. This relies on a normal UNIX server behaviour which is not -# as specified in the FTP standard and hence is not universal. -# zfgcp file1 file2 -# zfgcp file1 file2 ... dir -# Get with the behaviour of cp, i.e. copy remote file1 to local -# file2, or get remote fileN into local diretory dir. -# -# Function for sending data: -# zfput file1 file2 ... -# Put the local files onto the server under the same name. The -# local files are exactly as given; the remote files are the -# non-diretory parts of that. -# zfuput file1 file2 .. -# Put the local files onto the server, with update. Works -# similarly to zfuget. -# -# Utility functions: -# zftp_chpwd -# Show the new directory when it changes; try to put it into -# an xterm on shelltool header. Works best alongside chpwd. -# zftp_progress -# Show the percentage of a file retrieved as it is coming; if the -# size is not available show the size transferred so far. The -# percentage may be wrong if sending data from a local pipe. -# If you transfer files in the background, you should undefine -# this before the transfer. It is smart enough not to print -# anything when stderr is not a terminal. -# zfcd_match -# Function for remote directory completion. -# zfget_match -# Function for remote filename completion. -# zfrglob varname -# This is used for the remote globbing. The pattern resides -# in $varname (note extra level of indirection), and on return -# $varname will contain the list of matching files. -# zfrtime locfile remfile [ time ] -# This sad thing does the setting of local file times to those -# of the remote, see horror story above. - -zmodload -ia zftp - -alias zfcd='noglob zfcd' -alias zfget='noglob zfget' -alias zfls='noglob zfls' -alias zfdir='noglob zfdir' -alias zfuget='noglob zfuget' -# only way of getting that noglob out of the way at the moment -setopt completealiases - -# -# zftp completions -# -compctl -f -x 'p[1]' \ - -k '(open params user login type ascii binary mode put putat - get getat append appendat ls dir local remote mkdir rmdir delete - close quit)' - \ - 'w[1,cd][1,ls][1,dir][1,rmdir]' -K zfcd_match -S/ -q - \ - 'W[1,get*]' -K zfget_match - 'w[1,delete][1,remote]' -K zfget_match - \ - 'w[1,open][1,params]' -k hosts -- zftp -compctl -K zfcd_match -S/ -q zfcd zfdir zfls -compctl -K zfget_match zfget zfgcp zfuget zfcget -compctl -k hosts zfopen zfparams - -function zfanon { - local opt optlist once - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - 1) once=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - if [[ -z $EMAIL_ADDR ]]; then - # Exercise in futility. There's a poem by Wallace Stevens - # called something like `N ways of looking at a blackbird', - # where N is somewhere around 0x14 to 0x18. Now zftp is - # ashamed to prsent `N ways of looking at a hostname'. - local domain host - # First, maybe we've already got it. Zen-like. - if [[ $HOST = *.* ]]; then - # assume this is the full host name - host=$HOST - elif [[ -f /etc/resolv.conf ]]; then - # Next, maybe we've got resolv.conf. - domain=$(awk '/domain/ { print $2 }' /etc/resolv.conf) - [[ -n $domain ]] && host=$HOST.$domain - fi - # Next, maybe we've got nlsookup. May not work on LINUX. - [[ -z $host ]] && host=$(nslookup $HOST | awk '/Name:/ { print $2 }') - if [[ -z $host ]]; then - # we're running out of ideas, but this should work. - # after all, i wrote it... - # don't want user to know about this, too embarrassed. - local oldvb=$ZFTP_VERBOSE oldtm=$ZFTP_TMOUT - ZFTP_VERBOSE= - ZFTP_TMOUT=5 - if zftp open $host >& /dev/null; then - host=$ZFTP_HOST - zftp close $host - fi - ZFTP_VERBOSE=$oldvb - ZFTP_TMOUT=$oldtm - fi - if [[ -z $host ]]; then - print "Can't get your hostname. Define \$EMAIL_ADDR by hand." - return 1; - fi - EMAIL_ADDR="$USER@$host" - print "Using $EMAIL_ADDR as anonymous FTP password." - fi - - if [[ $once = 1 ]]; then - zftp open $1 anonymous $EMAIL_ADDR - else - zftp params $1 anonymous $EMAIL_ADDR - zftp open - fi -} - -function zfcd { - # zfcd: change directory on the remote server. - # - # Currently has the following features: - # --- an initial string matching $HOME in the directory is turned back into ~ - # to be re-interpreted by the remote server. - # --- zfcd with no arguments changes directory to '~' - # --- `zfcd old new' and `zfcd -' work analagously to cd - # --- if the connection is not currently open, it will try to - # re-open it with the stored parameters as set by zfopen. - # If the connection timed out, however, it won't know until - # too late. In that case, just try the same zfcd command again - # (but now `zfcd -' and `zfcd old new' won't work). - - # hack: if directory begins with $HOME, turn it back into ~ - # there are two reasons for this: - # first, a ~ on the command line gets expanded even with noglob. - # (I suppose this is correct, but I wouldn't like to swear to it.) - # second, we can no do 'zfcd $PWD' and the like, and that will - # work just as long as the directory structures under the home match. - - # Autoopen: if not already open, hope there are parameters set up to - # do so. If not, we get the right error message, so no harm done. - [[ -z $ZFTP_HOST ]] && { zfopen || return 1; } - - if [[ $1 = $HOME || $1 = $HOME/* ]]; then - 1="~${1#$HOME}" - fi - - if (( $# == 0 )); then - # Emulate `cd' behaviour - set -- '~' - elif [[ $# -eq 1 && $1 = - ]]; then - # Emulate `cd -' behaviour. - set -- $zflastdir - elif [[ $# -eq 2 ]]; then - # Emulate `cd old new' behaviour. - # We have to find a character not in $1 or $2; ! is a good bet. - eval set -- "\${ZFTP_PWD:s!$1!$2!}" - fi - - # We have to remember the current directory before changing it - # if we want to keep it. - local lastdir=$ZFTP_PWD - - zftp cd "$@" && zflastdir=$lastdir -} - -function zfcd_match { - # see zfcd for details of this hack - if [[ $1 = $HOME || $1 = $HOME/* ]]; then - 1="~${1#$HOME}" - fi - - # error messages only - local ZFTP_VERBOSE=45 - # should we redirect 2>/dev/null or let the user see it? - - if [[ $ZFTP_SYSTEM = UNIX* ]]; then - # hoo, aren't we lucky: this makes things so much easier - setopt localoptions rcexpandparam - local dir - if [[ $1 = ?*/* ]]; then - dir=${1%/*} - elif [[ $1 = /* ]]; then - dir=/ - fi - # If we're using -F, we get away with using a directory - # to list, but not a glob. Don't ask me why. - # I hate having to rely on awk here. - reply=($(zftp ls -F $dir | - awk '/\/$/ { print substr($1, 0, length($1)-1) }')) - if [[ $dir = / ]]; then - reply=(${dir}$reply) - elif [[ -n $dir ]]; then - reply=($dir/$reply) - fi - else - # I simply don't know what to do here. - # Just use the list of files for the current directory. - zfget_match $* - fi - -} - -function zfcget { - # Continuation get of files from remote server. - # For each file, if it's shorter here, try to get the remainder from - # over there. This requires the server to support the REST command - # in the way many do but RFC959 doesn't specify. - # Options: - # -G don't to remote globbing, else do - # -t update the local file times to the same time as the remote. - # Currently this only works if you have the `perl' command, - # and that perl is version 5 with the standard library. - # See the function zfrtime for more gory details. - - setopt localoptions - unsetopt ksharrays shwordsplit - - local loc rem stat=0 optlist opt nglob remlist locst remst - local tmpfile=${TMPPREFIX}zfcget$$ rstat tsize time - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - G) nglob=1 - ;; - t) time=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - for remlist in $*; do - # zfcd directory hack to put the front back to ~ - if [[ $remlist = $HOME || $remlist = $HOME/* ]]; then - remlist="~${remlist#$HOME}" - fi - if [[ $nglob != 1 ]]; then - zfrglob remlist - fi - if (( $#remlist )); then - for rem in $remlist; do - loc=${rem:t} - if [[ ! -f $loc ]]; then - # File does not yet exist - zftp get $rem >$loc || stat=$? - else - # Compare the sizes. - locst=($(zftp local $loc)) - zftp remote $rem >$tmpfile - rstat=$? - remst=($(<$tmpfile)) - rm -f $tmpfile - if [[ $rstat = 2 ]]; then - print "Server does not support SIZE command.\n" \ - "Assuming you know what you're doing..." 2>&1 - zftp getat $rem $locst[1] >>$loc || stat=$? - continue - elif [[ $rstat = 1 ]]; then - print "Remote file not found: $rem" 2>&1 - continue - fi - if [[ $locst[1] -gt $remst[1] ]]; then - print "Local file is larger!" 2>&1 - continue; - elif [[ $locst[1] == $remst[1] ]]; then - print "Files are already the same size." 2>&1 - continue - else - if zftp getat $rem $locst[1] >>$loc; then - [[ $time = 1 ]] && zfrtime $loc $rem $remst[2] - else - stat=1 - fi - fi - fi - done - fi - done - - return $stat -} - -function zfclose { - zftp close -} - -function zfdir { - # Long directory of remote server. - # The remote directory is cached. In fact, two caches are kept: - # one of the standard listing of the current directory, i.e. zfdir - # with no arguments, and another for everything else. - # To access the appropriate cache, just use zfdir with the same - # arguments as previously. zfdir -r will also re-use the `everything - # else' cache; you can always reuse the current directory cache just - # with zfdir on its own. - # - # The current directory cache is emptied when the directory changes; - # the other is kept until a new zfdir with a non-empty argument list. - # Both are removed when the connection is closed. - # - # zfdir -f will force the existing cache to be ignored, e.g. if you know - # or suspect the directory has changed. - # zfdir -d will remove both caches without listing anything. - # If you need to pass -r, -f or -d to the dir itself, use zfdir -- -d etc. - - setopt localoptions unset - unsetopt shwordsplit ksharrays - - local file opt optlist redir i newargs force - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - r) redir=1 - ;; - f) force=1 - ;; - d) [[ -n $zfcurdir && -f $zfcurdir ]] && rm -f $zfcurdir - [[ -n $zfotherdir && -f $zfotherdir ]] && rm -f $zfotherdir - zftp_fcache=() - return 0 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - # directory hack, see zfcd - for (( i = 1; i <= $#argv; i++ )); do - if [[ $argv[$i] = $HOME || $argv[$i] = $HOME/* ]]; then - argv[$i]="~${argv[$i]#$HOME}" - fi - done - - if [[ $# -eq 0 ]]; then - # Cache it in the current directory file. This means that repeated - # calls to zfdir with no arguments always use a cached file. - [[ -z $zfcurdir ]] && zfcurdir=${TMPPREFIX}zfcurdir$$ - file=$zfcurdir - else - # Last directly looked at was not the current one, or at least - # had non-standard arguments. - [[ -z $zfotherdir ]] && zfotherdir=${TMPPREFIX}zfotherdir$$ - file=$zfotherdir - newargs="$*" - if [[ -f $file && $redir != 1 && $force -ne 1 ]]; then - # Don't use the cached file if the arguments changed. - [[ $newargs = $zfotherargs ]] || rm -f $file - fi - zfotherargs=$newargs - fi - - if [[ $force -eq 1 ]]; then - rm -f $file - # if it looks like current directory has changed, better invalidate - # the filename cache, too. - (( $# == 0 )) && zftp_fcache=() - fi - - if [[ -n $file && -f $file ]]; then - eval ${PAGER:-more} \$file - else - zftp dir $* | tee $file | eval ${PAGER-:more} - fi -} - -function zfgcp { - # ZFTP get as copy: i.e. first arguments are remote, last is local. - # Supposed to work exactly like a normal copy otherwise, i.e. - # zfcp rfile lfile - # or - # zfcp rfile1 rfile2 rfile3 ... ldir - # Options: - # -G don't to remote globbing, else do - # -t update the local file times to the same time as the remote. - # Currently this only works if you have the `perl' command, - # and that perl is version 5 with the standard library. - # See the function zfrtime for more gory details. - - setopt localoptions - unsetopt shwordsplit - - local opt optlist nglob remlist rem loc stat=0 time - - while [[ $1 == -* ]]; do - if [[ $1 == - || $1 == -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $opt in - G) nglob=1 - ;; - t) time=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - # hmm, we should really check this after expanding the glob, - # but we shouldn't expand the last argument remotely anyway. - if [[ $# -gt 2 && ! -d $argv[-1] ]]; then - print "zfgcp: last argument must be a directory." 2>&1 - return 1 - elif [[ $# == 1 ]]; then - print "zfgcp: not enough arguments." 2>&1 - return 1 - fi - - if [[ -d $argv[-1] ]]; then - local dir=$argv[-1] - argv[-1]= - for remlist in $*; do - # zfcd directory hack to put the front back to ~ - if [[ $remlist = $HOME || $remlist = $HOME/* ]]; then - remlist="~${remlist#$HOME}" - fi - if [[ $nglob != 1 ]]; then - zfrglob remlist - fi - if (( $#remlist )); then - for rem in $remlist; do - loc=$dir/${rem:t} - if zftp get $rem >$loc; then - [[ $time = 1 ]] && zfrtime $rem $loc - else - stat=1 - fi - done - fi - done - else - zftp get $1 >$2 || stat=$? - fi - return $stat -} - -function zfget { - # Get files from remote server. Options: - # -G don't to remote globbing, else do - # -t update the local file times to the same time as the remote. - # Currently this only works if you have the `perl' command, - # and that perl is version 5 with the standard library. - # See the function zfrtime for more gory details. - - local loc rem stat=0 optlist opt nglob remlist time - - while [[ $1 == -* ]]; do - if [[ $1 == - || $1 == -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $opt in - G) nglob=1 - ;; - t) time=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - for remlist in $*; do - # zfcd directory hack to put the front back to ~ - if [[ $remlist == $HOME || $remlist == $HOME/* ]]; then - remlist="~${remlist#$HOME}" - fi - if [[ $nglob != 1 ]]; then - zfrglob remlist - fi - if (( $#remlist )); then - for rem in $remlist; do - loc=${rem:t} - if zftp get $rem >$loc; then - [[ $time = 1 ]] && zfrtime $rem $loc - else - stat=1 - fi - done - fi - done - - return $stat -} - -function zfget_match { - # the zfcd hack: this may not be necessary here - if [[ $1 == $HOME || $1 == $HOME/* ]]; then - 1="~${1#$HOME}" - fi - - - if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then - # On the first argument to ls, we usually get away with a glob. - reply=($(zftp ls "$1*$2")) - else - if (( $#zftp_fcache == 0 )); then - # Always cache the current directory and use it - # even if the system is UNIX. - zftp_fcache=($(zftp ls)) - fi - reply=($zftp_fcache); - fi -} - -function zfhere { - # Change to the directory corresponding to $PWD on the server. - # See zfcd for how this works. - zfcd $PWD -} - -function zfls { - # directory hack, see zfcd - if [[ $1 = $HOME || $1 = $HOME/* ]]; then - 1="~${1#$HOME}" - fi - zftp ls $* -} - -function zfopen { - # Use zftp params to set parameters for open, rather than sending - # them straight to open. That way they are stored for a future open - # command. - # - # With option -1 (just this 1ce), don't do that. - - local optlist opt once - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - 1) once=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - # This is where we should try and do same name-lookupage in - # both .netrc and .ncftp/bookmarks . We could even try saving - # the info in their for new hosts, like ncftp does. - - if [[ $once = 1 ]]; then - zftp open $* - else - # set parameters, but only if there was at least a host - (( $# > 0 )) && zfparams $* - # now call with no parameters - zftp open - fi -} - -function zfparams { - # Set to prompt for any user or password if not given. - # Don't worry about accounts here. - if (( $# > 0 )); then - (( $# < 2 )) && 2='?' - (( $# < 3 )) && 3='?' - fi - zftp params $* -} - -function zfput { - # Simple put: dump every file under the same name, but stripping - # off any directory parts. - local loc rem stat=0 - for loc in $*; do - rem=${loc:t} - zftp put $rem <$loc - [[ $? == 0 ]] || stat=$? - done - return $stat -} - -function zfrglob { - # Do the remote globbing for zfput, etc. - # We have two choices: - # (1) Get the entire file list and match it one by one - # locally against the pattern. - # Causes problems if we are globbing directories (rare, presumably). - # But: we can cache the current directory, which - # we need for completion anyway. Works on any OS if you - # 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. - - # There is only one argument, the variable containing the - # pattern to be globbed. We set this back to an array containing - # all the matches. - setopt localoptions unset - unsetopt ksharrays - - local pat dir nondir files i - - eval pat=\$$1 - - # Check if we really need to do anything. Look for standard - # globbing characters, and if extendedglob is set and we are - # using zsh for the actual pattern matching also look for - # extendedglob characters. - if [[ $remlist != *[][*?]* && - ( -n $zfrglob || ! -o extendedglob || $remlist != *[(|)~#^]* ) ]]; then - return 0 - fi - - if [[ $zfrglob != '' ]]; then - eval "$1=(\$(zftp ls \"$pat\" 2>/dev/null))" - else - if [[ $ZFTP_SYSTEM = UNIX* && $pat = */* ]]; then - # not the current directory and we know how to handle paths - if [[ $pat = ?*/* ]]; then - # careful not to remove too many slashes - dir=${pat%/*} - else - dir=/ - fi - nondir=${pat##*/} - files=($(zftp ls "$dir" 2>/dev/null)) - else - # we just have to do an ls and hope that's right - nondir=$pat - if (( $#zftp_fcache == 0 )); then - zftp_fcache=($(zftp ls)) - fi - files=($zftp_fcache) - fi - # now we want to see which of the $files match $nondir - for (( i = 1; i <= $#files; i++)); do - # empty words are elided in array assignment - [[ $files[$i] = ${~nondir} ]] || files[$i]='' - done - eval "$1=(\$files)" - fi -} - -function zfrtime { - # Set the modification time of file LOCAL to that of REMOTE. - # If the optional TIME is passed, it should be in the FTP format - # CCYYMMDDhhmmSS, i.e. no dot before the seconds, and in GMT. - # This is what both `zftp remote' and `zftp local' return. - # - # Unfortunately, since the time returned from FTP is GMT and - # your file needs to be set in local time, we need to do some - # hacking around with time. At the moment this requires perl 5 - # with the standard library. - - setopt localoptions unset - unsetopt ksharrays - - local time gmtime loctime - - if [[ -n $3 ]]; then - time=$3 - else - time=($(zftp remote $2 2>/dev/null)) - [[ -n $time ]] && time=$time[2] - fi - [[ -z $time ]] && return 1 - - # Now's the real *!@**!?!. We have the date in GMT and want to turn - # it into local time for touch to handle. It's just too nasty - # to handle in zsh; do it in perl. - if perl -mTime::Local -e '($file, $t) = @ARGV; - $yr = substr($t, 0, 4) - 1900; - $mon = substr($t, 4, 2) - 1; - $mday = substr($t, 6, 2) + 0; - $hr = substr($t, 8, 2) + 0; - $min = substr($t, 10, 2) + 0; - $sec = substr($t, 12, 2) + 0; - $time = Time::Local::timegm($sec, $min, $hr, $mday, $mon, $yr); - utime $time, $time, $file and return 0;' $1 $time 2>/dev/null; then - print "Setting time for $1 failed. Need perl 5." 2>1 - fi - - # If it wasn't for the GMT/local time thing, it would be this simple. - # - # time="${time[1,12]}.${time[13,14]}" - # - # touch -t $time $1 - -} - -function zfstat { - # Give a zftp status report using local variables. - # With option -v, connect the remote host and ask it what it - # thinks the status is. - - setopt localoptions unset - unsetopt ksharrays - - local i stat=0 opt optlist verbose - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $opt in - v) verbose=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - # hack: in case the status from a subshell process hasn't been - # fixed yet - zftp type >&/dev/null - - if [[ -n $ZFTP_HOST ]]; then - print "Host:\t\t$ZFTP_HOST" - print "IP:\t\t$ZFTP_IP" - [[ -n $ZFTP_SYSTEM ]] && print "System type:\t$ZFTP_SYSTEM" - if [[ -n $ZFTP_USER ]]; then - print "User:\t\t$ZFTP_USER " - [[ -n $ZFTP_ACCOUNT ]] && print "Account:\t$AFTP_ACCOUNT" - print "Directory:\t$ZFTP_PWD" - print -n "Transfer type:\t" - if [[ $ZFTP_TYPE = "I" ]]; then - print Image - elif [[ $ZFTP_TYPE = "A" ]]; then - print Ascii - else - print Unknown - fi - print -n "Transfer mode:\t" - if [[ $ZFTP_MODE = "S" ]]; then - print Stream - elif [[ $ZFTP_MODE = "B" ]]; then - print Block - else - print Unknown - fi - else - print "No user logged in." - fi - else - print "Not connected." - stat=1 - fi - - # things which may be set even if not connected: - [[ -n $ZFTP_REPLY ]] && print "Last reply:\t$ZFTP_REPLY" - print "Verbosity:\t$ZFTP_VERBOSE" - print -n "Preferences:\t" - for (( i = 1; i <= ${#ZFTP_PREFS}; i++ )); do - case $ZFTP_PREFS[$i] in - [pP]) print -n "Passive " - ;; - [sS]) print -n "Sendport " - ;; - [dD]) print -n "Dumb " - ;; - *) print -n "$ZFTP_PREFS[$i]???" - esac - done - print - - if [[ -n $ZFTP_HOST && $verbose = 1 ]]; then - print "Status of remote server:" - # make sure we print the reply - local ZFTP_VERBOSE=045 - zftp quote STAT - fi - - return $stat -} - -function zftp_chpwd { - # You may want to alter chpwd to call this when $ZFTP_USER is set. - # If so, call it with a non-zero first argument so it doesn't - # print the new FTP directory. - - # 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 - - if [[ -z $ZFTP_USER ]]; then - # last call, after an FTP logout - - # delete the non-current cached directory - [[ -n $zfotherdir && -f $zfotherdir ]] && rm -f $zfotherdir - zfotherargs= - - # don't keep zflastdir between opens - zflastdir= - - # return the display to standard - # uncomment the following line if you have a chpwd which shows directories - # chpwd - else - [[ -z $zflastdir ]] && zflastdir=$ZFTP_PWD - local args - if [[ -t 1 && -t 2 ]]; then - local str="$ZFTP_HOST:$ZFTP_PWD" - [[ -z $1 ]] && print $str - [[ ${#str} -lt 70 ]] && str="%m: %~ $str" - case $TERM in - sun-cmd) print -n -P "\033]l$str\033\\" - ;; - xterm) print -n -P "\033]2;$str\a" - ;; - esac - fi - fi -} - -function zftp_progress { - # Basic progress metre, showing the percent of the file transferred. - # You want growing bars? You gotta write growing bars. - - # Don't show progress unless stderr is a terminal - [[ ! -t 2 ]] && return 0 - - if [[ $ZFTP_TRANSFER = *F ]]; then - print 1>&2 - elif [[ -n $ZFTP_TRANSFER ]]; then - if [[ -n $ZFTP_SIZE ]]; then - local frac="$(( ZFTP_COUNT * 100 / ZFTP_SIZE ))%" - print -n "\r$ZFTP_FILE ($ZFTP_SIZE bytes): $ZFTP_TRANSFER $frac" 1>&2 - else - print -n "\r$ZFTP_FILE: $ZFTP_TRANSFER $ZFTP_COUNT" 1>&2 - fi - fi -} - -function zftype { - local type - - if (( $# == 0 )); then - type=$(zftp type) - if [[ $type = I ]]; then - print "Current type is image (binary)" - return 0 - elif [[ $type = A ]]; then - print "Current type is ASCII" - return 0 - else - return 1 - fi - else - if [[ $1 == [aA]([sS][cC]([iI][iI]|)|) ]]; then - type=A - elif [[ $1 == [iI]([mM]([aA][gG][eE]|)|) || - $1 == [bB]([iI][nN]([aA][rR][yY]|)|) ]]; then - type=I - else - print "Type not recognised: $1" 2>&1 - return 1 - fi - zftp type $type - fi -} - -function zfuget { - # Get a list of files from the server with update. - # In other words, only retrieve files which are newer than local - # ones. This depends on the clocks being adjusted correctly - # (i.e. if one is fifteen minutes out, for the next fifteen minutes - # updates may not be correctly calculated). However, difficult - # cases --- where the files are the same size, but the remote is newer, - # or have different sizes, but the local is newer -- are prompted for. - # - # Files are globbed on the remote host --- assuming, of course, they - # haven't already been globbed local, so use 'noglob' e.g. as - # `alias zfuget="noglob zfuget"'. - # - # Options: - # -G Glob: turn off globbing - # -v verbose: print more about the files listed. - # -s silent: don't ask, just guess. The guesses are: - # - if the files have different sizes but remote is older ) grab - # - if they have the same size but remote is newer ) - # which is safe if the remote files are always the right ones. - # -t time: update the local file times to the same time as the remote. - # Currently this only works if you have the `perl' command, - # and that perl is version 5 with the standard library. - # See the function zfrtime for more gory details. - - setopt localoptions - unsetopt ksharrays shwordsplit - - local loc rem stat=0 locstats remstats doit tmpfile=${TMPPREFIX}zfuget$$ - local rstat remlist verbose optlist opt bad i silent nglob time - - zfuget_print_time() { - local tim=$1 - print -n "$tim[1,4]/$tim[5,6]/$tim[7,8] $tim[9,10]:$tim[11,12].$tim[13,14]" - print -n GMT - } - - zfuget_print () { - print -n "\nremote $rem (" - zfuget_print_time $remstats[2] - print -n ", $remstats[1] bytes)\nlocal $loc (" - zfuget_print_time $locstats[2] - print ", $locstats[1] bytes)" - } - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - v) verbose=1 - ;; - s) silent=1 - ;; - G) nglob=1 - ;; - t) time=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - [[ -n $bad ]] && return 1 - - for remlist in $*; do - # zfcd directory hack to put the front back to ~ - if [[ $remlist == $HOME || $remlist == $HOME/* ]]; then - remlist="~${remlist#$HOME}" - fi - if [[ $nglob != 1 ]]; then - zfrglob remlist - fi - if (( $#remlist )); then - for rem in $remlist; do - loc=${rem:t} - doit=y - remstats=() - if [[ -f $loc ]]; then - zftp local $loc >$tmpfile - locstats=($(<$tmpfile)) - zftp remote $rem >$tmpfile - rstat=$? - remstats=($(<$tmpfile)) - rm -f $tmpfile - if [[ $rstat = 2 ]]; then - print "Server does not implement full command set required." 1>&2 - return 1 - elif [[ $rstat = 1 ]]; then - print "File not found on server: $rem" 1>&2 - stat=1 - continue - fi - [[ $verbose = 1 ]] && zfuget_print - if (( $locstats[1] != $remstats[1] )); then - # Files have different sizes - if [[ $locstats[2] > $remstats[2] && $silent != 1 ]]; then - [[ $verbose != 1 ]] && zfuget_print - print "Local file $loc more recent than remote," 1>&2 - print -n "but sizes are different. Transfer anyway [y/n]? " 1>&2 - read -q doit - fi - else - # Files have same size - if [[ $locstats[2] < $remstats[2] ]]; then - if [[ $silent != 1 ]]; then - [[ $verbose != 1 ]] && zfuget_print - print "Local file $loc has same size as remote," 1>&2 - print -n "but local file is older. Transfer anyway [y/n]? " 1>&2 - read -q doit - fi - else - # presumably same file, so don't get it. - [[ $verbose = 1 ]] && print Not transferring - doit=n - fi - fi - else - [[ $verbose = 1 ]] && print New file $loc - fi - if [[ $doit = y ]]; then - if zftp get $rem >$loc; then - if [[ $time = 1 ]]; then - # if $remstats is set, it's second element is the remote time - zfrtime $loc $rem $remstats[2] - fi - else - stat=$? - fi - - fi - done - fi - done - return $stat -} - -function zfuput { - # Put a list of files from the server with update. - # See zfuget for details. - # - # Options: - # -v verbose: print more about the files listed. - # -s silent: don't ask, just guess. The guesses are: - # - if the files have different sizes but remote is older ) grab - # - if they have the same size but remote is newer ) - # which is safe if the remote files are always the right ones. - - setopt localoptions - unsetopt ksharrays shwordsplit - - local loc rem stat=0 locstats remstats doit tmpfile=${TMPPREFIX}zfuput$$ - local rstat verbose optlist opt bad i silent - - zfuput_print_time() { - local tim=$1 - print -n "$tim[1,4]/$tim[5,6]/$tim[7,8] $tim[9,10]:$tim[11,12].$tim[13,14]" - print -n GMT - } - - zfuput_print () { - print -n "\nremote $rem (" - zfuput_print_time $remstats[2] - print -n ", $remstats[1] bytes)\nlocal $loc (" - zfuput_print_time $locstats[2] - print ", $locstats[1] bytes)" - } - - while [[ $1 = -* ]]; do - if [[ $1 = - || $1 = -- ]]; then - shift; - break; - fi - optlist=${1#-} - for (( i = 1; i <= $#optlist; i++)); do - opt=$optlist[$i] - case $optlist[$i] in - v) verbose=1 - ;; - s) silent=1 - ;; - *) print option $opt not recognised >&2 - ;; - esac - done - shift - done - - [[ -n $bad ]] && return 1 - - if [[ $ZFTP_VERBOSE = *5* ]]; then - # should we turn it off locally? - print "Messages with code 550 are harmless." >&2 - fi - - for loc in $*; do - rem=${loc:t} - doit=y - remstats=() - if [[ ! -f $loc ]]; then - print "$loc: file not found" >&2 - stat=1 - continue - fi - zftp local $loc >$tmpfile - locstats=($(<$tmpfile)) - zftp remote $rem >$tmpfile - rstat=$? - remstats=($(<$tmpfile)) - rm -f $tmpfile - if [[ $rstat = 2 ]]; then - print "Server does not implement full command set required." 1>&2 - return 1 - elif [[ $rstat = 1 ]]; then - [[ $verbose = 1 ]] && print New file $loc - else - [[ $verbose = 1 ]] && zfuput_print - if (( $locstats[1] != $remstats[1] )); then - # Files have different sizes - if [[ $locstats[2] < $remstats[2] && $silent != 1 ]]; then - [[ $verbose != 1 ]] && zfuput_print - print "Remote file $rem more recent than local," 1>&2 - print -n "but sizes are different. Transfer anyway [y/n]? " 1>&2 - read -q doit - fi - else - # Files have same size - if [[ $locstats[2] > $remstats[2] ]]; then - if [[ $silent != 1 ]]; then - [[ $verbose != 1 ]] && zfuput_print - print "Remote file $rem has same size as local," 1>&2 - print -n "but remote file is older. Transfer anyway [y/n]? " 1>&2 - read -q doit - fi - else - # presumably same file, so don't get it. - [[ $verbose = 1 ]] && print Not transferring - doit=n - fi - fi - fi - if [[ $doit = y ]]; then - zftp put $rem <$loc || stat=$? - fi - done - return $stat -} diff --git a/Src/.lastloc b/Src/.lastloc deleted file mode 100644 index b3c6cf0f3..000000000 --- a/Src/.lastloc +++ /dev/null @@ -1,5 +0,0 @@ -(("/home/user2/pws/src/zsh-3.1.5/Src/glob.c" . 15475) - ("/home/user2/pws/src/zsh-3.1.5/Src/zsh.export" . 794) - ("/home/user2/pws/src/zsh-3.1.5/Src/utils.c" . 10946) - ("/home/user2/pws/src/zsh-3.1.5/Src/Makefile" . 4282) - ("/home/user2/pws/src/zsh-3.1.5/Src/mkmakemod.sh" . 6832)) diff --git a/Src/Zle/.lastloc b/Src/Zle/.lastloc deleted file mode 100644 index a060de394..000000000 --- a/Src/Zle/.lastloc +++ /dev/null @@ -1,10 +0,0 @@ -(("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle.h" . 2619) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle.export" . 35) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle_main.c" . 13806) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/iwidgets.list" . 7831) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/comp.h" . 8512) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle_tricky.c" . 72920) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/comp1.c" . 9640) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle_vi.c" . 16035) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/zle_utils.c" . 8406) - ("/home/user2/pws/src/zsh-3.1.5/Src/Zle/comp1.export" . 81)) diff --git a/Src/signames.awk b/Src/signames.awk deleted file mode 100755 index 5d2eeb61e..000000000 --- a/Src/signames.awk +++ /dev/null @@ -1,98 +0,0 @@ -# -# {g,n}awk script to generate signames.c -# -# NB: On SunOS 4.1.3 - user-functions don't work properly, also \" problems -# Without 0 + hacks some nawks compare numbers as strings -# -/^[\t ]*#[\t ]*define[\t _]*SIG[A-Z][A-Z0-9]*[\t ]*[1-9][0-9]*/ { - sigindex = index($0, "SIG") - sigtail = substr($0, sigindex, 80) - split(sigtail, tmp) - signam = substr(tmp[1], 4, 20) - signum = tmp[2] - if (sig[signum] == "") { - sig[signum] = signam - if (0 + max < 0 + signum && signum < 60) - max = signum - if (signam == "ABRT") { msg[signum] = "abort" } - if (signam == "ALRM") { msg[signum] = "alarm" } - if (signam == "BUS") { msg[signum] = "bus error" } - if (signam == "CHLD") { msg[signum] = "death of child" } - if (signam == "CLD") { msg[signum] = "death of child" } - if (signam == "CONT") { msg[signum] = "continued" } - if (signam == "EMT") { msg[signum] = "EMT instruction" } - if (signam == "FPE") { msg[signum] = "floating point exception" } - if (signam == "HUP") { msg[signum] = "hangup" } - if (signam == "ILL") { msg[signum] = "illegal hardware instruction" } - if (signam == "INFO") { msg[signum] = "status request from keyboard" } - if (signam == "INT") { msg[signum] = "interrupt" } - if (signam == "IO") { msg[signum] = "i/o ready" } - if (signam == "IOT") { msg[signum] = "IOT instruction" } - if (signam == "KILL") { msg[signum] = "killed" } - if (signam == "LOST") { msg[signum] = "resource lost" } - if (signam == "PIPE") { msg[signum] = "broken pipe" } - if (signam == "POLL") { msg[signum] = "pollable event occurred" } - if (signam == "PROF") { msg[signum] = "profile signal" } - if (signam == "PWR") { msg[signum] = "power fail" } - if (signam == "QUIT") { msg[signum] = "quit" } - if (signam == "SEGV") { msg[signum] = "segmentation fault" } - if (signam == "SYS") { msg[signum] = "invalid system call" } - if (signam == "TERM") { msg[signum] = "terminated" } - if (signam == "TRAP") { msg[signum] = "trace trap" } - if (signam == "URG") { msg[signum] = "urgent condition" } - if (signam == "USR1") { msg[signum] = "user-defined signal 1" } - if (signam == "USR2") { msg[signum] = "user-defined signal 2" } - if (signam == "VTALRM") { msg[signum] = "virtual time alarm" } - if (signam == "WINCH") { msg[signum] = "window size changed" } - if (signam == "XCPU") { msg[signum] = "cpu limit exceeded" } - if (signam == "XFSZ") { msg[signum] = "file size limit exceeded" } - } -} - -END { - ps = "%s" - ifdstr = sprintf("# ifdef USE_SUSPENDED\n\t%csuspended%s%c,\n%s else\n\t%cstopped%s%c,\n# endif\n", 34, ps, 34, "#", 34, ps, 34) - - printf "/** signames.c **/\n" - printf "/** architecture-customized signames.c for zsh **/\n" - printf "\n" - printf "#define SIGCOUNT\t%d\n", max - printf "\n" - printf "#include %czsh.mdh%c\n", 34, 34 - printf "\n" - printf "/**/\n" - printf "char *sigmsg[SIGCOUNT+2] = {\n" - printf "\t%c%s%c,\n", 34, "done", 34 - - for (i = 1; i <= 0 + max; i++) - if (msg[i] == "") { - if (sig[i] == "") - printf("\t%c%c,\n", 34, 34) - else if (sig[i] == "STOP") - printf ifdstr, " (signal)", " (signal)" - else if (sig[i] == "TSTP") - printf ifdstr, "", "" - else if (sig[i] == "TTIN") - printf ifdstr, " (tty input)", " (tty input)" - else if (sig[i] == "TTOU") - printf ifdstr, " (tty output)", " (tty output)" - else - printf("\t%cSIG%s%c,\n", 34, sig[i], 34) - } else - printf("\t%c%s%c,\n", 34, msg[i], 34) - print "\tNULL" - print "};" - print "" - print "/**/" - printf "char *sigs[SIGCOUNT+4] = {\n" - printf("\t%cEXIT%c,\n", 34, 34) - for (i = 1; i <= 0 + max; i++) - if (sig[i] == "") - printf("\t%c%d%c,\n", 34, i, 34) - else - printf("\t%c%s%c,\n", 34, sig[i], 34) - printf("\t%cZERR%c,\n", 34, 34) - printf("\t%cDEBUG%c,\n", 34, 34) - print "\tNULL" - print "};" -} diff --git a/patchlist.txt b/patchlist.txt deleted file mode 100644 index fc471a727..000000000 --- a/patchlist.txt +++ /dev/null @@ -1,41 +0,0 @@ -This version of zsh is based on 3.1.5 and includes the following -patches. (The version number built into the shell has not been changed.) - - Old stuff: - -Zoli's AIX dynamic loading patch from 3933, slightly updated, without -some hunks which weren't needed on AIX 3.x so I don't know how to -update properly. - -My completion widgets patch - - Patches which have appeared since 3.1.5 (it's already a week, after - all...): - -Bart's addon collection 4473 (excluding the bit from 4105), 4475, 4476 - -My patch in 4477 to rename three functions to avoid clashes when -dynamic loading (particularly necessary on IRIX and AIX), including -the effect of Sven's additional fix in 4488 - -My patch 4513 for case-insensitive globbing via flags, plus fixlet 4552 - -Sven's magna opera patch-or 4510 and patch-match 4509 to add control of -alternative matches and arbitrary mapping between characters in the -command line and the matched, plus all known fixes 4526, 4527, 4534, -4555, 4557 - -My ~PWD patch 4533 - -My suggestion for fixing the suffix on a yank in 4564 - -Bart's deltochar patch including new flags to allow commands not to -interrupt cumulative effects in 4570 - -Bart's doc fiz 4574 - -Sven's latest word on the fixsuffix() horror in 4576, plus a -fixsuffix() added by hand in delcharorlist() which I've somehow missed -along the way - -My latest version of lete2ctl, not posted |