complete.tcsh revision 131962
159243Sobrien#
2131962Smp# $Id: complete.tcsh,v 1.43 2004/02/22 15:57:15 christos Exp $
359243Sobrien# example file using the new completion code
459243Sobrien#
5131962Smp# Debian GNU/Linux
6131962Smp# /usr/share/doc/tcsh/examples/complete.gz
7131962Smp#
8131962Smp# This file may be read from user's ~/.cshrc or ~/.tcsh 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
52100616Smp	set hosts=($hosts $f)
53100616Smp    endif
5459243Sobrien    unset f
5559243Sobrien    if ( ! $?hosts ) then
5659243Sobrien	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
5759243Sobrien		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
5859243Sobrien		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
5959243Sobrien		   labrea.stanford.edu sumex-aim.stanford.edu \
6059243Sobrien		   tut.cis.ohio-state.edu)
6159243Sobrien    endif
6259243Sobrien
6359243Sobrien    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
6459243Sobrien    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6559243Sobrien    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6659243Sobrien    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
6759243Sobrien    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
6859243Sobrien    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
6959243Sobrien
7059243Sobrien    complete cd  	p/1/d/		# Directories only
7159243Sobrien    complete chdir 	p/1/d/
7259243Sobrien    complete pushd 	p/1/d/
7359243Sobrien    complete popd 	p/1/d/
7459243Sobrien    complete pu 	p/1/d/
7559243Sobrien    complete po 	p/1/d/
7659243Sobrien    complete complete 	p/1/X/		# Completions only
7759243Sobrien    complete uncomplete	n/*/X/
7859243Sobrien    complete exec 	p/1/c/		# Commands only
7959243Sobrien    complete trace 	p/1/c/
8059243Sobrien    complete strace 	p/1/c/
8159243Sobrien    complete which	n/*/c/
8259243Sobrien    complete where	n/*/c/
8359243Sobrien    complete skill 	p/1/c/
8459243Sobrien    complete dde	p/1/c/ 
8559243Sobrien    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
8659243Sobrien    complete sdb	p/1/c/
8759243Sobrien    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
8859243Sobrien    complete xdb	p/1/c/
8959243Sobrien    complete gdb	n/-d/d/ n/*/c/
9059243Sobrien    complete ups	p/1/c/
9159243Sobrien    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
9259243Sobrien    complete unset	n/*/s/
9359243Sobrien    complete alias 	p/1/a/		# only aliases are valid
9459243Sobrien    complete unalias	n/*/a/
9559243Sobrien    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
9659243Sobrien    complete dvips 	n/*/f:*.dvi/
97131962Smpif ($?traditional_complete) then
9859243Sobrien    complete tex 	n/*/f:*.tex/	# Only files that match *.tex
99131962Smpelse
100131962Smp    complete tex 	n/*/f:*.{tex,texi}/	# Files that match *.tex and *.texi
101131962Smpendif
10259243Sobrien    complete latex 	n/*/f:*.{tex,ltx}/
10359243Sobrien    complete su		c/--/"(login fast preserve-environment command shell \
10459243Sobrien			help version)"/	c/-/"(f l m p c s -)"/ \
10559243Sobrien			n/{-c,--command}/c/ \
10659243Sobrien			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
10759243Sobrien    complete cc 	c/-[IL]/d/ \
10859243Sobrien              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
10959243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
11059243Sobrien    complete acc 	c/-[IL]/d/ \
11159243Sobrien       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
11259243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
11359243Sobrien    complete gcc 	c/-[IL]/d/ \
11459243Sobrien		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
11559243Sobrien		               elide-constructors expensive-optimizations \
11659243Sobrien			       float-store force-addr force-mem inline \
11759243Sobrien			       inline-functions keep-inline-functions \
11859243Sobrien			       memoize-lookups no-default-inline \
11959243Sobrien			       no-defer-pop no-function-cse omit-frame-pointer \
12059243Sobrien			       rerun-cse-after-loop schedule-insns \
12159243Sobrien			       schedule-insns2 strength-reduce \
12259243Sobrien			       thread-jumps unroll-all-loops \
12359243Sobrien			       unroll-loops syntax-only all-virtual \
12459243Sobrien			       cond-mismatch dollars-in-identifiers \
12559243Sobrien			       enum-int-equiv no-asm no-builtin \
12659243Sobrien			       no-strict-prototype signed-bitfields \
12759243Sobrien			       signed-char this-is-variable unsigned-bitfields \
12859243Sobrien			       unsigned-char writable-strings call-saved-reg \
12959243Sobrien			       call-used-reg fixed-reg no-common \
13059243Sobrien			       no-gnu-binutils nonnull-objects \
13159243Sobrien			       pcc-struct-return pic PIC shared-data \
13259243Sobrien			       short-enums short-double volatile)"/ \
13359243Sobrien		 	c/-W/"(all aggregate-return cast-align cast-qual \
13459243Sobrien		      	       comment conversion enum-clash error format \
13559243Sobrien		      	       id-clash-len implicit missing-prototypes \
13659243Sobrien		      	       no-parentheses pointer-arith return-type shadow \
13759243Sobrien		      	       strict-prototypes switch uninitialized unused \
13859243Sobrien		      	       write-strings)"/ \
13959243Sobrien		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
14059243Sobrien			       short c68000 c68020 soft-float g gnu unix fpu \
14159243Sobrien			       no-epilogue)"/ \
14259243Sobrien		 	c/-d/"(D M N)"/ \
14359243Sobrien		 	c/-/"(f W vspec v vpath ansi traditional \
14459243Sobrien			      traditional-cpp trigraphs pedantic x o l c g L \
14559243Sobrien			      I D U O O2 C E H B b V M MD MM i dynamic \
14659243Sobrien			      nodtdlib static nostdinc undef)"/ \
14759243Sobrien		 	c/-l/f:*.a/ \
14859243Sobrien		 	n/*/f:*.{c,C,cc,o,a,s,i}/
14959243Sobrien    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
15069408Sache    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
15159243Sobrien    complete rm 	c/--/"(directory force interactive verbose \
15259243Sobrien			recursive help version)"/ c/-/"(d f i v r R -)"/ \
15359243Sobrien			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
15459243Sobrien    complete vi 	n/*/f:^*.[oa]/
15559243Sobrien    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
15659243Sobrien			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
15759243Sobrien			n/-k/"(left right up down)"/ p/2-/b/ \
15859243Sobrien			p/1/'x:<key-sequence or option>'/
15959243Sobrien
16059243Sobrien    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
16159243Sobrien		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
16259243Sobrien			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
16359243Sobrien		  	c/-/"(fstype name perm prune type user nouser \
16459243Sobrien		  	     group nogroup size inum atime mtime ctime exec \
16559243Sobrien			     ok print ls cpio ncpio newer xdev depth \
16659243Sobrien			     daystart follow maxdepth mindepth noleaf version \
16759243Sobrien			     anewer cnewer amin cmin mmin true false uid gid \
16859243Sobrien			     ilname iname ipath iregex links lname empty path \
16959243Sobrien			     regex used xtype fprint fprint0 fprintf \
17059243Sobrien			     print0 printf not a and o or)"/ \
17159243Sobrien			     n/*/d/
17259243Sobrien
17359243Sobrien    complete -%*	c/%/j/			# fill in the jobs builtin
17459243Sobrien    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
17559243Sobrien
17659243Sobrien    complete limit	c/-/"(h)"/ n/*/l/
17759243Sobrien    complete unlimit	c/-/"(h)"/ n/*/l/
17859243Sobrien
17959243Sobrien    complete -co*	p/0/"(compress)"/	# make compress completion
18059243Sobrien						# not ambiguous
181131962Smpif ($?traditional_complete) then
18259243Sobrien    complete zcat	n/*/f:*.Z/
183131962Smpelse
184131962Smp    # "zcat" may be linked to "compress" or "gzip"
185131962Smp    if (-X zcat) then
186131962Smp        zcat --version >& /dev/null
187131962Smp        if ($status != 0) then
188131962Smp            complete zcat	n/*/f:*.Z/
189131962Smp        else
190131962Smp            complete zcat	c/--/"(force help license quiet version)"/ \
191131962Smp				c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
192131962Smp	endif
193131962Smp    endif
194131962Smpendif
19559243Sobrien
19659243Sobrien    complete finger	c/*@/\$hosts/ n/*/u/@ 
19759243Sobrien    complete ping	p/1/\$hosts/
19859243Sobrien    complete traceroute	p/1/\$hosts/
19959243Sobrien
20059243Sobrien    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
20159243Sobrien		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
20259243Sobrien
20359243Sobrien    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
20459243Sobrien
20559243Sobrien    # this one is simple...
20659243Sobrien    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
20759243Sobrien    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
20859243Sobrien    # This one will rsh to the file to fetch the list of files!
20959243Sobrien    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/:'
21059243Sobrien
21159243Sobrien    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
21259243Sobrien		c/conv=*,/"(ascii ebcdic ibm block unblock \
21359243Sobrien			    lcase notrunc ucase swab noerror sync)"/,\
21459243Sobrien		c/conv=/"(ascii ebcdic ibm block unblock \
21559243Sobrien			  lcase notrunc ucase swab noerror sync)"/,\
21659243Sobrien	        c/*=/x:'<number>'/ \
21759243Sobrien		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
21859243Sobrien
21959243Sobrien    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
22059243Sobrien
22159243Sobrien    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
22259243Sobrien		p/2/f:*.a/ p/*/f:*.o/
22359243Sobrien
22459243Sobrien    # these should be merged with the MH completion hacks below - jgotts
225131962Smp    complete {refile,sprev,snext,scan,pick,rmm,inc,folder,show} \
22659243Sobrien		c@+@F:$HOME/Mail/@
22759243Sobrien
22859243Sobrien    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
22959243Sobrien    complete {rexec,rxexec,rxterm,rmterm} \
23059243Sobrien			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
23159243Sobrien			'n/-E/e/' 'n/*/c/'
23259243Sobrien    complete kill	'c/-/S/' 'c/%/j/' \
23359243Sobrien			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
23459243Sobrien
23559243Sobrien    # these from Marc Horowitz <marc@cam.ov.com>
23659243Sobrien    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
23759243Sobrien		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
23859243Sobrien		    'c/-/(verbose quiet force printpath lookup debug map \
23959243Sobrien			  nomap remap zephyr nozephyr readonly write \
24059243Sobrien			  mountpoint noexplicit explicit type mountoptions \
24159243Sobrien			  nosetuid setuid override skipfsck lock user host)/' \
24259243Sobrien		    'n/-e/f/' 'n/*/()/'
24359243Sobrien    complete hesinfo	'p/1/u/' \
24459243Sobrien			'p/2/(passwd group uid grplist pcap pobox cluster \
24559243Sobrien			      filsys sloc service)/'
24659243Sobrien
24759243Sobrien    # these from E. Jay Berkenbilt <ejb@ERA.COM>
24859243Sobrien    # = isn't always followed by a filename or a path anymore - jgotts
249131962Smpif ($?traditional_complete) then
25059243Sobrien    complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
25159243Sobrien    				bindir,sbindir,libexecdir,datadir,\
25259243Sobrien				sysconfdir,sharedstatedir,localstatedir,\
25359243Sobrien				libdir,includedir,oldincludedir,infodir,\
25459243Sobrien				mandir,srcdir}/(=)//' \
25559243Sobrien			 'c/--/(cache-file verbose prefix exec-prefix bindir \
25659243Sobrien			 	sbindir libexecdir datadir sysconfdir \
25759243Sobrien				sharedstatedir localstatedir libdir \
25859243Sobrien				includedir oldincludedir infodir mandir \
25959243Sobrien				srcdir)//'
260131962Smpelse
261131962Smp	complete ./configure \
262131962Smp			'c@--{prefix,exec-prefix,bindir,sbindir,libexecdir,datadir,sysconfdir,sharedstatedir,localstatedir,infodir,mandir,srcdir,x-includes,x-libraries}=*@x:<directory e.g. /usr/local>'@ \
263131962Smp 			'c/--cachefile=*/x:<filename>/' \
264131962Smp  			'c/--{enable,disable,with}-*/x:<feature>//' \
265131962Smp 			'c/--*=/x:<directory>//' \
266131962Smp  			'c/--/(prefix= exec-prefix= bindir= \
267131962Smp			sbindir= libexecdir= datadir= sysconfdir= \
268131962Smp   			sharedstatedir= localstatedir= infodir= \
269131962Smp			mandir= srcdir= x-includes= x-libraries= cachefile= \
270131962Smp 			enable- disable- with- \
271131962Smp 			help no-create quiet silent version verbose )//'
272131962Smpendif
27359243Sobrien    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
27459243Sobrien			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
27559243Sobrien			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
27659243Sobrien		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
27759243Sobrien		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
27859243Sobrien    complete perl	'n/-S/c/'
27959243Sobrien    complete printenv	'n/*/e/'
28059243Sobrien    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
28159243Sobrien			delta diffs edit enter fix get help info \
28259243Sobrien			print prs prt rmdel sccsdiff tell unedit \
28359243Sobrien			unget val what)"/
28459243Sobrien    complete setenv	'p/1/e/' 'c/*:/f/'
28559243Sobrien
28659243Sobrien    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
28759243Sobrien    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
28859243Sobrien
28959243Sobrien    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
29059243Sobrien    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
29159243Sobrien
29259243Sobrien    set folders = ( $FOLDERS )
29359243Sobrien    set mha = ( $MHA )
29459243Sobrien
29559243Sobrien    complete ali \
29659243Sobrien        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
29759243Sobrien        'n,-alias,f,'
29859243Sobrien
29959243Sobrien    complete anno \
30059243Sobrien        'c/-/(component noinplace inplace nodate date text help)/' \
30159243Sobrien        'c,+,$folders,'  \
30259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
30359243Sobrien
30459243Sobrien    complete burst \
30559243Sobrien        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
30659243Sobrien        'c,+,$folders,'  \
30759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
30859243Sobrien
30959243Sobrien    complete comp \
31059243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
31159243Sobrien        'c,+,$folders,'  \
31259243Sobrien        'n,-whatnowproc,c,'  \
31359243Sobrien        'n,-file,f,'\
31459243Sobrien        'n,-form,f,'\
31559243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
31659243Sobrien
31759243Sobrien    complete dist \
31859243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
31959243Sobrien        'c,+,$folders,'  \
32059243Sobrien        'n,-whatnowproc,c,'  \
32159243Sobrien        'n,-form,f,'\
32259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
32359243Sobrien
32459243Sobrien    complete folder \
32559243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
32659243Sobrien        'c,+,$folders,'  \
32759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
32859243Sobrien
32959243Sobrien    complete folders \
33059243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
33159243Sobrien        'c,+,$folders,'  \
33259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33359243Sobrien
33459243Sobrien    complete forw \
33559243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
33659243Sobrien        'c,+,$folders,'  \
33759243Sobrien        'n,-whatnowproc,c,'  \
33859243Sobrien        'n,-filter,f,'\
33959243Sobrien        'n,-form,f,'\
34059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
34159243Sobrien
34259243Sobrien    complete inc \
34359243Sobrien        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
34459243Sobrien        'c,+,$folders,'  \
34559243Sobrien        'n,-audit,f,'\
34659243Sobrien        'n,-form,f,'
34759243Sobrien
34859243Sobrien    complete mark \
34959243Sobrien        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
35059243Sobrien        'c,+,$folders,'  \
35159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
35259243Sobrien
35359243Sobrien    complete mhmail \
35459243Sobrien        'c/-/(body cc from subject help)/' \
35559243Sobrien        'n,-cc,$mha,'  \
35659243Sobrien        'n,-from,$mha,'  \
35759243Sobrien        'n/*/$mha/'
35859243Sobrien
35959243Sobrien    complete mhpath \
36059243Sobrien        'c/-/(help)/' \
36159243Sobrien        'c,+,$folders,'  \
36259243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
36359243Sobrien
36459243Sobrien    complete msgchk \
36559243Sobrien        'c/-/(nodate date nonotify notify help)/' 
36659243Sobrien
36759243Sobrien    complete msh \
36859243Sobrien        'c/-/(prompt noscan scan notopcur topcur help)/' 
36959243Sobrien
37059243Sobrien    complete next \
37159243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
37259243Sobrien        'c,+,$folders,'  \
37359243Sobrien        'n,-moreproc,c,'  \
37459243Sobrien        'n,-showproc,c,'  \
37559243Sobrien        'n,-form,f,'
37659243Sobrien
37759243Sobrien    complete packf \
37859243Sobrien        'c/-/(file help)/' \
37959243Sobrien        'c,+,$folders,'  \
38059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38159243Sobrien
38259243Sobrien    complete pick \
38359243Sobrien        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
38459243Sobrien        'c,+,$folders,'  \
38559243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38659243Sobrien
38759243Sobrien    complete prev \
38859243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
38959243Sobrien        'c,+,$folders,'  \
39059243Sobrien        'n,-moreproc,c,'  \
39159243Sobrien        'n,-showproc,c,'  \
39259243Sobrien        'n,-form,f,'
39359243Sobrien
39459243Sobrien    complete prompter \
39559243Sobrien        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
39659243Sobrien
39759243Sobrien    complete refile \
39859243Sobrien        'c/-/(draft nolink link nopreserve preserve src file help)/' \
39959243Sobrien        'c,+,$folders,'  \
40059243Sobrien        'n,-file,f,'\
40159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
40259243Sobrien
40359243Sobrien    complete rmf \
40459243Sobrien        'c/-/(nointeractive interactive help)/' \
40559243Sobrien        'c,+,$folders,'  
40659243Sobrien
40759243Sobrien    complete rmm \
40859243Sobrien        'c/-/(help)/' \
40959243Sobrien        'c,+,$folders,'  \
41059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
41159243Sobrien
41259243Sobrien    complete scan \
41359243Sobrien        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
41459243Sobrien        'c,+,$folders,'  \
41559243Sobrien        'n,-form,f,'\
41659243Sobrien        'n,-file,f,'\
41759243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
41859243Sobrien
41959243Sobrien    complete send \
42059243Sobrien        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
42159243Sobrien        'n,-alias,f,'\
42259243Sobrien        'n,-filter,f,'
42359243Sobrien
42459243Sobrien    complete show \
42559243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
42659243Sobrien        'c,+,$folders,'  \
42759243Sobrien        'n,-moreproc,c,'  \
42859243Sobrien        'n,-showproc,c,'  \
42959243Sobrien        'n,-form,f,'\
43059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
43159243Sobrien
43259243Sobrien    complete sortm \
43359243Sobrien        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
43459243Sobrien        'c,+,$folders,'  \
43559243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
43659243Sobrien
43759243Sobrien    complete vmh \
43859243Sobrien        'c/-/(prompt vmhproc novmhproc help)/' \
43959243Sobrien        'n,-vmhproc,c,'  
44059243Sobrien
44159243Sobrien    complete whatnow \
44259243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
44359243Sobrien
44459243Sobrien    complete whom \
44559243Sobrien        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
44659243Sobrien        'n,-alias,f,'
44759243Sobrien
44859243Sobrien    complete plum \
44959243Sobrien        'c/-/()/' \
45059243Sobrien        'c,+,$folders,'  \
45159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
45259243Sobrien
45359243Sobrien    complete mail \
45459243Sobrien        'c/-/()/' \
45559243Sobrien        'n/*/$mha/'
45659243Sobrien
45759243Sobrien    endif
45859243Sobrien
45959243Sobrien    #from Dan Nicolaescu <dann@ics.uci.edu>
46059243Sobrien    if ( $?MODULESHOME ) then
46161515Sobrien	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
46259243Sobrien	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
46361515Sobrien	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
46461515Sobrien	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
46561515Sobrien	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
46661515Sobrien	'C%[^-]*%`eval Compl_module`%'
46759243Sobrien    endif
46859243Sobrien
46969408Sache    # from George Cox
470100616Smp    complete acroread	'p/*/f:*.{pdf,PDF}/'
47169408Sache    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
47269408Sache			configtest help)/'
47369408Sache    complete appletviewer	'p/*/f:*.class/'
47469408Sache    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
47569408Sache			help name-prefix= no-lines no-parser output= \
47669408Sache			token-table verbose version yacc)/' \
47769408Sache			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
47869408Sache			'n/-p/f/'
47969408Sache    complete bunzip2	'p/*/f:*.bz2/' 
48069408Sache    complete bzip2	'n/-9/f:^*.bz2/' 'n/-d/f:*.bz2/'
48169408Sache    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
48269408Sache    complete co		'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
48369408Sache    complete crontab	'n/-u/u/'
48469408Sache    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
48569408Sache			modepage negotiate periphlist rescan reset start \
48669408Sache			stop tags tur)/'
48769408Sache    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
48869408Sache			checkfile drop feedinfo flush flushlogs go hangup \
48969408Sache			logmode mode name newgroup param pause readers refile \
49069408Sache			reject reload renumber reserve rmgroup send shutdown \
49169408Sache			kill throttle trace xabort xexec)/'
49269408Sache    complete cvs	'c/--/(help help-commands help-synonyms)/' \
49369408Sache			'p/1/(add admin annotate checkout commit diff \
49469408Sache			edit editors export history import init log login \
49569408Sache			logout rdiff release remove rtag status tag unedit \
49669408Sache			update watch watchers)/' 'n/-a/(edit unedit commit \
49769408Sache			all none)/' 'n/watch/(on off add remove)/'
49869408Sache    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
49969408Sache    complete detex	'p/*/f:*.tex/'
50069408Sache    complete edquota    'n/*/u/'
50169408Sache    complete exec	'p/1/c/'
50269408Sache    complete ghostview	'p/*/f:*.ps/'
50369408Sache    complete gv		'p/*/f:*.ps/'
50469408Sache    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
50569408Sache			mtu vlandev vlan metric mediaopt down delete \
50669408Sache			broadcast arp debug)/'
50769408Sache    complete imake	'c/-I/d/'
50869408Sache    complete ipfw 	'p/1/(flush add delete list show zero)/' \
50969408Sache			'n/add/(allow permit accept pass deny drop reject \
51069408Sache			reset count skipto num divert port tee port)/'
51169408Sache    complete javac	'p/*/f:*.java/'
51269408Sache    complete ldif2ldbm	'n/-i/f:*.ldif/'
51369408Sache    complete libtool	'c/--mode=/(compile execute finish install link \
51469408Sache			uninstall)/' 'c/--/(config debug dry-run features \
51569408Sache			finish help quiet silent version mode=)/'
51669408Sache    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
51769408Sache			ltdl-tar version)/'
51869408Sache    complete links	'c/-/(assume-codepage async-dns download-dir \
51969408Sache			format-cache-size ftp-proxy help http-proxy \
52069408Sache			max-connections max-connections-to-host \
52169408Sache			memory-cache-size receive-timeout retries \
52269408Sache			unrestartable-receive-timeout version)/'
52369408Sache    complete natd	c/-/'(alias_address config deny_incoming dynamic \
52469408Sache			inport interface log log_denied log_facility \
52569408Sache			outport outport port pptpalias proxy_only \
52669408Sache			proxy_rule redirect_address redirect_port \
52769408Sache			reverse same_ports unregistered_only use_sockets \
52869408Sache			verbose)'/ 'n@-interface@`ifconfig -l`@'
52969408Sache    complete netstat	'n@-I@`ifconfig -l`@'
53069408Sache    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
53169408Sache			archive-headers debugging demangle disassemble \
53269408Sache			disassemble-all disassemble-zeroes dynamic-reloc \
53369408Sache			dynamic-syms endian= file-headers full-contents \
53469408Sache			headers help info line-numbers no-show-raw-insn \
53569408Sache			prefix-addresses private-headers reloc section-headers \
53669408Sache			section=source stabs start-address= stop-address= \
53769408Sache			syms target= version wide)/' \
53869408Sache			'c/-/(a h i f C d D p r R t T x s S l w)/'
53969408Sache    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
54069408Sache			pke pp)/'
54169408Sache    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
54269408Sache			assume_local_charset= assume_unrec_charset= auth= base \
54369408Sache			book buried_news cache= case cfg= child cookie_file= \
54469408Sache			cookies core crawl debug_partial display= dump editor= \
54569408Sache			emacskeys enable_scrollback error_file= force_html \
54669408Sache			force_secure forms_options from ftp get_data head help \
54769408Sache			hiddenlinks= historical homepage= image_links index= \
54869408Sache			ismap link= localhost mime_header minimal \
54969408Sache			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
55069408Sache			nofilereferer nolist nolog nopause noprint noredir \
55169408Sache			noreferer nostatus number_links partial partial_thres \
55269408Sache			pauth= popup post_data preparsed print pseudo_inlines \
55369408Sache			raw realm reload restrictions= resubmit_posts rlogin \
55469408Sache			selective show_cursor soft_dquotes source stack_dump \
55569408Sache			startfile_ok tagsoup telnet term= tlog trace traversal \
55669408Sache			underscore useragent= validate verbose version vikeys \
55769408Sache			width=)/' 'c/(http|ftp)/$URLS/'
55869408Sache    complete gmake	'c/{--directory=,--include-dir=}/d/' \
55969408Sache			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
56069408Sache			'c/--/(assume-new= assume-old= debug directory= \
56169408Sache			dry-run environment-overrides file= help \
56269408Sache			ignore-errors include-dir= jobs[=N] just-print \
56369408Sache			keep-going load-average[=N] makefile= max-load[=N] \
56469408Sache			new-file= no-builtin-rules no-keep-going \
56569408Sache			no-print-directory old-file= print-data-base \
56669408Sache			print-directory question quiet recon silent stop \
56769408Sache			touch version warn-undefined-variables what-if=)/' \
56869408Sache			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
56969408Sache			'n/=/f/' 'n/-f/f/'
57069408Sache    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
57169408Sache			pcm2 rec igain ogain line1 line2 line3)'/ \
57269408Sache			p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
57369408Sache
57469408Sache    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
57569408Sache    			auth buffer cdr check doublespeed equalizer frames \
57669408Sache			gain halfspeed headphones left lineout list mix mono \
57769408Sache			proxy quiet random rate reopen resync right scale \
57869408Sache			shuffle single0 single1 skip speaker stdout stereo \
57969408Sache			test verbose wav)/'
58069408Sache    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
58169408Sache			flush-logs flush-status flush-tables flush-privileges \
58269408Sache			kill password ping processlist reload refresh \
58369408Sache			shutdown status variables version)/'
58469408Sache    complete mutt	c@-f=@F:${HOME}/Mail/@ \
58569408Sache			n/-a/f/ \
58669408Sache			n/-F/f/ n/-H/f/ \
58769408Sache			n/-s/x:'<subject line>'/ \
58869408Sache			n/-e/x:'<command>'/ \
58969408Sache			n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
59069408Sache			n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
59169408Sache			n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
59269408Sache    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
59369408Sache			querylog start stop restart )/'
594131962Smp	if ($?traditional_complete) then
59569408Sache    complete nm		'c/--/(debug-syms defined-only demangle dynamic \
59669408Sache			extern-only format= help line-numbers no-demangle \
59769408Sache			no-sort numeric-sort portability print-armap \
59869408Sache			print-file-name reverse-sort size-sort undefined-only \
59969408Sache			version)/' 'p/*/f:^*.{h,C,c,cc}/'
600131962Smp	else
601131962Smp	complete nm	'c/--radix=/x:<radix: _o_ctal _d_ecimal he_x_adecimal>/' \
602131962Smp		'c/--target=/x:<bfdname>/' \
603131962Smp		'c/--format=/(bsd sysv posix)/n/' \
604131962Smp		'c/--/(debugsyms extern-only demangle dynamic print-armap \
605131962Smp			print-file-name numeric-sort no-sort reverse-sort \
606131962Smp			size-sort undefined-only portability target= radix= \
607131962Smp			format= defined-only\ line-numbers no-demangle version \
608131962Smp			help)//' \
609131962Smp		'n/*/f:^*.{h,c,cc,s,S}/'
610131962Smp	endif
61169408Sache    complete nmap	'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
61269408Sache    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
61369408Sache    complete postfix    'n/*/(start stop reload abort flush check)/'
61469408Sache    complete postmap	'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
61569408Sache    complete rcsdiff	'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
61669408Sache    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
61769408Sache			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
61869408Sache			bgamma bpp broadcast bs c cc class co core deferglyphs \
61969408Sache			disableModInDev disableVidMode displayID dpi dpms f fc \
62069408Sache			flipPixels fn fp gamma ggamma help indirect kb keeptty \
62169408Sache			ld lf logo ls nolisten string noloadxkb nolock nopn \
62269408Sache			once p pn port probeonly query quiet r rgamma s \
62369408Sache			showconfig sp su t terminate to tst v verbose version \
62469408Sache			weight wm x xkbdb xkbmap)/'
62569408Sache    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
62669408Sache    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
62769408Sache			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
62869408Sache			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
62969408Sache			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
63069408Sache			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
63169408Sache    complete vim	'n/*/f:^*.[oa]/'
63269408Sache    complete where	'n/*/c/'
63369408Sache    complete which	'n/*/c/'
63469408Sache    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
63569408Sache			'c/--/(back-color center colors dither help match \
63669408Sache			maxscale parse scale smooth tile update-domain \
63769408Sache			update-wmaker version workspace)/'
63869408Sache    complete xdb	'p/1/c/'
63969408Sache    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
64069408Sache			hushchecksums hushspecials install interpreter keep \
64169408Sache			margins nogrey noinstall nomakepk noscan paper safer \
64269408Sache			shrinkbuttonn thorough topmargin underlink version)/' \
64369408Sache			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
64469408Sache    complete xlock	'c/-/(allowaccess allowroot debug description \
64569408Sache			echokeys enablesaver grabmouse grabserver hide inroot \
64669408Sache			install inwindow mono mousemotion nolock remote \
64769408Sache			resetsaver sound timeelapsed use3d usefirst verbose \
64869408Sache			wireframe background batchcount bg bitmap both3d \
64969408Sache			count cycles delay delta3d display dpmsoff \
65069408Sache			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
65169408Sache			erasetime fg font foreground geometry help \
65269408Sache			icongeometry info invalid left3d lockdelay logoutCmd \
65369408Sache			mailCmd mailIcon message messagefile messagefont \
65469408Sache			messagesfile mode name ncolors nice nomailIcon none3d \
65569408Sache			parent password planfont program resources right3d \
65669408Sache			saturation size startCmd timeout username validate \
65769408Sache			version visual)/' 'n/-mode/(ant atlantis ball bat \
65869408Sache			blot bouboule bounce braid bubble bubble3d bug cage \
65969408Sache			cartoon clock coral crystal daisy dclock decay deco \
66069408Sache			demon dilemma discrete drift eyes fadeplot flag flame \
66169408Sache			flow forest galaxy gears goop grav helix hop hyper \
66269408Sache			ico ifs image invert julia kaleid kumppa lament laser \
66369408Sache			life life1d life3d lightning lisa lissie loop lyapunov \
66469408Sache			mandelbrot marquee matrix maze moebius morph3d \
66569408Sache			mountain munch nose pacman penrose petal pipes puzzle \
66669408Sache			pyro qix roll rotor rubik shape sierpinski slip sphere \
66769408Sache			spiral spline sproingies stairs star starfish strange \
66869408Sache			superquadrics swarm swirl tetris thornbird triangle \
66969408Sache			tube turtle vines voters wator wire world worm xjack \
67069408Sache			blank bomb random)/' 
67169408Sache    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
67269408Sache    complete wget 	c/--/"(accept= append-output= background cache= \
67369408Sache			continue convert-links cut-dirs= debug \
67469408Sache			delete-after directory-prefix= domains= \
67569408Sache			dont-remove-listing dot-style= exclude-directories= \
67669408Sache			exclude-domains= execute= follow-ftp \
67769408Sache			force-directories force-html glob= header= help \
67869408Sache			http-passwd= http-user= ignore-length \
67969408Sache			include-directories= input-file= level= mirror \
68069408Sache			no-clobber no-directories no-host-directories \
68169408Sache			no-host-lookup no-parent non-verbose \
68269408Sache			output-document= output-file= passive-ftp \
68369408Sache			proxy-passwd= proxy-user= proxy= quiet quota= \
68469408Sache			recursive reject= relative retr-symlinks save-headers \
68569408Sache			server-response span-hosts spider timeout= \
68669408Sache			timestamping tries= user-agent= verbose version wait=)"/
68769408Sache
68869408Sache    # these from Tom Warzeka <tom@waz.cc>
68959243Sobrien
69059243Sobrien    # this one works but is slow and doesn't descend into subdirectories
69159243Sobrien    # complete	cd	C@[./\$~]*@d@ \
69259243Sobrien    #			p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
69359243Sobrien
69459243Sobrien    if ( -r /etc/shells ) then
69559243Sobrien        complete setenv	p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
69659243Sobrien    else
69759243Sobrien	complete setenv	p@1@e@ n@DISPLAY@\$hosts@:
69859243Sobrien    endif
69959243Sobrien    complete unsetenv	n/*/e/
70059243Sobrien
701131962Smp    set _maildir = /var/mail
70259243Sobrien    if (-r $HOME/.mailrc) then
70359243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
70459243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
70559243Sobrien			n@-u@T:$_maildir@ n/-f/f/ \
70659243Sobrien			n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "	" | cut -f 2`'@
70759243Sobrien    else
70859243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
70959243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
71059243Sobrien			n@-u@T:$_maildir@ n/-f/f/ n/*/u/
71159243Sobrien    endif
71283098Smp    unset _maildir
71359243Sobrien
714100616Smp    if (! $?MANPATH) then
715100616Smp	if (-r /usr/share/man) then
716100616Smp	    setenv MANPATH /usr/share/man:
717100616Smp	else
718100616Smp	    setenv MANPATH /usr/man:
719100616Smp	endif
72083098Smp    endif
721100616Smp
722131962Smp	if ($?traditional_complete) then
723100616Smp    # use of $MANPATH from Dan Nicolaescu <dann@ics.uci.edu>
724100616Smp    # use of 'find' adapted from Lubomir Host <host8@kepler.fmph.uniba.sk>
72583098Smp    complete man \
726100616Smp	    'n@1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
727100616Smp	    'n@2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
728100616Smp	    'n@3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
729100616Smp	    'n@4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
730100616Smp	    'n@5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
731100616Smp	    'n@6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
732100616Smp	    'n@7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
733100616Smp	    'n@8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
734100616Smp	    'n@9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
735100616Smp	    'n@0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
736100616Smp	    'n@n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
737100616Smp	    'n@o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
738100616Smp	    'n@l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
739100616Smp	    'n@p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
740100616Smp	    c@-@"(- f k M P s S t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@   \
741100616Smp	    'N@-[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
742100616Smp	    'n@-[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
743100616Smp	    'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
744100616Smp	    #n@*@c@ # old way -- commands only
745131962Smp	else
746131962Smp    complete man	    n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
747131962Smp			    n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
748131962Smp			    n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
749131962Smp			    n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
750131962Smp			    n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
751131962Smp			    n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
752131962Smp			    n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
753131962Smp			    n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
754131962Smp    n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
755131962Smp    n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
756131962Smp  n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
757131962Smp  n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
758131962Smpn@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
759131962Smpn@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
760131962Smp		c/-/"(- f k P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-P/d/ \
761131962Smp		N@-P@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
762131962Smp	endif
76359243Sobrien
76459243Sobrien    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
76559243Sobrien			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
76659243Sobrien    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
76759243Sobrien    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
76859243Sobrien
76969408Sache    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
77069408Sache    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
77169408Sache
77259243Sobrien    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
773100616Smp    complete xpdf	c/-/"(z g remote raise quit cmap rgb papercolor       \
774100616Smp			      eucjp t1lib freetype ps paperw paperh level1    \
775100616Smp			      upw fullscreen cmd q v h help)"/                \
776100616Smp			n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
777100616Smp			n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
778100616Smp			n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
779100616Smp			n/-{t1lib,freetype}/x:'<font_type>'/                  \
780100616Smp			n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
781100616Smp			n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
782100616Smp			n/-/f:*.{pdf,PDF}/                                    \
783100616Smp			N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
784100616Smp			N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
78559243Sobrien
786131962Smp    complete tcsh	c/-D*=/'x:<value>'/ c/-D/'x:<name>'/ \
787131962Smp			c/-/"(b c d D e f F i l m n q s t v V x X -version)"/ \
788131962Smp			n/-c/c/ n/{-l,--version}/n/ n/*/'f:*.{,t}csh'/
789131962Smp
790131962Smp    complete rpm	c/--/"(query verify nodeps nofiles nomd5 noscripts    \
791131962Smp	                nogpg nopgp install upgrade freshen erase allmatches  \
792131962Smp		        notriggers repackage test rebuild recompile initdb    \
793131962Smp		        rebuilddb addsign resign querytags showrc setperms    \
794131962Smp		        setugids all file group package querybynumber qf      \
795131962Smp		        triggeredby whatprovides whatrequires changelog       \
796131962Smp		        configfiles docfiles dump filesbypkg info last list   \
797131962Smp		        provides queryformat requires scripts state triggers  \
798131962Smp		        triggerscripts allfiles badreloc excludepath checksig \
799131962Smp	                excludedocs force hash ignoresize ignorearch ignoreos \
800131962Smp		        includedocs justdb noorder oldpackage percent prefix  \
801131962Smp		        relocate replace-files replacepkgs buildroot clean    \
802131962Smp		        nobuild rmsource rmspec short-circuit sign target     \
803131962Smp		        help version quiet rcfile pipe dbpath root specfile)"/\
804131962Smp		        c/-/"(q V K i U F e ba bb bp bc bi bl bs ta tb tp tc  \
805131962Smp			ti tl ts a f g p c d l R s h ? v vv -)"/              \
806131962Smp		n/{-f,--file}/f/ n/{-g,--group}/g/ n/--pipe/c/ n/--dbpath/d/  \
807131962Smp		n/--querybynumber/x:'<number>'/ n/--triggeredby/x:'<package>'/\
808131962Smp		n/--what{provides,requires}/x:'<capability>'/ n/--root/d/     \
809131962Smp		n/--{qf,queryformat}/x:'<format>'/ n/--buildroot/d/           \
810131962Smp		n/--excludepath/x:'<oldpath>'/  n/--prefix/x:'<newpath>'/     \
811131962Smp		n/--relocate/x:'<oldpath=newpath>'/ n/--target/x:'<platform>'/\
812131962Smp		n/--rcfile/x:'<filelist>'/ n/--specfile/x:'<specfile>'/       \
813131962Smp	        n/{-[iUFep],--{install,upgrade,freshen,erase,package}}/f:*.rpm/
814131962Smp
81559243Sobrien    # these conform to the latest GNU versions available at press time ...
81659243Sobrien    # updates by John Gotts <jgotts@engin.umich.edu>
81783098Smp    if (-X emacs) then
81883098Smp      # TW note:  if your version of GNU Emacs supports the "--version" option,
81983098Smp      #           uncomment this line and comment the next to automatically
820131962Smp      #           detect the version, else set "_emacs_ver" to your version.
821100616Smp      #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
822131962Smp      set _emacs_ver=21.3
82383098Smp      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
82483098Smp      complete emacs	c/--/"(batch terminal display no-windows no-init-file \
82583098Smp                               user debug-init unibyte multibyte version help \
82683098Smp                               no-site-file funcall load eval insert kill)"/ \
82783098Smp                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
82883098Smp			n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
82983098Smp	                n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
83083098Smp			n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
83183098Smp			n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
83283098Smp      unset _emacs_ver _emacs_dir
83383098Smp    endif
83459243Sobrien
83559243Sobrien    complete gzcat	c/--/"(force help license quiet version)"/ \
83659243Sobrien			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
83759243Sobrien    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
83859243Sobrien			force help list license no-name quiet recurse \
83959243Sobrien			suffix test verbose version fast best)"/ \
84059243Sobrien			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
84159243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
84259243Sobrien			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
84359243Sobrien			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
84459243Sobrien			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
84559243Sobrien    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
84659243Sobrien			no-name quiet recurse suffix test verbose version)"/ \
84759243Sobrien			c/-/"(c f h l L n q r S t v V -)"/ \
84859243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
84959243Sobrien			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
85059243Sobrien    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
85159243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
85259243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
85359243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
85459243Sobrien    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
85559243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
85659243Sobrien			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
85759243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
85859243Sobrien    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
85959243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
86059243Sobrien			p/1/x:'<fixed_string>'/ N/-*e/f/ \
86159243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
86259243Sobrien    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
86359243Sobrien    complete zmore	n/*/f:*.{gz,Z,z,zip}/
86459243Sobrien    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
86559243Sobrien    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
86659243Sobrien    complete zforce	n/*/f:^*.{gz,tgz}/
86759243Sobrien
868131962Smp    complete dcop 'p/1/`$:0`/ /' \
869131962Smp	'p/2/`$:0 $:1 | awk \{print\ \$1\}`/ /' \
870131962Smp	'p/3/`$:0 $:1 $:2 | sed "s%.* \(.*\)(.*%\1%"`/ /'
871131962Smp
872131962Smp
87359243Sobrien    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
87459243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
87559243Sobrien			regexp file ignore-case word-regexp line-regexp \
87659243Sobrien			no-messages revert-match version help byte-offset \
87759243Sobrien			line-number with-filename no-filename quiet silent \
87859243Sobrien			text directories recursive files-without-match \
87959243Sobrien			files-with-matches count before-context after-context \
88059243Sobrien			context binary unix-byte-offsets)"/ \
88159243Sobrien			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 \
88259243Sobrien				v w x)"/ \
88359243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
88459243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
88559243Sobrien    complete egrep	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:'<full_regular_expression>'/ N/-*e/f/ \
89659243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
89759243Sobrien    complete fgrep	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:'<fixed_string>'/ N/-*e/f/ \
90859243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
90959243Sobrien
910100616Smp    complete sed	c/--/"(quiet silent version help expression file)"/   \
911100616Smp			c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
912100616Smp			n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
913100616Smp			n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
914100616Smp
91559243Sobrien    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
91659243Sobrien    complete who	c/--/"(heading idle count mesg message writable help \
91759243Sobrien    			version)"/ c/-/"(H i m q s T w u -)"/ \
91859243Sobrien			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
91959243Sobrien
92059243Sobrien    complete chown	c/--/"(changes dereference no-dereference silent \
92159243Sobrien    			quiet reference recursive verbose help version)"/ \
92259243Sobrien			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
92369408Sache			n/-/u/: p/1/u/: n/*/f/
92459243Sobrien    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
92559243Sobrien    			recursive verbose help version)"/ \
92659243Sobrien			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
92759243Sobrien    complete chmod	c/--/"(changes silent quiet verbose reference \
92859243Sobrien    			recursive help version)"/ c/-/"(c f R v)"/
92959243Sobrien    complete df		c/--/"(all block-size human-readable si inodes \
93059243Sobrien			kilobytes local megabytes no-sync portability sync \
93159243Sobrien			type print-type exclude-type help version)"/ \
93259243Sobrien			c/-/"(a H h i k l m P T t v x)"/
93359243Sobrien    complete du		c/--/"(all block-size bytes total dereference-args \
93459243Sobrien    			human-readable si kilobytes count-links dereference \
93559243Sobrien			megabytes separate-dirs summarize one-file-system \
93659243Sobrien			exclude-from exclude max-depth help version"/ \
93759243Sobrien			c/-/"(a b c D H h k L l m S s X x)"/
93859243Sobrien
93959243Sobrien    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
94059243Sobrien			show-nonprinting show-ends show-tabs help version)"/ \
94159243Sobrien			c/-/"(A b E e n s T t u v -)"/ n/*/f/
94259243Sobrien    complete mv		c/--/"(backup force interactive update verbose suffix \
94359243Sobrien			version-control help version)"/ \
94459243Sobrien			c/-/"(b f i S u V v -)"/ \
94559243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
94659243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
94759243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
94859243Sobrien    complete cp		c/--/"(archive backup no-dereference force \
94959243Sobrien    			interactive link preserve parents sparse recursive \
95059243Sobrien			symbolic-link suffix update verbose version-control \
95159243Sobrien			one-file-system help version)"/ \
95259243Sobrien			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
95359243Sobrien			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
95459243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
95559243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
95659243Sobrien    complete ln		c/--/"(backup directory force no-dereference \
95759243Sobrien    			interactive symbolic suffix verbose version-control \
95859243Sobrien			help version)"/ \
95959243Sobrien			c/-/"(b d F f i n S s V v -)"/ \
96059243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
96159243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
96259243Sobrien			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
96359243Sobrien			p/1/f/ p/2/x:'<link_name>'/
96459243Sobrien    complete touch	c/--/"(date reference time help version)"/ \
96559243Sobrien			c/-/"(a c d f m r t -)"/ \
96659243Sobrien			n/{-d,--date}/x:'<date_string>'/ \
96759243Sobrien			c/--time/"(access atime mtime modify use)"/ \
96859243Sobrien			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
96959243Sobrien    complete mkdir	c/--/"(mode parents verbose help version)"/ \
97059243Sobrien    			c/-/"(p m -)"/ \
97159243Sobrien			n/{-m,--mode}/x:'<mode>'/ n/*/d/
97259243Sobrien    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
97359243Sobrien    			version)"/ c/-/"(p -)"/ n/*/d/
974131962Smp    complete env 	'c/*=/f/' 'p/1/e/=/' 'p/2/c/'
97559243Sobrien
97659243Sobrien    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
97759243Sobrien			R S T v V w W X z Z)"/ \
97859243Sobrien			c/-[dtx]*/"( B C f F g G i k K m M O p P \
97959243Sobrien			R s S T v w x X z Z)"/ \
98059243Sobrien			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
98159243Sobrien			--catenate --concatenate --create --diff --compare \
98259243Sobrien			--delete --append --list --update --extract --get \
98359243Sobrien			--help --version)"/ \
98459243Sobrien			c/--/"(catenate concatenate create diff compare \
98559243Sobrien			delete append list update extract get atime-preserve \
98659243Sobrien			block-size read-full-blocks directory checkpoint file \
98759243Sobrien			force-local info-script new-volume-script incremental \
98859243Sobrien			listed-incremental dereference ignore-zeros \
98959243Sobrien			ignore-failed-read keep-old-files starting-file \
99059243Sobrien			one-file-system tape-length modification-time \
99159243Sobrien			multi-volume after-date newer old-archive portability \
99259243Sobrien			to-stdout same-permissions preserve-permissions \
99359243Sobrien			absolute-paths preserve record-number remove-files \
99459243Sobrien			same-order preserve-order same-owner sparse \
99559243Sobrien			files-from null totals verbose label version \
99659243Sobrien			interactive confirmation verify exclude exclude-from \
99759243Sobrien			compress uncompress gzip ungzip use-compress-program \
99859243Sobrien			block-compress help version)"/ \
99959243Sobrien			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
100059243Sobrien			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
1001131962Smp			C@/dev@f@ \
100259243Sobrien			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
1003131962Smp			n/{-[Adrtux]z*f,--file}/f:*.{tar.gz,tgz}/ \
1004131962Smp			n/{-[Adrtux]Z*f,--file}/f:*.{tar.Z,taz}/ \
1005131962Smp			n/{-[Adrtux]*f,--file}/f:*.tar/ \
1006131962Smp			N/{-xz*f,--file}/'`tar -tzf $:-1`'/ \
1007131962Smp			N/{-xZ*f,--file}/'`tar -tZf $:-1`'/ \
100859243Sobrien			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
100959243Sobrien			n/--use-compress-program/c/ \
101059243Sobrien			n/{-b,--block-size}/x:'<block_size>'/ \
101159243Sobrien			n/{-V,--label}/x:'<volume_label>'/ \
101259243Sobrien			n/{-N,--{after-date,newer}}/x:'<date>'/ \
101359243Sobrien			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
101459243Sobrien			n/{-C,--directory}/d/ \
101559243Sobrien			N/{-C,--directory}/'`\ls $:-1`'/ \
101659243Sobrien			n/-[0-7]/"(l m h)"/
101759243Sobrien
101859243Sobrien    # SVR4 filesystems
101969408Sache    complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
102069408Sache    			n/-o/x:'<FSType_options>'/ \
102169408Sache    			n@-F@'`\ls -1 /usr/lib/fs`'@ \
102269408Sache    			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
102369408Sache    complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
102469408Sache    			n/*/'`mount | cut -d " " -f 1`'/
102569408Sache    complete  mountall	c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
102669408Sache    complete umountall	c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
102769408Sache    			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
102859243Sobrien    # BSD 4.3 filesystems
102969408Sache    #complete  mount	c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \
103069408Sache    #			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	" | cut -f 2`'@
103169408Sache    #complete umount	c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
103269408Sache    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
103369408Sache    #			n/*/'`mount | cut -d " " -f 3`'/
103459243Sobrien    # BSD 4.2 filesystems
103559243Sobrien    #complete  mount	c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
103659243Sobrien    #			n@*@'`cut -d ":" -f 2 /etc/fstab`'@
103759243Sobrien    #complete umount	c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
103859243Sobrien    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
103959243Sobrien    #			n/*/'`mount | cut -d " " -f 3`'/
104059243Sobrien
104159243Sobrien    # these deal with NIS (formerly YP); if it's not running you don't need 'em
104283098Smp    if (-X domainname) then
104383098Smp      set _domain = "`domainname`"
104483098Smp      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
104583098Smp      if ("$_domain" != "" && "$_domain" != "noname") then
104683098Smp        complete domainname p@1@D:$_ypdir@" " n@*@n@
104783098Smp        complete ypcat	    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
104883098Smp	                    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
104983098Smp	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
105083098Smp        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
105183098Smp	                    N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
105283098Smp	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
105383098Smp        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
105483098Smp	                    n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
105583098Smp			    N@-m@n@ n@*@\$hosts@
105683098Smp      endif
105783098Smp      unset _domain _ypdir
105883098Smp    endif
105959243Sobrien
106059243Sobrien    complete make \
106159243Sobrien	'n/-f/f/' \
106259243Sobrien      	'c/*=/f/' \
106359243Sobrien	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
106459243Sobrien
106559243Sobrien    if ( -f /etc/printcap ) then
106659243Sobrien	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
106759243Sobrien
106859243Sobrien	complete lpr    'c/-P/$printers/'
106959243Sobrien	complete lpq    'c/-P/$printers/'
107059243Sobrien	complete lprm   'c/-P/$printers/'
107159243Sobrien	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
107259243Sobrien	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
107369408Sache	complete dvilj	'p/*/f:*.dvi/'
107459243Sobrien    endif
107559243Sobrien
1076131962Smp    # From Alphonse Bendt
1077131962Smp    complete ant \
1078131962Smp	 'n/-f/f:*.xml/' \
1079131962Smp	      'n@*@`cat build.xml | sed -n -e "s/[ \t]*<target[\t\n]*name=.\([a-zA-Z0-9_:]*\).*/\1/p"`@'
1080131962Smp
1081131962Smp    if ($?P4CLIENT && -X perl) then
1082131962Smp	# This is from Greg Allen.
1083131962Smp	set p4cmds=(add branch branches commands change changes client clients \
1084131962Smp	    counter counters delete depot depots describe diff diff2 \
1085131962Smp	    edit filelog files fix fixes fstat group groups have help \
1086131962Smp	    info integrate integrated job jobs jobspec label labels \
1087131962Smp	    labelsync lock obliterate opened passwd print protect rename \
1088131962Smp	    reopen resolve resolved revert review reviews set submit \
1089131962Smp	    sync triggers unlock user users verify where)
1090131962Smp	complete p4 'p/1/$p4cmds/' 'n/help/$p4cmds/' \
1091131962Smp	    'n%{-l,label}%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
1092131962Smp	    'n%-t%`p4 $:1s | sed "s/[^ ]* \([^ ]*\) .*/\1/"`%' \
1093131962Smp	    'c%*@%`p4 labels | sed "s/Label \([^ ]*\) .*/\1/"`%' \
1094131962Smp	    'c@//*/*@`p4 files $:-0... |& perl -nle "m%\Q$:-0\E([^#][^/# ] \
1095131962Smp	    *)%;print "\$"1 if \\\!/no such/&&\!"\$"h{"\$"1}++"`@@' \
1096131962Smp	    'c@//@`p4 depots | sed "s/Depot \([^ ]*\) .*/\1/"`@/@'
1097131962Smp    endif
1098131962Smp
1099131962Smp
1100131962Smp	if (! $?traditional_complete) then
1101131962Smp    uncomplete vi
1102131962Smp    uncomplete vim
1103131962Smp    complete {vi,vim,gvim,nvi,elvis} 	n/*/f:^*.{o,a,so,sa,aux,dvi,log,fig,bbl,blg,bst,idx,ilg,ind,toc}/
1104131962Smp    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}/'
1105131962Smp    complete elm	'n/-[Ai]/f/' 'c@=@F:$HOME/Mail/@' 'n/-s/x:\<subject\>/'
1106131962Smp    complete ncftp	'n@*@`sed -e '1,2d' $HOME/.ncftp/bookmarks | cut -f 1,2 -d "," | tr "," "\012" | sort | uniq ` '@
1107131962Smp    complete bibtex	'n@*@`ls *.aux | sed -e "s/\.aux//"`'@
1108131962Smp    complete dvi2tty	n/*/f:*.dvi/	# Only files that match *.dvi
1109131962Smp	uncomplete gv
1110131962Smp	uncomplete ghostview
1111131962Smp    complete {gv,ghostview}	'n/*/f:*.{ps,eps,epsi}/'
1112131962Smp    complete enscript \
1113131962Smp		'c/--/(columns= pages= header= no-header truncate-lines \
1114131962Smp			line-numbers setpagedevice= escapes font= \
1115131962Smp			header-font= fancy-header no-job-header \
1116131962Smp			highlight-bars indent= filter= borders page-prefeed \
1117131962Smp			no-page-prefeed lineprinter lines-per-page= mail \
1118131962Smp			media= copies= newline= output= missing-characters \
1119131962Smp			printer= quiet silent landscape portrait \
1120131962Smp			baselineskip= statusdict= title= tabsize= underlay= \
1121131962Smp			verbose version encoding pass-through download-font= \
1122131962Smp			filter-stdin= help highlight-bar-gray= list-media \
1123131962Smp			list-options non-printable-format= page-label-format= \
1124131962Smp			printer-options= ul-angle= ul-font= ul-gray= \
1125131962Smp			ul-position= ul-style= \
1126131962Smp		     )/'
1127131962Smp	endif
1128131962Smp
1129131962Smpcomplete dpkg	'c/--{admindir,instdir,root}=/d/' \
1130131962Smp		'c/--debug=/n/' \
1131131962Smp		'c/--{admindir,debug,instdir,root}/(=)//' \
1132131962Smp		'c/--/(admindir= debug= instdir= root= \
1133131962Smp			assert-support-predepends assert-working-epoch \
1134131962Smp			audit auto-deconfigure clear-avail \
1135131962Smp			compare-versions configure contents control \
1136131962Smp			extract force-bad-path field \
1137131962Smp			force-configure-any force-conflicts \
1138131962Smp			force-depends force-depends-version force-help \
1139131962Smp			force-hold force-non-root \
1140131962Smp			force-overwrite-diverted \
1141131962Smp			force-remove-essential force-remove-reinstreq \
1142131962Smp			forget-old-unavail fsys-tarfile get-selections \
1143131962Smp			help ignore-depends info install largemem \
1144131962Smp			license list listfiles merge-avail no-act \
1145131962Smp			pending predep-package print-architecture \
1146131962Smp			print-gnu-build-architecture \
1147131962Smp			print-installation-architecture print-avail \
1148131962Smp			purge record-avail recursive refuse-downgrade \
1149131962Smp			remove search set-selections selected-only \
1150131962Smp			skip-same-version smallmem status unpack \
1151131962Smp			update-avail version vextract \
1152131962Smp		      )//' \
1153131962Smp		'n/{-l}/`dpkg -l|awk \{print\ \$2\}`/' \
1154131962Smp		'n/*/f:*.deb'/
1155131962Smpcomplete dpkg-deb 'c/--{build}=/d/' \
1156131962Smp			   'c/--/(build contents info field control extract \
1157131962Smp				 vextract fsys-tarfile help version \
1158131962Smp				 license)//' \
1159131962Smp			   'n/*/f:*.deb/'
1160131962Smpcomplete apt-get 'c/--/(build config-file diff-only download-only \
1161131962Smp		   fix-broken fix-missing force-yes help ignore-hold no-download \
1162131962Smp		   no-upgrade option print-uris purge reinstall quiet simulate \
1163131962Smp		   show-upgraded target-release tar-only version yes )/' \
1164131962Smp	    	'c/-/(b c= d f h m o= q qq s t x y )/' \
1165131962Smp 		'n/{source,build-dep}/x:<pkgname>/' \
1166131962Smp 		'n/{remove}/`dpkg -l|grep ^ii|awk \{print\ \$2\}`/' \
1167131962Smp 		'n/{install}/`apt-cache pkgnames | sort`/' \
1168131962Smp 		'C/*/(update upgrade dselect-upgrade source \
1169131962Smp		   build-dep check clean autoclean install remove)/'
1170131962Smpcomplete apt-cache \
1171131962Smp 		'c/--/(all-versions config-file generate full help important \
1172131962Smp 		names-only option pkg-cache quiet recurse src-cache version )/' \
1173131962Smp 	    	'c/-/(c= h i o= p= q s= v)/' \
1174131962Smp  		'n/{search}/x:<regex>/' \
1175131962Smp 		'n/{pkgnames,policy,show,showpkg,depends,dotty}/`apt-cache pkgnames | sort`/' \
1176131962Smp 		'C/*/(add gencaches showpkg stats dump dumpavail unmet show \
1177131962Smp 		search depends pkgnames dotty policy )/'
1178131962Smp
117959243Sobrien    unset noglob
118083098Smp    unset _complete
1181131962Smp    unset traditional_complete
118259243Sobrienendif
118359243Sobrien
118459243Sobrienend:
118559243Sobrien	onintr
1186