complete.tcsh revision 100616
1#
2# $Id: complete.tcsh,v 1.40 2002/07/07 15:37:20 christos Exp $
3# example file using the new completion code
4#
5
6onintr -
7if (! $?prompt) goto end
8
9if ($?tcsh) then
10    if ($tcsh != 1) then
11   	set rev=$tcsh:r
12	set rel=$rev:e
13	set pat=$tcsh:e
14	set rev=$rev:r
15    endif
16    if ($rev > 5 && $rel > 1) then
17	set _complete=1
18    endif
19    unset rev rel pat
20endif
21
22if ($?_complete) then
23    set noglob
24    if ( ! $?hosts ) set hosts
25    foreach f ($HOME/.hosts /usr/local/etc/csh.hosts $HOME/.rhosts /etc/hosts.equiv)
26        if ( -r $f ) then
27	    set hosts = ($hosts `grep -v "+" $f | grep -E -v "^#" | tr -s " " "	" | cut -f 1`)
28	endif
29    end
30    if ( -r $HOME/.netrc ) then
31	set f=`awk '/machine/ { print $2 }' < $HOME/.netrc` >& /dev/null
32	set hosts=($hosts $f)
33    endif
34    if ( -r $HOME/.ssh/known_hosts ) then
35	set f=`cat $HOME/.ssh/known_hosts | cut -f 1 -d \ ` >& /dev/null
36	set hosts=($hosts $f)
37    endif
38    unset f
39    if ( ! $?hosts ) then
40	set hosts=(hyperion.ee.cornell.edu phaeton.ee.cornell.edu \
41		   guillemin.ee.cornell.edu vangogh.cs.berkeley.edu \
42		   ftp.uu.net prep.ai.mit.edu export.lcs.mit.edu \
43		   labrea.stanford.edu sumex-aim.stanford.edu \
44		   tut.cis.ohio-state.edu)
45    endif
46
47    complete ywho  	n/*/\$hosts/	# argument from list in $hosts
48    complete rsh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
49    complete ssh	p/1/\$hosts/ c/-/"(l n)"/   n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
50    complete xrsh	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/
51    complete rlogin 	p/1/\$hosts/ c/-/"(l 8 e)"/ n/-l/u/
52    complete telnet 	p/1/\$hosts/ p/2/x:'<port>'/ n/*/n/
53
54    complete cd  	p/1/d/		# Directories only
55    complete chdir 	p/1/d/
56    complete pushd 	p/1/d/
57    complete popd 	p/1/d/
58    complete pu 	p/1/d/
59    complete po 	p/1/d/
60    complete complete 	p/1/X/		# Completions only
61    complete uncomplete	n/*/X/
62    complete exec 	p/1/c/		# Commands only
63    complete trace 	p/1/c/
64    complete strace 	p/1/c/
65    complete which	n/*/c/
66    complete where	n/*/c/
67    complete skill 	p/1/c/
68    complete dde	p/1/c/ 
69    complete adb	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
70    complete sdb	p/1/c/
71    complete dbx	c/-I/d/ n/-/c/ N/-/"(core)"/ p/1/c/ p/2/"(core)"/
72    complete xdb	p/1/c/
73    complete gdb	n/-d/d/ n/*/c/
74    complete ups	p/1/c/
75    complete set	'c/*=/f/' 'p/1/s/=' 'n/=/f/'
76    complete unset	n/*/s/
77    complete alias 	p/1/a/		# only aliases are valid
78    complete unalias	n/*/a/
79    complete xdvi 	n/*/f:*.dvi/	# Only files that match *.dvi
80    complete dvips 	n/*/f:*.dvi/
81    complete tex 	n/*/f:*.tex/	# Only files that match *.tex
82    complete latex 	n/*/f:*.{tex,ltx}/
83    complete su		c/--/"(login fast preserve-environment command shell \
84			help version)"/	c/-/"(f l m p c s -)"/ \
85			n/{-c,--command}/c/ \
86			n@{-s,--shell}@'`cat /etc/shells`'@ n/*/u/
87    complete cc 	c/-[IL]/d/ \
88              c@-l@'`\ls -1 /usr/lib/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
89			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
90    complete acc 	c/-[IL]/d/ \
91       c@-l@'`\ls -1 /usr/lang/SC1.0/lib*.a | sed s%^.\*/lib%%\;s%\\.a\$%%`'@ \
92			c/-/"(o l c g L I D U)"/ n/*/f:*.[coasi]/
93    complete gcc 	c/-[IL]/d/ \
94		 	c/-f/"(caller-saves cse-follow-jumps delayed-branch \
95		               elide-constructors expensive-optimizations \
96			       float-store force-addr force-mem inline \
97			       inline-functions keep-inline-functions \
98			       memoize-lookups no-default-inline \
99			       no-defer-pop no-function-cse omit-frame-pointer \
100			       rerun-cse-after-loop schedule-insns \
101			       schedule-insns2 strength-reduce \
102			       thread-jumps unroll-all-loops \
103			       unroll-loops syntax-only all-virtual \
104			       cond-mismatch dollars-in-identifiers \
105			       enum-int-equiv no-asm no-builtin \
106			       no-strict-prototype signed-bitfields \
107			       signed-char this-is-variable unsigned-bitfields \
108			       unsigned-char writable-strings call-saved-reg \
109			       call-used-reg fixed-reg no-common \
110			       no-gnu-binutils nonnull-objects \
111			       pcc-struct-return pic PIC shared-data \
112			       short-enums short-double volatile)"/ \
113		 	c/-W/"(all aggregate-return cast-align cast-qual \
114		      	       comment conversion enum-clash error format \
115		      	       id-clash-len implicit missing-prototypes \
116		      	       no-parentheses pointer-arith return-type shadow \
117		      	       strict-prototypes switch uninitialized unused \
118		      	       write-strings)"/ \
119		 	c/-m/"(68000 68020 68881 bitfield fpa nobitfield rtd \
120			       short c68000 c68020 soft-float g gnu unix fpu \
121			       no-epilogue)"/ \
122		 	c/-d/"(D M N)"/ \
123		 	c/-/"(f W vspec v vpath ansi traditional \
124			      traditional-cpp trigraphs pedantic x o l c g L \
125			      I D U O O2 C E H B b V M MD MM i dynamic \
126			      nodtdlib static nostdinc undef)"/ \
127		 	c/-l/f:*.a/ \
128		 	n/*/f:*.{c,C,cc,o,a,s,i}/
129    complete g++ 	n/*/f:*.{C,cc,o,s,i}/
130    complete CC 	n/*/f:*.{C,cc,cpp,o,s,i}/
131    complete rm 	c/--/"(directory force interactive verbose \
132			recursive help version)"/ c/-/"(d f i v r R -)"/ \
133			n/*/f:^*.{c,cc,C,h,in}/	# Protect precious files
134    complete vi 	n/*/f:^*.[oa]/
135    complete bindkey    N/-a/b/ N/-c/c/ n/-[ascr]/'x:<key-sequence>'/ \
136			n/-[svedlr]/n/ c/-[vedl]/n/ c/-/"(a s k c v e d l r)"/\
137			n/-k/"(left right up down)"/ p/2-/b/ \
138			p/1/'x:<key-sequence or option>'/
139
140    complete find 	n/-fstype/"(nfs 4.2)"/ n/-name/f/ \
141		  	n/-type/"(c b d f p l s)"/ n/-user/u/ n/-group/g/ \
142			n/-exec/c/ n/-ok/c/ n/-cpio/f/ n/-ncpio/f/ n/-newer/f/ \
143		  	c/-/"(fstype name perm prune type user nouser \
144		  	     group nogroup size inum atime mtime ctime exec \
145			     ok print ls cpio ncpio newer xdev depth \
146			     daystart follow maxdepth mindepth noleaf version \
147			     anewer cnewer amin cmin mmin true false uid gid \
148			     ilname iname ipath iregex links lname empty path \
149			     regex used xtype fprint fprint0 fprintf \
150			     print0 printf not a and o or)"/ \
151			     n/*/d/
152
153    complete -%*	c/%/j/			# fill in the jobs builtin
154    complete {fg,bg,stop}	c/%/j/ p/1/"(%)"//
155
156    complete limit	c/-/"(h)"/ n/*/l/
157    complete unlimit	c/-/"(h)"/ n/*/l/
158
159    complete -co*	p/0/"(compress)"/	# make compress completion
160						# not ambiguous
161    complete zcat	n/*/f:*.Z/
162
163    complete finger	c/*@/\$hosts/ n/*/u/@ 
164    complete ping	p/1/\$hosts/
165    complete traceroute	p/1/\$hosts/
166
167    complete {talk,ntalk,phone}	p/1/'`users | tr " " "\012" | uniq`'/ \
168		n/*/\`who\ \|\ grep\ \$:1\ \|\ awk\ \'\{\ print\ \$2\ \}\'\`/
169
170    complete ftp	c/-/"(d i g n v)"/ n/-/\$hosts/ p/1/\$hosts/ n/*/n/
171
172    # this one is simple...
173    #complete rcp c/*:/f/ C@[./\$~]*@f@ n/*/\$hosts/:
174    # From Michael Schroeder <mlschroe@immd4.informatik.uni-erlangen.de> 
175    # This one will rsh to the file to fetch the list of files!
176    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/:'
177
178    complete dd c/--/"(help version)"/ c/[io]f=/f/ \
179		c/conv=*,/"(ascii ebcdic ibm block unblock \
180			    lcase notrunc ucase swab noerror sync)"/,\
181		c/conv=/"(ascii ebcdic ibm block unblock \
182			  lcase notrunc ucase swab noerror sync)"/,\
183	        c/*=/x:'<number>'/ \
184		n/*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
185
186    complete nslookup   p/1/x:'<host>'/ p/2/\$hosts/
187
188    complete ar c/[dmpqrtx]/"(c l o u v a b i)"/ p/1/"(d m p q r t x)"// \
189		p/2/f:*.a/ p/*/f:*.o/
190
191    # these should be merged with the MH completion hacks below - jgotts
192    complete {sprev,snext} \
193		c@+@F:$HOME/Mail/@
194
195    # these and interrupt handling from Jaap Vermeulen <jaap@sequent.com>
196    complete {rexec,rxexec,rxterm,rmterm} \
197			'p/1/$hosts/' 'c/-/(l L E)/' 'n/-l/u/' 'n/-L/f/' \
198			'n/-E/e/' 'n/*/c/'
199    complete kill	'c/-/S/' 'c/%/j/' \
200			'n/*/`ps -u $LOGNAME | awk '"'"'{print $1}'"'"'`/'
201
202    # these from Marc Horowitz <marc@cam.ov.com>
203    complete attach 'n/-mountpoint/d/' 'n/-m/d/' 'n/-type/(afs nfs rvd ufs)/' \
204		    'n/-t/(afs nfs rvd ufs)/' 'n/-user/u/' 'n/-U/u/' \
205		    'c/-/(verbose quiet force printpath lookup debug map \
206			  nomap remap zephyr nozephyr readonly write \
207			  mountpoint noexplicit explicit type mountoptions \
208			  nosetuid setuid override skipfsck lock user host)/' \
209		    'n/-e/f/' 'n/*/()/'
210    complete hesinfo	'p/1/u/' \
211			'p/2/(passwd group uid grplist pcap pobox cluster \
212			      filsys sloc service)/'
213
214    # these from E. Jay Berkenbilt <ejb@ERA.COM>
215    # = isn't always followed by a filename or a path anymore - jgotts
216    complete ./configure 'c/--*=/f/' 'c/--{cache-file,prefix,exec-prefix,\
217    				bindir,sbindir,libexecdir,datadir,\
218				sysconfdir,sharedstatedir,localstatedir,\
219				libdir,includedir,oldincludedir,infodir,\
220				mandir,srcdir}/(=)//' \
221			 'c/--/(cache-file verbose prefix exec-prefix bindir \
222			 	sbindir libexecdir datadir sysconfdir \
223				sharedstatedir localstatedir libdir \
224				includedir oldincludedir infodir mandir \
225				srcdir)//'
226    complete gs 'c/-sDEVICE=/(x11 cdjmono cdj550 epson eps9high epsonc \
227			      dfaxhigh dfaxlow laserjet ljet4 sparc pbm \
228			      pbmraw pgm pgmraw ppm ppmraw bit)/' \
229		'c/-sOutputFile=/f/' 'c/-s/(DEVICE OutputFile)/=' \
230		'c/-d/(NODISPLAY NOPLATFONTS NOPAUSE)/' 'n/*/f/'
231    complete perl	'n/-S/c/'
232    complete printenv	'n/*/e/'
233    complete sccs	p/1/"(admin cdc check clean comb deledit delget \
234			delta diffs edit enter fix get help info \
235			print prs prt rmdel sccsdiff tell unedit \
236			unget val what)"/
237    complete setenv	'p/1/e/' 'c/*:/f/'
238
239    # these and method of setting hosts from Kimmo Suominen <kim@tac.nyc.ny.us>
240    if ( -f $HOME/.mh_profile && -x "`which folders`" ) then 
241
242    if ( ! $?FOLDERS ) setenv FOLDERS "`folders -fast -recurse`"
243    if ( ! $?MHA )     setenv MHA     "`ali | sed -e '/^ /d' -e 's/:.*//'`"
244
245    set folders = ( $FOLDERS )
246    set mha = ( $MHA )
247
248    complete ali \
249        'c/-/(alias nolist list nonormalize normalize nouser user help)/' \
250        'n,-alias,f,'
251
252    complete anno \
253        'c/-/(component noinplace inplace nodate date text help)/' \
254        'c,+,$folders,'  \
255        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
256
257    complete burst \
258        'c/-/(noinplace inplace noquiet quiet noverbose verbose help)/' \
259        'c,+,$folders,'  \
260        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
261
262    complete comp \
263        'c/-/(draftfolder draftmessage nodraftfolder editor noedit file form nouse use whatnowproc nowhatnowproc help)/' \
264        'c,+,$folders,'  \
265        'n,-whatnowproc,c,'  \
266        'n,-file,f,'\
267        'n,-form,f,'\
268        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
269
270    complete dist \
271        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit form noinplace inplace whatnowproc nowhatnowproc help)/' \
272        'c,+,$folders,'  \
273        'n,-whatnowproc,c,'  \
274        'n,-form,f,'\
275        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
276
277    complete folder \
278        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
279        'c,+,$folders,'  \
280        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
281
282    complete folders \
283        'c/-/(all nofast fast noheader header nopack pack noverbose verbose norecurse recurse nototal total noprint print nolist list push pop help)/' \
284        'c,+,$folders,'  \
285        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
286
287    complete forw \
288        'c/-/(noannotate annotate draftfolder draftmessage nodraftfolder editor noedit filter form noformat format noinplace inplace digest issue volume whatnowproc nowhatnowproc help)/' \
289        'c,+,$folders,'  \
290        'n,-whatnowproc,c,'  \
291        'n,-filter,f,'\
292        'n,-form,f,'\
293        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
294
295    complete inc \
296        'c/-/(audit file noaudit nochangecur changecur file form format nosilent silent notruncate truncate width help)/' \
297        'c,+,$folders,'  \
298        'n,-audit,f,'\
299        'n,-form,f,'
300
301    complete mark \
302        'c/-/(add delete list sequence nopublic public nozero zero help)/' \
303        'c,+,$folders,'  \
304        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
305
306    complete mhmail \
307        'c/-/(body cc from subject help)/' \
308        'n,-cc,$mha,'  \
309        'n,-from,$mha,'  \
310        'n/*/$mha/'
311
312    complete mhpath \
313        'c/-/(help)/' \
314        'c,+,$folders,'  \
315        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
316
317    complete msgchk \
318        'c/-/(nodate date nonotify notify help)/' 
319
320    complete msh \
321        'c/-/(prompt noscan scan notopcur topcur help)/' 
322
323    complete next \
324        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
325        'c,+,$folders,'  \
326        'n,-moreproc,c,'  \
327        'n,-showproc,c,'  \
328        'n,-form,f,'
329
330    complete packf \
331        'c/-/(file help)/' \
332        'c,+,$folders,'  \
333        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
334
335    complete pick \
336        'c/-/(and or not lbrace rbrace cc date from search subject to othercomponent after before datefield sequence nopublic public nozero zero nolist list help)/' \
337        'c,+,$folders,'  \
338        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
339
340    complete prev \
341        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
342        'c,+,$folders,'  \
343        'n,-moreproc,c,'  \
344        'n,-showproc,c,'  \
345        'n,-form,f,'
346
347    complete prompter \
348        'c/-/(erase kill noprepend prepend norapid rapid nodoteof doteof help)/' 
349
350    complete refile \
351        'c/-/(draft nolink link nopreserve preserve src file help)/' \
352        'c,+,$folders,'  \
353        'n,-file,f,'\
354        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
355
356    complete rmf \
357        'c/-/(nointeractive interactive help)/' \
358        'c,+,$folders,'  
359
360    complete rmm \
361        'c/-/(help)/' \
362        'c,+,$folders,'  \
363        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
364
365    complete scan \
366        'c/-/(noclear clear form format noheader header width noreverse reverse file help)/' \
367        'c,+,$folders,'  \
368        'n,-form,f,'\
369        'n,-file,f,'\
370        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
371
372    complete send \
373        'c/-/(alias draft draftfolder draftmessage nodraftfolder filter nofilter noformat format noforward forward nomsgid msgid nopush push noverbose verbose nowatch watch width help)/' \
374        'n,-alias,f,'\
375        'n,-filter,f,'
376
377    complete show \
378        'c/-/(draft form moreproc nomoreproc length width showproc noshowproc header noheader help)/' \
379        'c,+,$folders,'  \
380        'n,-moreproc,c,'  \
381        'n,-showproc,c,'  \
382        'n,-form,f,'\
383        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
384
385    complete sortm \
386        'c/-/(datefield textfield notextfield limit nolimit noverbose verbose help)/' \
387        'c,+,$folders,'  \
388        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
389
390    complete vmh \
391        'c/-/(prompt vmhproc novmhproc help)/' \
392        'n,-vmhproc,c,'  
393
394    complete whatnow \
395        'c/-/(draftfolder draftmessage nodraftfolder editor noedit prompt help)/' 
396
397    complete whom \
398        'c/-/(alias nocheck check draft draftfolder draftmessage nodraftfolder help)/' \
399        'n,-alias,f,'
400
401    complete plum \
402        'c/-/()/' \
403        'c,+,$folders,'  \
404        'n,*,`(mark | sed "s/:.*//";echo next cur prev first last)|tr " " "\12" | sort -u`,'
405
406    complete mail \
407        'c/-/()/' \
408        'n/*/$mha/'
409
410    endif
411
412    #from Dan Nicolaescu <dann@ics.uci.edu>
413    if ( $?MODULESHOME ) then
414	alias Compl_module 'find ${MODULEPATH:as/:/ /} -name .version -o -name .modulea\* -prune -o -print  | sed `echo "-e s@${MODULEPATH:as%:%/\*@@g -e s@%}/\*@@g"`'
415	complete module 'p%1%(add load unload switch display avail use unuse update purge list clear help initadd initrm initswitch initlist initclear)%' \
416	'n%{unl*,sw*,inits*}%`echo "$LOADEDMODULES:as/:/ /"`%' \
417	'n%{lo*,di*,he*,inita*,initr*}%`eval Compl_module`%' \
418	'N%{sw*,initsw*}%`eval Compl_module`%' 'C%-%(-append)%' 'n%{use,unu*,av*}%d%' 'n%-append%d%' \
419	'C%[^-]*%`eval Compl_module`%'
420    endif
421
422    # from George Cox
423    complete acroread	'p/*/f:*.{pdf,PDF}/'
424    complete apachectl  'c/*/(start stop restart fullstatus status graceful \
425			configtest help)/'
426    complete appletviewer	'p/*/f:*.class/'
427    complete bison	'c/--/(debug defines file-prefix= fixed-output-files \
428			help name-prefix= no-lines no-parser output= \
429			token-table verbose version yacc)/' \
430			'c/-/(b d h k l n o p t v y V)/' 'n/-b/f/' 'n/-o/f/' \
431			'n/-p/f/'
432    complete bunzip2	'p/*/f:*.bz2/' 
433    complete bzip2	'n/-9/f:^*.bz2/' 'n/-d/f:*.bz2/'
434    complete c++	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
435    complete co		'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
436    complete crontab	'n/-u/u/'
437    complete camcontrol	'p/1/(cmd debug defects devlist eject inquiry \
438			modepage negotiate periphlist rescan reset start \
439			stop tags tur)/'
440    complete ctlinnd	'p/1/(addhist allow begin cancel changegroup \
441			checkfile drop feedinfo flush flushlogs go hangup \
442			logmode mode name newgroup param pause readers refile \
443			reject reload renumber reserve rmgroup send shutdown \
444			kill throttle trace xabort xexec)/'
445    complete cvs	'c/--/(help help-commands help-synonyms)/' \
446			'p/1/(add admin annotate checkout commit diff \
447			edit editors export history import init log login \
448			logout rdiff release remove rtag status tag unedit \
449			update watch watchers)/' 'n/-a/(edit unedit commit \
450			all none)/' 'n/watch/(on off add remove)/'
451    complete cxx	'p/*/f:*.{c++,cxx,c,cc,C,cpp}/'
452    complete detex	'p/*/f:*.tex/'
453    complete edquota    'n/*/u/'
454    complete exec	'p/1/c/'
455    complete ghostview	'p/*/f:*.ps/'
456    complete gv		'p/*/f:*.ps/'
457    complete ifconfig	'p@1@`ifconfig -l`@' 'n/*/(range phase link netmask \
458			mtu vlandev vlan metric mediaopt down delete \
459			broadcast arp debug)/'
460    complete imake	'c/-I/d/'
461    complete ipfw 	'p/1/(flush add delete list show zero)/' \
462			'n/add/(allow permit accept pass deny drop reject \
463			reset count skipto num divert port tee port)/'
464    complete javac	'p/*/f:*.java/'
465    complete ldif2ldbm	'n/-i/f:*.ldif/'
466    complete libtool	'c/--mode=/(compile execute finish install link \
467			uninstall)/' 'c/--/(config debug dry-run features \
468			finish help quiet silent version mode=)/'
469    complete libtoolize	'c/--/(automake copy debug dry-run force help ltdl \
470			ltdl-tar version)/'
471    complete links	'c/-/(assume-codepage async-dns download-dir \
472			format-cache-size ftp-proxy help http-proxy \
473			max-connections max-connections-to-host \
474			memory-cache-size receive-timeout retries \
475			unrestartable-receive-timeout version)/'
476    complete natd	c/-/'(alias_address config deny_incoming dynamic \
477			inport interface log log_denied log_facility \
478			outport outport port pptpalias proxy_only \
479			proxy_rule redirect_address redirect_port \
480			reverse same_ports unregistered_only use_sockets \
481			verbose)'/ 'n@-interface@`ifconfig -l`@'
482    complete netstat	'n@-I@`ifconfig -l`@'
483    complete objdump	'c/--/(adjust-vma= all-headers architecture= \
484			archive-headers debugging demangle disassemble \
485			disassemble-all disassemble-zeroes dynamic-reloc \
486			dynamic-syms endian= file-headers full-contents \
487			headers help info line-numbers no-show-raw-insn \
488			prefix-addresses private-headers reloc section-headers \
489			section=source stabs start-address= stop-address= \
490			syms target= version wide)/' \
491			'c/-/(a h i f C d D p r R t T x s S l w)/'
492    complete xmodmap	'c/-/(display help grammar verbose quiet n e pm pk \
493			pke pp)/'
494    complete lynx	'c/-/(accept_all_cookies anonymous assume_charset= \
495			assume_local_charset= assume_unrec_charset= auth= base \
496			book buried_news cache= case cfg= child cookie_file= \
497			cookies core crawl debug_partial display= dump editor= \
498			emacskeys enable_scrollback error_file= force_html \
499			force_secure forms_options from ftp get_data head help \
500			hiddenlinks= historical homepage= image_links index= \
501			ismap link= localhost mime_header minimal \
502			newschunksize= newsmaxchunk= nobrowse nocc nocolor \
503			nofilereferer nolist nolog nopause noprint noredir \
504			noreferer nostatus number_links partial partial_thres \
505			pauth= popup post_data preparsed print pseudo_inlines \
506			raw realm reload restrictions= resubmit_posts rlogin \
507			selective show_cursor soft_dquotes source stack_dump \
508			startfile_ok tagsoup telnet term= tlog trace traversal \
509			underscore useragent= validate verbose version vikeys \
510			width=)/' 'c/(http|ftp)/$URLS/'
511    complete gmake	'c/{--directory=,--include-dir=}/d/' \
512			'c/{--assume-new,--assume-old,--makefile,--new-file,--what-if,--file}/f/' \
513			'c/--/(assume-new= assume-old= debug directory= \
514			dry-run environment-overrides file= help \
515			ignore-errors include-dir= jobs[=N] just-print \
516			keep-going load-average[=N] makefile= max-load[=N] \
517			new-file= no-builtin-rules no-keep-going \
518			no-print-directory old-file= print-data-base \
519			print-directory question quiet recon silent stop \
520			touch version warn-undefined-variables what-if=)/' \
521			'n@*@`cat -s GNUMakefile Makefile makefile |& sed -n -e "/No such file/d" -e "s/^\([A-Za-z0-9-]*\):.*/\1/p"`@' \
522			'n/=/f/' 'n/-f/f/'
523    complete mixer	p/1/'(vol bass treble synth pcm speaker mic cd mix \
524			pcm2 rec igain ogain line1 line2 line3)'/ \
525			p@2@'`mixer $:-1 | awk \{\ print\ \$7\ \}`'@
526
527    complete mpg123	'c/--/(2to1 4to1 8bit aggressive au audiodevice \
528    			auth buffer cdr check doublespeed equalizer frames \
529			gain halfspeed headphones left lineout list mix mono \
530			proxy quiet random rate reopen resync right scale \
531			shuffle single0 single1 skip speaker stdout stereo \
532			test verbose wav)/'
533    complete mysqladmin	'n/*/(create drop extended-status flush-hosts \
534			flush-logs flush-status flush-tables flush-privileges \
535			kill password ping processlist reload refresh \
536			shutdown status variables version)/'
537    complete mutt	c@-f=@F:${HOME}/Mail/@ \
538			n/-a/f/ \
539			n/-F/f/ n/-H/f/ \
540			n/-s/x:'<subject line>'/ \
541			n/-e/x:'<command>'/ \
542			n@-b@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
543			n@-c@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@ \
544			n@*@'`cat ${HOME}/.muttrc-alias | awk '"'"'{print $2 }'"'"\`@
545    complete ndc	'n/*/(status dumpdb reload stats trace notrace \
546			querylog start stop restart )/'
547    complete nm		'c/--/(debug-syms defined-only demangle dynamic \
548			extern-only format= help line-numbers no-demangle \
549			no-sort numeric-sort portability print-armap \
550			print-file-name reverse-sort size-sort undefined-only \
551			version)/' 'p/*/f:^*.{h,C,c,cc}/'
552    complete nmap	'n@-e@`ifconfig -l`@' 'p/*/$hostnames/'
553    complete perldoc 	'n@*@`\ls -1 /usr/libdata/perl/5.*/pod | sed s%\\.pod.\*\$%%`@'
554    complete postfix    'n/*/(start stop reload abort flush check)/'
555    complete postmap	'n/1/(hash: regexp:)' 'c/hash:/f/' 'c/regexp:/f/'
556    complete rcsdiff	'p@1@`\ls -1a RCS | sed -e "s/\(.*\),v/\1/"`@'
557    complete X		'c/-/(I a ac allowMouseOpenFail allowNonLocalModInDev \
558			allowNonLocalXvidtune ar1 ar2 audit auth bestRefresh \
559			bgamma bpp broadcast bs c cc class co core deferglyphs \
560			disableModInDev disableVidMode displayID dpi dpms f fc \
561			flipPixels fn fp gamma ggamma help indirect kb keeptty \
562			ld lf logo ls nolisten string noloadxkb nolock nopn \
563			once p pn port probeonly query quiet r rgamma s \
564			showconfig sp su t terminate to tst v verbose version \
565			weight wm x xkbdb xkbmap)/'
566    complete users      'c/--/(help version)/' 'p/1/x:"<accounting_file>"/'
567    complete vidcontrol	'p/1/(132x25 132x30 132x43 132x50 132x60 40x25 80x25 \
568			80x30 80x43 80x50 80x60 EGA_80x25 EGA_80x43 \
569			VESA_132x25 VESA_132x30 VESA_132x43 VESA_132x50 \
570			VESA_132x60 VESA_800x600 VGA_320x200 VGA_40x25 \
571			VGA_80x25 VGA_80x30 VGA_80x50 VGA_80x60)/'
572    complete vim	'n/*/f:^*.[oa]/'
573    complete where	'n/*/c/'
574    complete which	'n/*/c/'
575    complete wmsetbg	'c/-/(display D S a b c d e m p s t u w)/' \
576			'c/--/(back-color center colors dither help match \
577			maxscale parse scale smooth tile update-domain \
578			update-wmaker version workspace)/'
579    complete xdb	'p/1/c/'
580    complete xdvi	'c/-/(allowshell debug display expert gamma hushchars \
581			hushchecksums hushspecials install interpreter keep \
582			margins nogrey noinstall nomakepk noscan paper safer \
583			shrinkbuttonn thorough topmargin underlink version)/' \
584			'n/-paper/(a4 a4r a5 a5r)/' 'p/*/f:*.dvi/'
585    complete xlock	'c/-/(allowaccess allowroot debug description \
586			echokeys enablesaver grabmouse grabserver hide inroot \
587			install inwindow mono mousemotion nolock remote \
588			resetsaver sound timeelapsed use3d usefirst verbose \
589			wireframe background batchcount bg bitmap both3d \
590			count cycles delay delta3d display dpmsoff \
591			dpmsstandby dpmssuspend endCmd erasedelay erasemode \
592			erasetime fg font foreground geometry help \
593			icongeometry info invalid left3d lockdelay logoutCmd \
594			mailCmd mailIcon message messagefile messagefont \
595			messagesfile mode name ncolors nice nomailIcon none3d \
596			parent password planfont program resources right3d \
597			saturation size startCmd timeout username validate \
598			version visual)/' 'n/-mode/(ant atlantis ball bat \
599			blot bouboule bounce braid bubble bubble3d bug cage \
600			cartoon clock coral crystal daisy dclock decay deco \
601			demon dilemma discrete drift eyes fadeplot flag flame \
602			flow forest galaxy gears goop grav helix hop hyper \
603			ico ifs image invert julia kaleid kumppa lament laser \
604			life life1d life3d lightning lisa lissie loop lyapunov \
605			mandelbrot marquee matrix maze moebius morph3d \
606			mountain munch nose pacman penrose petal pipes puzzle \
607			pyro qix roll rotor rubik shape sierpinski slip sphere \
608			spiral spline sproingies stairs star starfish strange \
609			superquadrics swarm swirl tetris thornbird triangle \
610			tube turtle vines voters wator wire world worm xjack \
611			blank bomb random)/' 
612    complete xfig	'c/-/(display)/' 'p/*/f:*.fig/'
613    complete wget 	c/--/"(accept= append-output= background cache= \
614			continue convert-links cut-dirs= debug \
615			delete-after directory-prefix= domains= \
616			dont-remove-listing dot-style= exclude-directories= \
617			exclude-domains= execute= follow-ftp \
618			force-directories force-html glob= header= help \
619			http-passwd= http-user= ignore-length \
620			include-directories= input-file= level= mirror \
621			no-clobber no-directories no-host-directories \
622			no-host-lookup no-parent non-verbose \
623			output-document= output-file= passive-ftp \
624			proxy-passwd= proxy-user= proxy= quiet quota= \
625			recursive reject= relative retr-symlinks save-headers \
626			server-response span-hosts spider timeout= \
627			timestamping tries= user-agent= verbose version wait=)"/
628
629    # these from Tom Warzeka <tom@waz.cc>
630
631    # this one works but is slow and doesn't descend into subdirectories
632    # complete	cd	C@[./\$~]*@d@ \
633    #			p@1@'`\ls -1F . $cdpath | grep /\$ | sort -u`'@ n@*@n@
634
635    if ( -r /etc/shells ) then
636        complete setenv	p@1@e@ n@DISPLAY@\$hosts@: n@SHELL@'`cat /etc/shells`'@
637    else
638	complete setenv	p@1@e@ n@DISPLAY@\$hosts@:
639    endif
640    complete unsetenv	n/*/e/
641
642    if (-r /var/spool/mail) then
643      set _maildir = /var/spool/mail
644    else
645      set _maildir = /usr/mail
646    endif
647    if (-r $HOME/.mailrc) then
648        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
649			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
650			n@-u@T:$_maildir@ n/-f/f/ \
651			n@*@'`sed -n s/alias//p $HOME/.mailrc | tr -s " " "	" | cut -f 2`'@
652    else
653        complete mail	c/-/"(e i f n s u v)"/ c/*@/\$hosts/ \
654			c@+@F:$HOME/Mail@ C@[./\$~]@f@ n/-s/x:'<subject>'/ \
655			n@-u@T:$_maildir@ n/-f/f/ n/*/u/
656    endif
657    unset _maildir
658
659    if (! $?MANPATH) then
660	if (-r /usr/share/man) then
661	    setenv MANPATH /usr/share/man:
662	else
663	    setenv MANPATH /usr/man:
664	endif
665    endif
666
667    # use of $MANPATH from Dan Nicolaescu <dann@ics.uci.edu>
668    # use of 'find' adapted from Lubomir Host <host8@kepler.fmph.uniba.sk>
669    complete man \
670	    'n@1@`set q = "$MANPATH:as%:%/man1 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.1.\*\$%%`@'\
671	    'n@2@`set q = "$MANPATH:as%:%/man2 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.2.\*\$%%`@'\
672	    'n@3@`set q = "$MANPATH:as%:%/man3 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.3.\*\$%%`@'\
673	    'n@4@`set q = "$MANPATH:as%:%/man4 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.4.\*\$%%`@'\
674	    'n@5@`set q = "$MANPATH:as%:%/man5 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.5.\*\$%%`@'\
675	    'n@6@`set q = "$MANPATH:as%:%/man6 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.6.\*\$%%`@'\
676	    'n@7@`set q = "$MANPATH:as%:%/man7 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.7.\*\$%%`@'\
677	    'n@8@`set q = "$MANPATH:as%:%/man8 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.8.\*\$%%`@'\
678	    'n@9@`set q = "$MANPATH:as%:%/man9 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.9.\*\$%%`@'\
679	    'n@0@`set q = "$MANPATH:as%:%/man0 %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.0.\*\$%%`@'\
680	    'n@n@`set q = "$MANPATH:as%:%/mann %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.n.\*\$%%`@'\
681	    'n@o@`set q = "$MANPATH:as%:%/mano %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.o.\*\$%%`@'\
682	    'n@l@`set q = "$MANPATH:as%:%/manl %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.l.\*\$%%`@'\
683	    'n@p@`set q = "$MANPATH:as%:%/manp %" ; \ls -1 $q |& sed -e s%^.\*:.\*\$%% -e s%\\.p.\*\$%%`@'\
684	    c@-@"(- f k M P s S t)"@ n@-f@c@ n@-k@x:'<keyword>'@ n@-[MP]@d@   \
685	    'N@-[MP]@`\ls -1 $:-1/man? |& sed -n s%\\..\\+\$%%p`@'            \
686	    'n@-[sS]@`\ls -1 $MANPATH:as%:% % |& sed -n s%^man%%p | sort -u`@'\
687	    'n@*@`find $MANPATH:as%:% % \( -type f -o -type l \) -printf "%f " |& sed -e "s%find: .*: No such file or directory%%" -e "s%\([^\.]\+\)\.\([^ ]*\) %\1 %g"`@'
688	    #n@*@c@ # old way -- commands only
689
690    complete ps	        c/-t/x:'<tty>'/ c/-/"(a c C e g k l S t u v w x)"/ \
691			n/-k/x:'<kernel>'/ N/-k/x:'<core_file>'/ n/*/x:'<PID>'/
692    complete compress	c/-/"(c f v b)"/ n/-b/x:'<max_bits>'/ n/*/f:^*.Z/
693    complete uncompress	c/-/"(c f v)"/                        n/*/f:*.Z/
694
695    complete uuencode	p/1/f/ p/2/x:'<decode_pathname>'/ n/*/n/
696    complete uudecode	c/-/"(f)"/ n/-f/f:*.{uu,UU}/ p/1/f:*.{uu,UU}/ n/*/n/
697
698    complete xhost	c/[+-]/\$hosts/ n/*/\$hosts/
699    complete xpdf	c/-/"(z g remote raise quit cmap rgb papercolor       \
700			      eucjp t1lib freetype ps paperw paperh level1    \
701			      upw fullscreen cmd q v h help)"/                \
702			n/-z/x:'<zoom (-5 .. +5) or "page" or "width">'/      \
703			n/-g/x:'<geometry>'/ n/-remote/x:'<name>'/            \
704			n/-rgb/x:'<number>'/ n/-papercolor/x:'<color>'/       \
705			n/-{t1lib,freetype}/x:'<font_type>'/                  \
706			n/-ps/x:'<PS_file>'/ n/-paperw/x:'<width>'/           \
707			n/-paperh/x:'<height>'/ n/-upw/x:'<password>'/        \
708			n/-/f:*.{pdf,PDF}/                                    \
709			N/-{z,g,remote,rgb,papercolor,t1lib,freetype,ps,paperw,paperh,upw}/f:*.{pdf,PDF}/ \
710			N/-/x:'<page>'/ p/1/f:*.{pdf,PDF}/ p/2/x:'<page>'/
711
712    # these conform to the latest GNU versions available at press time ...
713    # updates by John Gotts <jgotts@engin.umich.edu>
714    if (-X emacs) then
715      # TW note:  if your version of GNU Emacs supports the "--version" option,
716      #           uncomment this line and comment the next to automatically
717      #           detect the version, else replace "21.2" with your version.
718      #set _emacs_ver=`emacs --version | sed -e 's%GNU Emacs %%' -e q | cut -d . -f1-2`
719      set _emacs_ver=21.2
720      set _emacs_dir=`which emacs | sed s%/bin/emacs%%` 
721      complete emacs	c/--/"(batch terminal display no-windows no-init-file \
722                               user debug-init unibyte multibyte version help \
723                               no-site-file funcall load eval insert kill)"/ \
724                        c/-/"(t d nw q u f l -)"/ c/+/x:'<line_number>'/ \
725			n/{-t,--terminal}/x:'<terminal>'/ n/{-d,--display}/x:'<display>'/ \
726	                n/{-u,--user}/u/ n/{-f,--funcall}/x:'<lisp_function>'/ \
727			n@{-l,--load}@F:$_emacs_dir/share/emacs/$_emacs_ver/lisp@ \
728			n/--eval/x:'<expression>'/ n/--insert/f/ n/*/f:^*[\#~]/
729      unset _emacs_ver _emacs_dir
730    endif
731
732    # if your "zcat" is the GNU version, change "gzcat" below to just "zcat"
733    complete gzcat	c/--/"(force help license quiet version)"/ \
734			c/-/"(f h L q V -)"/ n/*/f:*.{gz,Z,z,zip}/
735    complete gzip	c/--/"(stdout to-stdout decompress uncompress \
736			force help list license no-name quiet recurse \
737			suffix test verbose version fast best)"/ \
738			c/-/"(c d f h l L n q r S t v V 1 2 3 4 5 6 7 8 9 -)"/\
739			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
740			n/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
741			N/{-d,--{de,un}compress}/f:*.{gz,Z,z,zip,taz,tgz}/ \
742			n/*/f:^*.{gz,Z,z,zip,taz,tgz}/
743    complete {gunzip,ungzip} c/--/"(stdout to-stdout force help list license \
744			no-name quiet recurse suffix test verbose version)"/ \
745			c/-/"(c f h l L n q r S t v V -)"/ \
746			n/{-S,--suffix}/x:'<file_name_suffix>'/ \
747			n/*/f:*.{gz,Z,z,zip,taz,tgz}/
748    complete zgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
749			c/-/"(A b B c C e f h i l n s v V w x)"/ \
750			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
751			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
752    complete zegrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
753			c/-/"(A b B c C e f h i l n s v V w x)"/ \
754			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
755			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
756    complete zfgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
757			c/-/"(A b B c C e f h i l n s v V w x)"/ \
758			p/1/x:'<fixed_string>'/ N/-*e/f/ \
759			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
760    complete znew	c/-/"(f t v 9 P K)"/ n/*/f:*.Z/
761    complete zmore	n/*/f:*.{gz,Z,z,zip}/
762    complete zfile	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
763    complete ztouch	n/*/f:*.{gz,Z,z,zip,taz,tgz}/
764    complete zforce	n/*/f:^*.{gz,tgz}/
765
766    complete grep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
767			c/--/"(extended-regexp fixed-regexp basic-regexp \
768			regexp file ignore-case word-regexp line-regexp \
769			no-messages revert-match version help byte-offset \
770			line-number with-filename no-filename quiet silent \
771			text directories recursive files-without-match \
772			files-with-matches count before-context after-context \
773			context binary unix-byte-offsets)"/ \
774			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 \
775				v w x)"/ \
776			p/1/x:'<limited_regular_expression>'/ N/-*e/f/ \
777			n/-*e/x:'<limited_regular_expression>'/ n/-*f/f/ n/*/f/
778    complete egrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
779			c/--/"(extended-regexp fixed-regexp basic-regexp \
780			regexp file ignore-case word-regexp line-regexp \
781			no-messages revert-match version help byte-offset \
782			line-number with-filename no-filename quiet silent \
783			text directories recursive files-without-match \
784			files-with-matches count before-context after-context \
785			context binary unix-byte-offsets)"/ \
786			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 \
787				v w x)"/ \
788			p/1/x:'<full_regular_expression>'/ N/-*e/f/ \
789			n/-*e/x:'<full_regular_expression>'/ n/-*f/f/ n/*/f/
790    complete fgrep	c/-*A/x:'<#_lines_after>'/ c/-*B/x:'<#_lines_before>'/\
791			c/--/"(extended-regexp fixed-regexp basic-regexp \
792			regexp file ignore-case word-regexp line-regexp \
793			no-messages revert-match version help byte-offset \
794			line-number with-filename no-filename quiet silent \
795			text directories recursive files-without-match \
796			files-with-matches count before-context after-context \
797			context binary unix-byte-offsets)"/ \
798			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 \
799				v w x)"/ \
800			p/1/x:'<fixed_string>'/ N/-*e/f/ \
801			n/-*e/x:'<fixed_string>'/ n/-*f/f/ n/*/f/
802
803    complete sed	c/--/"(quiet silent version help expression file)"/   \
804			c/-/"(n V e f -)"/ n/{-e,--expression}/x:'<script>'/  \
805			n/{-f,--file}/f:*.sed/ N/-{e,f,-{file,expression}}/f/ \
806			n/-/x:'<script>'/ N/-/f/ p/1/x:'<script>'/ p/2/f/
807
808    complete users	c/--/"(help version)"/ p/1/x:'<accounting_file>'/
809    complete who	c/--/"(heading idle count mesg message writable help \
810    			version)"/ c/-/"(H i m q s T w u -)"/ \
811			p/1/x:'<accounting_file>'/ n/am/"(i)"/ n/are/"(you)"/
812
813    complete chown	c/--/"(changes dereference no-dereference silent \
814    			quiet reference recursive verbose help version)"/ \
815			c/-/"(c f h R v -)"/ C@[./\$~]@f@ c/*[.:]/g/ \
816			n/-/u/: p/1/u/: n/*/f/
817    complete chgrp	c/--/"(changes no-dereference silent quiet reference \
818    			recursive verbose help version)"/ \
819			c/-/"(c f h R v -)"/ n/-/g/ p/1/g/ n/*/f/
820    complete chmod	c/--/"(changes silent quiet verbose reference \
821    			recursive help version)"/ c/-/"(c f R v)"/
822    complete df		c/--/"(all block-size human-readable si inodes \
823			kilobytes local megabytes no-sync portability sync \
824			type print-type exclude-type help version)"/ \
825			c/-/"(a H h i k l m P T t v x)"/
826    complete du		c/--/"(all block-size bytes total dereference-args \
827    			human-readable si kilobytes count-links dereference \
828			megabytes separate-dirs summarize one-file-system \
829			exclude-from exclude max-depth help version"/ \
830			c/-/"(a b c D H h k L l m S s X x)"/
831
832    complete cat	c/--/"(number-nonblank number squeeze-blank show-all \
833			show-nonprinting show-ends show-tabs help version)"/ \
834			c/-/"(A b E e n s T t u v -)"/ n/*/f/
835    complete mv		c/--/"(backup force interactive update verbose suffix \
836			version-control help version)"/ \
837			c/-/"(b f i S u V v -)"/ \
838			n/{-S,--suffix}/x:'<suffix>'/ \
839			n/{-V,--version-control}/"(t numbered nil existing \
840			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
841    complete cp		c/--/"(archive backup no-dereference force \
842    			interactive link preserve parents sparse recursive \
843			symbolic-link suffix update verbose version-control \
844			one-file-system help version)"/ \
845			c/-/"(a b d f i l P p R r S s u V v x -)"/ \
846			n/-*r/d/ n/{-S,--suffix}/x:'<suffix>'/ \
847			n/{-V,--version-control}/"(t numbered nil existing \
848			never simple)"/ n/-/f/ N/-/d/ p/1/f/ p/2/d/ n/*/f/
849    complete ln		c/--/"(backup directory force no-dereference \
850    			interactive symbolic suffix verbose version-control \
851			help version)"/ \
852			c/-/"(b d F f i n S s V v -)"/ \
853			n/{-S,--suffix}/x:'<suffix>'/ \
854			n/{-V,--version-control}/"(t numbered nil existing \
855			never simple)"/ n/-/f/ N/-/x:'<link_name>'/ \
856			p/1/f/ p/2/x:'<link_name>'/
857    complete touch	c/--/"(date reference time help version)"/ \
858			c/-/"(a c d f m r t -)"/ \
859			n/{-d,--date}/x:'<date_string>'/ \
860			c/--time/"(access atime mtime modify use)"/ \
861			n/{-r,--file}/f/ n/-t/x:'<time_stamp>'/ n/*/f/
862    complete mkdir	c/--/"(mode parents verbose help version)"/ \
863    			c/-/"(p m -)"/ \
864			n/{-m,--mode}/x:'<mode>'/ n/*/d/
865    complete rmdir	c/--/"(ignore-fail-on-non-empty parents verbose help \
866    			version)"/ c/-/"(p -)"/ n/*/d/
867
868    complete tar	c/-[Acru]*/"(b B C f F g G h i l L M N o P \
869			R S T v V w W X z Z)"/ \
870			c/-[dtx]*/"( B C f F g G i k K m M O p P \
871			R s S T v w x X z Z)"/ \
872			p/1/"(A c d r t u x -A -c -d -r -t -u -x \
873			--catenate --concatenate --create --diff --compare \
874			--delete --append --list --update --extract --get \
875			--help --version)"/ \
876			c/--/"(catenate concatenate create diff compare \
877			delete append list update extract get atime-preserve \
878			block-size read-full-blocks directory checkpoint file \
879			force-local info-script new-volume-script incremental \
880			listed-incremental dereference ignore-zeros \
881			ignore-failed-read keep-old-files starting-file \
882			one-file-system tape-length modification-time \
883			multi-volume after-date newer old-archive portability \
884			to-stdout same-permissions preserve-permissions \
885			absolute-paths preserve record-number remove-files \
886			same-order preserve-order same-owner sparse \
887			files-from null totals verbose label version \
888			interactive confirmation verify exclude exclude-from \
889			compress uncompress gzip ungzip use-compress-program \
890			block-compress help version)"/ \
891			c/-/"(b B C f F g G h i k K l L m M N o O p P R s S \
892			T v V w W X z Z 0 1 2 3 4 5 6 7 -)"/ \
893			C@[/dev]@f@ \
894			n/-c*f/x:'<new_tar_file, device_file, or "-">'/ \
895			n/{-[Adrtux]*f,--file}/f:*.{tar,taz,tgz}/ \
896			N/{-x*f,--file}/'`tar -tf $:-1`'/ \
897			n/--use-compress-program/c/ \
898			n/{-b,--block-size}/x:'<block_size>'/ \
899			n/{-V,--label}/x:'<volume_label>'/ \
900			n/{-N,--{after-date,newer}}/x:'<date>'/ \
901			n/{-L,--tape-length}/x:'<tape_length_in_kB>'/ \
902			n/{-C,--directory}/d/ \
903			N/{-C,--directory}/'`\ls $:-1`'/ \
904			n/-[0-7]/"(l m h)"/
905
906    # SVR4 filesystems
907    complete  mount	c/-/"(a F m o O p r v V)"/ n/-p/n/ n/-v/n/ \
908    			n/-o/x:'<FSType_options>'/ \
909    			n@-F@'`\ls -1 /usr/lib/fs`'@ \
910    			n@*@'`grep -v "^#" /etc/vfstab | tr -s " " "	 " | cut -f 3`'@
911    complete umount	c/-/"(a o V)"/ n/-o/x:'<FSType_options>'/ \
912    			n/*/'`mount | cut -d " " -f 1`'/
913    complete  mountall	c/-/"(F l r)"/ n@-F@'`\ls -1 /usr/lib/fs`'@
914    complete umountall	c/-/"(F h k l r s)"/ n@-F@'`\ls -1 /usr/lib/fs`'@ \
915    			n/-h/'`df -k | cut -s -d ":" -f 1 | sort -u`'/
916    # BSD 4.3 filesystems
917    #complete  mount	c/-/"(a r t v)"/ n/-t/"(4.2 nfs)"/ \
918    #			n@*@'`grep -v "^#" /etc/fstab | tr -s " " "	" | cut -f 2`'@
919    #complete umount	c/-/"(a h t v)"/ n/-t/"(4.2 nfs)"/ \
920    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
921    #			n/*/'`mount | cut -d " " -f 3`'/
922    # BSD 4.2 filesystems
923    #complete  mount	c/-/"(a r t v)"/ n/-t/"(ufs nfs)"/ \
924    #			n@*@'`cut -d ":" -f 2 /etc/fstab`'@
925    #complete umount	c/-/"(a h t v)"/ n/-t/"(ufs nfs)"/ \
926    #			n/-h/'`df | cut -s -d ":" -f 1 | sort -u`'/ \
927    #			n/*/'`mount | cut -d " " -f 3`'/
928
929    # these deal with NIS (formerly YP); if it's not running you don't need 'em
930    if (-X domainname) then
931      set _domain = "`domainname`"
932      set _ypdir  = /var/yp	# directory where NIS (YP) maps are kept
933      if ("$_domain" != "" && "$_domain" != "noname") then
934        complete domainname p@1@D:$_ypdir@" " n@*@n@
935        complete ypcat	    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
936	                    N@-d@\`\\ls\ -1\ $_ypdir/\$:-1\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
937	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
938        complete ypmatch    c@-@"(d k t x)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
939	                    N@-d@x:'<key ...>'@ n@-@x:'<key ...>'@ p@1@x:'<key ...>'@ \
940	                    n@*@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@
941        complete ypwhich    c@-@"(d m t x V1 V2)"@ n@-x@n@ n@-d@D:$_ypdir@" " \
942	                    n@-m@\`\\ls\ -1\ $_ypdir/$_domain\ \|\ sed\ -n\ s%\\\\.pag\\\$%%p\`@ \
943			    N@-m@n@ n@*@\$hosts@
944      endif
945      unset _domain _ypdir
946    endif
947
948    complete make \
949	'n/-f/f/' \
950      	'c/*=/f/' \
951	'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
952
953    if ( -f /etc/printcap ) then
954	set printers=(`sed -n -e "/^[^     #].*:/s/:.*//p" /etc/printcap`)
955
956	complete lpr    'c/-P/$printers/'
957	complete lpq    'c/-P/$printers/'
958	complete lprm   'c/-P/$printers/'
959	complete lpquota        'p/1/(-Qprlogger)/' 'c/-P/$printers/'
960	complete dvips  'c/-P/$printers/' 'n/-o/f:*.{ps,PS}/' 'n/*/f:*.dvi/'
961	complete dvilj	'p/*/f:*.dvi/'
962    endif
963
964    unset noglob
965    unset _complete
966endif
967
968end:
969	onintr
970