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