complete.tcsh revision 83098
143313Sbrian#
243313Sbrian# $Id: complete.tcsh,v 1.37 2001/09/02 21:06:02 christos Exp $
343313Sbrian# example file using the new completion code
443313Sbrian#
543313Sbrian
643313Sbrianonintr -
743313Sbrianif (! $?prompt) goto end
843313Sbrian
943313Sbrianif ($?tcsh) then
1043313Sbrian    if ($tcsh != 1) then
1143313Sbrian   	set rev=$tcsh:r
1243313Sbrian	set rel=$rev:e
1343313Sbrian	set pat=$tcsh:e
1443313Sbrian	set rev=$rev:r
1543313Sbrian    endif
1643313Sbrian    if ($rev > 5 && $rel > 1) then
1743313Sbrian	set _complete=1
1843313Sbrian    endif
1943313Sbrian    unset rev rel pat
2043313Sbrianendif
2143313Sbrian
2243313Sbrianif ($?_complete) then
2343313Sbrian    set noglob
2443313Sbrian    set hosts
2543313Sbrian    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
2650479Speter        if ( -r $f ) then
2743313Sbrian	    set hosts = ($hosts `grep -v "+" $f | tr -s " " "	" | cut -f 1`)
2843313Sbrian	endif
2943313Sbrian    end
30129457Sdds    if ( -r $HOME/.netrc ) then
3143313Sbrian	set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
3298132Sbrian	set hosts=($hosts $f)
33140905Sbrian    endif
3458032Sbrian    unset f
3543313Sbrian    if ( ! $?hosts ) then
3643313Sbrian	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
3743313Sbrian		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
3843313Sbrian		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
3943313Sbrian		   labrea.stanford.edu sumex-aim.stanford.edu \
4058032Sbrian		   tut.cis.ohio-state.edu)
4143313Sbrian    endif
4258037Sbrian
4358037Sbrian    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
4496324Sbrian    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4558037Sbrian    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4658037Sbrian    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
4796324Sbrian    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
4858037Sbrian    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
4958037Sbrian
5043313Sbrian    complete cd  	p/1/d/		# Directories only
5198132Sbrian    complete chdir 	p/1/d/
5298132Sbrian    complete pushd 	p/1/d/
5398132Sbrian    complete popd 	p/1/d/
54102500Sbrian    complete pu 	p/1/d/
5543313Sbrian    complete po 	p/1/d/
5643313Sbrian    complete complete 	p/1/X/		# Completions only
5743313Sbrian    complete uncomplete	n/*/X/
5843693Sbrian    complete exec 	p/1/c/		# Commands only
5943313Sbrian    complete trace 	p/1/c/
6050840Sbrian    complete strace 	p/1/c/
6150840Sbrian    complete which	n/*/c/
6243313Sbrian    complete where	n/*/c/
6346686Sbrian    complete skill 	p/1/c/
6443313Sbrian    complete dde	p/1/c/ 
6543313Sbrian    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
6643313Sbrian    complete sdb	p/1/c/
6743313Sbrian    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
6843313Sbrian    complete xdb	p/1/c/
6943313Sbrian    complete gdb	n/-d/d/ n/*/c/
7043313Sbrian    complete ups	p/1/c/
7143313Sbrian    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
7243313Sbrian    complete unset	n/*/s/
7343313Sbrian    complete alias 	p/1/a/		# only aliases are valid
7443313Sbrian    complete unalias	n/*/a/
7543313Sbrian    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
7681634Sbrian    complete dvips 	n/*/f:*.dvi/
7781634Sbrian    complete tex 	n/*/f:*.tex/	# Only files that match *.tex
7843313Sbrian    complete latex 	n/*/f:*.{tex,ltx}/
7981634Sbrian    complete su		c/--/"(login fast preserve-environment command shell \
8043313Sbrian			help version)"/	c/-/"(f l m p c s -)"/ \
8143313Sbrian			n/{-c,--command}/c/ \
8243313Sbrian			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
8343313Sbrian    complete cc 	c/-[IL]/d/ \
8443313Sbrian              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
8543313Sbrian			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
8643313Sbrian    complete acc 	c/-[IL]/d/ \
8743313Sbrian       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
8843693Sbrian			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
8943693Sbrian    complete gcc 	c/-[IL]/d/ \
9043693Sbrian		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
9143693Sbrian		               elide-constructors expensive-optimizations \
9243693Sbrian			       float-store force-addr force-mem inline \
9343693Sbrian			       inline-functions keep-inline-functions \
9443693Sbrian			       memoize-lookups no-default-inline \
9581634Sbrian			       no-defer-pop no-function-cse omit-frame-pointer \
9643313Sbrian			       rerun-cse-after-loop schedule-insns \
9796324Sbrian			       schedule-insns2 strength-reduce \
98169986Snovel			       thread-jumps unroll-all-loops \
9943313Sbrian			       unroll-loops syntax-only all-virtual \
10096324Sbrian			       cond-mismatch dollars-in-identifiers \
10196730Sbrian			       enum-int-equiv no-asm no-builtin \
10296324Sbrian			       no-strict-prototype signed-bitfields \
10396324Sbrian			       signed-char this-is-variable unsigned-bitfields \
10496324Sbrian			       unsigned-char writable-strings call-saved-reg \
10596324Sbrian			       call-used-reg fixed-reg no-common \
10696324Sbrian			       no-gnu-binutils nonnull-objects \
10796730Sbrian			       pcc-struct-return pic PIC shared-data \
10896730Sbrian			       short-enums short-double volatile)"/ \
10996730Sbrian		 	c/-W/"(all aggregate-return cast-align cast-qual \
11096730Sbrian		      	       comment conversion enum-clash error format \
11196730Sbrian		      	       id-clash-len implicit missing-prototypes \
11296730Sbrian		      	       no-parentheses pointer-arith return-type shadow \
11396730Sbrian		      	       strict-prototypes switch uninitialized unused \
11496730Sbrian		      	       write-strings)"/ \
11598132Sbrian		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
11698132Sbrian			       short c68000 c68020 soft-float g gnu unix fpu \
11798132Sbrian			       no-epilogue)"/ \
11896324Sbrian		 	c/-d/"(D M N)"/ \
11996324Sbrian		 	c/-/"(f W vspec v vpath ansi traditional \
12098132Sbrian			      traditional-cpp trigraphs pedantic x o l c g L \
12198132Sbrian			      I D U O O2 C E H B b V M MD MM i dynamic \
12298132Sbrian			      nodtdlib static nostdinc undef)"/ \
12398132Sbrian		 	c/-l/f:*.a/ \
12498132Sbrian		 	n/*/f:*.{c,C,cc,o,a,s,i}/
12598132Sbrian    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
12698132Sbrian    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
12798132Sbrian    complete rm 	c/--/"(directory force interactive verbose \
12898132Sbrian			recursive help version)"/ c/-/"(d f i v r R -)"/ \
12998132Sbrian			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
13098132Sbrian    complete vi 	n/*/f:^*.[oa]/
13198132Sbrian    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
13298132Sbrian			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
13398132Sbrian			n/-k/"(left right up down)"/ p/2-/b/ \
13498132Sbrian			p/1/'x:<key-sequence or option>'/
13598132Sbrian
13698132Sbrian    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
13798132Sbrian		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
13898132Sbrian			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
13998132Sbrian		  	c/-/"(fstype name perm prune type user nouser \
14098132Sbrian		  	     group nogroup size inum atime mtime ctime exec \
14198132Sbrian			     ok print ls cpio ncpio newer xdev depth \
14298132Sbrian			     daystart follow maxdepth mindepth noleaf version \
14398132Sbrian			     anewer cnewer amin cmin mmin true false uid gid \
14498132Sbrian			     ilname iname ipath iregex links lname empty path \
14598132Sbrian			     regex used xtype fprint fprint0 fprintf \
14698132Sbrian			     print0 printf not a and o or)"/ \
14798132Sbrian			     n/*/d/
14898132Sbrian
14998132Sbrian    complete -%*	c/%/j/			# fill in the jobs builtin
15098132Sbrian    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
15198132Sbrian
15298132Sbrian    complete limit	c/-/"(h)"/ n/*/l/
15398132Sbrian    complete unlimit	c/-/"(h)"/ n/*/l/
15498132Sbrian
15598132Sbrian    complete -co*	p/0/"(compress)"/	# make compress completion
15698132Sbrian						# not ambiguous
15798132Sbrian    complete zcat	n/*/f:*.Z/
15898132Sbrian
15998132Sbrian    complete finger	c/*@/\$hosts/ n/*/u/@ 
16098132Sbrian    complete ping	p/1/\$hosts/
16198132Sbrian    complete traceroute	p/1/\$hosts/
16298132Sbrian
16398132Sbrian    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
16498132Sbrian		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
16598132Sbrian
16698132Sbrian    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
16798132Sbrian
16898132Sbrian    # this one is simple...
16998132Sbrian    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
17098132Sbrian    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
17198132Sbrian    # This one will rsh to the file to fetch the list of files!
17298132Sbrian    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/:'
17398132Sbrian
17498132Sbrian    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
17598132Sbrian		c/conv=*,/"(ascii ebcdic ibm block unblock \
17698132Sbrian			    lcase notrunc ucase swab noerror sync)"/,\
17798132Sbrian		c/conv=/"(ascii ebcdic ibm block unblock \
17898132Sbrian			  lcase notrunc ucase swab noerror sync)"/,\
17998132Sbrian	        c/*=/x:'<number>'/ \
18098132Sbrian		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
18198132Sbrian
18298132Sbrian    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
18398132Sbrian
18498132Sbrian    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
18598132Sbrian		p/2/f:*.a/ p/*/f:*.o/
18698132Sbrian
18798132Sbrian    # these should be merged with the MH completion hacks below - jgotts
18898132Sbrian    complete {sprev,snext} \
18998132Sbrian		c@+@F:$HOME/Mail/@
19098132Sbrian
19198132Sbrian    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
19298132Sbrian    complete {rexec,rxexec,rxterm,rmterm} \
19398132Sbrian			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
19498132Sbrian			'n/-E/e/' 'n/*/c/'
19598132Sbrian    complete kill	'c/-/S/' 'c/%/j/' \
19698132Sbrian			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
19798132Sbrian
19898132Sbrian    # these from Marc Horowitz <marc@cam.ov.com>
19998132Sbrian    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
20098132Sbrian		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
20198132Sbrian		    'c/-/(verbose quiet force printpath lookup debug map \
20298132Sbrian			  nomap remap zephyr nozephyr readonly write \
20398132Sbrian			  mountpoint noexplicit explicit type mountoptions \
20498132Sbrian			  nosetuid setuid override skipfsck lock user host)/' \
20598132Sbrian		    'n/-e/f/' 'n/*/()/'
20698132Sbrian    complete hesinfo	'p/1/u/' \
20798132Sbrian			'p/2/(passwd group uid grplist pcap pobox cluster \
20898132Sbrian			      filsys sloc service)/'
20998132Sbrian
21098132Sbrian    # these from E. Jay Berkenbilt <ejb@ERA.COM>
21198132Sbrian    # = isn't always followed by a filename or a path anymore - jgotts
21298132Sbrian    complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
21398132Sbrian    				bindir,sbindir,libexecdir,datadir,\
21498132Sbrian				sysconfdir,sharedstatedir,localstatedir,\
21598132Sbrian				libdir,includedir,oldincludedir,infodir,\
21698132Sbrian				mandir,srcdir}/(=)//' \
217136375Sbrian			 'c/--/(cache-file verbose prefix exec-prefix bindir \
218136375Sbrian			 	sbindir libexecdir datadir sysconfdir \
219136375Sbrian				sharedstatedir localstatedir libdir \
220136375Sbrian				includedir oldincludedir infodir mandir \
221136375Sbrian				srcdir)//'
22298132Sbrian    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
22398132Sbrian			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
22498132Sbrian			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
225116622Sume		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
226116622Sume		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
227116622Sume    complete perl	'n/-S/c/'
228116622Sume    complete printenv	'n/*/e/'
229116622Sume    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
230116622Sume			delta diffs edit enter fix get help info \
231116622Sume			print prs prt rmdel sccsdiff tell unedit \
232116622Sume			unget val what)"/
233116622Sume    complete setenv	'p/1/e/' 'c/*:/f/'
234116622Sume
235116622Sume    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
236116622Sume    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
237116622Sume
238116622Sume    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
239116622Sume    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
240116622Sume
241116622Sume    set folders = ( $FOLDERS )
242116622Sume    set mha = ( $MHA )
243116622Sume
24443693Sbrian    complete ali \
24543693Sbrian        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
24643693Sbrian        'n,-alias,f,'
24743693Sbrian
24843693Sbrian    complete anno \
24943313Sbrian        'c/-/(component noinplace inplace nodate date text help)/' \
25043313Sbrian        'c,+,$folders,'  \
25143693Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
25296324Sbrian
25345910Sbrian    complete burst \
25481634Sbrian        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
25581634Sbrian        'c,+,$folders,'  \
25643693Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
25771972Sbrian
25896324Sbrian    complete comp \
25981634Sbrian        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
260116586Sume        'c,+,$folders,'  \
261116622Sume        'n,-whatnowproc,c,'  \
262116586Sume        'n,-file,f,'\
263116586Sume        'n,-form,f,'\
26443313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
26543693Sbrian
26671972Sbrian    complete dist \
26743313Sbrian        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
26843313Sbrian        'c,+,$folders,'  \
26943313Sbrian        'n,-whatnowproc,c,'  \
270132273Sbrian        'n,-form,f,'\
271132273Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
27271972Sbrian
27371972Sbrian    complete folder \
27471972Sbrian        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
27571972Sbrian        'c,+,$folders,'  \
27643313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
27743313Sbrian
27843693Sbrian    complete folders \
279132273Sbrian        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
280132273Sbrian        'c,+,$folders,'  \
28196324Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
28296324Sbrian
28396324Sbrian    complete forw \
28496324Sbrian        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
28596324Sbrian        'c,+,$folders,'  \
28643693Sbrian        'n,-whatnowproc,c,'  \
28743313Sbrian        'n,-filter,f,'\
28843313Sbrian        'n,-form,f,'\
289132273Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
290132273Sbrian
29171972Sbrian    complete inc \
29271972Sbrian        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
29343693Sbrian        'c,+,$folders,'  \
29443693Sbrian        'n,-audit,f,'\
29543313Sbrian        'n,-form,f,'
29665178Sbrian
297132273Sbrian    complete mark \
298132273Sbrian        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
299132273Sbrian        'c,+,$folders,'  \
300132273Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
301132273Sbrian
302132273Sbrian    complete mhmail \
303132273Sbrian        'c/-/(body cc from subject help)/' \
304132273Sbrian        'n,-cc,$mha,'  \
30571972Sbrian        'n,-from,$mha,'  \
30671972Sbrian        'n/*/$mha/'
30771972Sbrian
30865178Sbrian    complete mhpath \
30965178Sbrian        'c/-/(help)/' \
31065178Sbrian        'c,+,$folders,'  \
31165178Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
31243313Sbrian
313132273Sbrian    complete msgchk \
314132273Sbrian        'c/-/(nodate date nonotify notify help)/' 
31571972Sbrian
31671972Sbrian    complete msh \
31743693Sbrian        'c/-/(prompt noscan scan notopcur topcur help)/' 
31843693Sbrian
31943313Sbrian    complete next \
32043313Sbrian        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
32171972Sbrian        'c,+,$folders,'  \
32243693Sbrian        'n,-moreproc,c,'  \
32371972Sbrian        'n,-showproc,c,'  \
32471972Sbrian        'n,-form,f,'
32543693Sbrian
32643693Sbrian    complete packf \
32743313Sbrian        'c/-/(file help)/' \
32843313Sbrian        'c,+,$folders,'  \
32996324Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33043313Sbrian
33143313Sbrian    complete pick \
33243313Sbrian        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
33396324Sbrian        'c,+,$folders,'  \
33496324Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
33543313Sbrian
33643313Sbrian    complete prev \
337132273Sbrian        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
338132273Sbrian        'c,+,$folders,'  \
33943313Sbrian        'n,-moreproc,c,'  \
34043313Sbrian        'n,-showproc,c,'  \
34196153Sbrian        'n,-form,f,'
34296153Sbrian
34396153Sbrian    complete prompter \
34496153Sbrian        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
34596324Sbrian
34696153Sbrian    complete refile \
34796153Sbrian        'c/-/(draft nolink link nopreserve preserve src file help)/' \
34896153Sbrian        'c,+,$folders,'  \
349132273Sbrian        'n,-file,f,'\
350132273Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
35196153Sbrian
35296153Sbrian    complete rmf \
35396153Sbrian        'c/-/(nointeractive interactive help)/' \
35496153Sbrian        'c,+,$folders,'  
355132273Sbrian
356132273Sbrian    complete rmm \
35796153Sbrian        'c/-/(help)/' \
35896153Sbrian        'c,+,$folders,'  \
35943313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
36043313Sbrian
361132273Sbrian    complete scan \
362132273Sbrian        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
36343313Sbrian        'c,+,$folders,'  \
36443313Sbrian        'n,-form,f,'\
36543313Sbrian        'n,-file,f,'\
36643313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
367132273Sbrian
368132273Sbrian    complete send \
36943313Sbrian        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
37043313Sbrian        'n,-alias,f,'\
37143313Sbrian        'n,-filter,f,'
37243313Sbrian
37343313Sbrian    complete show \
37443313Sbrian        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
37543313Sbrian        'c,+,$folders,'  \
37643313Sbrian        'n,-moreproc,c,'  \
37743313Sbrian        'n,-showproc,c,'  \
37843313Sbrian        'n,-form,f,'\
37943313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
380132273Sbrian
381132273Sbrian    complete sortm \
38243313Sbrian        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
38343313Sbrian        'c,+,$folders,'  \
38443313Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
38543313Sbrian
38643313Sbrian    complete vmh \
38743313Sbrian        'c/-/(prompt vmhproc novmhproc help)/' \
38843313Sbrian        'n,-vmhproc,c,'  
38943313Sbrian
39043313Sbrian    complete whatnow \
39143313Sbrian        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
39243313Sbrian
39343693Sbrian    complete whom \
39496324Sbrian        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
39543693Sbrian        'n,-alias,f,'
39643693Sbrian
39743313Sbrian    complete plum \
39843313Sbrian        'c/-/()/' \
399132273Sbrian        'c,+,$folders,'  \
400132273Sbrian        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
40143693Sbrian
40281634Sbrian    complete mail \
403116586Sume        'c/-/()/' \
40481634Sbrian        'n/*/$mha/'
40543313Sbrian
40654914Sbrian    endif
40754914Sbrian
40854914Sbrian    #from Dan Nicolaescu <dann@ics.uci.edu>
40954914Sbrian    if ( $?MODULESHOME ) then
41043313Sbrian	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
41143313Sbrian	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
41243313Sbrian	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
41381634Sbrian	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
41481634Sbrian	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
41543313Sbrian	'C%[^-]*%`eval Compl_module`%'
41643313Sbrian    endif
41743313Sbrian
41881634Sbrian    # from George Cox
41981634Sbrian    complete acroread	'p/*/f:*.pdf/'
42043313Sbrian    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
42181634Sbrian			configtest help)/'
42281634Sbrian    complete appletviewer	'p/*/f:*.class/'
42381634Sbrian    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
42443313Sbrian			help name-prefix= no-lines no-parser output= \
42543313Sbrian			token-table verbose version yacc)/' \
42643313Sbrian			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
42743313Sbrian			'n/-p/f/'
42843313Sbrian    complete bunzip2	'p/*/f:*.bz2/' 
42943313Sbrian    complete bzip2	'n/-9/f:^*.bz2/' 'n/-d/f:*.bz2/'
43043313Sbrian    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
43181634Sbrian    complete co		'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
43243313Sbrian    complete crontab	'n/-u/u/'
43381634Sbrian    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
43443313Sbrian			modepage negotiate periphlist rescan reset start \
43543313Sbrian			stop tags tur)/'
43643313Sbrian    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
43781634Sbrian			checkfile drop feedinfo flush flushlogs go hangup \
43843313Sbrian			logmode mode name newgroup param pause readers refile \
43943313Sbrian			reject reload renumber reserve rmgroup send shutdown \
44043313Sbrian			kill throttle trace xabort xexec)/'
44196324Sbrian    complete cvs	'c/--/(help help-commands help-synonyms)/' \
44296324Sbrian			'p/1/(add admin annotate checkout commit diff \
44396324Sbrian			edit editors export history import init log login \
44496324Sbrian			logout rdiff release remove rtag status tag unedit \
44596324Sbrian			update watch watchers)/' 'n/-a/(edit unedit commit \
44696324Sbrian			all none)/' 'n/watch/(on off add remove)/'
44796324Sbrian    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
44896324Sbrian    complete detex	'p/*/f:*.tex/'
44996324Sbrian    complete edquota    'n/*/u/'
450132273Sbrian    complete exec	'p/1/c/'
451132273Sbrian    complete ghostview	'p/*/f:*.ps/'
45296324Sbrian    complete gv		'p/*/f:*.ps/'
45396324Sbrian    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
454116586Sume			mtu vlandev vlan metric mediaopt down delete \
455116622Sume			broadcast arp debug)/'
456116622Sume    complete imake	'c/-I/d/'
457167147Sume    complete ipfw 	'p/1/(flush add delete list show zero)/' \
458167147Sume			'n/add/(allow permit accept pass deny drop reject \
459167147Sume			reset count skipto num divert port tee port)/'
460167147Sume    complete javac	'p/*/f:*.java/'
461167147Sume    complete ldif2ldbm	'n/-i/f:*.ldif/'
462167147Sume    complete libtool	'c/--mode=/(compile execute finish install link \
463167147Sume			uninstall)/' 'c/--/(config debug dry-run features \
464116622Sume			finish help quiet silent version mode=)/'
465132273Sbrian    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
466132273Sbrian			ltdl-tar version)/'
467116622Sume    complete links	'c/-/(assume-codepage async-dns download-dir \
468116622Sume			format-cache-size ftp-proxy help http-proxy \
469116586Sume			max-connections max-connections-to-host \
470116586Sume			memory-cache-size receive-timeout retries \
471116586Sume			unrestartable-receive-timeout version)/'
472116586Sume    complete natd	c/-/'(alias_address config deny_incoming dynamic \
473116586Sume			inport interface log log_denied log_facility \
474116586Sume			outport outport port pptpalias proxy_only \
475116586Sume			proxy_rule redirect_address redirect_port \
476116586Sume			reverse same_ports unregistered_only use_sockets \
477116586Sume			verbose)'/ 'n@-interface@`ifconfig -l`@'
478116586Sume    complete netstat	'n@-I@`ifconfig -l`@'
479116586Sume    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
480116586Sume			archive-headers debugging demangle disassemble \
481116586Sume			disassemble-all disassemble-zeroes dynamic-reloc \
482116586Sume			dynamic-syms endian= file-headers full-contents \
483116586Sume			headers help info line-numbers no-show-raw-insn \
484132273Sbrian			prefix-addresses private-headers reloc section-headers \
485132273Sbrian			section=source stabs start-address= stop-address= \
486116586Sume			syms target= version wide)/' \
487116586Sume			'c/-/(a h i f C d D p r R t T x s S l w)/'
488116586Sume    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
489116586Sume			pke pp)/'
490116586Sume    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
491116586Sume			assume_local_charset= assume_unrec_charset= auth= base \
492116586Sume			book buried_news cache= case cfg= child cookie_file= \
493116586Sume			cookies core crawl debug_partial display= dump editor= \
494116586Sume			emacskeys enable_scrollback error_file= force_html \
495116586Sume			force_secure forms_options from ftp get_data head help \
496116586Sume			hiddenlinks= historical homepage= image_links index= \
497116586Sume			ismap link= localhost mime_header minimal \
498116586Sume			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
499116586Sume			nofilereferer nolist nolog nopause noprint noredir \
500116586Sume			noreferer nostatus number_links partial partial_thres \
501116586Sume			pauth= popup post_data preparsed print pseudo_inlines \
502116586Sume			raw realm reload restrictions= resubmit_posts rlogin \
503116586Sume			selective show_cursor soft_dquotes source stack_dump \
504116586Sume			startfile_ok tagsoup telnet term= tlog trace traversal \
505116586Sume			underscore useragent= validate verbose version vikeys \
506116586Sume			width=)/' 'c/(http|ftp)/$URLS/'
507116586Sume    complete gmake	'c/{--directory=,--include-dir=}/d/' \
508116586Sume			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
509116586Sume			'c/--/(assume-new= assume-old= debug directory= \
510116586Sume			dry-run environment-overrides file= help \
511116586Sume			ignore-errors include-dir= jobs[=N] just-print \
512116586Sume			keep-going load-average[=N] makefile= max-load[=N] \
513116586Sume			new-file= no-builtin-rules no-keep-going \
514116586Sume			no-print-directory old-file= print-data-base \
515116586Sume			print-directory question quiet recon silent stop \
516116586Sume			touch version warn-undefined-variables what-if=)/' \
517116586Sume			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
518116586Sume			'n/=/f/' 'n/-f/f/'
519116586Sume    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
520116586Sume			pcm2 rec igain ogain line1 line2 line3)'/ \
52196324Sbrian			p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
52296324Sbrian
52396324Sbrian    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
52496324Sbrian    			auth buffer cdr check doublespeed equalizer frames \
52596324Sbrian			gain halfspeed headphones left lineout list mix mono \
52696324Sbrian			proxy quiet random rate reopen resync right scale \
52796324Sbrian			shuffle single0 single1 skip speaker stdout stereo \
52896324Sbrian			test verbose wav)/'
52996324Sbrian    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
53096324Sbrian			flush-logs flush-status flush-tables flush-privileges \
53196324Sbrian			kill password ping processlist reload refresh \
53296324Sbrian			shutdown status variables version)/'
53398132Sbrian    complete mutt	c@-f=@F:${HOME}/Mail/@ \
53496324Sbrian			n/-a/f/ \
53596324Sbrian			n/-F/f/ n/-H/f/ \
53698149Sbrian			n/-s/x:'<subject line>'/ \
53798149Sbrian			n/-e/x:'<command>'/ \
53898149Sbrian			n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
53998712Sbrian			n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
54098712Sbrian			n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
54198712Sbrian    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
54298712Sbrian			querylog start stop restart )/'
54398712Sbrian    complete nm		'c/--/(debug-syms defined-only demangle dynamic \
544132790Skan			extern-only format= help line-numbers no-demangle \
54598712Sbrian			no-sort numeric-sort portability print-armap \
54698967Sbrian			print-file-name reverse-sort size-sort undefined-only \
54798967Sbrian			version)/' 'p/*/f:^*.{h,C,c,cc}/'
54898967Sbrian    complete nmap	'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
54998712Sbrian    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
55098712Sbrian    complete postfix    'n/*/(start stop reload abort flush check)/'
55198149Sbrian    complete postmap	'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
55298149Sbrian    complete rcsdiff	'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
55398149Sbrian    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
55498149Sbrian			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
55598149Sbrian			bgamma bpp broadcast bs c cc class co core deferglyphs \
55698149Sbrian			disableModInDev disableVidMode displayID dpi dpms f fc \
557132273Sbrian			flipPixels fn fp gamma ggamma help indirect kb keeptty \
558132273Sbrian			ld lf logo ls nolisten string noloadxkb nolock nopn \
55996324Sbrian			once p pn port probeonly query quiet r rgamma s \
56096324Sbrian			showconfig sp su t terminate to tst v verbose version \
56196730Sbrian			weight wm x xkbdb xkbmap)/'
56296730Sbrian    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
56396730Sbrian    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
56498149Sbrian			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
56598149Sbrian			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
56698149Sbrian			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
56798712Sbrian			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
56898712Sbrian    complete vim	'n/*/f:^*.[oa]/'
56998712Sbrian    complete where	'n/*/c/'
57098712Sbrian    complete which	'n/*/c/'
57198712Sbrian    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
572132790Skan			'c/--/(back-color center colors dither help match \
57398712Sbrian			maxscale parse scale smooth tile update-domain \
57498967Sbrian			update-wmaker version workspace)/'
57598967Sbrian    complete xdb	'p/1/c/'
57698967Sbrian    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
57798712Sbrian			hushchecksums hushspecials install interpreter keep \
57898712Sbrian			margins nogrey noinstall nomakepk noscan paper safer \
57998149Sbrian			shrinkbuttonn thorough topmargin underlink version)/' \
58098149Sbrian			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
58198149Sbrian    complete xlock	'c/-/(allowaccess allowroot debug description \
58298149Sbrian			echokeys enablesaver grabmouse grabserver hide inroot \
58398149Sbrian			install inwindow mono mousemotion nolock remote \
58498149Sbrian			resetsaver sound timeelapsed use3d usefirst verbose \
585132273Sbrian			wireframe background batchcount bg bitmap both3d \
586132273Sbrian			count cycles delay delta3d display dpmsoff \
58796730Sbrian			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
58896730Sbrian			erasetime fg font foreground geometry help \
58998243Sbrian			icongeometry info invalid left3d lockdelay logoutCmd \
59098132Sbrian			mailCmd mailIcon message messagefile messagefont \
59198132Sbrian			messagesfile mode name ncolors nice nomailIcon none3d \
592132273Sbrian			parent password planfont program resources right3d \
593132273Sbrian			saturation size startCmd timeout username validate \
59498132Sbrian			version visual)/' 'n/-mode/(ant atlantis ball bat \
59598132Sbrian			blot bouboule bounce braid bubble bubble3d bug cage \
59698132Sbrian			cartoon clock coral crystal daisy dclock decay deco \
59798132Sbrian			demon dilemma discrete drift eyes fadeplot flag flame \
59898132Sbrian			flow forest galaxy gears goop grav helix hop hyper \
599132273Sbrian			ico ifs image invert julia kaleid kumppa lament laser \
600132273Sbrian			life life1d life3d lightning lisa lissie loop lyapunov \
60198132Sbrian			mandelbrot marquee matrix maze moebius morph3d \
60298132Sbrian			mountain munch nose pacman penrose petal pipes puzzle \
60398132Sbrian			pyro qix roll rotor rubik shape sierpinski slip sphere \
60498132Sbrian			spiral spline sproingies stairs star starfish strange \
60598132Sbrian			superquadrics swarm swirl tetris thornbird triangle \
60698132Sbrian			tube turtle vines voters wator wire world worm xjack \
607132273Sbrian			blank bomb random)/' 
608132273Sbrian    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
60998132Sbrian    complete wget 	c/--/"(accept= append-output= background cache= \
61098132Sbrian			continue convert-links cut-dirs= debug \
61198132Sbrian			delete-after directory-prefix= domains= \
61298132Sbrian			dont-remove-listing dot-style= exclude-directories= \
613132273Sbrian			exclude-domains= execute= follow-ftp \
614132273Sbrian			force-directories force-html glob= header= help \
61598132Sbrian			http-passwd= http-user= ignore-length \
61698132Sbrian			include-directories= input-file= level= mirror \
61798132Sbrian			no-clobber no-directories no-host-directories \
61896324Sbrian			no-host-lookup no-parent non-verbose \
61996324Sbrian			output-document= output-file= passive-ftp \
62096324Sbrian			proxy-passwd= proxy-user= proxy= quiet quota= \
62196324Sbrian			recursive reject= relative retr-symlinks save-headers \
62296324Sbrian			server-response span-hosts spider timeout= \
62396324Sbrian			timestamping tries= user-agent= verbose version wait=)"/
62496324Sbrian
62596324Sbrian    # these from Tom Warzeka <tom@waz.cc>
62696324Sbrian
62796324Sbrian    # this one works but is slow and doesn't descend into subdirectories
62896324Sbrian    # complete	cd	C@[./\$~]*@d@ \
62996324Sbrian    #			p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
63096324Sbrian
63196324Sbrian    if ( -r /etc/shells ) then
63296324Sbrian        complete setenv	p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
63396324Sbrian    else
63496324Sbrian	complete setenv	p@1@e@ n@DISPLAY@\$hosts@:
63543313Sbrian    endif
63643313Sbrian    complete unsetenv	n/*/e/
63743313Sbrian
63896324Sbrian    if (-r /var/spool/mail) then
63943693Sbrian      set _maildir = /var/spool/mail
64043693Sbrian    else
64143693Sbrian      set _maildir = /usr/mail
64296324Sbrian    endif
64396324Sbrian    if (-r $HOME/.mailrc) then
64496324Sbrian        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
64543693Sbrian			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
64643693Sbrian			n@-u@T:$_maildir@ n/-f/f/ \
64743313Sbrian			n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "	" | cut -f 2`'@
64896324Sbrian    else
64943693Sbrian        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
65043313Sbrian			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
65143693Sbrian			n@-u@T:$_maildir@ n/-f/f/ n/*/u/
65258038Sbrian    endif
65343693Sbrian    unset _maildir
65443693Sbrian
65543693Sbrian    if (-r /usr/share/man) then
65643693Sbrian      set _man_dir = /usr/share/man
65743693Sbrian    else
65843693Sbrian      set _man_dir = /usr/man
65943313Sbrian    endif
66043693Sbrian    complete man \
66143693Sbrian		 n@0@\`if\ \(-r\ $_man_dir/man0\)\ \\ls\ -1\ $_man_dir/man0\ \|\ sed\ s%\\\.0.\\\*\\\$%%\`@ \
662132273Sbrian		 n@1@\`if\ \(-r\ $_man_dir/man1\)\ \\ls\ -1\ $_man_dir/man1\ \|\ sed\ s%\\\.1.\\\*\\\$%%\`@ \
663132273Sbrian		 n@2@\`if\ \(-r\ $_man_dir/man2\)\ \\ls\ -1\ $_man_dir/man2\ \|\ sed\ s%\\\.2.\\\*\\\$%%\`@ \
66443693Sbrian		 n@3@\`if\ \(-r\ $_man_dir/man3\)\ \\ls\ -1\ $_man_dir/man3\ \|\ sed\ s%\\\.3.\\\*\\\$%%\`@ \
66543693Sbrian		 n@4@\`if\ \(-r\ $_man_dir/man4\)\ \\ls\ -1\ $_man_dir/man4\ \|\ sed\ s%\\\.4.\\\*\\\$%%\`@ \
66643693Sbrian		 n@5@\`if\ \(-r\ $_man_dir/man5\)\ \\ls\ -1\ $_man_dir/man5\ \|\ sed\ s%\\\.5.\\\*\\\$%%\`@ \
66743693Sbrian		 n@6@\`if\ \(-r\ $_man_dir/man6\)\ \\ls\ -1\ $_man_dir/man6\ \|\ sed\ s%\\\.6.\\\*\\\$%%\`@ \
66843693Sbrian		 n@7@\`if\ \(-r\ $_man_dir/man7\)\ \\ls\ -1\ $_man_dir/man7\ \|\ sed\ s%\\\.7.\\\*\\\$%%\`@ \
66943693Sbrian		 n@8@\`if\ \(-r\ $_man_dir/man8\)\ \\ls\ -1\ $_man_dir/man8\ \|\ sed\ s%\\\.8.\\\*\\\$%%\`@ \
67043313Sbrian		 n@9@\`if\ \(-r\ $_man_dir/man9\)\ \\ls\ -1\ $_man_dir/man9\ \|\ sed\ s%\\\.9.\\\*\\\$%%\`@ \
67143313Sbrian	       n@new@\`if\ \(-r\ $_man_dir/mann\)\ \\ls\ -1\ $_man_dir/mann\ \|\ sed\ s%\\\.n.\\\*\\\$%%\`@ \
67243693Sbrian	       n@old@\`if\ \(-r\ $_man_dir/mano\)\ \\ls\ -1\ $_man_dir/mano\ \|\ sed\ s%\\\.o.\\\*\\\$%%\`@ \
67343693Sbrian	     n@local@\`if\ \(-r\ $_man_dir/manl\)\ \\ls\ -1\ $_man_dir/manl\ \|\ sed\ s%\\\.l.\\\*\\\$%%\`@ \
67443693Sbrian	    n@public@\`if\ \(-r\ $_man_dir/manp\)\ \\ls\ -1\ $_man_dir/manp\ \|\ sed\ s%\\\.p.\\\*\\\$%%\`@ \
67543693Sbrian	    c@-@"(- f k M P s t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@ \
67643693Sbrian	    n@-s@\`\\ls\ -1\ $_man_dir\ \|\ sed\ -n\ s%man%%p\`@ \
67743693Sbrian	    N@-[MP]@'`\ls -1 $:-1/man? | sed s%\\..\*\$%%`'@ n@*@c@
67843693Sbrian    unset _man_dir
67943693Sbrian
68043693Sbrian    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
68143693Sbrian			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
68243693Sbrian    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
68343693Sbrian    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
68443693Sbrian
685134789Sbrian    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
686134789Sbrian    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
68743693Sbrian
68843693Sbrian    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
68943693Sbrian
69043693Sbrian    # these conform to the latest GNU versions available at press time ...
69143693Sbrian    # updates by John Gotts <jgotts@engin.umich.edu>
692140905Sbrian    if (-X emacs) then
693140905Sbrian      # TW note:  if your version of GNU Emacs supports the "--version" option,
694140905Sbrian      #           uncomment this line and comment the next to automatically
695140905Sbrian      #           detect the version, else replace "20.7" with your version.
696140905Sbrian      #set _emacs_ver=`emacs --version | head -1 | sed 's%GNU Emacs %%' | cut -d . -f1-2`
697140905Sbrian      set _emacs_ver=20.7
698140905Sbrian      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
699140905Sbrian      complete emacs	c/--/"(batch terminal display no-windows no-init-file \
700140905Sbrian                               user debug-init unibyte multibyte version help \
701140905Sbrian                               no-site-file funcall load eval insert kill)"/ \
702140905Sbrian                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
703140905Sbrian			n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
704140905Sbrian	                n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
705140905Sbrian			n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
706140905Sbrian			n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
707140905Sbrian      unset _emacs_ver _emacs_dir
708140905Sbrian    endif
709140905Sbrian
710140905Sbrian    complete gzcat	c/--/"(force help license quiet version)"/ \
71158038Sbrian			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
71243693Sbrian    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
71343693Sbrian			force help list license no-name quiet recurse \
714134789Sbrian			suffix test verbose version fast best)"/ \
715134789Sbrian			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
71643693Sbrian			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
71743693Sbrian			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
71843693Sbrian			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
71943693Sbrian			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
72043693Sbrian    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
72143693Sbrian			no-name quiet recurse suffix test verbose version)"/ \
72243693Sbrian			c/-/"(c f h l L n q r S t v V -)"/ \
72343693Sbrian			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
72443693Sbrian			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
72543693Sbrian    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
72643693Sbrian			c/-/"(A b B c C e f h i l n s v V w x)"/ \
72743693Sbrian			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
72843693Sbrian			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
72943693Sbrian    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
73043693Sbrian			c/-/"(A b B c C e f h i l n s v V w x)"/ \
73158038Sbrian			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
73243693Sbrian			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
73343693Sbrian    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
73458028Sbrian			c/-/"(A b B c C e f h i l n s v V w x)"/ \
73543693Sbrian			p/1/x:'<fixed_string>'/ N/-*e/f/ \
73643693Sbrian			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
73743693Sbrian    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
73843693Sbrian    complete zmore	n/*/f:*.{gz,Z,z,zip}/
73943693Sbrian    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
74043693Sbrian    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
74143693Sbrian    complete zforce	n/*/f:^*.{gz,tgz}/
74258038Sbrian
74343693Sbrian    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
74443693Sbrian			c/--/"(extended-regexp fixed-regexp basic-regexp \
745134789Sbrian			regexp file ignore-case word-regexp line-regexp \
746134789Sbrian			no-messages revert-match version help byte-offset \
74743693Sbrian			line-number with-filename no-filename quiet silent \
74843693Sbrian			text directories recursive files-without-match \
74943693Sbrian			files-with-matches count before-context after-context \
75043693Sbrian			context binary unix-byte-offsets)"/ \
75143693Sbrian			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 \
75243693Sbrian				v w x)"/ \
75343693Sbrian			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
75443693Sbrian			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
75543693Sbrian    complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
75643313Sbrian			c/--/"(extended-regexp fixed-regexp basic-regexp \
75743693Sbrian			regexp file ignore-case word-regexp line-regexp \
75843693Sbrian			no-messages revert-match version help byte-offset \
75943693Sbrian			line-number with-filename no-filename quiet silent \
76043693Sbrian			text directories recursive files-without-match \
76143693Sbrian			files-with-matches count before-context after-context \
76243693Sbrian			context binary unix-byte-offsets)"/ \
76343693Sbrian			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 \
76496324Sbrian				v w x)"/ \
76596324Sbrian			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
76643693Sbrian			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
76796324Sbrian    complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
76896324Sbrian			c/--/"(extended-regexp fixed-regexp basic-regexp \
76996324Sbrian			regexp file ignore-case word-regexp line-regexp \
77096324Sbrian			no-messages revert-match version help byte-offset \
77196324Sbrian			line-number with-filename no-filename quiet silent \
77296324Sbrian			text directories recursive files-without-match \
77396324Sbrian			files-with-matches count before-context after-context \
77496730Sbrian			context binary unix-byte-offsets)"/ \
77596324Sbrian			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 \
776116586Sume				v w x)"/ \
777116622Sume			p/1/x:'<fixed_string>'/ N/-*e/f/ \
778116586Sume			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
779116586Sume
78096324Sbrian    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
78198132Sbrian    complete who	c/--/"(heading idle count mesg message writable help \
78298132Sbrian    			version)"/ c/-/"(H i m q s T w u -)"/ \
78398132Sbrian			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
78498132Sbrian
78598132Sbrian    complete chown	c/--/"(changes dereference no-dereference silent \
78698132Sbrian    			quiet reference recursive verbose help version)"/ \
787241844Seadler			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
78865178Sbrian			n/-/u/: p/1/u/: n/*/f/
78943693Sbrian    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
79043693Sbrian    			recursive verbose help version)"/ \
79143693Sbrian			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
79243693Sbrian    complete chmod	c/--/"(changes silent quiet verbose reference \
79343693Sbrian    			recursive help version)"/ c/-/"(c f R v)"/
79443693Sbrian    complete df		c/--/"(all block-size human-readable si inodes \
79543693Sbrian			kilobytes local megabytes no-sync portability sync \
79643693Sbrian			type print-type exclude-type help version)"/ \
79743693Sbrian			c/-/"(a H h i k l m P T t v x)"/
79865178Sbrian    complete du		c/--/"(all block-size bytes total dereference-args \
79943693Sbrian    			human-readable si kilobytes count-links dereference \
80043693Sbrian			megabytes separate-dirs summarize one-file-system \
801116586Sume			exclude-from exclude max-depth help version"/ \
802116586Sume			c/-/"(a b c D H h k L l m S s X x)"/
803116586Sume
80496153Sbrian    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
80596153Sbrian			show-nonprinting show-ends show-tabs help version)"/ \
80696730Sbrian			c/-/"(A b E e n s T t u v -)"/ n/*/f/
80796730Sbrian    complete mv		c/--/"(backup force interactive update verbose suffix \
80896324Sbrian			version-control help version)"/ \
80996324Sbrian			c/-/"(b f i S u V v -)"/ \
810116622Sume			n/{-S,--suffix}/x:'<suffix>'/ \
811116622Sume			n/{-V,--version-control}/"(t numbered nil existing \
812116622Sume			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
813116622Sume    complete cp		c/--/"(archive backup no-dereference force \
81496324Sbrian    			interactive link preserve parents sparse recursive \
81596324Sbrian			symbolic-link suffix update verbose version-control \
81698132Sbrian			one-file-system help version)"/ \
81798132Sbrian			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
81898132Sbrian			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
81998132Sbrian			n/{-V,--version-control}/"(t numbered nil existing \
82098132Sbrian			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
82198132Sbrian    complete ln		c/--/"(backup directory force no-dereference \
82243693Sbrian    			interactive symbolic suffix verbose version-control \
82343693Sbrian			help version)"/ \
82443693Sbrian			c/-/"(b d F f i n S s V v -)"/ \
82543693Sbrian			n/{-S,--suffix}/x:'<suffix>'/ \
82643693Sbrian			n/{-V,--version-control}/"(t numbered nil existing \
82743693Sbrian			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
82896582Sbrian			p/1/f/ p/2/x:'<link_name>'/
829169986Snovel    complete touch	c/--/"(date reference time help version)"/ \
83096582Sbrian			c/-/"(a c d f m r t -)"/ \
83196582Sbrian			n/{-d,--date}/x:'<date_string>'/ \
83296582Sbrian			c/--time/"(access atime mtime modify use)"/ \
83396582Sbrian			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
83496582Sbrian    complete mkdir	c/--/"(mode parents verbose help version)"/ \
83596582Sbrian    			c/-/"(p m -)"/ \
83696582Sbrian			n/{-m,--mode}/x:'<mode>'/ n/*/d/
83796582Sbrian    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
83896582Sbrian    			version)"/ c/-/"(p -)"/ n/*/d/
83996582Sbrian
84096582Sbrian    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
84196582Sbrian			R S T v V w W X z Z)"/ \
84296582Sbrian			c/-[dtx]*/"( B C f F g G i k K m M O p P \
84396582Sbrian			R s S T v w x X z Z)"/ \
84496582Sbrian			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
84596582Sbrian			--catenate --concatenate --create --diff --compare \
84696582Sbrian			--delete --append --list --update --extract --get \
84796582Sbrian			--help --version)"/ \
84896582Sbrian			c/--/"(catenate concatenate create diff compare \
84996582Sbrian			delete append list update extract get atime-preserve \
85096582Sbrian			block-size read-full-blocks directory checkpoint file \
85196582Sbrian			force-local info-script new-volume-script incremental \
85296582Sbrian			listed-incremental dereference ignore-zeros \
85396582Sbrian			ignore-failed-read keep-old-files starting-file \
85496582Sbrian			one-file-system tape-length modification-time \
85596582Sbrian			multi-volume after-date newer old-archive portability \
85696582Sbrian			to-stdout same-permissions preserve-permissions \
857169986Snovel			absolute-paths preserve record-number remove-files \
858169986Snovel			same-order preserve-order same-owner sparse \
859169986Snovel			files-from null totals verbose label version \
86096582Sbrian			interactive confirmation verify exclude exclude-from \
86196582Sbrian			compress uncompress gzip ungzip use-compress-program \
86296582Sbrian			block-compress help version)"/ \
863169986Snovel			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
864169986Snovel			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
865169986Snovel			C@[/dev]@f@ \
866169986Snovel			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
867169986Snovel			n/{-[Adrtux]*f,--file}/f:*.{tar,taz,tgz}/ \
868169986Snovel			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
869169986Snovel			n/--use-compress-program/c/ \
870169986Snovel			n/{-b,--block-size}/x:'<block_size>'/ \
871169986Snovel			n/{-V,--label}/x:'<volume_label>'/ \
872169986Snovel			n/{-N,--{after-date,newer}}/x:'<date>'/ \
873169986Snovel			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
874169986Snovel			n/{-C,--directory}/d/ \
875169986Snovel			N/{-C,--directory}/'`\ls $:-1`'/ \
876169986Snovel			n/-[0-7]/"(l m h)"/
877169986Snovel
878169986Snovel    # SVR4 filesystems
879169986Snovel    complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
880169986Snovel    			n/-o/x:'<FSType_options>'/ \
881169986Snovel    			n@-F@'`\ls -1 /usr/lib/fs`'@ \
882169986Snovel    			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
88396582Sbrian    complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
88496582Sbrian    			n/*/'`mount | cut -d " " -f 1`'/
88596582Sbrian    complete  mountall	c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
88696582Sbrian    complete umountall	c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
88796582Sbrian    			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
88896582Sbrian    # BSD 4.3 filesystems
88943693Sbrian    #complete  mount	c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \
89043693Sbrian    #			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	" | cut -f 2`'@
89143693Sbrian    #complete umount	c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
89296730Sbrian    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
89343693Sbrian    #			n/*/'`mount | cut -d " " -f 3`'/
89496730Sbrian    # BSD 4.2 filesystems
89598311Sbrian    #complete  mount	c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
89643693Sbrian    #			n@*@'`cut -d ":" -f 2 /etc/fstab`'@
897134789Sbrian    #complete umount	c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
89843693Sbrian    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
899134789Sbrian    #			n/*/'`mount | cut -d " " -f 3`'/
900134789Sbrian
90196582Sbrian    # these deal with NIS (formerly YP); if it's not running you don't need 'em
90250840Sbrian    if (-X domainname) then
90398132Sbrian      set _domain = "`domainname`"
90496324Sbrian      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
90596730Sbrian      if ("$_domain" != "" && "$_domain" != "noname") then
90696730Sbrian        complete domainname p@1@D:$_ypdir@" " n@*@n@
90798311Sbrian        complete ypcat	    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
90896324Sbrian	                    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
90943693Sbrian	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
91043693Sbrian        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
91196730Sbrian	                    N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
91243693Sbrian	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
91343693Sbrian        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
91443693Sbrian	                    n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
91543693Sbrian			    N@-m@n@ n@*@\$hosts@
91643693Sbrian      endif
91743693Sbrian      unset _domain _ypdir
91896730Sbrian    endif
91943693Sbrian
92043693Sbrian    complete make \
92143693Sbrian	'n/-f/f/' \
92265178Sbrian      	'c/*=/f/' \
92365178Sbrian	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
92496730Sbrian
92543693Sbrian    if ( -f /etc/printcap ) then
92643693Sbrian	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
92743693Sbrian
92843693Sbrian	complete lpr    'c/-P/$printers/'
92943693Sbrian	complete lpq    'c/-P/$printers/'
93096730Sbrian	complete lprm   'c/-P/$printers/'
93143693Sbrian	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
93243693Sbrian	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
93343693Sbrian	complete dvilj	'p/*/f:*.dvi/'
93443693Sbrian    endif
93543693Sbrian
93696730Sbrian    unset noglob
93743693Sbrian    unset _complete
93843693Sbrianendif
93999418Sbrian
94043693Sbrianend:
94143693Sbrian	onintr
94243693Sbrian