From 1cb11615aa337d98022a48c1c3c8c5c33b0b57c2 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 2 Jul 2003 10:25:05 +0000 Subject: merge changes back from 4.1 --- ChangeLog | 35 +++++++ Completion/AIX/Command/_smit | 25 +++++ Completion/Linux/Command/_modutils | 138 ++++++++++++------------ Completion/Linux/Command/_uml | 6 +- Completion/Unix/Command/_ant | 8 +- Completion/Unix/Command/_arp | 14 +++ Completion/Unix/Command/_bzip2 | 10 +- Completion/Unix/Command/_compress | 48 +++++++++ Completion/Unix/Command/_ecasound | 210 +++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_elinks | 4 +- Completion/Unix/Command/_finger | 80 ++++++++++++++ Completion/Unix/Command/_gpg | 157 +++++++++++++++++++++++++++ Completion/Unix/Command/_gzip | 14 +-- Completion/Unix/Command/_java | 46 ++++---- Completion/Unix/Command/_links | 7 +- Completion/Unix/Command/_look | 23 ++++ Completion/Unix/Command/_lynx | 10 +- Completion/Unix/Command/_lzop | 104 ++++++++++++++++++ Completion/Unix/Command/_mt | 8 +- Completion/Unix/Command/_sccs | 9 +- Completion/Unix/Command/_telnet | 73 +++++++++++++ Completion/Unix/Command/_w3m | 10 +- Completion/Unix/Command/_zip | 16 +-- Completion/X/Command/_mplayer | 165 +++++++++++++++++++++++++++++ Completion/Zsh/Command/_compdef | 54 ++++++++++ Completion/Zsh/Command/_hash | 40 +++++++ Completion/Zsh/Command/_which | 39 +++++++ Src/system.h | 43 +++++--- 28 files changed, 1249 insertions(+), 147 deletions(-) create mode 100644 Completion/AIX/Command/_smit create mode 100644 Completion/Unix/Command/_arp create mode 100644 Completion/Unix/Command/_compress create mode 100644 Completion/Unix/Command/_ecasound create mode 100644 Completion/Unix/Command/_finger create mode 100644 Completion/Unix/Command/_gpg create mode 100644 Completion/Unix/Command/_look create mode 100644 Completion/Unix/Command/_lzop create mode 100644 Completion/Unix/Command/_telnet create mode 100644 Completion/X/Command/_mplayer create mode 100644 Completion/Zsh/Command/_compdef create mode 100644 Completion/Zsh/Command/_hash create mode 100644 Completion/Zsh/Command/_which diff --git a/ChangeLog b/ChangeLog index 8252a59d1..0ed507cbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2003-07-02 Oliver Kiddle + + * 18520, 13691 (Mario Lang), 13701 (Sven): + Completion/Unix/Command/_ecasound: completion for ecasound + + * 18520, 15822/15838 (Bruno Bonfils): Completion/Unix/Command/_gpg: + new completion for gpg + + * 18520 based on 16380, 16541 (Bruno Bonfils) and users/6013 + (GoTaR ): Completion/X/Command/_mplayer: + new completion for mplayer + + * 18446: Completion/Linux/Command/_modutils: handle modinfo and + improvements to option handling + +2003-06-25 Oliver Kiddle + + * 18634: Tomi Vainio: Src/system.h: work around problem with + latest Sun k2 compiler mistaking an array as variable length + + * 18631: Completion/AIX/Command/_smit, + Completion/Linux/Command/_modutils, Completion/Linux/Command/_uml, + Completion/Unix/Command/_ant, Completion/Unix/Command/_arp, + Completion/Unix/Command/_bzip2, Completion/Unix/Command/_compress, + Completion/Unix/Command/_elinks, Completion/Unix/Command/_finger, + Completion/Unix/Command/_gpg, Completion/Unix/Command/_gzip, + Completion/Unix/Command/_java, Completion/Unix/Command/_links, + Completion/Unix/Command/_look, Completion/Unix/Command/_lynx, + Completion/Unix/Command/_lzop, Completion/Unix/Command/_mt, + Completion/Unix/Command/_prcs, Completion/Unix/Command/_sccs, + Completion/Unix/Command/_telnet, Completion/Unix/Command/_w3m, + Completion/Unix/Command/_zip, Completion/Zsh/Command/_compdef, + Completion/Zsh/Command/_hash, Completion/Zsh/Command/_which: + returning too early breaks prefix-needed style set to false + 2003-06-25 Clint Adams * 18628: Completion/Debian/Command/_bug: update completion of diff --git a/Completion/AIX/Command/_smit b/Completion/AIX/Command/_smit new file mode 100644 index 000000000..f02229501 --- /dev/null +++ b/Completion/AIX/Command/_smit @@ -0,0 +1,25 @@ +#compdef smit smitty + +local state line expl curcontext="$curcontext" + +_arguments -C \ + '-s[specify smit.script file]:smit.script file:_files' \ + '-l[specify smit.log file]:smit.log file:_files' \ + '-C[use curses interface]' \ + '-D[debug mode]' \ + '-d[FastPath is dialogue screen]' \ + '-f[allow redirection of stdin and stdout]' \ + '-h[display help/usage message]' \ + '-M[start smit in windows mode]' \ + '-m[FastPath is menu screen]' \ + '-n[FastPath is selector screen]' \ + '-o[alternate SMIT/ODM database]' \ + '-t[generate trace information]' \ + '-v[verbose]' \ + '-x[do not run any execute commands]' \ + '-X[do not run any commands]' \ + '1:fast path:->fastpath' + +[[ "$state" = fastpath ]] && (( $+commands[odmget] )) && + _wanted fastpaths expl 'fast path' compadd \ + $(odmget sm_cmd_hdr sm_name_hdr|sed -n 's/^ id = \"\(.*\)\"/\1/p') diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index 1b47e8a3d..2fc7110ba 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -1,87 +1,83 @@ -#compdef modprobe rmmod +#compdef lsmod modinfo modprobe rmmod -local curcontext="$curcontext" state line expl loaded +local curcontext="$curcontext" expl state line modules ign args ret=1 -_modutils_loaded_modules() { - -if [[ -r /proc/modules ]]; then - loaded=(${${(f)"$(all_modules' && ret=0 ;; modprobe) - - _modprobe_arguments=( - '(--all)-a[all]' \ - '(-a)--all' \ - '(--showconfig)-c[showconfig]' \ - '(-c)--showconfig' \ - '(--debug)-d[debug]' \ - '(-d)--debug' \ - '(--autoclean)-k[set autoclean]' \ - '(-k)--autoclean' \ - '(--show)-n[do not act]' \ - '(-n)--show' \ - '(--quiet)-q[do not complain about insmod failures]' \ - '(-q)--quiet' \ - '(--syslog)-s[report via syslog instead of stderr]' \ - '(-s)--syslog' \ - '(--type)-t[module type]:moduletype:' \ - '(-t)--type:moduletype:' \ - '(--verbose)-v[print all commands as executed]' \ - '(-v)--verbose' \ - '(--version)-V[show release version]' \ - '(-V)--version' \ - '(--config)-C[config file]:config file:_files' \ - '(-C)--config:config file:_files' - ) - - _arguments -C '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \ - '(-r)--remove:*:loaded module:->modprobe_remove' \ - '(--list)-l[list matching modules]:*:module file:->modprobe_list' \ - '(-l)--list:*:module file:->modprobe_list' \ - "$_modprobe_arguments[@]" && return 0 - + ign='-h --help -V --version -c --showconfig' + _arguments -s -C "$args[@]" \ + "(-a --all $ign)"{-a,--all}'[load all matching modules]' \ + '(-)'{-c,--showconfig}'[show current configuration]' \ + "(-d --debug $ign)"{-d,--debug}'[print debug info]' \ + "(-k --autoclean $ign)"{-k,--autoclean}'[set autoclean]' \ + "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \ + "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \ + "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \ + "(* -t --type $ign)"{-t,--type}'[module type]:module type' \ + "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \ + '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \ + "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \ + "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \ + "(-c $ign)1:modules:->all_modules" \ + "(-c -l --list -t --type $ign)*:params:->params" && ret=0 + + [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules ;; + rmmod) + _arguments -s -C "$args[@]" \ + '(-a --all)'{-a,--all}'[remove all unused autocleanable modules]' \ + '(-e --persist)'{-e,--persist}'[save persistent data]' \ + '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \ + '(-s --syslog)'{-s,--syslog}'[output to syslog]' \ + '(-v --verbose)'{-v,--verbose}'[be verbose]' \ + '*:loaded module:->loaded_modules' && ret=0 + ;; esac case "$state" in - modprobe_remove) - _call_function ret _modutils_$state && return ret - _arguments "$_modprobe_arguments[@]" \ - '*:loaded module:_modutils_loaded_modules' + loaded_modules) + if [[ -r /proc/modules ]]; then + modules=(${${(f)"$(/dev/null)"}:#path*}#*[=]} ) + _wanted modules expl module compadd ${^modules}/**/*.o(:t:r) && return + ;; + params) + if compset -P '*='; then + _message 'parameter value' + else + _message 'module parameter' + fi + ;; esac + +return ret diff --git a/Completion/Linux/Command/_uml b/Completion/Linux/Command/_uml index f2deb7484..81d995b32 100644 --- a/Completion/Linux/Command/_uml +++ b/Completion/Linux/Command/_uml @@ -12,6 +12,7 @@ case $service in _arguments \ '-unix[listen on specified pair of sockets]:control socket: :data socket' \ '-hub[act like a hub]' + return ;; uml_mconsole) if (( CURRENT == 2 )); then @@ -46,7 +47,7 @@ case $service in '(* -)--version[display kernel version number]' \ '(* -)--help[print usage information]' \ '(* -)--showconfig[show kernel configuration]' \ - '(-)*:option:->option' && return + '(-)*:option:->option' && ret=0 ;; tunctl) _arguments \ @@ -55,6 +56,7 @@ case $service in '(-d)-u[specify owner]:owner:_users' \ '(-b -u -t)-d[specify devicename to delete]:device name:(tap{0..9})' \ '(-d)-t[specify devicename]:device name:(tap{0..9})' + return ;; esac @@ -113,7 +115,7 @@ while [[ -n $state ]]; do 'ncpus[specify number of virtual processors to start]:processors' \ 'mode[force UML to run in specified mode]:mode:(tt)' \ 'mconsole[request mconsole driver to send a message to socket]:socket' \ - 'xterm[specify alternate terminal emulator]:terminam emulator:->xterm' \ + 'xterm[specify alternate terminal emulator]:terminal emulator:->xterm' \ 'dsp[specify host dsp device]:dsp device:_files' \ 'mixer[specify host mixer device]:mixer device:_files' \ 'umn[specify ip address for host side of slip device]' && ret=0 diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 473fdf33c..e81fbfc02 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -1,7 +1,7 @@ #compdef ant typeset -A opt_args -local state line curcontext="$curcontext" +local state line curcontext="$curcontext" ret=1 local target='*:target:->target' _arguments -C \ @@ -21,11 +21,13 @@ _arguments -C \ '-propertyfile[load properties from specified file]:property file:_files' \ '-inputhandler[specify class which will handle input requests]:class:_java_class' \ '-find[search for buildfile]:file:_files' \ - $target && return + $target && ret=0 if [[ -n $state ]]; then targets=( $(sed -n 's/ *hostintable' \ + '(-a -s -f 1)-d[delete entry from table]:host:->hostintable' \ + '(-a -d -f 1)-s[create an arp entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \ + '(-a -d -s 1)-f[read multiple entries from file]:file:_files' \ + '(-a)1:host:->hostintable' + +[[ "$state" = hostintable ]] && + _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*} + diff --git a/Completion/Unix/Command/_bzip2 b/Completion/Unix/Command/_bzip2 index 160d77b2d..97cfe6a84 100644 --- a/Completion/Unix/Command/_bzip2 +++ b/Completion/Unix/Command/_bzip2 @@ -1,6 +1,6 @@ #compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -local decompress expl state line curcontext="$curcontext" +local decompress expl state line curcontext="$curcontext" ret=1 typeset -A opt_args case "$service" in @@ -39,7 +39,7 @@ case "$service" in '(-1 -2 -3 -4 -5 -6 -8 -9)-7' \ '(-1 -2 -3 -4 -5 -6 -7 -9)-8' \ '(-1 -2 -3 -4 -5 -6 -7 -8 )-9' \ - '*:files:->files' && return 0 + '*:files:->files' && ret=0 ;; esac @@ -49,11 +49,11 @@ if [[ "$state" = files ]]; then $+opt_args[--test] )) && unset decompress if [[ -z "$decompress" ]]; then _description files expl 'compressed file' - _files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return 0 + _files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return else _description files expl 'file to compress' - _files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return 0 + _files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return fi fi -return 1 +return ret diff --git a/Completion/Unix/Command/_compress b/Completion/Unix/Command/_compress new file mode 100644 index 000000000..d2e6fe8ae --- /dev/null +++ b/Completion/Unix/Command/_compress @@ -0,0 +1,48 @@ +#compdef compress uncompress + +local expl state line bits common_args1 common_args2 decompress ret=1 +local curcontext="$curcontext" +typeset -A opt_args +bits=( {9..16} ) + +common_args1=( \ + '-n[omit compressed file header from compressed file]' \ + '-V[display current version and compile options]' \ + '*:files:->files') +common_args2=( \ + '-c[write on standard output]' \ + '(-F)-f[force overwrite]' \ + '(-f)-F[force overwrite]' \ + '(-v)-q[suppress display of compression statistics]' \ + '(-q)-v[display compression statistics]' \ + "${common_args1[@]}" ) + +case "$service" in + compress) + _arguments -C -s \ + "-b[specify maximum number of bits used to replace common substring]:bits:(${bits[*]})" \ + '-C[produce output compatible with BSD 2.0]' \ + '(-b -C)-d[decompress]' \ + "${common_args2[@]}" && ret=0 + ;; + uncompress) + _arguments -C -s "${common_args2[@]}" && ret=0 + decompress=yes + ;; + zcat) + _arguments -C -s "${common_args1[@]}" && ret=0 + decompress=yes + ;; +esac + +if [[ "$state" = files ]]; then + if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then + _description files expl 'file to compress' + _files "$expl[@]" -g '*~*.Z' && return + else + _description files expl 'compressed file' + _files "$expl[@]" -g '*.Z' && return + fi +fi + +return ret diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound new file mode 100644 index 000000000..cb6b724a0 --- /dev/null +++ b/Completion/Unix/Command/_ecasound @@ -0,0 +1,210 @@ +#compdef ecasound + +local curcontext="$curcontext" state line expl +typeset -A opt_args + +_arguments \ + '-c[start in interactive mode]' \ + '(-q)-d\:-[debug level]:debug level' \ + '-D[print all debug information to stderr]' \ + '(-d)-q[quiet mode, no output]' \ + '(-)--help[show usage information]' \ + '(-)--version[show version information]' \ + '-n\:-[set the name of chainsetup]:chainsetup name' \ + '-s\:-[create a new chainsetup from file]:chainsetup file:_files' \ + '-sr\:-[set internal sampling rate]:Internal sampling rate:(8000 11025 22050 44100 48000)' \ + '*-a\:-[select active signal chains]:chain name' \ + '-b\:-[set the size of buffer in samples]:buffer size:->b' \ + '-m\:-[force use of specified mix mode]:Mix mode:((auto\:Automatic simple\:Only\ one\ input/cain/output normal\:Normal\ single-threaded\ mode))' \ + '-r[use realtime scheduling policy (SCHED_FIFO)]' \ + '-r\:-[use realtime scheduling policy (SCHED_FIFO)]:sched_priority' \ + '-x[truncate outputs]' \ + '*-z\:-[enable feature]:feature:->z' \ + '-t\:-[set processing time in seconds]:seconds (int/float)' \ + '-tl[enable looping]' \ + '*-f\:-[set sampling parameters for the following input/output files]: :->f' \ + '*-y\:-[set starting position for last specified input/output]:seconds' \ + '*-i\:-[specifies a new input source]:input source:->io' \ + '*-o\:-[specifies a new output source]:output source:->io' \ + '*-Md\:-[set the active MIDI-device]:device name:_files' \ + '*-Mms\:-[send MMC start/stop to MIDI device-id]:device id' \ + '*-mss[sends MIDI-sync to the selected MIDI-device]' \ + '*-pf\:-[use the first preset found from file as chain operator]:preset file:_files -g *.epp' \ + '*-pn\:-[find preset from global preset database]:preset name:->pn' \ + '*-ev[analyze sample data to find max apm value without clipping]' \ + '*-ezf[find the optimal value for DC-adjusting]' \ + '*-eS\:-[audio stamp]:stamp-id (int)' \ + '*-ea\:-[amplify signal]:amplification value (percent)' \ + '*-eac\:-[amplify signal of channel]: :->eac' \ + '*-eaw\:-[amplify singal (clipping)]: :->eaw' \ + '*-eal\:-[limits audio level]:limit (percent)' \ + '*-ec\:-[compressor (a simple one)]: :->ec' \ + '*-eca\:-[a more advanced compressor]: :->eca' \ + '*-enm\:-[noise gate. (each channel is processes separately)]: :->enm' \ + '*-ei\:-[pitch shifter (modifies audio pitch by altering its length)]:pitch-shift (percent)' \ + '*-epp\:-[normal pan effect]:panning (0=left, 50=center, 100=right)' \ + '*-ezx\:-[adjusts the signal DC (use -ezf to find optimal values)]: :->ezx' \ + '*-eem-[envelope modulation]: :->emod' \ + '*-ef-[apply filter effects]: :->filters' \ + '*-erc\:-[copy channel]: :->erc' \ + '*-erm\:-[mix all channels to one channel]:to channel' \ + '*-et-[time based effects]: :->teffects' \ + '*-el\:-[LADSPA Plugin]: :->el' \ + '*-eli\:-[LADSPA Plugin]: :->el' \ + '*-gc\:-[time crop gate]: :->gc' \ + '*-ge\:-[threshold gate]: :->ge' \ + && return 0 + +case $state in + filters) + _values -S : 'filter effect' \ + '1[resonant bandpass filter]: :->ef1' \ + '3[resonant lowpass filter]: :->ef3' \ + '4[resonant lowpass filter (3rd-order, 36dB)]: :->ef4' \ + 'a[allpass filter]: :->efa' \ + 'c[comb filter]: :->efc' \ + 'b[bandpass filter]: :->efb' \ + 'h[highpass filter]:cutoff frequency' \ + 'i[inverse comb filter]: :->efi' \ + 'l[lowpass filter]:cutoff frequency' \ + 'r[bandreject filter]: :->efr' \ + 's[resonator (resonating bandpass filter)]: :->efs' + ;; + teffects) + _values -S : 'time based effect' \ + 'c[chorus]: :->etc' \ + 'd[delay effect]: :->etd' \ + 'e[a more advanced reverb effect]: :->ete' \ + 'f[fake-stereo effect]:delay time (msec)' \ + 'l[flanger]: :->etl' \ + 'm[multitap delay]: :->etm' \ + 'p[phaser]: :->etp' \ + 'r[reverb effect]: :->etr' + ;; + emod) + _values -S : 'envelopme modulation' \ + 'b[pulse gate]: :->eemb' \ + 'p[pulse gate (hz)]: :->eemp' \ + 't[tremolo effect]: :->eemt' + ;; +esac + +case $state in + b) + _wanted -V sizes expl 'buffer size' compadd \ + 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 + ;; + f) + if compset -P '*,*,*,'; then + _values 'interleaving' \ + 'i[interleaved stream format]' \ + 'n[noninterleaved]' + elif compset -P '*,*,'; then + _message 'sampling rate' + elif compset -P '*,'; then + _message 'channels' + else + _values 'sampling parameters' \ + 'u8[unsigned 8-bit]' \ + 's16_le[signed 16-bit little endian]' \ + 's16_be[signed 16-bit big endian]' \ + 's24_le[signed 24-bit little endian]' \ + 's24_be[signed 24-bit big endian]' \ + 's32_le[signed 32-bit little endian]' \ + 's32_be[signed 32-bit big endian]' \ + 'f32_le[32-bit float (little endian)]' \ + 'f32_be[32-bit float (big endian)]' + fi + ;; + z) + _values -s , feature \ + '(nodb)db[enable double-buffering]' \ + '(db)nodb[disable double-buffering]' \ + 'dbsize[set db buffer size]:buffer size in sample frames:(0 1 2 4 8 16)' \ + '(nointbuf)intbuf[use extra internal buffering for realtime devices]' \ + '(intbuf)nointbuf[prevent extra internal buffering for realtime devices]' \ + 'xruns[processing will be halted when a under/overrun occurs]' \ + 'psr[enable the precise-sample-rates]' + ;; + io) + if compset -P 'alsa,'; then + if [[ -e /proc/asound ]]; then + eval `grep "^[[:digit:]]" < /proc/asound/cards|awk 'BEGIN {print "_values '\''ALSA device'\''" }; {print "'\''" $1 "[" $6, $7, $8, $9 "]'\''"}'||echo _message Wrong` + else + _message 'ALSA information bot found in proc filesystem' + fi + else + _alternative \ + 'files:input/output file:_files -g "*.(aif|aiff|mid|wav|ewf|mp3|mp2)"' \ + 'streams:stream:(stdin stdout)' \ + 'devices:realtime device:((/dev/dsp alsa\:alsa\ device null\:null\ device))' + fi + ;; + pn) + _wanted presets expl preset compadd \ + ${${(M)${(f)"$(url' && return + '1:url:->url' && ret=0 if [[ "$state" = url ]]; then local elinks_bookmarks @@ -40,4 +40,4 @@ if [[ "$state" = url ]]; then 'urls:url:_urls' && return fi -return 1 +return ret diff --git a/Completion/Unix/Command/_finger b/Completion/Unix/Command/_finger new file mode 100644 index 000000000..1ffb52d14 --- /dev/null +++ b/Completion/Unix/Command/_finger @@ -0,0 +1,80 @@ +#compdef finger + +local curcontext="$curcontext" state line match ret=1 +typeset -A opt_args + +if (( ! $+_finger_args )); then + local help="$(_call_program options finger -\\\? 2>&1)" + local -A optionmap + +## `finger -\?': + +# SunOS 5.7: +# finger: illegal option -- ? +# Usage: finger [-bfhilmpqsw] [-t l|h|l,h] [name1 [name2 ...] ] + +# SunOS 4.1.4: +# Usage: finger [-bfhilmpqsw] [login1 [login2 ...] ] + +# IRIX 6.3: +# Usage: finger [-bfhilmpqsw] [login1 [login2 ...] ] + +# NetBSD 1.4.1: +# finger: illegal option -- ? +# usage: finger [-lmpsho] [login ...] + +# FreeBSD 2.2.8 +# finger: illegal option -- ? +# usage: finger [-lmpshoT] [login ...] + +# BSD/OS 3.0: +# finger: illegal option -- ? +# usage: finger [-lmps] [login ...] + +# 4.4BSD Lite: +# usage: finger [-lmps] [login ...] + +# Debian GNU/Linux (potato) (netstd 3.07-10): +# finger: invalid option -- ? +# usage: finger [-lmps] [login ...] + + if [[ "$help" = *\[-(#b)(lmps[a-zA-Z]#)* ]]; then + # BSD style + optionmap=( + '*m*' '-m[match to login name]' + '*l*' '(-s -o)-l[force long format]' + '*s*' '(-l -p)-s[force short format]' + '*p*' '(-s -o)-p[suppress .forward, .plan and .project]' + '*o*' '(-l -p)-o[print office information]' + '*T*' '-T[disable T/TCP]' + ) + _finger_args=($optionmap[(K)$match[1]]) + elif [[ "$help" = *\[-(#b)(bfhilmpqsw[a-zA-Z]#)* ]]; then + # System V style + optionmap=( + '*m*' '-m[match to login name]' + '*l*' '( -i -q -s -f -w)-l[force long format]' + '*i*' '(-l -q -s -b -h -p -w)-i[force idle format]' + '*q*' '(-l -i -s -b -h -p -w)-q[force quick format]' + '*s*' '(-l -i -q -b -h -p)-s[force short format]' + '*b*' '(-i -q -s)-b[suppress home and shell]' + '*f*' '(-l)-f[suppress header]' + '*h*' '(-i -q -s)-h[suppress .project]' + '*p*' '(-i -q -s)-p[suppress .plan]' + '*w*' '(-i -q -l)-w[suppress full name]' + ) + _finger_args=($optionmap[(K)$match[1]]) + else + _finger_args=() + fi +fi + +_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && ret=0 + +case "$state" in +finger-targets) + _user_at_host -t other-accounts "$@" && return + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg new file mode 100644 index 000000000..32a51cb08 --- /dev/null +++ b/Completion/Unix/Command/_gpg @@ -0,0 +1,157 @@ +#compdef gpg gpgv + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args + +_arguments -C -s -S -A "-*" \ + '(-s --sign)'{-s,--sign}'[make a signature]' \ + '--clearsign[make a clear text signature]' \ + '(-b --detach-sign)'{-b,--detach-sign}'[make a detached signature]' \ + '(-e --encrypt)'{-e,--encrypt}'[encrypt data. this option may be combined with --sign]' \ + '(-c --symmetric)'{-c,--symmetric}'[encrypt with symmetric cypher only]' \ + '--store[store only]' \ + '--decrypt[decrypt file or stdin]' \ + '--verify[verify a signature]:file attachment:_files' \ + '--verify-files[verify a list of files]:_files attachment_files' \ + '(-f --encrypt-files)'{-f,--encrypt-files}'[encrypt files]' \ + '--decrypt-files[decrypt files]' \ + '--list-keys[list all keys]' \ + '--list-public-keys[list all public keys]' \ + '--list-secret-keys[list all secret keys]' \ + '--list-sigs[lists keys and signatures]:key attachment:_pub-keys-list' \ + '--check-sigs[lists key, signatures and check them]:key attachment:_pub-keys-list' \ + '--fingerprint[list all keys with their fingerprints]:key attachment:_pub-keys-list' \ + '--list-packets[list only the sequence of packets]' \ + '--gen-key[generate a new pair key]' \ + '--edit-key[a menu for edit yours keys]:key attachment:_pub-keys-list' \ + '--sign-key[sign a key]:key attachment:_pub-keys-list '\ + '--lsign-key[sign a key but mark as non-exportable]:key attachment:_pub-keys-list' \ + '--nrsign-key[sign a key non-revocably]' \ + '--delete-key[remove key from public keyring]:key attachment:_pub-keys-list' \ + '--delete-secret-key[remove key from public & private keyring]:key attachment:_sec-keys-list' \ + '--delete-secret-and-public-key:key attachment:_sec-keys-list' \ + '--gen-revoke[generate a revocation certificate]' \ + '--desig-revoke[generate a designated revocation certificate]' \ + '--export[export all key from all keyrings]' \ + '--send-keys[send keys to a keyserver]:key attachment:_pub-keys-list' \ + '--export-all[export all key and not OpenPGP compatible keys]' \ + '--export-secret-keys:key attachment:_sec-keys-list' \ + '--export-secret-subkeys:key attachment:_sec-keys-list' \ + '--import[import a gpg key from a file]:_files attachment:_files' \ + '--fast-import[import a file without build trustdb]:_files attachment:_files' \ + '--recv-keys[receive a list of keys from a keyserver]:key attachment:_pub-keys-list' \ + '--refresh-keys[update all keys from a keyserver]' \ + '--search-keys[search for keys on a key server]' \ + '--update-trustdb[update the trust database]' \ + '--check-trustdb[unattended trust database update]' \ + '--fix-trustdb[fix a corrupted trust database]' \ + '--export-ownertrust[list the assigned ownertrust values in ASCII format]:file:_files' \ + '--import-ownertrust[update the trustdb with a file]:file:_files' \ + '--dearmor[de-Armor a file or stdin]' \ + '--enarmor[en-Armor a file or stdin]' \ + '--print-md[print message digests]:algorithm:->ciphers::file:_files' \ + '--print-mds[print message digests]::file:_files' \ + '--gen-random:count' --gen-prime \ + '--version[print info on program version and supported algorithms]' \ + '--warranty[print warranty info]' \ + '(-h --help)'{-h,--help}'[display usage information]' \ + '(-a --armor)'{-a,--armor}'[create ASCII armored output]' \ + '(-o --output)'{-o+,--output}'[write output to file]:output file:_files' \ + '(-u --local-user)'{-u+,--local-user}'[use name as the user ID to sign]:user attachment:_users'\ + '--default-key[specify default user-id for signatures]:key:->secret-key' \ + '*'{-r+,--recipient}'[specify user to encrypt for]:recipient:->public-key' \ + '--default-recipient[specify default recipient]:recipient:->public-key' \ + '--default-recipient-self[use default key as default recipient]' \ + '--no-default-recipient[reset default recipient]' \ + '*--encrypt-to[specify recipient]:->public-key' \ + '(--encrypt-to)--no-encrypt-to[disable the use of all --encrypt-to keys]' \ + '(-q --quiet)*'{-v,--verbose}'[increase amount of output]' \ + '(-q --quiet -v --verbose)'{-q,--quiet}'[reduce amount of output]' \ + '(-z --compress)'{-z,--compress}'[specify compression level]:compression level:((0\:no\ compression 1\:minimum 2 3 4 5 6\:default 7 8 9\:maximum))' \ + '(-t --textmode)'{-t,--textmode}'[use canonical text mode]' \ + '(-n --dry-run)'{-n,--dry-run}"[don't make any changes]" \ + '(-i --interactive --batch)'{-i,--interactive}'[prompt before overwriting files]' \ + '(-i --interactive --no-batch)--batch[use batch mode]' \ + '--no-tty[never output to tty]' \ + '(--batch)--no-batch[disable batch mode]' \ + '(--no)--yes[assume "yes" on most questions]' \ + '(--yes)--no[assume "no" on most questions]' \ + '--default-cert-check-level:check level:((0\:no\ claim 1\:no\ verification 2\:casual\ verification 3\:extensive\ verification))' \ + '--trusted-key[assume that the specified key is trustworthy]:long key id' \ + '--always-trust[skip key validation]' \ + '--keyserver[specify key server to use]:key server:_hosts' \ + '--keyserver-options[specify keyserver options]:options' \ + '--import-options[specify options for importing keys]:options' \ + '--export-options[specify options for exporting keys]:options' \ + --show-photos --no-show-photos '--photo-viewer:command:_command_names -e'\ + --exec-path:path:_dir_list' \ + --show-keyring[display keyring name when listing keys]' \ + '--keyring[add specified file to list of keyrings]:file' \ + '--secret-keyring[add specified file to list of secret keyrings]:file' \ + --homedir:directory:_directories \ + '--charset:character set:(iso-8859-1 iso-8859-2 koi8-r utf-8)' \ + '--utf8-strings' '--no-utf8-strings[arguments are not in UTF8]' \ + '(--no-options)--options[specify file to read options from]:options file:_files' \ + "(--options)--no-options[don't read options file]" \ + --{status,logger,attribute,passphrase,command}-fd:file\ descriptor:_file_descriptors \ + '--sk-comments[include secret key comments when exporting keys]' \ + '(--emit-version)--no-version[omit version string in clear text signatures]' \ + '(--no-version)--emit-version[force writing of version string in clear text signatures]' \ + '(-N --notation-data)'{-N,--notation-data}'[put parameter in signature]:name=value' \ + '(--no-show-notation)--show-notation[show key signature notations]' \ + "(--show-notation)--no-show-notation[don't show key signature notations]" \ + '--set-policy-url:policy url' \ + '(--no-show-policy-url)--show-policy-url' \ + "(--show-policy-url)--no-show-policy-url" \ + '--set-filename[specify file which is stored in messages]:file:_files' \ + '(--for-your-eyes-only)--for-your-eyes-only' \ + "(--for-your-eyes-only)--no-for-your-eyes-only" \ + --completes-needed:number --marginals-needed:number --max-cert-depth:number \ + --{{,disable-,s2k-}cipher,{,s2k-,cert-}digest,disable-pubkey}'-algo:cipher:->ciphers' \ + --s2k-mode:value --simple-sk-checksum \ + '--compress-algo:compression algorithm:((0\:disable\ compression 1\:zlib 2\:rfc1950))' \ + --no-sig-cache --no-sig-create-check --{,no-}auto-check-trustdb --throw-keyid \ + --not-dash-escaped --escape-from-lines --use-agent \ + --rfc1991 --{,no-}pgp2 --{,no}pgp6 --{,no}pgp7 --openpgp \ + --{,no-}force-v3-sigs --{,no}force-v4-certs --force-mdc --disable-mdc \ + --{,no-}allow-non-selfsigned-uid --allow-freeform-uid \ + --ignore-time-conflict --ignore-valid-from \ + --ignore-crc-error --ignore-mdc-error --lock-once --lock-multiple --lock-never \ + --no-random-seed-file --no-verbose --no-greeting --no-secmem-warning \ + --no-permission-warning --no-mdc-warning --no-armor --no-default-keyring \ + --skip-verify --with-colons --with-key-data --with-fingerprint \ + --fast-list-mode --fixed-list-mode --list-only --no-literal --set-filesize \ + --emulate-md-encode-bug --show-session-key --override-session-key:string \ + --{,no-}ask-sig-expire --{,no}ask-cert-expire --{,no}expert \ + --merge-only --allow-secret-key-import --try-all-secrets \ + --enable-special-filenames --no-expensive-trust-checks --group:name=value \ + --preserve-permissions --personal-{cipher,digest,compress}-preferences:string \ + --default-preference-list:string \ + '*:args:->args' && ret=0 + +if [[ $state = args ]]; then + if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} )); then + state=public-key + elif (( ${+opt_args[--list-secret-keys]} )); then + state=secret-key + else + _files && return + fi +fi + +case "$state" in + public-key) + _wanted public-keys expl 'public key' \ + compadd ${${(Mo)$(gpg --list-keys 2>/dev/null):%<*>}//(<|>)/} && return + ;; + secret-key) + _wanted secretkeys expl 'secret key' compadd \ + ${${(Mo)$(gpg --list-secret-keys 2>/dev/null):%<*>}//(<|>)/} && return + ;; + ciphers) + _wanted ciphers expl cipher compadd \ + ${${(s.,.)${(M)${(f)"$(gpg --version)"}:#Cipher*}#*:}# } && return + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip index 46664958d..8d8a5390c 100644 --- a/Completion/Unix/Command/_gzip +++ b/Completion/Unix/Command/_gzip @@ -1,6 +1,6 @@ #compdef gzip gunzip gzcat=gunzip -local decompress expl curcontext="$curcontext" state line +local decompress expl curcontext="$curcontext" state line ret=1 typeset -A opt_args case "$service" in @@ -51,7 +51,7 @@ gzip) '(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \ - '*:files:->files' && return 0 + '*:files:->files' && ret=0 ;; esac @@ -64,19 +64,21 @@ files) if (( $+opt_args[-r] || $+opt_args[--recursive] )); then if [[ -z "$decompress" ]]; then _description directories expl 'directory to compress' - _files "$expl[@]" -/ + _files "$expl[@]" -/ && return else _description directories expl 'compressed directory' - _files "$expl[@]" -/ + _files "$expl[@]" -/ && return fi else if [[ -z "$decompress" ]]; then _description files expl 'file to compress' - _files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]' + _files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]' && return else _description files expl 'compressed file' - _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]' + _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]' && return fi fi ;; esac + +return ret diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index 5f78bb05a..76f3358b1 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -1,6 +1,6 @@ #compdef javac java javadoc appletviewer jar jdb javah javap extcheck rmic rmiregistry rmid serialvar native2ascii keytool jarsigner policytool -local expl tmp jdb_args jar_cmd match basedir +local expl tmp jdb_args jar_cmd match basedir ret=1 local curcontext="$curcontext" state line jf typeset -A opt_args tmpassoc @@ -90,7 +90,7 @@ javadoc) '-helpfile[specify alternative help link]:helpfile path/filename:' \ '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \ '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \ - '*:package name, source file or @list:->docsrc' && return 0 + '*:package name, source file or @list:->docsrc' && ret=0 ;; appletviewer) @@ -113,7 +113,7 @@ jar) 'v[verbose mode]' \ 'm[specify manifest file]' \ '0[store only without using ZIP compression]' \ - 'M[do not create manifest file]' + 'M[do not create manifest file]' && return else jar_cmd="${words[2]#-}" tmpassoc=( @@ -187,7 +187,7 @@ rmic) rmiregistry) if (( CURRENT == 2 )); then - _wanted ports expl 'port to listen' _ports + _wanted ports expl 'port to listen' _ports && return else _message 'no more arguments' fi @@ -360,11 +360,11 @@ case "$state" in debug) if [[ -prefix :*, ]]; then compset -P : - _values -s , "debug info" lines vars source + _values -s , "debug info" lines vars source && return else _description debuginfo expl "debug info" - compadd -P: "$expl[@]" none - compadd -P: -qS, "$expl[@]" lines vars source + compadd -P: "$expl[@]" none && ret=0 + compadd -P: -qS, "$expl[@]" lines vars source && ret=0 fi ;; @@ -373,12 +373,12 @@ classpath|sourcepath|bootstrapclasspath|docletpath) compset -S ':*' _alternative \ "classpath:$state:_path_files -qS: -g '*.(jar|zip)'" \ - "classpath:$state:_path_files -r': ' -/" + "classpath:$state:_path_files -r': ' -/" && return ;; extdirs) compset -P '*:' - _path_files -/ + _path_files -/ && return ;; encoding) @@ -497,7 +497,7 @@ encoding) property) if compset -P '*='; then - _default + _default && return else _message 'property name' fi @@ -514,30 +514,30 @@ class|doclet) docsrc) if compset -P @; then - _wanted files expl 'package/source list file' _files + _wanted files expl 'package/source list file' _files && return else - _wanted files expl 'package or source' _files -g '*.java' + _wanted files expl 'package or source' _files -g '*.java' && return fi ;; jararg) if [[ -prefix - ]]; then tmp=('-C:chdir') - _describe -o 'option' tmp -- + _describe -o 'option' tmp -- && return elif [[ "$words[CURRENT - 2]" == -C ]]; then - _wanted file expl 'input file' _files -W "($words[CURRENT - 1])" + _wanted file expl 'input file' _files -W "($words[CURRENT - 1])" && return elif [[ "$words[CURRENT - 1]" == -C ]]; then - _wanted directories expl 'chdir to' _files -/ + _wanted directories expl 'chdir to' _files -/ && return elif [[ $words[2] = *x* ]]; then - jf="$words[3]" - if [[ $jf != $_jar_cache_name && -f $jf ]]; then - _jar_cache_list=("${(@f)$($words[1] tf $jf)}") - _jar_cache_name=$jf - fi + jf="$words[3]" + if [[ $jf != $_jar_cache_name && -f $jf ]]; then + _jar_cache_list=("${(@f)$($words[1] tf $jf)}") + _jar_cache_name=$jf + fi - _wanted files expl 'file from archive' _multi_parts / _jar_cache_list + _wanted files expl 'file from archive' _multi_parts / _jar_cache_list && return else - _wanted files expl 'input file' _files + _wanted files expl 'input file' _files && return fi ;; @@ -545,3 +545,5 @@ jararg) _message "unknown state: $state" ;; esac + +return ret diff --git a/Completion/Unix/Command/_links b/Completion/Unix/Command/_links index d21fae9db..899c10108 100644 --- a/Completion/Unix/Command/_links +++ b/Completion/Unix/Command/_links @@ -1,6 +1,6 @@ #compdef links -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ @@ -25,10 +25,13 @@ _arguments -C \ '(-help)-source[dump the source page]' \ '(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:secs:' \ '(-help)-version[prints the links version number and exit]' \ - ':url:->html' && return 0 + ':url:->html' && ret=0 case "$state" in html) _files -g '*.html' || _urls + return ;; esac + +return ret diff --git a/Completion/Unix/Command/_look b/Completion/Unix/Command/_look new file mode 100644 index 000000000..a0258c276 --- /dev/null +++ b/Completion/Unix/Command/_look @@ -0,0 +1,23 @@ +#compdef look + +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args + +_arguments -C -s \ + '-t+[termination character]:termination character:' \ + '-f[case insensitive]' \ + '-d[dictionary order]' \ + ':string:->string' \ + ':dictionary file:_files' && ret=0 + +case "$state" in +string) + if [[ -n "$PREFIX" ]]; then + _wanted values expl 'word prefix' compadd - $(_call_program values $words[1] $PREFIX) && return + else + _message 'word prefix' + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_lynx b/Completion/Unix/Command/_lynx index 855213b7c..6bbe01449 100644 --- a/Completion/Unix/Command/_lynx +++ b/Completion/Unix/Command/_lynx @@ -1,6 +1,6 @@ #compdef lynx -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C \ @@ -128,7 +128,7 @@ _arguments -C \ '-vikeys' \ '-width=:NUMBER:' \ '-with_backspaces' \ - ':url:->html' && return 0 + ':url:->html' && ret=0 case "$state" in restrictions) @@ -137,9 +137,11 @@ restrictions) disk_save dotfiles download editor exec exec_frozen externals file_url \ goto inside_ftp inside_news inside_rlogin inside_telnet jump mail \ multibook news_post options_save outside_ftp outside_news outside_rlogin \ - outside_telnet print shell suspend telnet_port useragent + outside_telnet print shell suspend telnet_port useragent && return ;; html) - _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' + _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' && return ;; esac + +return ret diff --git a/Completion/Unix/Command/_lzop b/Completion/Unix/Command/_lzop new file mode 100644 index 000000000..fd3c94689 --- /dev/null +++ b/Completion/Unix/Command/_lzop @@ -0,0 +1,104 @@ +#compdef lzop + +local expl state line decompress disp curcontext="$curcontext" ret=1 +typeset -A opt_args + +_arguments -C -s \ + '(--to-stdout --stdout)-c[write on standard output]' \ + '(-c --stdout)--to-stdout[write on standard output]' \ + '(-c --to-stdout)--stdout[write on standard output]' \ + '(--decompress --uncompress -x -extract)-d[decompress]' \ + '(-d --uncompress -x -extract)--decompress[decompress]' \ + '(-d --decompress -x -extract)--uncompress[decompress]' \ + '(--extract -d --decompress --uncompress -n --name -p --path)-x[extract]' \ + '(-x -d --decompress --uncompress -n --name -p --path)-x[extract]' \ + '(--force)-f[force overwrite]' \ + '(-f)--force[force overwrite]' \ + '(--help -H)-h[display help message]' \ + '(-h -H)--help[display help message]' \ + '(-h --help)-H[display help message]' \ + '(--list)-l[list compressed file contents]' \ + '(-l)--list[list compressed file contents]' \ + '(--license)-L[display software license]' \ + '(-L)--license[display software license]' \ + '(--no-name -N --name)-n[do not save or restore the original name and time stamp]' \ + '(-n -N --name)--no-name[do not save or restore the original name and time stamp]' \ + '(--name -n --no-name)-N[save or restore the original name and time stamp]' \ + '(-N -n --no-name)--name[save or restore the original name and time stamp]' \ + '--no-mode[do not restore original mode]' \ + '--no-time[do not restore original time stamp]' \ + '(--quiet --silent)-q[suppress all warnings]' \ + '(-q --silent)--quiet[suppress all warnings]' \ + '(-q --quiet)--silent[suppress all warnings]' \ + '(--recursive)-r[operate recursively on directories]' \ + '(-r)--recursive[operate recursively on directories]' \ + '(--suffix)-S+[specify suffix for compressed files]:suffix:' \ + '(-S)--suffix=[specify suffix for compressed files]:suffix:' \ + '(--test)-t[test compressed file integrity]' \ + '(-t)--test[test compressed file integrity]' \ + '*-v[verbose mode]' \ + '*--verbose[verbose mode]' \ + '(--version)-V[display version number]' \ + '(-V)--version[display version number]' \ + '( -1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \ + '(--fast -2 -3 -4 -5 -6 -7 -8 -9 --best)-1' \ + '(--fast -1 -3 -4 -5 -6 -7 -8 -9 --best)-2' \ + '(--fast -1 -2 -4 -5 -6 -7 -8 -9 --best)-3' \ + '(--fast -1 -2 -3 -5 -6 -7 -8 -9 --best)-4' \ + '(--fast -1 -2 -3 -4 -6 -7 -8 -9 --best)-5' \ + '(--fast -1 -2 -3 -4 -5 -7 -8 -9 --best)-6' \ + '(--fast -1 -2 -3 -4 -5 -6 -8 -9 --best)-7' \ + '(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \ + '(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \ + '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \ + '--ls=[list each compressed file in a format similar to ls -ln]:ls flag:->flags' \ + '--info[list internal header fields for each compressed file]' \ + '(--sysinfo)-I[display information about the system]' \ + '(-I)--sysinfo[display information about the system]' \ + '(--outfile)-o[specify output file]:output file:_files' \ + '(-o)--outfile=[specify output file]:output file:_files' \ + '(--path)-p[write output files to specified directory]:directory:_files -/' \ + '(-p)--path=[write output files to specified directory]:directory:_files -/' \ + '(--no-checksum)-F[do not store or verify a checksum]' \ + '(-F)--no-checksum[do not store or verify a checksum]' \ + "(--keep -U --unlink --delete)-k[keep (don't delete) input files]" \ + "(-k -U --unlink --delete)--keep[keep (don't delete) input files]" \ + '(--unlink --delete)-U[delete input files]' \ + '(-U --delete)--unlink[delete input files]' \ + '(-U --unlink)--delete[delete input files]' \ + '--no-stdin[do not try to read stdin]' \ + '--no-warn[suppress all warnings]' \ + '--ignore-warn[suppress all warnings and never exit with status 2]' \ + '--no-color[do not use an color escape sequences]' \ + '--mono[assume a mono ANSI terminal]' \ + '--color[assume a color ANSI terminal]' \ + '--intro[display intro sequence]' \ + '--filter=[preprocess data with a special multimedia filter]:number' \ + '*:files:->files' && ret=0 + +case "$state" in + files) + if (( $+opt_args[-d] || $+opt_args[--decompress] || + $+opt_args[--uncompress] || $+opt_args[-x] || $+opt_args[--extract] || + $+opt_args[--test] || $+opt_args[-t] || $+opt_args[--list] || + $+opt_args[-l] || $+opt_args[--ls] || $+opt_args[--info] )); then + _description files expl 'compressed file' + _files "$expl[@]" -g '*.[tl]zo' && ret=0 + else + _description files expl 'file to compress' + _files "$expl[@]" -g '*~*.[tl]zo' && ret=0 + + fi + ;; + flags) + disp=( \ + "F -- Append a \`*' for executable files" \ + "G -- Inhibit display of group information" \ + "Q -- Enclose file names in double quotes" ) + disp=( ${disp[@]%[Z$PREFIX] -*} ) + compset -P '[FGQ]*' + compadd -d disp - ${disp[@]% -*} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_mt b/Completion/Unix/Command/_mt index 8d2689539..4d750537c 100644 --- a/Completion/Unix/Command/_mt +++ b/Completion/Unix/Command/_mt @@ -1,7 +1,7 @@ #compdef mt local -a args cmds -local state line curcontext="$curcontext" +local state line curcontext="$curcontext" ret=1 args=( '(-)-f[specify raw tape device]:tape device:_files' ) cmds=( @@ -73,6 +73,8 @@ elif [[ $OSTYPE = solaris* ]]; then fi _arguments -C "$args[@]" '(--help --version -V)1:operation:->operation' \ - '2:count:' && return + '2:count:' && ret=0 -[[ -n "$state" ]] && _describe -t operations 'operation' cmds +[[ -n "$state" ]] && _describe -t operations 'operation' cmds && ret=0 + +return ret diff --git a/Completion/Unix/Command/_sccs b/Completion/Unix/Command/_sccs index e4af91a97..ff68c0c9a 100644 --- a/Completion/Unix/Command/_sccs +++ b/Completion/Unix/Command/_sccs @@ -8,7 +8,7 @@ _sccs_files() { _files -W $dir -g \*\(:s/s.//\) "$@" } -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line ret=1 typeset -A opt_args local subcmds ropt copt sfiles finalpath @@ -27,12 +27,13 @@ if [[ $service = sccs ]]; then '-r[run with real and not effective user ID]' \ '-d+[specify root prefix]:root prefix:_directories' \ '-p+[specify subdirectory of history file]:path to history file:_directories' \ - '*::command:->subcmd' && return 0 + '*::command:->subcmd' && ret=0 if (( CURRENT == 1 )); then - _wanted commands expl 'sccs command' compadd -a subcmds - return + _wanted commands expl 'sccs command' compadd -a subcmds && ret=0 fi + (( ret )) || return 0 + service="$words[1]" curcontext="${curcontext%:*}-$service:" fi diff --git a/Completion/Unix/Command/_telnet b/Completion/Unix/Command/_telnet new file mode 100644 index 000000000..5921105b0 --- /dev/null +++ b/Completion/Unix/Command/_telnet @@ -0,0 +1,73 @@ +#compdef telnet + +# Parameter used: +# +# telnet_hosts_ports_users +# The array that contains 3-tuples `host:port:user'. + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args + +if (( ! $+_telnet_args )); then + local help="$(_call_program options telnet -\? < /dev/null 2>&1)" + local -A optionmap + optionmap=( + '*\[-8\]*' '-8[allow 8-Bit data]' + '*\[-E\]*' '-E[disable an escape character]' + '*\[-K\]*' '-K[no automatic login]' + '*\[-L\]*' '-L[allow 8-Bit data on output]' + '*\[-N\]*' '-N[suppress reverse lookup]' + '*\[-S tos\]*' '-S+:IP type-of-service:' + '*\[-X atype\]*' '-X+:authentication type to disable:' + '*\[-a\]*' '-a[attempt automatic login]' + '*\[-c\]*' '-c[disable .telnetrc]' + '*\[-d\]*' '-d[debug mode]' + '*\[-e char\]*' '-e+[specify escape character]:escape character:' + '*\[-f/*' '-f' + '*/-F\]*' '-F' + '*\[-k realm\]*' '-k+:realm:' + '*\[-l user\]*' '-l+[specify user]:user:->users' + '*\[-n tracefile\]*' '-n+[specify tracefile]:tracefile:_files' + '*\[-r\]*' '-r[rlogin like user interface]' + '*\[-s src_addr\]*' '-s+[set source IP address]:src_addr:' + '*\[-x\]*' '-x' + '*\[-t transcom\]*' '-t+:transcom:' + '*\[-noasynch\]*' '-noasynch' + '*\[-noasyncnet\]*' '-noasyncnet' + '*\[-noasynctty\]*' '-noasynctty' + ) + _telnet_args=($optionmap[(K)"$help"]) + (( $#_telnet_args )) || _telnet_args=( '-l+[specify user]:user:->users' ) +fi + +_arguments -C -s \ + "$_telnet_args[@]" \ + ':host:->hosts' \ + ':port:->ports' && ret=0 + +case "$state" in +hosts) + _wanted hosts expl host \ + _combination -s '[@:]' '' users-hosts-ports \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ + hosts - && ret=0 + ;; + +ports) + _wanted ports expl port \ + _combination -s '[@:]' '' users-hosts-ports \ + ${opt_args[-l]:+users=${opt_args[-l]:q}} \ + hosts="${line[1]:q}" \ + ports - && ret=0 + ;; + +users) + _wanted users expl user \ + _combination -s '[@:]' '' users-hosts-ports \ + ${line[2]:+hosts="${line[2]:q}"} \ + ${line[3]:+ports="${line[3]:q}"} \ + users - && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index 5f1eee59c..02a995a92 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -1,6 +1,6 @@ #compdef w3m -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments \ @@ -31,7 +31,7 @@ _arguments \ '-o[option]:option-value:' \ '-config:config file:_files' \ '-debug' \ - ':url:->url' && return 0 + ':url:->url' && ret=0 case $state in url) @@ -39,10 +39,12 @@ case $state in if [[ -s ~/.w3m/history ]]; then _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"}) - compadd $_w3mhistory + compadd $_w3mhistory && ret=0 fi - _urls -f + _urls -f && ret=0 ;; esac + +return ret diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index 6f83b748f..c7a0aea5d 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -1,7 +1,7 @@ #compdef zip unzip zipinfo local suffixes suf zipfile uzi -local expl curcontext="$curcontext" state line +local expl curcontext="$curcontext" state line ret=1 typeset -A opt_args case $service in @@ -51,7 +51,7 @@ case $service in '-x[exclude the following names]' \ '-i[include only the following names]' \ "(-f -d -R -q -c -b -@ -F -FF -A -T -y -e -h -u -m -g -j -l -ll -L -v -z -t -tt -o -D -J -X -n -0 -1 -2 -3 -4 -5 -6 -7 -8 -9):zip file:_files -g '(#i)*.(zip|[jw]ar)'" \ - '*:file:->files' && return 0 + '*:file:->files' && ret=0 ;; unzip) _arguments -C -s \ @@ -76,7 +76,7 @@ case $service in '-x[exclude the following names]' \ '-Z[zipinfo mode]:zipinfomode:->zipinfo' \ "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|[jw]ar)'" \ - '*:file:->files' && return 0 + '*:file:->files' && ret=0 ;; esac @@ -99,7 +99,7 @@ if [[ $service == zipinfo ]] || [[ -n $uzi ]]; then '-M[page output]' \ '-x[exclude the following names]' \ "(-1 -2 -s -m -l -v -h -z -C -t -T -M)1:zip file:_files -g '(#i)*.(zip|[jw]ar)'" \ - '*:file:->files' && return 0 + '*:file:->files' && ret=0 fi case $state in @@ -108,11 +108,11 @@ case $state in compset -S ':*' || suf=":." suffixes=( *.*(N:e) ) _wanted suffixes expl suffixes \ - compadd -S "$suf" -r ": \t" .$^suffixes && return 0 + compadd -S "$suf" -r ": \t" .$^suffixes && ret=0 ;; files) if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then - _files -g '^(#i)*.(zip|[jw]ar)' && return 0 + _files -g '^(#i)*.(zip|[jw]ar)' && ret=0 else zipfile=( $~line[1](|.zip|.ZIP) ) [[ -z $zipfile[1] ]] && return 1 @@ -121,7 +121,9 @@ case $state in _zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} ) fi _wanted files expl 'file from archive' \ - _multi_parts / _zip_cache_list && return 0 + _multi_parts / _zip_cache_list && return fi ;; esac + +return ret diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer new file mode 100644 index 000000000..9cfa12cd5 --- /dev/null +++ b/Completion/X/Command/_mplayer @@ -0,0 +1,165 @@ +#compdef mplayer gmplayer + +local suf ret=1 curcontext="$curcontext" +local -a vals state line + +_x_arguments -C -s \ + '!-abs:buffer size' \ + '-ac[force usage of a specific audio codec]:audio codec attachment:->audio-codecs' \ + '-af[activate audio filters]:filter' -af-adv:option \ + '-afm[force usage of a specific audio codec family]:audio codec family:->audio-codec-families' \ + '-aid:audio channel id' \ + '-alang[select the DVD audio language]:country code' \ + '(-nosound)-ao[specify audio driver]:audio-driver attachment:->audio-drivers' \ + '-aofile:file:_files' \ + '(-nosound)*-aop[specify audio output filter]:audio output filter:->audio-plugins' \ + '-aspect:ratio' \ + '-audiofile:audio file:_files -g "(#i)*.(wav|mp3|ogg)"' \ + -autoq:quality -autosync:factor \ + -bandwidth:bandwidth\ value -benchmark -bpp:depth \ + '(-nocache)-cache:cache size (kb)' \ + '-cdda:audio CD options:(spped paranoia generic-dev sector-size overlap toc-bias toc-offset skip noskip)' \ + '-cdrom-device:cdrom device:_files -g "*(-%b)"' \ + '-channels:playback channels:((2\:stereo 4\:surround 6\:full\ 5.1))' \ + '-chapter:chapter' -contract:value \ + '-csslib:libcss.so location:_files' \ + -cuefile -delay:delay -demuxer:number -dfbopts:value \ + '(-nodouble)-double[enable double buffering]' \ + '-dr[enable direct rendering]' \ + -dxr2:option -dumpaudio -dumpstream -dumpvideo \ + '-dumpfile:output file:_files' \ + -dumpmicrodvdsub -dumpmpsub -dumpsrtsub -dumpjacosub -dumpsami -dumpsub \ + '-dvd:title id' '-dvdauth:DVD device' \ + '-dvd-device:dvd device:_files -g "*(-%b)"' \ + '-dvdangle:angle id' '-dvdkey:key' \ + '-edl:edl file:_files' '-edlout:edl file:_files' -enqueue \ + '-fbmode:video mode' '-fbmodeconfig:config file:_files' \ + '-fb[specify framebuffer device to use]:device:_files -g "*(-%b)"' \ + '-ffactor:factor:(0 0.75 1 10)' \ + -flip '-font:font.desc file:_files' -forceidx -forcexv -format:format \ + '-fps[force frame rate]:frame-rate' \ + '-framedrop' \ + '-frames:frame number' \ + '-fs[fullscreen]' -fstype:type \ + -gui -{,gui}'wid:X window:_x_window' \ + {-h,-help,--help}'[display help info]' \ + -hardframedrop \-hr-mp3-seek \ + '-hue:video signal hue adjustment' \ + '(-rootwin)-icelayer:icewm layer:((0\:Desktop 2\:Below 4\:Normal 6\:OnTop 8\:Dock 10\:AboveDock 12\:Menu))' \ + '(-use-stdin)-idx[rebuild index of the avi]' \ + '-ifo:ifo file:_files' '-include:config-file:_files' \ + '-input:command:(conf ar-delay ar-rate keylist cmdlist js-dev file)' \ + '-jpeg:option' -lavdopts:option \ + '-lircconf:lirc config file:_files' '-loop:repetitions' \ + '-mc[specify max sync correction]:max sync correction' \ + '-mf[specify option when decoding multiple PNG or JPEG files]:option' \ + '-mixer:mixer device:_files -g "*(-%b)"' \ + '-monitoraspect:ratio' -monitor_dotclock -monitor_{h,v}freq:frequency \ + '-ni[force usage of non-interlaced avi parser]' \ + -noaspect -noautosub -overlapsub -nooverlapsub -nowaveheader \ + '(-cache)-nocache' -nobps \ + '(-double)-nodouble' -nodshow -noextbased -noframedrop \ + -nograbpointer -nokeepaspect -noslices -nojoystick -nolirc -nortc \ + '(-ao -aop)-nosound' \ + '-osdlevel:osd-level:((0\:subtitles\ only 1\:volume\ +\ seek 2\:volume\ +\ seek\ +\ timer\ +\ percentage 3\:volume\ +\ seek\ +\ timer\ +\ percentage\ +\ total\ time))' \ + -panscan:value \ + '-passwd[specify password for http authentication]:password' \ + '-playlist:file:_files' \ + '-pp[apply postprocess filter]:filter attachment' -pphelp \ + -quiet -really-quiet -rootwin \ + -rawaudio:option -rawvideo:option \ + '-rtsp-stream-over-tcp' -saturation:value \ + '-sb[seek to byte position]:byte' \ + -screen{w,h}:pixels \ + '-sdp[input file is a SDP file]' -shuffle \ + '-skin[skin directory]:skin directory:_directories' \ + -skipopening -slave \ + '-sid[turn on DVD subtitles]:language id' \ + '-speed[set playback speed rate]:playback speed rate' \ + '-srate[specify frequency of audio playback]:frequency (Hz)' \ + '-ss[seek to given time position]:position (hh:mm\[:ss\])' \ + '-sstep[specify time between displayed frames]:time (seconds)' \ + -ssf:mode -stop_xscreensaver \ + '-stereo:mode:((0\:stereo 1\:left\ channel 2\:right\ channel))' \ + '-sub[use specified subtitle file]:subtitle file:_files' \ + -subfps:rate -sub-bg-alpha:value -sub-bg-color:value -subcc -subcp:codepage -subdelay:seconds \ + -subpos:vertical\ position -s{ub,pu}'align:alignment:((0\:top 1\:center 2\:bottom))' \ + '-subfont-autoscale:mode:((0\:no\ autoscale 1\:proportional\ to\ height 2\:proportional\ to\ width 3\:proportional\ to\ diagonal))' \ + -subfont-blur:radius -subfont-encoding:encoding -subfont-osd-scale:coefficient -subfont-outline:thickness -subfont-text-scale:coefficient \ + -sub-no-text-pp -spuaa:mode -spugauss:gauss -sws:scalar\ type \ + '-tv[TV grabbing]:option' \ + -unicode -utf8 \ + '-user[specify username for http authentication]' \ + '(-idx)-use-stdin' \ + '-vcd[play video cd track]:track' \ + '-vc[force usage of a specific video codec]:video-codec attachment:->video-codecs' \ + '-v[enable verbose output]' \ + '*-vf[video output filters]:video output filters:->video-output-plugins' \ + '-vfm[force usage of a specific video codec family]:video-codec-family:(1 2 3 4 5)' \ + '-vid[select video channel]:video-channel' \ + '-vm[try to change to a better video mode]' \ + '-vo[specify video driver]:video-driver attachment:->video-drivers' \ + '-vop[specify video output filters]:video output filters:->video-output-plugins' \ + -vobsub:vobsub\ file -vobsubid:id -vsync \ + '-x[scale image to x width if driver supports]:width' \ + -xineramascreeen:screen -xvidopts:option \ + '-xy[scale image by factor if driver supports]:factor' \ + '-y[scale image to y height if driver supports]:height' \ + '-z[specify compression level for png output]:compression-level:((0\:no\ compression 1 2 3 4 5 6\:default\ compression 7 8 9\:max\ compression))' \ + '-zoom[use software scaling, where available (use with -nofs)]' \ + -zrbw -zrcrop -zrdev -zrfd -zrhelp -zrnorm -zrquality -zr{h,v}dec -zr{x,y}doff \ + '(-use-stdin)*:video file:->mfiles' + +case "$state" in + mfiles) + _tags files urls + while _tags; do + _requested files expl 'video file' _files -g \ + "*.(#i)(avi|mp3|mpg|mpe|mpeg|m1v|mov|asf|vob|mjpg|wma|wmv|asx|qt|rm)" && ret=0 + if _requested urls; then + while _next_label urls expl url; do + _urls "$expl[@]" && ret=0 + compadd -S '' "$expl[@]" {dvd,vcd,cdda,cddb,tv}:// && ret=0 + done + fi + (( ret )) || return 0 + done + ;; + audio-codecs) + vals=( help ${${${(f)"$(_call_program audio-codecs $words[1] -ac help -quiet 2>/dev/null)"}[(r)ac:*,-1]}[2,-1]/ ##[^ ]# #[^ ]# #/:} ) + _describe -t audio-codecs 'audio codec' vals && ret=0 + ;; + audio-drivers) + vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) + _describe -t audio-drivers 'audio drivers' vals && ret=0 + ;; + audio-codec-families) + compset -P '*,' + compset -S ',*' + vals=( help ${${${(f)"$(_call_program audio-codec-families mplayer -afm help 2>/dev/null)"}[(r) [^:]#,-1]## ##}/ ##/:} ) + _describe -t audio-codec-families 'audio drivers' vals && ret=0 + ;; + audio-plugins) + _values -s : 'audio output plugin' \ + 'list[specify list of plugins]:plugin:(resample surround format volume extrastereo volnorm delay)' \ + 'format[output format]:format' \ + 'fout[output frequency]:frequency (Hz)' \ + 'volume[volume level]:volume <0-255>' \ + 'mul[stereo coefficient]:coefficient' \ + 'softclip[compressor]' && ret=0 + ;; + video-codecs) + vals=( help ${${${(f)"$(_call_program audio-codecs $words[1] -vc help -quiet 2>/dev/null)"}[(r)vc:*,-1]}[2,-1]/ ##[^ ]# #[^ ]# #/:} ) + _describe -t video-codecs 'video codec' vals && ret=0 + ;; + video-drivers) + vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) + _describe -t video-drivers 'video drivers' vals && ret=0 + ;; + video-output-plugins) + vals=( help ${${${${(f)"$(_call_program video-output-plugins mplayer -vop help 2>/dev/null)"}[(r) *,-1]}/ /}/ #: /:} ) + _describe -t video-output-plugins 'video output plugin' vals && ret=0 + ;; +esac + +return ret diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef new file mode 100644 index 000000000..b9b590b2d --- /dev/null +++ b/Completion/Zsh/Command/_compdef @@ -0,0 +1,54 @@ +#compdef compdef + +local state line expl list disp curcontext="$curcontext" ret=1 +typeset -A opt_args + +_arguments -C -s -A "-*" -S \ + '(-d)-a[make function autoloadable]' \ + '(-d -p -P)-n[leave existing definitions intact]' \ + ':completion function:->cfun' \ + '*:commands: _command_names' \ + - d \ + '(-a -n)-d[delete]:*:completed command:->ccom' \ + - p \ + '(-n)-p[completion for command matching pattern]:completion function:->cfun:pattern' \ + - P \ + '(-n)-P[as -p for commands without own completion]:completion function:->cfun:pattern' \ + - k \ + '-k[define widget and key binding]:completion function:->cfun:style:->style:*:key' \ + - K \ + '-K[define multiple widgets based on function]:*::: :->multi' && ret=0 + +if [[ $state = multi ]]; then + case $(( CURRENT % 3 )) in + 0) _message key + return 1;; + 1) state=cfun;; + 2) state=style;; + esac +fi + +case $state in + ccom) + _wanted commands expl 'completed command' compadd -k _comps && ret=0 + ;; + cfun) + list=( ${^fpath:/.}/_(|*[^~])(:t) ) + if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then + disp=( ${list[@]#_} ) + _wanted functions expl 'completion function' \ + compadd -d disp -a list && ret=0 + else + _wanted functions expl 'completion function' compadd -a list && ret=0 + fi + ;; + style) + _wanted widgetstyle expl 'widget style' \ + compadd -M 'r:|-=* r:|=*' \ + complete-word delete-char-or-list expand-or-complete \ + expand-or-complete-prefix list-choices menu-complete \ + menu-expand-or-complete reverse-menu-complete && ret=0 + ;; +esac + +return ret diff --git a/Completion/Zsh/Command/_hash b/Completion/Zsh/Command/_hash new file mode 100644 index 000000000..80c136118 --- /dev/null +++ b/Completion/Zsh/Command/_hash @@ -0,0 +1,40 @@ +#compdef hash rehash + +local state line expl common_args curcontext="$curcontext" ret=1 +typeset -A opt_args + +common_args=( \ + '-d[use named directory hash table]' \ + '(-r -m -v)-f[rebuild hash table]' ) + +case ${service} in + hash) + _arguments -C -s -S \ + '(-f -m -v)-r[empty hash table]' \ + '(-f -r)-m[treat arguments as patterns]' \ + '(-f -r -m)-v[list entries as they are added]' \ + '(-f -r -v)-L[list in the form of calls to hash]' \ + "${common_args[@]}" \ + '(-d -f -r -m -v -L)*:hash:->hashval' && ret=0 + ;; + rehash) + _arguments -C -s ${common_args[@]} && return 0 + ;; +esac + +if [[ $state = hashval ]]; then + if (( $+opt_args[-d] )); then + if compset -P 1 '*='; then + _wanted -C value files expl directories _path_files -/ && ret=0 + else + _wanted -C name named-directories expl 'named directory' \ + compadd -q -S '=' -k nameddirs && ret=0 + fi + elif compset -P 1 '*='; then + _wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0 + else + _wanted -C name commands expl command compadd -q -S '=' -k commands && ret=0 + fi +fi + +return ret diff --git a/Completion/Zsh/Command/_which b/Completion/Zsh/Command/_which new file mode 100644 index 000000000..2b89112bc --- /dev/null +++ b/Completion/Zsh/Command/_which @@ -0,0 +1,39 @@ +#compdef which whence where type + +local farg aarg cargs args state line curcontext="$curcontext" ret=1 + +cargs=( \ + '(-v -c)-w[print command type]' \ + '-p[always do a path search]' \ + '-m[treat the arguments as patterns]' \ + '-s[print symlink free path as well]' \ + '*:commands:->command' ) +farg='-f[output contents of functions]' +aarg='-a[print all occurrences in path]' + +case ${service} in + whence) + _arguments -C -s -A "-*" -S \ + '(-c -w)-v[verbose output]' \ + '(-v -w)-c[csh-like output]' \ + "${cargs[@]}" "$farg" "$aarg" && ret=0 + ;; + where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;; + which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;; + type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;; +esac + +if [[ "$state" = command ]]; then + + args=( "$@" ) + + _alternative -O args \ + 'commands:external command:compadd -k commands' \ + 'builtins:builtin command:compadd -k builtins' \ + 'functions:shell function:compadd -k functions' \ + 'aliases:alias:compadd -k aliases' \ + 'reserved-words:reserved word:compadd -k reswords' && ret=0 + +fi + +return ret diff --git a/Src/system.h b/Src/system.h index 31be575ef..1a28fe313 100644 --- a/Src/system.h +++ b/Src/system.h @@ -27,9 +27,15 @@ * */ +#if 0 +/* + * Setting _XPG_IV here is actually wrong and is not needed + * with currently supported versions (5.43C20 and above) + */ #ifdef sinix # define _XPG_IV 1 #endif +#endif /* NeXT has half-implemented POSIX support * * which currently fools configure */ @@ -194,19 +200,21 @@ struct timezone { # define VARARR(X,Y,Z) X *(Y) = (X *) alloca(sizeof(X) * (Z)) #endif -/* we should be getting this value from pathconf(_PC_PATH_MAX) */ -/* but this is too much trouble */ +/* we should handle unlimited sizes from pathconf(_PC_PATH_MAX) */ +/* but this is too much trouble */ #ifndef PATH_MAX # ifdef MAXPATHLEN # define PATH_MAX MAXPATHLEN # else - /* so we will just pick something */ -# define PATH_MAX 1024 +# ifdef _POSIX_PATH_MAX +# define PATH_MAX _POSIX_PATH_MAX +# else + /* so we will just pick something */ +# define PATH_MAX 1024 +# endif # endif #endif -/* we should be getting this value from sysconf(_SC_OPEN_MAX) */ -/* but this is too much trouble */ #ifndef OPEN_MAX # ifdef NOFILE # define OPEN_MAX NOFILE @@ -215,6 +223,9 @@ struct timezone { # define OPEN_MAX 64 # endif #endif +#ifndef HAVE_SYSCONF +# define zopenmax() ((long) OPEN_MAX) +#endif #ifdef HAVE_FCNTL_H # include @@ -299,10 +310,6 @@ struct timezone { # endif /* HAVE_TERMIO_H */ #endif /* HAVE_TERMIOS_H */ -#ifdef HAVE_TERMCAP_H -# include -#endif - #if defined(GWINSZ_IN_SYS_IOCTL) || defined(CLOBBERS_TYPEAHEAD) # include #endif @@ -399,8 +406,10 @@ struct timezone { /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 * * (or with ZSH_64_BIT_TYPE maybe -LONG_LONG_MAX-1) * * converted to printable decimal form including the sign and the * - * terminating null character. Below 0.30103 > lg 2. */ -#define DIGBUFSIZE ((int)(((sizeof(zlong) * 8) - 1) * 0.30103) + 3) + * terminating null character. Below 0.30103 > lg 2. * + * BDIGBUFSIZE is for a number converted to printable binary form. */ +#define DIGBUFSIZE ((int)(((sizeof(zlong) * 8) - 1) * 30103/100000) + 3) +#define BDIGBUFSIZE ((int)((sizeof(zlong) * 8) + 4)) /* If your stat macros are broken, we will * * just undefine them. */ @@ -642,3 +651,13 @@ extern short ospeed; #if defined(CONFIG_LOCALE) && defined(HAVE_SETLOCALE) && defined(LC_ALL) # define USE_LOCALE 1 #endif /* CONFIG_LOCALE && HAVE_SETLOCALE && LC_ALL */ + +#ifndef MAILDIR_SUPPORT +#define mailstat(X,Y) stat(X,Y) +#endif + +#ifdef __CYGWIN__ +# define IS_DIRSEP(c) ((c) == '/' || (c) == '\\') +#else +# define IS_DIRSEP(c) ((c) == '/') +#endif -- cgit 1.4.1