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