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