complete.tcsh revision 145479
159243Sobrien#
2145479Smp# $Id: complete.tcsh,v 1.46 2005/03/21 21:26:08 kim Exp $
359243Sobrien# example file using the new completion code
459243Sobrien#
5131962Smp# Debian GNU/Linux
6131962Smp# /usr/share/doc/tcsh/examples/complete.gz
7131962Smp#
8145479Smp# This file may be read from user's ~/.cshrc or ~/.tcshrc file by
9131962Smp# decompressing it into the home directory as ~/.complete and
10131962Smp# then adding the line "source ~/.complete" and maybe defining
11131962Smp# some of the shell variables described below.
12131962Smp#
13131962Smp# Added two Debian-specific completions: dpkg and dpkg-deb (who
14131962Smp# wrote them?). Changed completions of several commands. The ones
15131962Smp# are evaluated if the `traditional_complete' shell variable is
16131962Smp# defined.
17131962Smp#
18131962Smp# Debian enhancements by Vadim Vygonets <vadik@cs.huji.ac.il>.
19131962Smp# Bugfixes and apt completions by Miklos Quartus <miklos.quartus@nokia.com>.
20131962Smp# Cleanup by Martin A. Godisch <martin@godisch.de>.
2159243Sobrien
2259243Sobrienonintr -
2359243Sobrienif (! $?prompt) goto end
2459243Sobrien
2559243Sobrienif ($?tcsh) then
2659243Sobrien    if ($tcsh != 1) then
2759243Sobrien   	set rev=$tcsh:r
2859243Sobrien	set rel=$rev:e
2959243Sobrien	set pat=$tcsh:e
3059243Sobrien	set rev=$rev:r
3159243Sobrien    endif
3259243Sobrien    if ($rev > 5 && $rel > 1) then
3383098Smp	set _complete=1
3459243Sobrien    endif
3559243Sobrien    unset rev rel pat
3659243Sobrienendif
3759243Sobrien
3883098Smpif ($?_complete) then
3959243Sobrien    set noglob
40100616Smp    if ( ! $?hosts ) set hosts
4159243Sobrien    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
4259243Sobrien        if ( -r $f ) then
43100616Smp	    set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " "	" | cut -f 1`)
4459243Sobrien	endif
4559243Sobrien    end
4659243Sobrien    if ( -r $HOME/.netrc ) then
4759243Sobrien	set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
4859243Sobrien	set hosts=($hosts $f)
4959243Sobrien    endif
50100616Smp    if ( -r $HOME/.ssh/known_hosts ) then
51100616Smp	set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null
52145479Smp	set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ | sed -e 's/,/ /g'` >& /dev/null
53100616Smp	set hosts=($hosts $f)
54100616Smp    endif
5559243Sobrien    unset f
5659243Sobrien    if ( ! $?hosts ) then
5759243Sobrien	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
5859243Sobrien		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
5959243Sobrien		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
6059243Sobrien		   labrea.stanford.edu sumex-aim.stanford.edu \
6159243Sobrien		   tut.cis.ohio-state.edu)
6259243Sobrien    endif
6359243Sobrien
6459243Sobrien    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
6559243Sobrien    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6659243Sobrien    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6759243Sobrien    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6859243Sobrien    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
6959243Sobrien    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
7059243Sobrien
7159243Sobrien    complete cd  	p/1/d/		# Directories only
7259243Sobrien    complete chdir 	p/1/d/
7359243Sobrien    complete pushd 	p/1/d/
7459243Sobrien    complete popd 	p/1/d/
7559243Sobrien    complete pu 	p/1/d/
7659243Sobrien    complete po 	p/1/d/
7759243Sobrien    complete complete 	p/1/X/		# Completions only
7859243Sobrien    complete uncomplete	n/*/X/
7959243Sobrien    complete exec 	p/1/c/		# Commands only
8059243Sobrien    complete trace 	p/1/c/
8159243Sobrien    complete strace 	p/1/c/
8259243Sobrien    complete which	n/*/c/
8359243Sobrien    complete where	n/*/c/
8459243Sobrien    complete skill 	p/1/c/
8559243Sobrien    complete dde	p/1/c/ 
8659243Sobrien    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
8759243Sobrien    complete sdb	p/1/c/
8859243Sobrien    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
8959243Sobrien    complete xdb	p/1/c/
9059243Sobrien    complete gdb	n/-d/d/ n/*/c/
9159243Sobrien    complete ups	p/1/c/
9259243Sobrien    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
9359243Sobrien    complete unset	n/*/s/
9459243Sobrien    complete alias 	p/1/a/		# only aliases are valid
9559243Sobrien    complete unalias	n/*/a/
9659243Sobrien    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
9759243Sobrien    complete dvips 	n/*/f:*.dvi/
98145479Smp    if ($?traditional_complete) then
99145479Smp        complete tex 	n/*/f:*.tex/	# Only files that match *.tex
100145479Smp    else
101145479Smp        complete tex 	n/*/f:*.{tex,texi}/	# Files that match *.tex and *.texi
102145479Smp    endif
10359243Sobrien    complete latex 	n/*/f:*.{tex,ltx}/
10459243Sobrien    complete su		c/--/"(login fast preserve-environment command shell \
10559243Sobrien			help version)"/	c/-/"(f l m p c s -)"/ \
10659243Sobrien			n/{-c,--command}/c/ \
10759243Sobrien			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
10859243Sobrien    complete cc 	c/-[IL]/d/ \
10959243Sobrien              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
11059243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
11159243Sobrien    complete acc 	c/-[IL]/d/ \
11259243Sobrien       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
11359243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
11459243Sobrien    complete gcc 	c/-[IL]/d/ \
11559243Sobrien		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
11659243Sobrien		               elide-constructors expensive-optimizations \
11759243Sobrien			       float-store force-addr force-mem inline \
11859243Sobrien			       inline-functions keep-inline-functions \
11959243Sobrien			       memoize-lookups no-default-inline \
12059243Sobrien			       no-defer-pop no-function-cse omit-frame-pointer \
12159243Sobrien			       rerun-cse-after-loop schedule-insns \
12259243Sobrien			       schedule-insns2 strength-reduce \
12359243Sobrien			       thread-jumps unroll-all-loops \
12459243Sobrien			       unroll-loops syntax-only all-virtual \
12559243Sobrien			       cond-mismatch dollars-in-identifiers \
12659243Sobrien			       enum-int-equiv no-asm no-builtin \
12759243Sobrien			       no-strict-prototype signed-bitfields \
12859243Sobrien			       signed-char this-is-variable unsigned-bitfields \
12959243Sobrien			       unsigned-char writable-strings call-saved-reg \
13059243Sobrien			       call-used-reg fixed-reg no-common \
13159243Sobrien			       no-gnu-binutils nonnull-objects \
13259243Sobrien			       pcc-struct-return pic PIC shared-data \
13359243Sobrien			       short-enums short-double volatile)"/ \
13459243Sobrien		 	c/-W/"(all aggregate-return cast-align cast-qual \
13559243Sobrien		      	       comment conversion enum-clash error format \
13659243Sobrien		      	       id-clash-len implicit missing-prototypes \
13759243Sobrien		      	       no-parentheses pointer-arith return-type shadow \
13859243Sobrien		      	       strict-prototypes switch uninitialized unused \
13959243Sobrien		      	       write-strings)"/ \
14059243Sobrien		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
14159243Sobrien			       short c68000 c68020 soft-float g gnu unix fpu \
14259243Sobrien			       no-epilogue)"/ \
14359243Sobrien		 	c/-d/"(D M N)"/ \
14459243Sobrien		 	c/-/"(f W vspec v vpath ansi traditional \
14559243Sobrien			      traditional-cpp trigraphs pedantic x o l c g L \
14659243Sobrien			      I D U O O2 C E H B b V M MD MM i dynamic \
14759243Sobrien			      nodtdlib static nostdinc undef)"/ \
14859243Sobrien		 	c/-l/f:*.a/ \
14959243Sobrien		 	n/*/f:*.{c,C,cc,o,a,s,i}/
15059243Sobrien    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
15169408Sache    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
15259243Sobrien    complete rm 	c/--/"(directory force interactive verbose \
15359243Sobrien			recursive help version)"/ c/-/"(d f i v r R -)"/ \
15459243Sobrien			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
15559243Sobrien    complete vi 	n/*/f:^*.[oa]/
15659243Sobrien    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
15759243Sobrien			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
15859243Sobrien			n/-k/"(left right up down)"/ p/2-/b/ \
15959243Sobrien			p/1/'x:<key-sequence or option>'/
16059243Sobrien
16159243Sobrien    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
16259243Sobrien		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
16359243Sobrien			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
16459243Sobrien		  	c/-/"(fstype name perm prune type user nouser \
16559243Sobrien		  	     group nogroup size inum atime mtime ctime exec \
16659243Sobrien			     ok print ls cpio ncpio newer xdev depth \
16759243Sobrien			     daystart follow maxdepth mindepth noleaf version \
16859243Sobrien			     anewer cnewer amin cmin mmin true false uid gid \
16959243Sobrien			     ilname iname ipath iregex links lname empty path \
17059243Sobrien			     regex used xtype fprint fprint0 fprintf \
17159243Sobrien			     print0 printf not a and o or)"/ \
17259243Sobrien			     n/*/d/
17359243Sobrien
17459243Sobrien    complete -%*	c/%/j/			# fill in the jobs builtin
17559243Sobrien    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
17659243Sobrien
17759243Sobrien    complete limit	c/-/"(h)"/ n/*/l/
17859243Sobrien    complete unlimit	c/-/"(h)"/ n/*/l/
17959243Sobrien
18059243Sobrien    complete -co*	p/0/"(compress)"/	# make compress completion
18159243Sobrien						# not ambiguous
182145479Smp    if ($?traditional_complete) then
183145479Smp        complete zcat	n/*/f:*.Z/
184145479Smp    else
185145479Smp        # "zcat" may be linked to "compress" or "gzip"
186145479Smp        if (-X zcat) then
187145479Smp            zcat --version >& /dev/null
188145479Smp            if ($status != 0) then
189145479Smp                complete zcat	n/*/f:*.Z/
190145479Smp            else
191145479Smp                complete zcat	c/--/"(force help license quiet version)"/ \
192131962Smp				c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
193145479Smp	    endif
194145479Smp        endif
195131962Smp    endif
19659243Sobrien
19759243Sobrien    complete finger	c/*@/\$hosts/ n/*/u/@ 
19859243Sobrien    complete ping	p/1/\$hosts/
19959243Sobrien    complete traceroute	p/1/\$hosts/
20059243Sobrien
20159243Sobrien    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
20259243Sobrien		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
20359243Sobrien
20459243Sobrien    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
20559243Sobrien
20659243Sobrien    # this one is simple...
20759243Sobrien    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
20859243Sobrien    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
20959243Sobrien    # This one will rsh to the file to fetch the list of files!
21059243Sobrien    complete rcp 'c%*@*:%`set q=$:-0;set q="$q:s/@/ /";set q="$q:s/:/ /";set q=($q " ");rsh $q[2] -l $q[1] ls -dp $q[3]\*`%' 'c%*:%`set q=$:-0;set q="$q:s/:/ /";set q=($q " ");rsh $q[1] ls -dp $q[2]\*`%' 'c%*@%$hosts%:' 'C@[./$~]*@f@'  'n/*/$hosts/:'
21159243Sobrien
21259243Sobrien    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
21359243Sobrien		c/conv=*,/"(ascii ebcdic ibm block unblock \
21459243Sobrien			    lcase notrunc ucase swab noerror sync)"/,\
21559243Sobrien		c/conv=/"(ascii ebcdic ibm block unblock \
21659243Sobrien			  lcase notrunc ucase swab noerror sync)"/,\
21759243Sobrien	        c/*=/x:'<number>'/ \
21859243Sobrien		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
21959243Sobrien
22059243Sobrien    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
22159243Sobrien
22259243Sobrien    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
22359243Sobrien		p/2/f:*.a/ p/*/f:*.o/
22459243Sobrien
22559243Sobrien    # these should be merged with the MH completion hacks below - jgotts
226131962Smp    complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
22759243Sobrien		c@+@F:$HOME/Mail/@
22859243Sobrien
22959243Sobrien    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
23059243Sobrien    complete {rexec,rxexec,rxterm,rmterm} \
23159243Sobrien			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
23259243Sobrien			'n/-E/e/' 'n/*/c/'
23359243Sobrien    complete kill	'c/-/S/' 'c/%/j/' \
23459243Sobrien			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
23559243Sobrien
23659243Sobrien    # these from Marc Horowitz <marc@cam.ov.com>
23759243Sobrien    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
23859243Sobrien		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
23959243Sobrien		    'c/-/(verbose quiet force printpath lookup debug map \
24059243Sobrien			  nomap remap zephyr nozephyr readonly write \
24159243Sobrien			  mountpoint noexplicit explicit type mountoptions \
24259243Sobrien			  nosetuid setuid override skipfsck lock user host)/' \
24359243Sobrien		    'n/-e/f/' 'n/*/()/'
24459243Sobrien    complete hesinfo	'p/1/u/' \
24559243Sobrien			'p/2/(passwd group uid grplist pcap pobox cluster \
24659243Sobrien			      filsys sloc service)/'
24759243Sobrien
24859243Sobrien    # these from E. Jay Berkenbilt <ejb@ERA.COM>
24959243Sobrien    # = isn't always followed by a filename or a path anymore - jgotts
250145479Smp    if ($?traditional_complete) then
251145479Smp        complete ./configure \
252145479Smp			 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
25359243Sobrien    				bindir,sbindir,libexecdir,datadir,\
25459243Sobrien				sysconfdir,sharedstatedir,localstatedir,\
25559243Sobrien				libdir,includedir,oldincludedir,infodir,\
25659243Sobrien				mandir,srcdir}/(=)//' \
25759243Sobrien			 'c/--/(cache-file verbose prefix exec-prefix bindir \
25859243Sobrien			 	sbindir libexecdir datadir sysconfdir \
25959243Sobrien				sharedstatedir localstatedir libdir \
26059243Sobrien				includedir oldincludedir infodir mandir \
26159243Sobrien				srcdir)//'
262145479Smp    else
263131962Smp	complete ./configure \
264131962Smp			'c@--{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:<directory e.g. /usr/local>'@ \
265131962Smp 			'c/--cachefile=*/x:<filename>/' \
266131962Smp  			'c/--{enable,disable,with}-*/x:<feature>//' \
267131962Smp 			'c/--*=/x:<directory>//' \
268131962Smp  			'c/--/(prefix= exec-prefix= bindir= \
269131962Smp			sbindir= libexecdir= datadir= sysconfdir= \
270131962Smp   			sharedstatedir= localstatedir= infodir= \
271131962Smp			mandir= srcdir= x-includes= x-libraries= cachefile= \
272131962Smp 			enable- disable- with- \
273131962Smp 			help no-create quiet silent version verbose )//'
274145479Smp    endif
27559243Sobrien    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
27659243Sobrien			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
27759243Sobrien			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
27859243Sobrien		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
27959243Sobrien		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
28059243Sobrien    complete perl	'n/-S/c/'
28159243Sobrien    complete printenv	'n/*/e/'
28259243Sobrien    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
28359243Sobrien			delta diffs edit enter fix get help info \
28459243Sobrien			print prs prt rmdel sccsdiff tell unedit \
28559243Sobrien			unget val what)"/
28659243Sobrien    complete setenv	'p/1/e/' 'c/*:/f/'
28759243Sobrien
28859243Sobrien    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
28959243Sobrien    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
29059243Sobrien
29159243Sobrien    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
29259243Sobrien    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
29359243Sobrien
29459243Sobrien    set folders = ( $FOLDERS )
29559243Sobrien    set mha = ( $MHA )
29659243Sobrien
29759243Sobrien    complete ali \
29859243Sobrien        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
29959243Sobrien        'n,-alias,f,'
30059243Sobrien
30159243Sobrien    complete anno \
30259243Sobrien        'c/-/(component noinplace inplace nodate date text help)/' \
30359243Sobrien        'c,+,$folders,'  \
30459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
30559243Sobrien
30659243Sobrien    complete burst \
30759243Sobrien        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
30859243Sobrien        'c,+,$folders,'  \
30959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
31059243Sobrien
31159243Sobrien    complete comp \
31259243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
31359243Sobrien        'c,+,$folders,'  \
31459243Sobrien        'n,-whatnowproc,c,'  \
31559243Sobrien        'n,-file,f,'\
31659243Sobrien        'n,-form,f,'\
31759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
31859243Sobrien
31959243Sobrien    complete dist \
32059243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
32159243Sobrien        'c,+,$folders,'  \
32259243Sobrien        'n,-whatnowproc,c,'  \
32359243Sobrien        'n,-form,f,'\
32459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
32559243Sobrien
32659243Sobrien    complete folder \
32759243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
32859243Sobrien        'c,+,$folders,'  \
32959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33059243Sobrien
33159243Sobrien    complete folders \
33259243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
33359243Sobrien        'c,+,$folders,'  \
33459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33559243Sobrien
33659243Sobrien    complete forw \
33759243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
33859243Sobrien        'c,+,$folders,'  \
33959243Sobrien        'n,-whatnowproc,c,'  \
34059243Sobrien        'n,-filter,f,'\
34159243Sobrien        'n,-form,f,'\
34259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
34359243Sobrien
34459243Sobrien    complete inc \
34559243Sobrien        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
34659243Sobrien        'c,+,$folders,'  \
34759243Sobrien        'n,-audit,f,'\
34859243Sobrien        'n,-form,f,'
34959243Sobrien
35059243Sobrien    complete mark \
35159243Sobrien        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
35259243Sobrien        'c,+,$folders,'  \
35359243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
35459243Sobrien
35559243Sobrien    complete mhmail \
35659243Sobrien        'c/-/(body cc from subject help)/' \
35759243Sobrien        'n,-cc,$mha,'  \
35859243Sobrien        'n,-from,$mha,'  \
35959243Sobrien        'n/*/$mha/'
36059243Sobrien
36159243Sobrien    complete mhpath \
36259243Sobrien        'c/-/(help)/' \
36359243Sobrien        'c,+,$folders,'  \
36459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
36559243Sobrien
36659243Sobrien    complete msgchk \
36759243Sobrien        'c/-/(nodate date nonotify notify help)/' 
36859243Sobrien
36959243Sobrien    complete msh \
37059243Sobrien        'c/-/(prompt noscan scan notopcur topcur help)/' 
37159243Sobrien
37259243Sobrien    complete next \
37359243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
37459243Sobrien        'c,+,$folders,'  \
37559243Sobrien        'n,-moreproc,c,'  \
37659243Sobrien        'n,-showproc,c,'  \
37759243Sobrien        'n,-form,f,'
37859243Sobrien
37959243Sobrien    complete packf \
38059243Sobrien        'c/-/(file help)/' \
38159243Sobrien        'c,+,$folders,'  \
38259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38359243Sobrien
38459243Sobrien    complete pick \
38559243Sobrien        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
38659243Sobrien        'c,+,$folders,'  \
38759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38859243Sobrien
38959243Sobrien    complete prev \
39059243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
39159243Sobrien        'c,+,$folders,'  \
39259243Sobrien        'n,-moreproc,c,'  \
39359243Sobrien        'n,-showproc,c,'  \
39459243Sobrien        'n,-form,f,'
39559243Sobrien
39659243Sobrien    complete prompter \
39759243Sobrien        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
39859243Sobrien
39959243Sobrien    complete refile \
40059243Sobrien        'c/-/(draft nolink link nopreserve preserve src file help)/' \
40159243Sobrien        'c,+,$folders,'  \
40259243Sobrien        'n,-file,f,'\
40359243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
40459243Sobrien
40559243Sobrien    complete rmf \
40659243Sobrien        'c/-/(nointeractive interactive help)/' \
40759243Sobrien        'c,+,$folders,'  
40859243Sobrien
40959243Sobrien    complete rmm \
41059243Sobrien        'c/-/(help)/' \
41159243Sobrien        'c,+,$folders,'  \
41259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
41359243Sobrien
41459243Sobrien    complete scan \
41559243Sobrien        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
41659243Sobrien        'c,+,$folders,'  \
41759243Sobrien        'n,-form,f,'\
41859243Sobrien        'n,-file,f,'\
41959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
42059243Sobrien
42159243Sobrien    complete send \
42259243Sobrien        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
42359243Sobrien        'n,-alias,f,'\
42459243Sobrien        'n,-filter,f,'
42559243Sobrien
42659243Sobrien    complete show \
42759243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
42859243Sobrien        'c,+,$folders,'  \
42959243Sobrien        'n,-moreproc,c,'  \
43059243Sobrien        'n,-showproc,c,'  \
43159243Sobrien        'n,-form,f,'\
43259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
43359243Sobrien
43459243Sobrien    complete sortm \
43559243Sobrien        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
43659243Sobrien        'c,+,$folders,'  \
43759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
43859243Sobrien
43959243Sobrien    complete vmh \
44059243Sobrien        'c/-/(prompt vmhproc novmhproc help)/' \
44159243Sobrien        'n,-vmhproc,c,'  
44259243Sobrien
44359243Sobrien    complete whatnow \
44459243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
44559243Sobrien
44659243Sobrien    complete whom \
44759243Sobrien        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
44859243Sobrien        'n,-alias,f,'
44959243Sobrien
45059243Sobrien    complete plum \
45159243Sobrien        'c/-/()/' \
45259243Sobrien        'c,+,$folders,'  \
45359243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
45459243Sobrien
45559243Sobrien    complete mail \
45659243Sobrien        'c/-/()/' \
45759243Sobrien        'n/*/$mha/'
45859243Sobrien
45959243Sobrien    endif
46059243Sobrien
46159243Sobrien    #from Dan Nicolaescu <dann@ics.uci.edu>
46259243Sobrien    if ( $?MODULESHOME ) then
46361515Sobrien	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
46459243Sobrien	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
46561515Sobrien	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
46661515Sobrien	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
46761515Sobrien	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
46861515Sobrien	'C%[^-]*%`eval Compl_module`%'
46959243Sobrien    endif
47059243Sobrien
47169408Sache    # from George Cox
472100616Smp    complete acroread	'p/*/f:*.{pdf,PDF}/'
47369408Sache    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
47469408Sache			configtest help)/'
47569408Sache    complete appletviewer	'p/*/f:*.class/'
47669408Sache    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
47769408Sache			help name-prefix= no-lines no-parser output= \
47869408Sache			token-table verbose version yacc)/' \
47969408Sache			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
48069408Sache			'n/-p/f/'
481145479Smp    complete bzcat	c/--/"(help test quiet verbose license version)"/ \
482145479Smp			c/-/"(h t L V -)"/ n/*/f:*.{bz2,tbz}/
483145479Smp    complete bunzip2	c/--/"(help keep force test stdout quiet verbose \
484145479Smp                        license version)"/ c/-/"(h k f t c q v L V -)"/ \
485145479Smp			n/*/f:*.{bz2,tbz}/
486145479Smp    complete bzip2	c/--/"(help decompress compress keep force test \
487145479Smp			stdout quiet verbose license version small)"/ \
488145479Smp			c/-/"(h d z k f t c q v L V s 1 2 3 4 5 6 7 8 9 -)"/ \
489145479Smp			n/{-d,--decompress}/f:*.{bz2,tbz}/ \
490145479Smp			N/{-d,--decompress}/f:*.{bz2,tbz}/ n/*/f:^*.{bz2,tbz}/
49169408Sache    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
49269408Sache    complete co		'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
49369408Sache    complete crontab	'n/-u/u/'
49469408Sache    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
49569408Sache			modepage negotiate periphlist rescan reset start \
49669408Sache			stop tags tur)/'
49769408Sache    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
49869408Sache			checkfile drop feedinfo flush flushlogs go hangup \
49969408Sache			logmode mode name newgroup param pause readers refile \
50069408Sache			reject reload renumber reserve rmgroup send shutdown \
50169408Sache			kill throttle trace xabort xexec)/'
50269408Sache    complete cvs	'c/--/(help help-commands help-synonyms)/' \
50369408Sache			'p/1/(add admin annotate checkout commit diff \
50469408Sache			edit editors export history import init log login \
50569408Sache			logout rdiff release remove rtag status tag unedit \
50669408Sache			update watch watchers)/' 'n/-a/(edit unedit commit \
50769408Sache			all none)/' 'n/watch/(on off add remove)/'
50869408Sache    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
50969408Sache    complete detex	'p/*/f:*.tex/'
51069408Sache    complete edquota    'n/*/u/'
51169408Sache    complete exec	'p/1/c/'
51269408Sache    complete ghostview	'p/*/f:*.ps/'
51369408Sache    complete gv		'p/*/f:*.ps/'
51469408Sache    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
51569408Sache			mtu vlandev vlan metric mediaopt down delete \
51669408Sache			broadcast arp debug)/'
51769408Sache    complete imake	'c/-I/d/'
51869408Sache    complete ipfw 	'p/1/(flush add delete list show zero)/' \
51969408Sache			'n/add/(allow permit accept pass deny drop reject \
52069408Sache			reset count skipto num divert port tee port)/'
52169408Sache    complete javac	'p/*/f:*.java/'
52269408Sache    complete ldif2ldbm	'n/-i/f:*.ldif/'
52369408Sache    complete libtool	'c/--mode=/(compile execute finish install link \
52469408Sache			uninstall)/' 'c/--/(config debug dry-run features \
52569408Sache			finish help quiet silent version mode=)/'
52669408Sache    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
52769408Sache			ltdl-tar version)/'
52869408Sache    complete links	'c/-/(assume-codepage async-dns download-dir \
52969408Sache			format-cache-size ftp-proxy help http-proxy \
53069408Sache			max-connections max-connections-to-host \
53169408Sache			memory-cache-size receive-timeout retries \
53269408Sache			unrestartable-receive-timeout version)/'
53369408Sache    complete natd	c/-/'(alias_address config deny_incoming dynamic \
53469408Sache			inport interface log log_denied log_facility \
53569408Sache			outport outport port pptpalias proxy_only \
53669408Sache			proxy_rule redirect_address redirect_port \
53769408Sache			reverse same_ports unregistered_only use_sockets \
53869408Sache			verbose)'/ 'n@-interface@`ifconfig -l`@'
53969408Sache    complete netstat	'n@-I@`ifconfig -l`@'
54069408Sache    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
54169408Sache			archive-headers debugging demangle disassemble \
54269408Sache			disassemble-all disassemble-zeroes dynamic-reloc \
54369408Sache			dynamic-syms endian= file-headers full-contents \
54469408Sache			headers help info line-numbers no-show-raw-insn \
54569408Sache			prefix-addresses private-headers reloc section-headers \
54669408Sache			section=source stabs start-address= stop-address= \
54769408Sache			syms target= version wide)/' \
54869408Sache			'c/-/(a h i f C d D p r R t T x s S l w)/'
54969408Sache    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
55069408Sache			pke pp)/'
55169408Sache    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
55269408Sache			assume_local_charset= assume_unrec_charset= auth= base \
55369408Sache			book buried_news cache= case cfg= child cookie_file= \
55469408Sache			cookies core crawl debug_partial display= dump editor= \
55569408Sache			emacskeys enable_scrollback error_file= force_html \
55669408Sache			force_secure forms_options from ftp get_data head help \
55769408Sache			hiddenlinks= historical homepage= image_links index= \
55869408Sache			ismap link= localhost mime_header minimal \
55969408Sache			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
56069408Sache			nofilereferer nolist nolog nopause noprint noredir \
56169408Sache			noreferer nostatus number_links partial partial_thres \
56269408Sache			pauth= popup post_data preparsed print pseudo_inlines \
56369408Sache			raw realm reload restrictions= resubmit_posts rlogin \
56469408Sache			selective show_cursor soft_dquotes source stack_dump \
56569408Sache			startfile_ok tagsoup telnet term= tlog trace traversal \
56669408Sache			underscore useragent= validate verbose version vikeys \
56769408Sache			width=)/' 'c/(http|ftp)/$URLS/'
56869408Sache    complete gmake	'c/{--directory=,--include-dir=}/d/' \
56969408Sache			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
57069408Sache			'c/--/(assume-new= assume-old= debug directory= \
57169408Sache			dry-run environment-overrides file= help \
57269408Sache			ignore-errors include-dir= jobs[=N] just-print \
57369408Sache			keep-going load-average[=N] makefile= max-load[=N] \
57469408Sache			new-file= no-builtin-rules no-keep-going \
57569408Sache			no-print-directory old-file= print-data-base \
57669408Sache			print-directory question quiet recon silent stop \
57769408Sache			touch version warn-undefined-variables what-if=)/' \
57869408Sache			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
57969408Sache			'n/=/f/' 'n/-f/f/'
58069408Sache    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
58169408Sache			pcm2 rec igain ogain line1 line2 line3)'/ \
58269408Sache			p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
58369408Sache
58469408Sache    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
58569408Sache    			auth buffer cdr check doublespeed equalizer frames \
58669408Sache			gain halfspeed headphones left lineout list mix mono \
58769408Sache			proxy quiet random rate reopen resync right scale \
58869408Sache			shuffle single0 single1 skip speaker stdout stereo \
58969408Sache			test verbose wav)/'
59069408Sache    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
59169408Sache			flush-logs flush-status flush-tables flush-privileges \
59269408Sache			kill password ping processlist reload refresh \
59369408Sache			shutdown status variables version)/'
59469408Sache    complete mutt	c@-f=@F:${HOME}/Mail/@ \
59569408Sache			n/-a/f/ \
59669408Sache			n/-F/f/ n/-H/f/ \
59769408Sache			n/-s/x:'<subject line>'/ \
59869408Sache			n/-e/x:'<command>'/ \
59969408Sache			n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
60069408Sache			n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
60169408Sache			n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
60269408Sache    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
60369408Sache			querylog start stop restart )/'
604145479Smp    if ($?traditional_complete) then
605145479Smp        complete nm \
606145479Smp		'c/--/(debug-syms defined-only demangle dynamic \
60769408Sache			extern-only format= help line-numbers no-demangle \
60869408Sache			no-sort numeric-sort portability print-armap \
60969408Sache			print-file-name reverse-sort size-sort undefined-only \
61069408Sache			version)/' 'p/*/f:^*.{h,C,c,cc}/'
611145479Smp    else
612145479Smp	complete nm \
613145479Smp		'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
614131962Smp		'c/--target=/x:<bfdname>/' \
615131962Smp		'c/--format=/(bsd sysv posix)/n/' \
616131962Smp		'c/--/(debugsyms extern-only demangle dynamic print-armap \
617131962Smp			print-file-name numeric-sort no-sort reverse-sort \
618131962Smp			size-sort undefined-only portability target= radix= \
619131962Smp			format= defined-only\ line-numbers no-demangle version \
620131962Smp			help)//' \
621131962Smp		'n/*/f:^*.{h,c,cc,s,S}/'
622145479Smp    endif
62369408Sache    complete nmap	'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
62469408Sache    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
62569408Sache    complete postfix    'n/*/(start stop reload abort flush check)/'
62669408Sache    complete postmap	'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
62769408Sache    complete rcsdiff	'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
62869408Sache    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
62969408Sache			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
63069408Sache			bgamma bpp broadcast bs c cc class co core deferglyphs \
63169408Sache			disableModInDev disableVidMode displayID dpi dpms f fc \
63269408Sache			flipPixels fn fp gamma ggamma help indirect kb keeptty \
63369408Sache			ld lf logo ls nolisten string noloadxkb nolock nopn \
63469408Sache			once p pn port probeonly query quiet r rgamma s \
63569408Sache			showconfig sp su t terminate to tst v verbose version \
63669408Sache			weight wm x xkbdb xkbmap)/'
63769408Sache    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
63869408Sache    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
63969408Sache			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
64069408Sache			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
64169408Sache			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
64269408Sache			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
64369408Sache    complete vim	'n/*/f:^*.[oa]/'
64469408Sache    complete where	'n/*/c/'
64569408Sache    complete which	'n/*/c/'
64669408Sache    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
64769408Sache			'c/--/(back-color center colors dither help match \
64869408Sache			maxscale parse scale smooth tile update-domain \
64969408Sache			update-wmaker version workspace)/'
65069408Sache    complete xdb	'p/1/c/'
65169408Sache    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
65269408Sache			hushchecksums hushspecials install interpreter keep \
65369408Sache			margins nogrey noinstall nomakepk noscan paper safer \
65469408Sache			shrinkbuttonn thorough topmargin underlink version)/' \
65569408Sache			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
65669408Sache    complete xlock	'c/-/(allowaccess allowroot debug description \
65769408Sache			echokeys enablesaver grabmouse grabserver hide inroot \
65869408Sache			install inwindow mono mousemotion nolock remote \
65969408Sache			resetsaver sound timeelapsed use3d usefirst verbose \
66069408Sache			wireframe background batchcount bg bitmap both3d \
66169408Sache			count cycles delay delta3d display dpmsoff \
66269408Sache			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
66369408Sache			erasetime fg font foreground geometry help \
66469408Sache			icongeometry info invalid left3d lockdelay logoutCmd \
66569408Sache			mailCmd mailIcon message messagefile messagefont \
66669408Sache			messagesfile mode name ncolors nice nomailIcon none3d \
66769408Sache			parent password planfont program resources right3d \
66869408Sache			saturation size startCmd timeout username validate \
66969408Sache			version visual)/' 'n/-mode/(ant atlantis ball bat \
67069408Sache			blot bouboule bounce braid bubble bubble3d bug cage \
67169408Sache			cartoon clock coral crystal daisy dclock decay deco \
67269408Sache			demon dilemma discrete drift eyes fadeplot flag flame \
67369408Sache			flow forest galaxy gears goop grav helix hop hyper \
67469408Sache			ico ifs image invert julia kaleid kumppa lament laser \
67569408Sache			life life1d life3d lightning lisa lissie loop lyapunov \
67669408Sache			mandelbrot marquee matrix maze moebius morph3d \
67769408Sache			mountain munch nose pacman penrose petal pipes puzzle \
67869408Sache			pyro qix roll rotor rubik shape sierpinski slip sphere \
67969408Sache			spiral spline sproingies stairs star starfish strange \
68069408Sache			superquadrics swarm swirl tetris thornbird triangle \
68169408Sache			tube turtle vines voters wator wire world worm xjack \
68269408Sache			blank bomb random)/' 
68369408Sache    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
68469408Sache    complete wget 	c/--/"(accept= append-output= background cache= \
68569408Sache			continue convert-links cut-dirs= debug \
68669408Sache			delete-after directory-prefix= domains= \
68769408Sache			dont-remove-listing dot-style= exclude-directories= \
68869408Sache			exclude-domains= execute= follow-ftp \
68969408Sache			force-directories force-html glob= header= help \
69069408Sache			http-passwd= http-user= ignore-length \
69169408Sache			include-directories= input-file= level= mirror \
69269408Sache			no-clobber no-directories no-host-directories \
69369408Sache			no-host-lookup no-parent non-verbose \
69469408Sache			output-document= output-file= passive-ftp \
69569408Sache			proxy-passwd= proxy-user= proxy= quiet quota= \
69669408Sache			recursive reject= relative retr-symlinks save-headers \
69769408Sache			server-response span-hosts spider timeout= \
69869408Sache			timestamping tries= user-agent= verbose version wait=)"/
69969408Sache
70069408Sache    # these from Tom Warzeka <tom@waz.cc>
70159243Sobrien
70259243Sobrien    # this one works but is slow and doesn't descend into subdirectories
70359243Sobrien    # complete	cd	C@[./\$~]*@d@ \
70459243Sobrien    #			p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
70559243Sobrien
70659243Sobrien    if ( -r /etc/shells ) then
70759243Sobrien        complete setenv	p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
70859243Sobrien    else
70959243Sobrien	complete setenv	p@1@e@ n@DISPLAY@\$hosts@:
71059243Sobrien    endif
71159243Sobrien    complete unsetenv	n/*/e/
71259243Sobrien
713131962Smp    set _maildir = /var/mail
71459243Sobrien    if (-r $HOME/.mailrc) then
71559243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
71659243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
71759243Sobrien			n@-u@T:$_maildir@ n/-f/f/ \
71859243Sobrien			n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "	" | cut -f 2`'@
71959243Sobrien    else
72059243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
72159243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
72259243Sobrien			n@-u@T:$_maildir@ n/-f/f/ n/*/u/
72359243Sobrien    endif
72483098Smp    unset _maildir
72559243Sobrien
726100616Smp    if (! $?MANPATH) then
727100616Smp	if (-r /usr/share/man) then
728100616Smp	    setenv MANPATH /usr/share/man:
729100616Smp	else
730100616Smp	    setenv MANPATH /usr/man:
731100616Smp	endif
73283098Smp    endif
733100616Smp
734145479Smp    if ($?traditional_complete) then
735145479Smp        # use of $MANPATH from Dan Nicolaescu <dann@ics.uci.edu>
736145479Smp        # use of 'find' adapted from Lubomir Host <host8@kepler.fmph.uniba.sk>
737145479Smp        complete man \
738100616Smp	    'n@1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
739100616Smp	    'n@2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
740100616Smp	    'n@3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
741100616Smp	    'n@4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
742100616Smp	    'n@5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
743100616Smp	    'n@6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
744100616Smp	    'n@7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
745100616Smp	    'n@8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
746100616Smp	    'n@9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
747100616Smp	    'n@0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
748100616Smp	    'n@n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
749100616Smp	    'n@o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
750100616Smp	    'n@l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
751100616Smp	    'n@p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
752100616Smp	    c@-@"(- f k M P s S t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@   \
753100616Smp	    'N@-[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
754100616Smp	    'n@-[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
755100616Smp	    'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
756100616Smp	    #n@*@c@ # old way -- commands only
757145479Smp    else
758145479Smp        complete man	    n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
759131962Smp			    n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
760131962Smp			    n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
761131962Smp			    n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
762131962Smp			    n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
763131962Smp			    n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
764131962Smp			    n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
765131962Smp			    n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
766131962Smp    n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
767131962Smp    n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
768131962Smp  n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
769131962Smp  n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
770131962Smpn@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
771131962Smpn@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
772131962Smp		c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
773131962Smp		N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
774145479Smp    endif
77559243Sobrien
77659243Sobrien    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
77759243Sobrien			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
77859243Sobrien    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
77959243Sobrien    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
78059243Sobrien
78169408Sache    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
78269408Sache    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
78369408Sache
78459243Sobrien    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
785100616Smp    complete xpdf	c/-/"(z g remote raise quit cmap rgb papercolor       \
786100616Smp			      eucjp t1lib freetype ps paperw paperh level1    \
787100616Smp			      upw fullscreen cmd q v h help)"/                \
788100616Smp			n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
789100616Smp			n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
790100616Smp			n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
791100616Smp			n/-{t1lib,freetype}/x:'<font_type>'/                  \
792100616Smp			n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
793100616Smp			n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
794100616Smp			n/-/f:*.{pdf,PDF}/                                    \
795100616Smp			N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
796100616Smp			N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
79759243Sobrien
798131962Smp    complete tcsh	c/-D*=/'x:<value>'/ c/-D/'x:<name>'/ \
799131962Smp			c/-/"(b c d D e f F i l m n q s t v V x X -version)"/ \
800131962Smp			n/-c/c/ n/{-l,--version}/n/ n/*/'f:*.{,t}csh'/
801131962Smp
802131962Smp    complete rpm	c/--/"(query verify nodeps nofiles nomd5 noscripts    \
803131962Smp	                nogpg nopgp install upgrade freshen erase allmatches  \
804131962Smp		        notriggers repackage test rebuild recompile initdb    \
805131962Smp		        rebuilddb addsign resign querytags showrc setperms    \
806131962Smp		        setugids all file group package querybynumber qf      \
807131962Smp		        triggeredby whatprovides whatrequires changelog       \
808131962Smp		        configfiles docfiles dump filesbypkg info last list   \
809131962Smp		        provides queryformat requires scripts state triggers  \
810131962Smp		        triggerscripts allfiles badreloc excludepath checksig \
811131962Smp	                excludedocs force hash ignoresize ignorearch ignoreos \
812131962Smp		        includedocs justdb noorder oldpackage percent prefix  \
813131962Smp		        relocate replace-files replacepkgs buildroot clean    \
814131962Smp		        nobuild rmsource rmspec short-circuit sign target     \
815131962Smp		        help version quiet rcfile pipe dbpath root specfile)"/\
816131962Smp		        c/-/"(q V K i U F e ba bb bp bc bi bl bs ta tb tp tc  \
817131962Smp			ti tl ts a f g p c d l R s h ? v vv -)"/              \
818131962Smp		n/{-f,--file}/f/ n/{-g,--group}/g/ n/--pipe/c/ n/--dbpath/d/  \
819131962Smp		n/--querybynumber/x:'<number>'/ n/--triggeredby/x:'<package>'/\
820131962Smp		n/--what{provides,requires}/x:'<capability>'/ n/--root/d/     \
821131962Smp		n/--{qf,queryformat}/x:'<format>'/ n/--buildroot/d/           \
822131962Smp		n/--excludepath/x:'<oldpath>'/  n/--prefix/x:'<newpath>'/     \
823131962Smp		n/--relocate/x:'<oldpath=newpath>'/ n/--target/x:'<platform>'/\
824131962Smp		n/--rcfile/x:'<filelist>'/ n/--specfile/x:'<specfile>'/       \
825131962Smp	        n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/
826131962Smp
82759243Sobrien    # these conform to the latest GNU versions available at press time ...
82859243Sobrien    # updates by John Gotts <jgotts@engin.umich.edu>
82983098Smp    if (-X emacs) then
83083098Smp      # TW note:  if your version of GNU Emacs supports the "--version" option,
83183098Smp      #           uncomment this line and comment the next to automatically
832131962Smp      #           detect the version, else set "_emacs_ver" to your version.
833100616Smp      #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
834131962Smp      set _emacs_ver=21.3
83583098Smp      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
83683098Smp      complete emacs	c/--/"(batch terminal display no-windows no-init-file \
83783098Smp                               user debug-init unibyte multibyte version help \
83883098Smp                               no-site-file funcall load eval insert kill)"/ \
83983098Smp                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
84083098Smp			n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
84183098Smp	                n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
84283098Smp			n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
84383098Smp			n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
84483098Smp      unset _emacs_ver _emacs_dir
84583098Smp    endif
84659243Sobrien
84759243Sobrien    complete gzcat	c/--/"(force help license quiet version)"/ \
84859243Sobrien			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
84959243Sobrien    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
85059243Sobrien			force help list license no-name quiet recurse \
85159243Sobrien			suffix test verbose version fast best)"/ \
85259243Sobrien			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
85359243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
85459243Sobrien			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
85559243Sobrien			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
85659243Sobrien			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
85759243Sobrien    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
85859243Sobrien			no-name quiet recurse suffix test verbose version)"/ \
85959243Sobrien			c/-/"(c f h l L n q r S t v V -)"/ \
86059243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
86159243Sobrien			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
86259243Sobrien    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
86359243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
86459243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
86559243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
86659243Sobrien    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
86759243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
86859243Sobrien			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
86959243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
87059243Sobrien    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
87159243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
87259243Sobrien			p/1/x:'<fixed_string>'/ N/-*e/f/ \
87359243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
87459243Sobrien    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
87559243Sobrien    complete zmore	n/*/f:*.{gz,Z,z,zip}/
87659243Sobrien    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
87759243Sobrien    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
87859243Sobrien    complete zforce	n/*/f:^*.{gz,tgz}/
87959243Sobrien
880131962Smp    complete dcop 'p/1/`$:0`/ /' \
881131962Smp	'p/2/`$:0 $:1 | awk \{print\ \$1\}`/ /' \
882131962Smp	'p/3/`$:0 $:1 $:2 | sed "s%.* \(.*\)(.*%\1%"`/ /'
883131962Smp
884131962Smp
88559243Sobrien    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
88659243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
88759243Sobrien			regexp file ignore-case word-regexp line-regexp \
88859243Sobrien			no-messages revert-match version help byte-offset \
88959243Sobrien			line-number with-filename no-filename quiet silent \
89059243Sobrien			text directories recursive files-without-match \
89159243Sobrien			files-with-matches count before-context after-context \
89259243Sobrien			context binary unix-byte-offsets)"/ \
89359243Sobrien			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
89459243Sobrien				v w x)"/ \
89559243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
89659243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
89759243Sobrien    complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
89859243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
89959243Sobrien			regexp file ignore-case word-regexp line-regexp \
90059243Sobrien			no-messages revert-match version help byte-offset \
90159243Sobrien			line-number with-filename no-filename quiet silent \
90259243Sobrien			text directories recursive files-without-match \
90359243Sobrien			files-with-matches count before-context after-context \
90459243Sobrien			context binary unix-byte-offsets)"/ \
90559243Sobrien			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
90659243Sobrien				v w x)"/ \
90759243Sobrien			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
90859243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
90959243Sobrien    complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
91059243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
91159243Sobrien			regexp file ignore-case word-regexp line-regexp \
91259243Sobrien			no-messages revert-match version help byte-offset \
91359243Sobrien			line-number with-filename no-filename quiet silent \
91459243Sobrien			text directories recursive files-without-match \
91559243Sobrien			files-with-matches count before-context after-context \
91659243Sobrien			context binary unix-byte-offsets)"/ \
91759243Sobrien			c/-/"(A a B b C c d E e F f G H h i L l n q r s U u V \
91859243Sobrien				v w x)"/ \
91959243Sobrien			p/1/x:'<fixed_string>'/ N/-*e/f/ \
92059243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
92159243Sobrien
922100616Smp    complete sed	c/--/"(quiet silent version help expression file)"/   \
923100616Smp			c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
924100616Smp			n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
925100616Smp			n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
926100616Smp
92759243Sobrien    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
92859243Sobrien    complete who	c/--/"(heading idle count mesg message writable help \
92959243Sobrien    			version)"/ c/-/"(H i m q s T w u -)"/ \
93059243Sobrien			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
93159243Sobrien
93259243Sobrien    complete chown	c/--/"(changes dereference no-dereference silent \
93359243Sobrien    			quiet reference recursive verbose help version)"/ \
93459243Sobrien			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
93569408Sache			n/-/u/: p/1/u/: n/*/f/
93659243Sobrien    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
93759243Sobrien    			recursive verbose help version)"/ \
93859243Sobrien			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
93959243Sobrien    complete chmod	c/--/"(changes silent quiet verbose reference \
94059243Sobrien    			recursive help version)"/ c/-/"(c f R v)"/
94159243Sobrien    complete df		c/--/"(all block-size human-readable si inodes \
94259243Sobrien			kilobytes local megabytes no-sync portability sync \
94359243Sobrien			type print-type exclude-type help version)"/ \
94459243Sobrien			c/-/"(a H h i k l m P T t v x)"/
94559243Sobrien    complete du		c/--/"(all block-size bytes total dereference-args \
94659243Sobrien    			human-readable si kilobytes count-links dereference \
94759243Sobrien			megabytes separate-dirs summarize one-file-system \
94859243Sobrien			exclude-from exclude max-depth help version"/ \
94959243Sobrien			c/-/"(a b c D H h k L l m S s X x)"/
95059243Sobrien
95159243Sobrien    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
95259243Sobrien			show-nonprinting show-ends show-tabs help version)"/ \
95359243Sobrien			c/-/"(A b E e n s T t u v -)"/ n/*/f/
95459243Sobrien    complete mv		c/--/"(backup force interactive update verbose suffix \
95559243Sobrien			version-control help version)"/ \
95659243Sobrien			c/-/"(b f i S u V v -)"/ \
95759243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
95859243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
95959243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
96059243Sobrien    complete cp		c/--/"(archive backup no-dereference force \
96159243Sobrien    			interactive link preserve parents sparse recursive \
96259243Sobrien			symbolic-link suffix update verbose version-control \
96359243Sobrien			one-file-system help version)"/ \
96459243Sobrien			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
96559243Sobrien			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
96659243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
96759243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
96859243Sobrien    complete ln		c/--/"(backup directory force no-dereference \
96959243Sobrien    			interactive symbolic suffix verbose version-control \
97059243Sobrien			help version)"/ \
97159243Sobrien			c/-/"(b d F f i n S s V v -)"/ \
97259243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
97359243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
97459243Sobrien			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
97559243Sobrien			p/1/f/ p/2/x:'<link_name>'/
97659243Sobrien    complete touch	c/--/"(date reference time help version)"/ \
97759243Sobrien			c/-/"(a c d f m r t -)"/ \
97859243Sobrien			n/{-d,--date}/x:'<date_string>'/ \
97959243Sobrien			c/--time/"(access atime mtime modify use)"/ \
98059243Sobrien			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
98159243Sobrien    complete mkdir	c/--/"(mode parents verbose help version)"/ \
98259243Sobrien    			c/-/"(p m -)"/ \
98359243Sobrien			n/{-m,--mode}/x:'<mode>'/ n/*/d/
98459243Sobrien    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
98559243Sobrien    			version)"/ c/-/"(p -)"/ n/*/d/
986131962Smp    complete env 	'c/*=/f/' 'p/1/e/=/' 'p/2/c/'
98759243Sobrien
98859243Sobrien    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
98959243Sobrien			R S T v V w W X z Z)"/ \
99059243Sobrien			c/-[dtx]*/"( B C f F g G i k K m M O p P \
99159243Sobrien			R s S T v w x X z Z)"/ \
99259243Sobrien			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
99359243Sobrien			--catenate --concatenate --create --diff --compare \
99459243Sobrien			--delete --append --list --update --extract --get \
99559243Sobrien			--help --version)"/ \
99659243Sobrien			c/--/"(catenate concatenate create diff compare \
99759243Sobrien			delete append list update extract get atime-preserve \
99859243Sobrien			block-size read-full-blocks directory checkpoint file \
99959243Sobrien			force-local info-script new-volume-script incremental \
100059243Sobrien			listed-incremental dereference ignore-zeros \
100159243Sobrien			ignore-failed-read keep-old-files starting-file \
100259243Sobrien			one-file-system tape-length modification-time \
100359243Sobrien			multi-volume after-date newer old-archive portability \
100459243Sobrien			to-stdout same-permissions preserve-permissions \
100559243Sobrien			absolute-paths preserve record-number remove-files \
100659243Sobrien			same-order preserve-order same-owner sparse \
100759243Sobrien			files-from null totals verbose label version \
100859243Sobrien			interactive confirmation verify exclude exclude-from \
100959243Sobrien			compress uncompress gzip ungzip use-compress-program \
101059243Sobrien			block-compress help version)"/ \
101159243Sobrien			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
101259243Sobrien			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
1013131962Smp			C@/dev@f@ \
101459243Sobrien			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
1015145479Smp			n/{-[Adrtux]j*f,--file}/f:*.{tar.bz2,tbz}/ \
1016131962Smp			n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
1017131962Smp			n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
1018131962Smp			n/{-[Adrtux]*f,--file}/f:*.tar/ \
1019145479Smp			N/{-xj*f,--file}/'`tar -tjf $:-1`'/ \
1020131962Smp			N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
1021131962Smp			N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
102259243Sobrien			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
102359243Sobrien			n/--use-compress-program/c/ \
102459243Sobrien			n/{-b,--block-size}/x:'<block_size>'/ \
102559243Sobrien			n/{-V,--label}/x:'<volume_label>'/ \
102659243Sobrien			n/{-N,--{after-date,newer}}/x:'<date>'/ \
102759243Sobrien			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
102859243Sobrien			n/{-C,--directory}/d/ \
102959243Sobrien			N/{-C,--directory}/'`\ls $:-1`'/ \
103059243Sobrien			n/-[0-7]/"(l m h)"/
103159243Sobrien
1032145479Smp    # Linux filesystems
1033145479Smp    complete  mount	c/-/"(a f F h l n o r s t U v V w)"/ n/-[hV]/n/ \
1034145479Smp    			n/-o/x:'<options>'/ n/-t/x:'<vfstype>'/ \
1035145479Smp    			n/-L/x:'<label>'/ n/-U/x:'<uuid>'/ \
1036145479Smp    			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	 " | cut -f 2`'@
1037145479Smp    complete umount	c/-/"(a h n r t v V)"/ n/-t/x:'<vfstype>'/ \
1038145479Smp    			n/*/'`mount | cut -d " " -f 3`'/
1039145479Smp    # Solaris filesystems
1040145479Smp    #complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
1041145479Smp    #			n/-o/x:'<FSType_options>'/ \
1042145479Smp    #			n@-F@'`\ls -1 /usr/lib/fs`'@ \
1043145479Smp    #			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
1044145479Smp    #complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
1045145479Smp    #			n/*/'`mount | cut -d " " -f 1`'/
1046145479Smp    #complete  mountall	c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
1047145479Smp    #complete umountall	c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
1048145479Smp    #			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
104959243Sobrien
105059243Sobrien    # these deal with NIS (formerly YP); if it's not running you don't need 'em
105183098Smp    if (-X domainname) then
105283098Smp      set _domain = "`domainname`"
105383098Smp      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
105483098Smp      if ("$_domain" != "" && "$_domain" != "noname") then
105583098Smp        complete domainname p@1@D:$_ypdir@" " n@*@n@
105683098Smp        complete ypcat	    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
105783098Smp	                    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
105883098Smp	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
105983098Smp        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
106083098Smp	                    N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
106183098Smp	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
106283098Smp        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
106383098Smp	                    n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
106483098Smp			    N@-m@n@ n@*@\$hosts@
106583098Smp      endif
106683098Smp      unset _domain _ypdir
106783098Smp    endif
106859243Sobrien
106959243Sobrien    complete make \
107059243Sobrien	'n/-f/f/' \
107159243Sobrien      	'c/*=/f/' \
107259243Sobrien	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
107359243Sobrien
107459243Sobrien    if ( -f /etc/printcap ) then
107559243Sobrien	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
107659243Sobrien
107759243Sobrien	complete lpr    'c/-P/$printers/'
107859243Sobrien	complete lpq    'c/-P/$printers/'
107959243Sobrien	complete lprm   'c/-P/$printers/'
108059243Sobrien	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
108159243Sobrien	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
108269408Sache	complete dvilj	'p/*/f:*.dvi/'
108359243Sobrien    endif
108459243Sobrien
1085131962Smp    # From Alphonse Bendt
1086131962Smp    complete ant \
1087131962Smp	 'n/-f/f:*.xml/' \
1088131962Smp	      'n@*@`cat build.xml | sed -n -e "s/[ \t]*<target[\t\n]*name=.\([a-zA-Z0-9_:]*\).*/\1/p"`@'
1089131962Smp
1090131962Smp    if ($?P4CLIENT && -X perl) then
1091131962Smp	# This is from Greg Allen.
1092131962Smp	set p4cmds=(add branch branches commands change changes client clients \
1093131962Smp	    counter counters delete depot depots describe diff diff2 \
1094131962Smp	    edit filelog files fix fixes fstat group groups have help \
1095131962Smp	    info integrate integrated job jobs jobspec label labels \
1096131962Smp	    labelsync lock obliterate opened passwd print protect rename \
1097131962Smp	    reopen resolve resolved revert review reviews set submit \
1098131962Smp	    sync triggers unlock user users verify where)
1099131962Smp	complete p4 'p/1/$p4cmds/' 'n/help/$p4cmds/' \
1100131962Smp	    'n%{-l,label}%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
1101131962Smp	    'n%-t%`p4 $:1s | sed "s/[^ ]* \([^ ]*\) .*/\1/"`%' \
1102131962Smp	    'c%*@%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
1103131962Smp	    'c@//*/*@`p4 files $:-0... |& perl -nle "m%\Q$:-0\E([^#][^/# ] \
1104131962Smp	    *)%;print "\$"1 if \\\!/no such/&&\!"\$"h{"\$"1}++"`@@' \
1105131962Smp	    'c@//@`p4 depots | sed "s/Depot \([^ ]*\) .*/\1/"`@/@'
1106131962Smp    endif
1107131962Smp
1108131962Smp
1109145479Smp    if (! $?traditional_complete) then
1110145479Smp        uncomplete vi
1111145479Smp        uncomplete vim
1112145479Smp        complete {vi,vim,gvim,nvi,elvis} 	n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
1113145479Smp        complete {ispell,spell,spellword}	'n@-d@`ls /usr/lib/ispell/*.aff | sed -e "s/\.aff//" `@' 'n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/'
1114145479Smp        complete elm	'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
1115145479Smp        complete ncftp	'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
1116145479Smp        complete bibtex	'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
1117145479Smp        complete dvi2tty	n/*/f:*.dvi/	# Only files that match *.dvi
1118131962Smp	uncomplete gv
1119131962Smp	uncomplete ghostview
1120145479Smp        complete {gv,ghostview}	'n/*/f:*.{ps,eps,epsi}/'
1121145479Smp        complete enscript \
1122131962Smp		'c/--/(columns= pages= header= no-header truncate-lines \
1123131962Smp			line-numbers setpagedevice= escapes font= \
1124131962Smp			header-font= fancy-header no-job-header \
1125131962Smp			highlight-bars indent= filter= borders page-prefeed \
1126131962Smp			no-page-prefeed lineprinter lines-per-page= mail \
1127131962Smp			media= copies= newline= output= missing-characters \
1128131962Smp			printer= quiet silent landscape portrait \
1129131962Smp			baselineskip= statusdict= title= tabsize= underlay= \
1130131962Smp			verbose version encoding pass-through download-font= \
1131131962Smp			filter-stdin= help highlight-bar-gray= list-media \
1132131962Smp			list-options non-printable-format= page-label-format= \
1133131962Smp			printer-options= ul-angle= ul-font= ul-gray= \
1134131962Smp			ul-position= ul-style= \
1135131962Smp		     )/'
1136145479Smp    endif
1137131962Smp
1138145479Smp    complete dpkg \
1139145479Smp		'c/--{admindir,instdir,root}=/d/' \
1140131962Smp		'c/--debug=/n/' \
1141131962Smp		'c/--{admindir,debug,instdir,root}/(=)//' \
1142131962Smp		'c/--/(admindir= debug= instdir= root= \
1143131962Smp			assert-support-predepends assert-working-epoch \
1144131962Smp			audit auto-deconfigure clear-avail \
1145131962Smp			compare-versions configure contents control \
1146131962Smp			extract force-bad-path field \
1147131962Smp			force-configure-any force-conflicts \
1148131962Smp			force-depends force-depends-version force-help \
1149131962Smp			force-hold force-non-root \
1150131962Smp			force-overwrite-diverted \
1151131962Smp			force-remove-essential force-remove-reinstreq \
1152131962Smp			forget-old-unavail fsys-tarfile get-selections \
1153131962Smp			help ignore-depends info install largemem \
1154131962Smp			license list listfiles merge-avail no-act \
1155131962Smp			pending predep-package print-architecture \
1156131962Smp			print-gnu-build-architecture \
1157131962Smp			print-installation-architecture print-avail \
1158131962Smp			purge record-avail recursive refuse-downgrade \
1159131962Smp			remove search set-selections selected-only \
1160131962Smp			skip-same-version smallmem status unpack \
1161131962Smp			update-avail version vextract \
1162131962Smp		      )//' \
1163131962Smp		'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
1164131962Smp		'n/*/f:*.deb'/
1165145479Smp    complete dpkg-deb 	   'c/--{build}=/d/' \
1166131962Smp			   'c/--/(build contents info field control extract \
1167131962Smp				 vextract fsys-tarfile help version \
1168131962Smp				 license)//' \
1169131962Smp			   'n/*/f:*.deb/'
1170145479Smp    complete apt-get \
1171145479Smp	        'c/--/(build config-file diff-only download-only \
1172131962Smp		   fix-broken fix-missing force-yes help ignore-hold no-download \
1173131962Smp		   no-upgrade option print-uris purge reinstall quiet simulate \
1174131962Smp		   show-upgraded target-release tar-only version yes )/' \
1175131962Smp	    	'c/-/(b c= d f h m o= q qq s t x y )/' \
1176131962Smp 		'n/{source,build-dep}/x:<pkgname>/' \
1177131962Smp 		'n/{remove}/`dpkg -l|grep ^ii|awk \{print\ \$2\}`/' \
1178131962Smp 		'n/{install}/`apt-cache pkgnames | sort`/' \
1179131962Smp 		'C/*/(update upgrade dselect-upgrade source \
1180131962Smp		   build-dep check clean autoclean install remove)/'
1181145479Smp    complete apt-cache \
1182131962Smp 		'c/--/(all-versions config-file generate full help important \
1183131962Smp 		names-only option pkg-cache quiet recurse src-cache version )/' \
1184131962Smp 	    	'c/-/(c= h i o= p= q s= v)/' \
1185131962Smp  		'n/{search}/x:<regex>/' \
1186131962Smp 		'n/{pkgnames,policy,show,showpkg,depends,dotty}/`apt-cache pkgnames | sort`/' \
1187131962Smp 		'C/*/(add gencaches showpkg stats dump dumpavail unmet show \
1188131962Smp 		search depends pkgnames dotty policy )/'
1189131962Smp
119059243Sobrien    unset noglob
119183098Smp    unset _complete
1192131962Smp    unset traditional_complete
119359243Sobrienendif
119459243Sobrien
119559243Sobrienend:
119659243Sobrien	onintr
1197