complete.tcsh revision 69408
159243Sobrien#
269408Sache# $Id: complete.tcsh,v 1.36 2000/11/19 20:50:42 christos Exp $
359243Sobrien# example file using the new completion code
459243Sobrien#
559243Sobrien
659243Sobrienonintr -
759243Sobrienif (! $?prompt) goto end
859243Sobrien
959243Sobrienif ($?tcsh) then
1059243Sobrien    if ($tcsh != 1) then
1159243Sobrien   	set rev=$tcsh:r
1259243Sobrien	set rel=$rev:e
1359243Sobrien	set pat=$tcsh:e
1459243Sobrien	set rev=$rev:r
1559243Sobrien    endif
1659243Sobrien    if ($rev > 5 && $rel > 1) then
1759243Sobrien	set complete=1
1859243Sobrien    endif
1959243Sobrien    unset rev rel pat
2059243Sobrienendif
2159243Sobrien
2259243Sobrienif ($?complete) then
2359243Sobrien    set noglob
2459243Sobrien    set hosts
2559243Sobrien    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
2659243Sobrien        if ( -r $f ) then
2759243Sobrien	    set hosts = ($hosts `grep -v "+" $f | tr -s " " "	" | cut -f 1`)
2859243Sobrien	endif
2959243Sobrien    end
3059243Sobrien    if ( -r $HOME/.netrc ) then
3159243Sobrien	set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
3259243Sobrien	set hosts=($hosts $f)
3359243Sobrien    endif
3459243Sobrien    unset f
3559243Sobrien    if ( ! $?hosts ) then
3659243Sobrien	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
3759243Sobrien		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
3859243Sobrien		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
3959243Sobrien		   labrea.stanford.edu sumex-aim.stanford.edu \
4059243Sobrien		   tut.cis.ohio-state.edu)
4159243Sobrien    endif
4259243Sobrien
4359243Sobrien    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
4459243Sobrien    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4559243Sobrien    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4659243Sobrien    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4759243Sobrien    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
4859243Sobrien    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
4959243Sobrien
5059243Sobrien    complete cd  	p/1/d/		# Directories only
5159243Sobrien    complete chdir 	p/1/d/
5259243Sobrien    complete pushd 	p/1/d/
5359243Sobrien    complete popd 	p/1/d/
5459243Sobrien    complete pu 	p/1/d/
5559243Sobrien    complete po 	p/1/d/
5659243Sobrien    complete complete 	p/1/X/		# Completions only
5759243Sobrien    complete uncomplete	n/*/X/
5859243Sobrien    complete exec 	p/1/c/		# Commands only
5959243Sobrien    complete trace 	p/1/c/
6059243Sobrien    complete strace 	p/1/c/
6159243Sobrien    complete which	n/*/c/
6259243Sobrien    complete where	n/*/c/
6359243Sobrien    complete skill 	p/1/c/
6459243Sobrien    complete dde	p/1/c/ 
6559243Sobrien    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
6659243Sobrien    complete sdb	p/1/c/
6759243Sobrien    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
6859243Sobrien    complete xdb	p/1/c/
6959243Sobrien    complete gdb	n/-d/d/ n/*/c/
7059243Sobrien    complete ups	p/1/c/
7159243Sobrien    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
7259243Sobrien    complete unset	n/*/s/
7359243Sobrien    complete alias 	p/1/a/		# only aliases are valid
7459243Sobrien    complete unalias	n/*/a/
7559243Sobrien    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
7659243Sobrien    complete dvips 	n/*/f:*.dvi/
7759243Sobrien    complete tex 	n/*/f:*.tex/	# Only files that match *.tex
7859243Sobrien    complete latex 	n/*/f:*.{tex,ltx}/
7959243Sobrien    complete su		c/--/"(login fast preserve-environment command shell \
8059243Sobrien			help version)"/	c/-/"(f l m p c s -)"/ \
8159243Sobrien			n/{-c,--command}/c/ \
8259243Sobrien			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
8359243Sobrien    complete cc 	c/-[IL]/d/ \
8459243Sobrien              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
8559243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
8659243Sobrien    complete acc 	c/-[IL]/d/ \
8759243Sobrien       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
8859243Sobrien			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
8959243Sobrien    complete gcc 	c/-[IL]/d/ \
9059243Sobrien		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
9159243Sobrien		               elide-constructors expensive-optimizations \
9259243Sobrien			       float-store force-addr force-mem inline \
9359243Sobrien			       inline-functions keep-inline-functions \
9459243Sobrien			       memoize-lookups no-default-inline \
9559243Sobrien			       no-defer-pop no-function-cse omit-frame-pointer \
9659243Sobrien			       rerun-cse-after-loop schedule-insns \
9759243Sobrien			       schedule-insns2 strength-reduce \
9859243Sobrien			       thread-jumps unroll-all-loops \
9959243Sobrien			       unroll-loops syntax-only all-virtual \
10059243Sobrien			       cond-mismatch dollars-in-identifiers \
10159243Sobrien			       enum-int-equiv no-asm no-builtin \
10259243Sobrien			       no-strict-prototype signed-bitfields \
10359243Sobrien			       signed-char this-is-variable unsigned-bitfields \
10459243Sobrien			       unsigned-char writable-strings call-saved-reg \
10559243Sobrien			       call-used-reg fixed-reg no-common \
10659243Sobrien			       no-gnu-binutils nonnull-objects \
10759243Sobrien			       pcc-struct-return pic PIC shared-data \
10859243Sobrien			       short-enums short-double volatile)"/ \
10959243Sobrien		 	c/-W/"(all aggregate-return cast-align cast-qual \
11059243Sobrien		      	       comment conversion enum-clash error format \
11159243Sobrien		      	       id-clash-len implicit missing-prototypes \
11259243Sobrien		      	       no-parentheses pointer-arith return-type shadow \
11359243Sobrien		      	       strict-prototypes switch uninitialized unused \
11459243Sobrien		      	       write-strings)"/ \
11559243Sobrien		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
11659243Sobrien			       short c68000 c68020 soft-float g gnu unix fpu \
11759243Sobrien			       no-epilogue)"/ \
11859243Sobrien		 	c/-d/"(D M N)"/ \
11959243Sobrien		 	c/-/"(f W vspec v vpath ansi traditional \
12059243Sobrien			      traditional-cpp trigraphs pedantic x o l c g L \
12159243Sobrien			      I D U O O2 C E H B b V M MD MM i dynamic \
12259243Sobrien			      nodtdlib static nostdinc undef)"/ \
12359243Sobrien		 	c/-l/f:*.a/ \
12459243Sobrien		 	n/*/f:*.{c,C,cc,o,a,s,i}/
12559243Sobrien    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
12669408Sache    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
12759243Sobrien    complete rm 	c/--/"(directory force interactive verbose \
12859243Sobrien			recursive help version)"/ c/-/"(d f i v r R -)"/ \
12959243Sobrien			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
13059243Sobrien    complete vi 	n/*/f:^*.[oa]/
13159243Sobrien    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
13259243Sobrien			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
13359243Sobrien			n/-k/"(left right up down)"/ p/2-/b/ \
13459243Sobrien			p/1/'x:<key-sequence or option>'/
13559243Sobrien
13659243Sobrien    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
13759243Sobrien		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
13859243Sobrien			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
13959243Sobrien		  	c/-/"(fstype name perm prune type user nouser \
14059243Sobrien		  	     group nogroup size inum atime mtime ctime exec \
14159243Sobrien			     ok print ls cpio ncpio newer xdev depth \
14259243Sobrien			     daystart follow maxdepth mindepth noleaf version \
14359243Sobrien			     anewer cnewer amin cmin mmin true false uid gid \
14459243Sobrien			     ilname iname ipath iregex links lname empty path \
14559243Sobrien			     regex used xtype fprint fprint0 fprintf \
14659243Sobrien			     print0 printf not a and o or)"/ \
14759243Sobrien			     n/*/d/
14859243Sobrien
14959243Sobrien    complete -%*	c/%/j/			# fill in the jobs builtin
15059243Sobrien    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
15159243Sobrien
15259243Sobrien    complete limit	c/-/"(h)"/ n/*/l/
15359243Sobrien    complete unlimit	c/-/"(h)"/ n/*/l/
15459243Sobrien
15559243Sobrien    complete -co*	p/0/"(compress)"/	# make compress completion
15659243Sobrien						# not ambiguous
15759243Sobrien    complete zcat	n/*/f:*.Z/
15859243Sobrien
15959243Sobrien    complete finger	c/*@/\$hosts/ n/*/u/@ 
16059243Sobrien    complete ping	p/1/\$hosts/
16159243Sobrien    complete traceroute	p/1/\$hosts/
16259243Sobrien
16359243Sobrien    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
16459243Sobrien		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
16559243Sobrien
16659243Sobrien    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
16759243Sobrien
16859243Sobrien    # this one is simple...
16959243Sobrien    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
17059243Sobrien    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
17159243Sobrien    # This one will rsh to the file to fetch the list of files!
17259243Sobrien    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/:'
17359243Sobrien
17459243Sobrien    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
17559243Sobrien		c/conv=*,/"(ascii ebcdic ibm block unblock \
17659243Sobrien			    lcase notrunc ucase swab noerror sync)"/,\
17759243Sobrien		c/conv=/"(ascii ebcdic ibm block unblock \
17859243Sobrien			  lcase notrunc ucase swab noerror sync)"/,\
17959243Sobrien	        c/*=/x:'<number>'/ \
18059243Sobrien		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
18159243Sobrien
18259243Sobrien    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
18359243Sobrien
18459243Sobrien    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
18559243Sobrien		p/2/f:*.a/ p/*/f:*.o/
18659243Sobrien
18759243Sobrien    # these should be merged with the MH completion hacks below - jgotts
18859243Sobrien    complete {sprev,snext} \
18959243Sobrien		c@+@F:$HOME/Mail/@
19059243Sobrien
19159243Sobrien    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
19259243Sobrien    complete {rexec,rxexec,rxterm,rmterm} \
19359243Sobrien			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
19459243Sobrien			'n/-E/e/' 'n/*/c/'
19559243Sobrien    complete kill	'c/-/S/' 'c/%/j/' \
19659243Sobrien			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
19759243Sobrien
19859243Sobrien    # these from Marc Horowitz <marc@cam.ov.com>
19959243Sobrien    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
20059243Sobrien		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
20159243Sobrien		    'c/-/(verbose quiet force printpath lookup debug map \
20259243Sobrien			  nomap remap zephyr nozephyr readonly write \
20359243Sobrien			  mountpoint noexplicit explicit type mountoptions \
20459243Sobrien			  nosetuid setuid override skipfsck lock user host)/' \
20559243Sobrien		    'n/-e/f/' 'n/*/()/'
20659243Sobrien    complete hesinfo	'p/1/u/' \
20759243Sobrien			'p/2/(passwd group uid grplist pcap pobox cluster \
20859243Sobrien			      filsys sloc service)/'
20959243Sobrien
21059243Sobrien    # these from E. Jay Berkenbilt <ejb@ERA.COM>
21159243Sobrien    # = isn't always followed by a filename or a path anymore - jgotts
21259243Sobrien    complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
21359243Sobrien    				bindir,sbindir,libexecdir,datadir,\
21459243Sobrien				sysconfdir,sharedstatedir,localstatedir,\
21559243Sobrien				libdir,includedir,oldincludedir,infodir,\
21659243Sobrien				mandir,srcdir}/(=)//' \
21759243Sobrien			 'c/--/(cache-file verbose prefix exec-prefix bindir \
21859243Sobrien			 	sbindir libexecdir datadir sysconfdir \
21959243Sobrien				sharedstatedir localstatedir libdir \
22059243Sobrien				includedir oldincludedir infodir mandir \
22159243Sobrien				srcdir)//'
22259243Sobrien    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
22359243Sobrien			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
22459243Sobrien			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
22559243Sobrien		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
22659243Sobrien		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
22759243Sobrien    complete perl	'n/-S/c/'
22859243Sobrien    complete printenv	'n/*/e/'
22959243Sobrien    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
23059243Sobrien			delta diffs edit enter fix get help info \
23159243Sobrien			print prs prt rmdel sccsdiff tell unedit \
23259243Sobrien			unget val what)"/
23359243Sobrien    complete setenv	'p/1/e/' 'c/*:/f/'
23459243Sobrien
23559243Sobrien    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
23659243Sobrien    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
23759243Sobrien
23859243Sobrien    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
23959243Sobrien    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
24059243Sobrien
24159243Sobrien    set folders = ( $FOLDERS )
24259243Sobrien    set mha = ( $MHA )
24359243Sobrien
24459243Sobrien    complete ali \
24559243Sobrien        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
24659243Sobrien        'n,-alias,f,'
24759243Sobrien
24859243Sobrien    complete anno \
24959243Sobrien        'c/-/(component noinplace inplace nodate date text help)/' \
25059243Sobrien        'c,+,$folders,'  \
25159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
25259243Sobrien
25359243Sobrien    complete burst \
25459243Sobrien        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
25559243Sobrien        'c,+,$folders,'  \
25659243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
25759243Sobrien
25859243Sobrien    complete comp \
25959243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
26059243Sobrien        'c,+,$folders,'  \
26159243Sobrien        'n,-whatnowproc,c,'  \
26259243Sobrien        'n,-file,f,'\
26359243Sobrien        'n,-form,f,'\
26459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
26559243Sobrien
26659243Sobrien    complete dist \
26759243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
26859243Sobrien        'c,+,$folders,'  \
26959243Sobrien        'n,-whatnowproc,c,'  \
27059243Sobrien        'n,-form,f,'\
27159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
27259243Sobrien
27359243Sobrien    complete folder \
27459243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
27559243Sobrien        'c,+,$folders,'  \
27659243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
27759243Sobrien
27859243Sobrien    complete folders \
27959243Sobrien        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
28059243Sobrien        'c,+,$folders,'  \
28159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
28259243Sobrien
28359243Sobrien    complete forw \
28459243Sobrien        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
28559243Sobrien        'c,+,$folders,'  \
28659243Sobrien        'n,-whatnowproc,c,'  \
28759243Sobrien        'n,-filter,f,'\
28859243Sobrien        'n,-form,f,'\
28959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
29059243Sobrien
29159243Sobrien    complete inc \
29259243Sobrien        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
29359243Sobrien        'c,+,$folders,'  \
29459243Sobrien        'n,-audit,f,'\
29559243Sobrien        'n,-form,f,'
29659243Sobrien
29759243Sobrien    complete mark \
29859243Sobrien        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
29959243Sobrien        'c,+,$folders,'  \
30059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
30159243Sobrien
30259243Sobrien    complete mhmail \
30359243Sobrien        'c/-/(body cc from subject help)/' \
30459243Sobrien        'n,-cc,$mha,'  \
30559243Sobrien        'n,-from,$mha,'  \
30659243Sobrien        'n/*/$mha/'
30759243Sobrien
30859243Sobrien    complete mhpath \
30959243Sobrien        'c/-/(help)/' \
31059243Sobrien        'c,+,$folders,'  \
31159243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
31259243Sobrien
31359243Sobrien    complete msgchk \
31459243Sobrien        'c/-/(nodate date nonotify notify help)/' 
31559243Sobrien
31659243Sobrien    complete msh \
31759243Sobrien        'c/-/(prompt noscan scan notopcur topcur help)/' 
31859243Sobrien
31959243Sobrien    complete next \
32059243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
32159243Sobrien        'c,+,$folders,'  \
32259243Sobrien        'n,-moreproc,c,'  \
32359243Sobrien        'n,-showproc,c,'  \
32459243Sobrien        'n,-form,f,'
32559243Sobrien
32659243Sobrien    complete packf \
32759243Sobrien        'c/-/(file help)/' \
32859243Sobrien        'c,+,$folders,'  \
32959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33059243Sobrien
33159243Sobrien    complete pick \
33259243Sobrien        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
33359243Sobrien        'c,+,$folders,'  \
33459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33559243Sobrien
33659243Sobrien    complete prev \
33759243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
33859243Sobrien        'c,+,$folders,'  \
33959243Sobrien        'n,-moreproc,c,'  \
34059243Sobrien        'n,-showproc,c,'  \
34159243Sobrien        'n,-form,f,'
34259243Sobrien
34359243Sobrien    complete prompter \
34459243Sobrien        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
34559243Sobrien
34659243Sobrien    complete refile \
34759243Sobrien        'c/-/(draft nolink link nopreserve preserve src file help)/' \
34859243Sobrien        'c,+,$folders,'  \
34959243Sobrien        'n,-file,f,'\
35059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
35159243Sobrien
35259243Sobrien    complete rmf \
35359243Sobrien        'c/-/(nointeractive interactive help)/' \
35459243Sobrien        'c,+,$folders,'  
35559243Sobrien
35659243Sobrien    complete rmm \
35759243Sobrien        'c/-/(help)/' \
35859243Sobrien        'c,+,$folders,'  \
35959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
36059243Sobrien
36159243Sobrien    complete scan \
36259243Sobrien        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
36359243Sobrien        'c,+,$folders,'  \
36459243Sobrien        'n,-form,f,'\
36559243Sobrien        'n,-file,f,'\
36659243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
36759243Sobrien
36859243Sobrien    complete send \
36959243Sobrien        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
37059243Sobrien        'n,-alias,f,'\
37159243Sobrien        'n,-filter,f,'
37259243Sobrien
37359243Sobrien    complete show \
37459243Sobrien        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
37559243Sobrien        'c,+,$folders,'  \
37659243Sobrien        'n,-moreproc,c,'  \
37759243Sobrien        'n,-showproc,c,'  \
37859243Sobrien        'n,-form,f,'\
37959243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38059243Sobrien
38159243Sobrien    complete sortm \
38259243Sobrien        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
38359243Sobrien        'c,+,$folders,'  \
38459243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38559243Sobrien
38659243Sobrien    complete vmh \
38759243Sobrien        'c/-/(prompt vmhproc novmhproc help)/' \
38859243Sobrien        'n,-vmhproc,c,'  
38959243Sobrien
39059243Sobrien    complete whatnow \
39159243Sobrien        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
39259243Sobrien
39359243Sobrien    complete whom \
39459243Sobrien        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
39559243Sobrien        'n,-alias,f,'
39659243Sobrien
39759243Sobrien    complete plum \
39859243Sobrien        'c/-/()/' \
39959243Sobrien        'c,+,$folders,'  \
40059243Sobrien        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
40159243Sobrien
40259243Sobrien    complete mail \
40359243Sobrien        'c/-/()/' \
40459243Sobrien        'n/*/$mha/'
40559243Sobrien
40659243Sobrien    endif
40759243Sobrien
40859243Sobrien    #from Dan Nicolaescu <dann@ics.uci.edu>
40959243Sobrien    if ( $?MODULESHOME ) then
41061515Sobrien	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
41159243Sobrien	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
41261515Sobrien	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
41361515Sobrien	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
41461515Sobrien	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
41561515Sobrien	'C%[^-]*%`eval Compl_module`%'
41659243Sobrien    endif
41759243Sobrien
41869408Sache    # from George Cox
41969408Sache    complete acroread	'p/*/f:*.pdf/'
42069408Sache    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
42169408Sache			configtest help)/'
42269408Sache    complete appletviewer	'p/*/f:*.class/'
42369408Sache    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
42469408Sache			help name-prefix= no-lines no-parser output= \
42569408Sache			token-table verbose version yacc)/' \
42669408Sache			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
42769408Sache			'n/-p/f/'
42869408Sache    complete bunzip2	'p/*/f:*.bz2/' 
42969408Sache    complete bzip2	'n/-9/f:^*.bz2/' 'n/-d/f:*.bz2/'
43069408Sache    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
43169408Sache    complete co		'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
43269408Sache    complete crontab	'n/-u/u/'
43369408Sache    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
43469408Sache			modepage negotiate periphlist rescan reset start \
43569408Sache			stop tags tur)/'
43669408Sache    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
43769408Sache			checkfile drop feedinfo flush flushlogs go hangup \
43869408Sache			logmode mode name newgroup param pause readers refile \
43969408Sache			reject reload renumber reserve rmgroup send shutdown \
44069408Sache			kill throttle trace xabort xexec)/'
44169408Sache    complete cvs	'c/--/(help help-commands help-synonyms)/' \
44269408Sache			'p/1/(add admin annotate checkout commit diff \
44369408Sache			edit editors export history import init log login \
44469408Sache			logout rdiff release remove rtag status tag unedit \
44569408Sache			update watch watchers)/' 'n/-a/(edit unedit commit \
44669408Sache			all none)/' 'n/watch/(on off add remove)/'
44769408Sache    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
44869408Sache    complete detex	'p/*/f:*.tex/'
44969408Sache    complete edquota    'n/*/u/'
45069408Sache    complete exec	'p/1/c/'
45169408Sache    complete ghostview	'p/*/f:*.ps/'
45269408Sache    complete gv		'p/*/f:*.ps/'
45369408Sache    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
45469408Sache			mtu vlandev vlan metric mediaopt down delete \
45569408Sache			broadcast arp debug)/'
45669408Sache    complete imake	'c/-I/d/'
45769408Sache    complete ipfw 	'p/1/(flush add delete list show zero)/' \
45869408Sache			'n/add/(allow permit accept pass deny drop reject \
45969408Sache			reset count skipto num divert port tee port)/'
46069408Sache    complete javac	'p/*/f:*.java/'
46169408Sache    complete ldif2ldbm	'n/-i/f:*.ldif/'
46269408Sache    complete libtool	'c/--mode=/(compile execute finish install link \
46369408Sache			uninstall)/' 'c/--/(config debug dry-run features \
46469408Sache			finish help quiet silent version mode=)/'
46569408Sache    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
46669408Sache			ltdl-tar version)/'
46769408Sache    complete links	'c/-/(assume-codepage async-dns download-dir \
46869408Sache			format-cache-size ftp-proxy help http-proxy \
46969408Sache			max-connections max-connections-to-host \
47069408Sache			memory-cache-size receive-timeout retries \
47169408Sache			unrestartable-receive-timeout version)/'
47269408Sache    complete natd	c/-/'(alias_address config deny_incoming dynamic \
47369408Sache			inport interface log log_denied log_facility \
47469408Sache			outport outport port pptpalias proxy_only \
47569408Sache			proxy_rule redirect_address redirect_port \
47669408Sache			reverse same_ports unregistered_only use_sockets \
47769408Sache			verbose)'/ 'n@-interface@`ifconfig -l`@'
47869408Sache    complete netstat	'n@-I@`ifconfig -l`@'
47969408Sache    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
48069408Sache			archive-headers debugging demangle disassemble \
48169408Sache			disassemble-all disassemble-zeroes dynamic-reloc \
48269408Sache			dynamic-syms endian= file-headers full-contents \
48369408Sache			headers help info line-numbers no-show-raw-insn \
48469408Sache			prefix-addresses private-headers reloc section-headers \
48569408Sache			section=source stabs start-address= stop-address= \
48669408Sache			syms target= version wide)/' \
48769408Sache			'c/-/(a h i f C d D p r R t T x s S l w)/'
48869408Sache    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
48969408Sache			pke pp)/'
49069408Sache    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
49169408Sache			assume_local_charset= assume_unrec_charset= auth= base \
49269408Sache			book buried_news cache= case cfg= child cookie_file= \
49369408Sache			cookies core crawl debug_partial display= dump editor= \
49469408Sache			emacskeys enable_scrollback error_file= force_html \
49569408Sache			force_secure forms_options from ftp get_data head help \
49669408Sache			hiddenlinks= historical homepage= image_links index= \
49769408Sache			ismap link= localhost mime_header minimal \
49869408Sache			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
49969408Sache			nofilereferer nolist nolog nopause noprint noredir \
50069408Sache			noreferer nostatus number_links partial partial_thres \
50169408Sache			pauth= popup post_data preparsed print pseudo_inlines \
50269408Sache			raw realm reload restrictions= resubmit_posts rlogin \
50369408Sache			selective show_cursor soft_dquotes source stack_dump \
50469408Sache			startfile_ok tagsoup telnet term= tlog trace traversal \
50569408Sache			underscore useragent= validate verbose version vikeys \
50669408Sache			width=)/' 'c/(http|ftp)/$URLS/'
50769408Sache    complete gmake	'c/{--directory=,--include-dir=}/d/' \
50869408Sache			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
50969408Sache			'c/--/(assume-new= assume-old= debug directory= \
51069408Sache			dry-run environment-overrides file= help \
51169408Sache			ignore-errors include-dir= jobs[=N] just-print \
51269408Sache			keep-going load-average[=N] makefile= max-load[=N] \
51369408Sache			new-file= no-builtin-rules no-keep-going \
51469408Sache			no-print-directory old-file= print-data-base \
51569408Sache			print-directory question quiet recon silent stop \
51669408Sache			touch version warn-undefined-variables what-if=)/' \
51769408Sache			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
51869408Sache			'n/=/f/' 'n/-f/f/'
51969408Sache    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
52069408Sache			pcm2 rec igain ogain line1 line2 line3)'/ \
52169408Sache			p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
52269408Sache
52369408Sache    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
52469408Sache    			auth buffer cdr check doublespeed equalizer frames \
52569408Sache			gain halfspeed headphones left lineout list mix mono \
52669408Sache			proxy quiet random rate reopen resync right scale \
52769408Sache			shuffle single0 single1 skip speaker stdout stereo \
52869408Sache			test verbose wav)/'
52969408Sache    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
53069408Sache			flush-logs flush-status flush-tables flush-privileges \
53169408Sache			kill password ping processlist reload refresh \
53269408Sache			shutdown status variables version)/'
53369408Sache    complete mutt	c@-f=@F:${HOME}/Mail/@ \
53469408Sache			n/-a/f/ \
53569408Sache			n/-F/f/ n/-H/f/ \
53669408Sache			n/-s/x:'<subject line>'/ \
53769408Sache			n/-e/x:'<command>'/ \
53869408Sache			n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
53969408Sache			n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
54069408Sache			n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
54169408Sache    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
54269408Sache			querylog start stop restart )/'
54369408Sache    complete nm		'c/--/(debug-syms defined-only demangle dynamic \
54469408Sache			extern-only format= help line-numbers no-demangle \
54569408Sache			no-sort numeric-sort portability print-armap \
54669408Sache			print-file-name reverse-sort size-sort undefined-only \
54769408Sache			version)/' 'p/*/f:^*.{h,C,c,cc}/'
54869408Sache    complete nmap	'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
54969408Sache    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
55069408Sache    complete postfix    'n/*/(start stop reload abort flush check)/'
55169408Sache    complete postmap	'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
55269408Sache    complete rcsdiff	'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
55369408Sache    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
55469408Sache			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
55569408Sache			bgamma bpp broadcast bs c cc class co core deferglyphs \
55669408Sache			disableModInDev disableVidMode displayID dpi dpms f fc \
55769408Sache			flipPixels fn fp gamma ggamma help indirect kb keeptty \
55869408Sache			ld lf logo ls nolisten string noloadxkb nolock nopn \
55969408Sache			once p pn port probeonly query quiet r rgamma s \
56069408Sache			showconfig sp su t terminate to tst v verbose version \
56169408Sache			weight wm x xkbdb xkbmap)/'
56269408Sache    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
56369408Sache    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
56469408Sache			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
56569408Sache			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
56669408Sache			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
56769408Sache			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
56869408Sache    complete vim	'n/*/f:^*.[oa]/'
56969408Sache    complete where	'n/*/c/'
57069408Sache    complete which	'n/*/c/'
57169408Sache    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
57269408Sache			'c/--/(back-color center colors dither help match \
57369408Sache			maxscale parse scale smooth tile update-domain \
57469408Sache			update-wmaker version workspace)/'
57569408Sache    complete xdb	'p/1/c/'
57669408Sache    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
57769408Sache			hushchecksums hushspecials install interpreter keep \
57869408Sache			margins nogrey noinstall nomakepk noscan paper safer \
57969408Sache			shrinkbuttonn thorough topmargin underlink version)/' \
58069408Sache			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
58169408Sache    complete xlock	'c/-/(allowaccess allowroot debug description \
58269408Sache			echokeys enablesaver grabmouse grabserver hide inroot \
58369408Sache			install inwindow mono mousemotion nolock remote \
58469408Sache			resetsaver sound timeelapsed use3d usefirst verbose \
58569408Sache			wireframe background batchcount bg bitmap both3d \
58669408Sache			count cycles delay delta3d display dpmsoff \
58769408Sache			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
58869408Sache			erasetime fg font foreground geometry help \
58969408Sache			icongeometry info invalid left3d lockdelay logoutCmd \
59069408Sache			mailCmd mailIcon message messagefile messagefont \
59169408Sache			messagesfile mode name ncolors nice nomailIcon none3d \
59269408Sache			parent password planfont program resources right3d \
59369408Sache			saturation size startCmd timeout username validate \
59469408Sache			version visual)/' 'n/-mode/(ant atlantis ball bat \
59569408Sache			blot bouboule bounce braid bubble bubble3d bug cage \
59669408Sache			cartoon clock coral crystal daisy dclock decay deco \
59769408Sache			demon dilemma discrete drift eyes fadeplot flag flame \
59869408Sache			flow forest galaxy gears goop grav helix hop hyper \
59969408Sache			ico ifs image invert julia kaleid kumppa lament laser \
60069408Sache			life life1d life3d lightning lisa lissie loop lyapunov \
60169408Sache			mandelbrot marquee matrix maze moebius morph3d \
60269408Sache			mountain munch nose pacman penrose petal pipes puzzle \
60369408Sache			pyro qix roll rotor rubik shape sierpinski slip sphere \
60469408Sache			spiral spline sproingies stairs star starfish strange \
60569408Sache			superquadrics swarm swirl tetris thornbird triangle \
60669408Sache			tube turtle vines voters wator wire world worm xjack \
60769408Sache			blank bomb random)/' 
60869408Sache    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
60969408Sache    complete wget 	c/--/"(accept= append-output= background cache= \
61069408Sache			continue convert-links cut-dirs= debug \
61169408Sache			delete-after directory-prefix= domains= \
61269408Sache			dont-remove-listing dot-style= exclude-directories= \
61369408Sache			exclude-domains= execute= follow-ftp \
61469408Sache			force-directories force-html glob= header= help \
61569408Sache			http-passwd= http-user= ignore-length \
61669408Sache			include-directories= input-file= level= mirror \
61769408Sache			no-clobber no-directories no-host-directories \
61869408Sache			no-host-lookup no-parent non-verbose \
61969408Sache			output-document= output-file= passive-ftp \
62069408Sache			proxy-passwd= proxy-user= proxy= quiet quota= \
62169408Sache			recursive reject= relative retr-symlinks save-headers \
62269408Sache			server-response span-hosts spider timeout= \
62369408Sache			timestamping tries= user-agent= verbose version wait=)"/
62469408Sache
62569408Sache    # these from Tom Warzeka <tom@waz.cc>
62659243Sobrien    # you may need to set the following variables for your host
62769408Sache    set _elispdir = /usr/local/share/emacs/20.7/lisp # GNU Emacs lisp directory
62859243Sobrien    set _maildir = /var/spool/mail  # Post Office: /var/spool/mail or /usr/mail
62959243Sobrien    set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
63059243Sobrien    set _domain = "`domainname`"
63159243Sobrien
63259243Sobrien    # this one works but is slow and doesn't descend into subdirectories
63359243Sobrien    # complete	cd	C@[./\$~]*@d@ \
63459243Sobrien    #			p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
63559243Sobrien
63659243Sobrien    if ( -r /etc/shells ) then
63759243Sobrien        complete setenv	p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
63859243Sobrien    else
63959243Sobrien	complete setenv	p@1@e@ n@DISPLAY@\$hosts@:
64059243Sobrien    endif
64159243Sobrien    complete unsetenv	n/*/e/
64259243Sobrien
64359243Sobrien    if (-r $HOME/.mailrc) then
64459243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
64559243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
64659243Sobrien			n@-u@T:$_maildir@ n/-f/f/ \
64759243Sobrien			n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "	" | cut -f 2`'@
64859243Sobrien    else
64959243Sobrien        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
65059243Sobrien			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
65159243Sobrien			n@-u@T:$_maildir@ n/-f/f/ n/*/u/
65259243Sobrien    endif
65359243Sobrien
65459243Sobrien    complete man	    n@1@'`\ls -1 /usr/man/man1 | sed s%\\.1.\*\$%%`'@ \
65559243Sobrien			    n@2@'`\ls -1 /usr/man/man2 | sed s%\\.2.\*\$%%`'@ \
65659243Sobrien			    n@3@'`\ls -1 /usr/man/man3 | sed s%\\.3.\*\$%%`'@ \
65759243Sobrien			    n@4@'`\ls -1 /usr/man/man4 | sed s%\\.4.\*\$%%`'@ \
65859243Sobrien			    n@5@'`\ls -1 /usr/man/man5 | sed s%\\.5.\*\$%%`'@ \
65959243Sobrien			    n@6@'`\ls -1 /usr/man/man6 | sed s%\\.6.\*\$%%`'@ \
66059243Sobrien			    n@7@'`\ls -1 /usr/man/man7 | sed s%\\.7.\*\$%%`'@ \
66159243Sobrien			    n@8@'`\ls -1 /usr/man/man8 | sed s%\\.8.\*\$%%`'@ \
66259243Sobrien    n@9@'`[ -r /usr/man/man9 ] && \ls -1 /usr/man/man9 | sed s%\\.9.\*\$%%`'@ \
66359243Sobrien    n@0@'`[ -r /usr/man/man0 ] && \ls -1 /usr/man/man0 | sed s%\\.0.\*\$%%`'@ \
66459243Sobrien  n@new@'`[ -r /usr/man/mann ] && \ls -1 /usr/man/mann | sed s%\\.n.\*\$%%`'@ \
66559243Sobrien  n@old@'`[ -r /usr/man/mano ] && \ls -1 /usr/man/mano | sed s%\\.o.\*\$%%`'@ \
66659243Sobrienn@local@'`[ -r /usr/man/manl ] && \ls -1 /usr/man/manl | sed s%\\.l.\*\$%%`'@ \
66759243Sobrienn@public@'`[ -r /usr/man/manp ]&& \ls -1 /usr/man/manp | sed s%\\.p.\*\$%%`'@ \
66859243Sobrien		c/-/"(- f k M P s t)"/ n/-f/c/ n/-k/x:'<keyword>'/ n/-[MP]/d/ \
66959243Sobrien		N@-[MP]@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n/*/c/
67059243Sobrien
67159243Sobrien    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
67259243Sobrien			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
67359243Sobrien    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
67459243Sobrien    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
67559243Sobrien
67669408Sache    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
67769408Sache    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
67869408Sache
67959243Sobrien    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
68059243Sobrien
68159243Sobrien    # these conform to the latest GNU versions available at press time ...
68259243Sobrien    # updates by John Gotts <jgotts@engin.umich.edu>
68359243Sobrien
68459243Sobrien    complete emacs	c/-/"(batch d f funcall i insert kill l load \
68559243Sobrien			no-init-file nw q t u user)"/ c/+/x:'<line_number>'/ \
68659243Sobrien			n/-d/x:'<display>'/ n/-f/x:'<lisp_function>'/ n/-i/f/ \
68759243Sobrien			n@-l@F:$_elispdir@ n/-t/x:'<terminal>'/ \
68859243Sobrien			n/-u/u/ n/*/f:^*[\#~]/
68959243Sobrien
69059243Sobrien    complete gzcat	c/--/"(force help license quiet version)"/ \
69159243Sobrien			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
69259243Sobrien    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
69359243Sobrien			force help list license no-name quiet recurse \
69459243Sobrien			suffix test verbose version fast best)"/ \
69559243Sobrien			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
69659243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
69759243Sobrien			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
69859243Sobrien			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
69959243Sobrien			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
70059243Sobrien    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
70159243Sobrien			no-name quiet recurse suffix test verbose version)"/ \
70259243Sobrien			c/-/"(c f h l L n q r S t v V -)"/ \
70359243Sobrien			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
70459243Sobrien			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
70559243Sobrien    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
70659243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
70759243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
70859243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
70959243Sobrien    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
71059243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
71159243Sobrien			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
71259243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
71359243Sobrien    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
71459243Sobrien			c/-/"(A b B c C e f h i l n s v V w x)"/ \
71559243Sobrien			p/1/x:'<fixed_string>'/ N/-*e/f/ \
71659243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
71759243Sobrien    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
71859243Sobrien    complete zmore	n/*/f:*.{gz,Z,z,zip}/
71959243Sobrien    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
72059243Sobrien    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
72159243Sobrien    complete zforce	n/*/f:^*.{gz,tgz}/
72259243Sobrien
72359243Sobrien    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
72459243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
72559243Sobrien			regexp file ignore-case word-regexp line-regexp \
72659243Sobrien			no-messages revert-match version help byte-offset \
72759243Sobrien			line-number with-filename no-filename quiet silent \
72859243Sobrien			text directories recursive files-without-match \
72959243Sobrien			files-with-matches count before-context after-context \
73059243Sobrien			context binary unix-byte-offsets)"/ \
73159243Sobrien			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 \
73259243Sobrien				v w x)"/ \
73359243Sobrien			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
73459243Sobrien			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
73559243Sobrien    complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
73659243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
73759243Sobrien			regexp file ignore-case word-regexp line-regexp \
73859243Sobrien			no-messages revert-match version help byte-offset \
73959243Sobrien			line-number with-filename no-filename quiet silent \
74059243Sobrien			text directories recursive files-without-match \
74159243Sobrien			files-with-matches count before-context after-context \
74259243Sobrien			context binary unix-byte-offsets)"/ \
74359243Sobrien			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 \
74459243Sobrien				v w x)"/ \
74559243Sobrien			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
74659243Sobrien			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
74759243Sobrien    complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
74859243Sobrien			c/--/"(extended-regexp fixed-regexp basic-regexp \
74959243Sobrien			regexp file ignore-case word-regexp line-regexp \
75059243Sobrien			no-messages revert-match version help byte-offset \
75159243Sobrien			line-number with-filename no-filename quiet silent \
75259243Sobrien			text directories recursive files-without-match \
75359243Sobrien			files-with-matches count before-context after-context \
75459243Sobrien			context binary unix-byte-offsets)"/ \
75559243Sobrien			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 \
75659243Sobrien				v w x)"/ \
75759243Sobrien			p/1/x:'<fixed_string>'/ N/-*e/f/ \
75859243Sobrien			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
75959243Sobrien
76059243Sobrien    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
76159243Sobrien    complete who	c/--/"(heading idle count mesg message writable help \
76259243Sobrien    			version)"/ c/-/"(H i m q s T w u -)"/ \
76359243Sobrien			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
76459243Sobrien
76559243Sobrien    complete chown	c/--/"(changes dereference no-dereference silent \
76659243Sobrien    			quiet reference recursive verbose help version)"/ \
76759243Sobrien			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
76869408Sache			n/-/u/: p/1/u/: n/*/f/
76959243Sobrien    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
77059243Sobrien    			recursive verbose help version)"/ \
77159243Sobrien			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
77259243Sobrien    complete chmod	c/--/"(changes silent quiet verbose reference \
77359243Sobrien    			recursive help version)"/ c/-/"(c f R v)"/
77459243Sobrien    complete df		c/--/"(all block-size human-readable si inodes \
77559243Sobrien			kilobytes local megabytes no-sync portability sync \
77659243Sobrien			type print-type exclude-type help version)"/ \
77759243Sobrien			c/-/"(a H h i k l m P T t v x)"/
77859243Sobrien    complete du		c/--/"(all block-size bytes total dereference-args \
77959243Sobrien    			human-readable si kilobytes count-links dereference \
78059243Sobrien			megabytes separate-dirs summarize one-file-system \
78159243Sobrien			exclude-from exclude max-depth help version"/ \
78259243Sobrien			c/-/"(a b c D H h k L l m S s X x)"/
78359243Sobrien
78459243Sobrien    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
78559243Sobrien			show-nonprinting show-ends show-tabs help version)"/ \
78659243Sobrien			c/-/"(A b E e n s T t u v -)"/ n/*/f/
78759243Sobrien    complete mv		c/--/"(backup force interactive update verbose suffix \
78859243Sobrien			version-control help version)"/ \
78959243Sobrien			c/-/"(b f i S u V v -)"/ \
79059243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
79159243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
79259243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
79359243Sobrien    complete cp		c/--/"(archive backup no-dereference force \
79459243Sobrien    			interactive link preserve parents sparse recursive \
79559243Sobrien			symbolic-link suffix update verbose version-control \
79659243Sobrien			one-file-system help version)"/ \
79759243Sobrien			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
79859243Sobrien			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
79959243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
80059243Sobrien			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
80159243Sobrien    complete ln		c/--/"(backup directory force no-dereference \
80259243Sobrien    			interactive symbolic suffix verbose version-control \
80359243Sobrien			help version)"/ \
80459243Sobrien			c/-/"(b d F f i n S s V v -)"/ \
80559243Sobrien			n/{-S,--suffix}/x:'<suffix>'/ \
80659243Sobrien			n/{-V,--version-control}/"(t numbered nil existing \
80759243Sobrien			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
80859243Sobrien			p/1/f/ p/2/x:'<link_name>'/
80959243Sobrien    complete touch	c/--/"(date reference time help version)"/ \
81059243Sobrien			c/-/"(a c d f m r t -)"/ \
81159243Sobrien			n/{-d,--date}/x:'<date_string>'/ \
81259243Sobrien			c/--time/"(access atime mtime modify use)"/ \
81359243Sobrien			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
81459243Sobrien    complete mkdir	c/--/"(mode parents verbose help version)"/ \
81559243Sobrien    			c/-/"(p m -)"/ \
81659243Sobrien			n/{-m,--mode}/x:'<mode>'/ n/*/d/
81759243Sobrien    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
81859243Sobrien    			version)"/ c/-/"(p -)"/ n/*/d/
81959243Sobrien
82059243Sobrien    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
82159243Sobrien			R S T v V w W X z Z)"/ \
82259243Sobrien			c/-[dtx]*/"( B C f F g G i k K m M O p P \
82359243Sobrien			R s S T v w x X z Z)"/ \
82459243Sobrien			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
82559243Sobrien			--catenate --concatenate --create --diff --compare \
82659243Sobrien			--delete --append --list --update --extract --get \
82759243Sobrien			--help --version)"/ \
82859243Sobrien			c/--/"(catenate concatenate create diff compare \
82959243Sobrien			delete append list update extract get atime-preserve \
83059243Sobrien			block-size read-full-blocks directory checkpoint file \
83159243Sobrien			force-local info-script new-volume-script incremental \
83259243Sobrien			listed-incremental dereference ignore-zeros \
83359243Sobrien			ignore-failed-read keep-old-files starting-file \
83459243Sobrien			one-file-system tape-length modification-time \
83559243Sobrien			multi-volume after-date newer old-archive portability \
83659243Sobrien			to-stdout same-permissions preserve-permissions \
83759243Sobrien			absolute-paths preserve record-number remove-files \
83859243Sobrien			same-order preserve-order same-owner sparse \
83959243Sobrien			files-from null totals verbose label version \
84059243Sobrien			interactive confirmation verify exclude exclude-from \
84159243Sobrien			compress uncompress gzip ungzip use-compress-program \
84259243Sobrien			block-compress help version)"/ \
84359243Sobrien			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
84459243Sobrien			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
84569408Sache			C@[/dev]@f@ \
84659243Sobrien			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
84769408Sache			n/{-[Adrtux]*f,--file}/f:*.{tar,taz,tgz}/ \
84859243Sobrien			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
84959243Sobrien			n/--use-compress-program/c/ \
85059243Sobrien			n/{-b,--block-size}/x:'<block_size>'/ \
85159243Sobrien			n/{-V,--label}/x:'<volume_label>'/ \
85259243Sobrien			n/{-N,--{after-date,newer}}/x:'<date>'/ \
85359243Sobrien			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
85459243Sobrien			n/{-C,--directory}/d/ \
85559243Sobrien			N/{-C,--directory}/'`\ls $:-1`'/ \
85659243Sobrien			n/-[0-7]/"(l m h)"/
85759243Sobrien
85859243Sobrien    # SVR4 filesystems
85969408Sache    complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
86069408Sache    			n/-o/x:'<FSType_options>'/ \
86169408Sache    			n@-F@'`\ls -1 /usr/lib/fs`'@ \
86269408Sache    			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
86369408Sache    complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
86469408Sache    			n/*/'`mount | cut -d " " -f 1`'/
86569408Sache    complete  mountall	c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
86669408Sache    complete umountall	c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
86769408Sache    			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
86859243Sobrien    # BSD 4.3 filesystems
86969408Sache    #complete  mount	c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \
87069408Sache    #			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	" | cut -f 2`'@
87169408Sache    #complete umount	c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
87269408Sache    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
87369408Sache    #			n/*/'`mount | cut -d " " -f 3`'/
87459243Sobrien    # BSD 4.2 filesystems
87559243Sobrien    #complete  mount	c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
87659243Sobrien    #			n@*@'`cut -d ":" -f 2 /etc/fstab`'@
87759243Sobrien    #complete umount	c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
87859243Sobrien    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
87959243Sobrien    #			n/*/'`mount | cut -d " " -f 3`'/
88059243Sobrien
88159243Sobrien    # these deal with NIS (formerly YP); if it's not running you don't need 'em
88259243Sobrien    complete domainname	p@1@D:$_ypdir@" " n@*@n@
88359243Sobrien    complete ypcat	c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
88459243Sobrien	    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
88559243Sobrien	  n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
88659243Sobrien    complete ypmatch	c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
88759243Sobrien	            N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
88859243Sobrien	  n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
88959243Sobrien    complete ypwhich	c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
89059243Sobrien	 n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
89159243Sobrien			N@-m@n@ n@*@\$hosts@
89259243Sobrien
89359243Sobrien    # there's no need to clutter the user's shell with these
89459243Sobrien    unset _elispdir _maildir _ypdir _domain
89559243Sobrien
89659243Sobrien    complete make \
89759243Sobrien	'n/-f/f/' \
89859243Sobrien      	'c/*=/f/' \
89959243Sobrien	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
90059243Sobrien
90159243Sobrien    if ( -f /etc/printcap ) then
90259243Sobrien	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
90359243Sobrien
90459243Sobrien	complete lpr    'c/-P/$printers/'
90559243Sobrien	complete lpq    'c/-P/$printers/'
90659243Sobrien	complete lprm   'c/-P/$printers/'
90759243Sobrien	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
90859243Sobrien	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
90969408Sache	complete dvilj	'p/*/f:*.dvi/'
91059243Sobrien    endif
91159243Sobrien
91259243Sobrien    unset noglob
91359243Sobrien    unset complete
91459243Sobrienendif
91559243Sobrien
91659243Sobrienend:
91759243Sobrien	onintr
918