diff options
author | David Paleino <d.paleino@gmail.com> | 2009-04-03 13:07:16 +0200 |
---|---|---|
committer | David Paleino <d.paleino@gmail.com> | 2009-04-03 13:07:16 +0200 |
commit | 96d00c3d7f1912d4f3f76f8ea21ef68d179b8b30 (patch) | |
tree | 1e956dc3b947bf1c80f661b27731775a5f7932ba | |
download | bash-completion-96d00c3d7f1912d4f3f76f8ea21ef68d179b8b30.tar.gz |
Imported Upstream version 1.0upstream/1.0
-rw-r--r-- | AUTHORS | 8 | ||||
-rw-r--r-- | CHANGES | 384 | ||||
-rw-r--r-- | COPYING | 339 | ||||
-rw-r--r-- | Makefile.am | 49 | ||||
-rw-r--r-- | Makefile.in | 500 | ||||
-rw-r--r-- | README | 486 | ||||
-rw-r--r-- | TODO | 33 | ||||
-rw-r--r-- | aclocal.m4 | 554 | ||||
-rwxr-xr-x | autogen.sh | 4 | ||||
-rw-r--r-- | bash_completion | 9340 | ||||
-rw-r--r-- | bash_completion.sh | 12 | ||||
-rwxr-xr-x | configure | 3351 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | contrib/_subversion | 426 | ||||
-rw-r--r-- | contrib/apache2ctl | 18 | ||||
-rw-r--r-- | contrib/bitkeeper | 20 | ||||
-rw-r--r-- | contrib/bittorrent | 38 | ||||
-rw-r--r-- | contrib/brctl | 44 | ||||
-rw-r--r-- | contrib/cksfv | 30 | ||||
-rw-r--r-- | contrib/clisp | 26 | ||||
-rw-r--r-- | contrib/cowsay | 26 | ||||
-rw-r--r-- | contrib/cpan2dist | 45 | ||||
-rw-r--r-- | contrib/dsniff | 272 | ||||
-rw-r--r-- | contrib/freeciv | 64 | ||||
-rw-r--r-- | contrib/gcl | 25 | ||||
-rw-r--r-- | contrib/gkrellm | 37 | ||||
-rw-r--r-- | contrib/gnatmake | 32 | ||||
-rw-r--r-- | contrib/gpg2 | 44 | ||||
-rw-r--r-- | contrib/harbour | 8 | ||||
-rw-r--r-- | contrib/isql | 13 | ||||
-rw-r--r-- | contrib/larch | 39 | ||||
-rw-r--r-- | contrib/lilypond | 6 | ||||
-rw-r--r-- | contrib/lisp | 26 | ||||
-rw-r--r-- | contrib/lzma | 42 | ||||
-rw-r--r-- | contrib/lzop | 53 | ||||
-rw-r--r-- | contrib/mailman | 533 | ||||
-rw-r--r-- | contrib/mcrypt | 80 | ||||
-rw-r--r-- | contrib/minicom | 46 | ||||
-rw-r--r-- | contrib/modules | 84 | ||||
-rw-r--r-- | contrib/monodevelop | 97 | ||||
-rw-r--r-- | contrib/mtx | 46 | ||||
-rw-r--r-- | contrib/net-tools | 89 | ||||
-rw-r--r-- | contrib/p4 | 55 | ||||
-rw-r--r-- | contrib/povray | 59 | ||||
-rw-r--r-- | contrib/qdbus | 20 | ||||
-rw-r--r-- | contrib/qemu | 100 | ||||
-rw-r--r-- | contrib/quota-tools | 309 | ||||
-rw-r--r-- | contrib/rdesktop | 53 | ||||
-rw-r--r-- | contrib/ri | 89 | ||||
-rw-r--r-- | contrib/sbcl | 25 | ||||
-rw-r--r-- | contrib/sitecopy | 31 | ||||
-rw-r--r-- | contrib/snownews | 19 | ||||
-rw-r--r-- | contrib/ssh | 142 | ||||
-rw-r--r-- | contrib/svk | 263 | ||||
-rw-r--r-- | contrib/unace | 29 | ||||
-rw-r--r-- | contrib/unrar | 30 | ||||
-rw-r--r-- | contrib/vncviewer | 126 | ||||
-rwxr-xr-x | install-sh | 519 | ||||
-rwxr-xr-x | missing | 367 |
59 files changed, 19610 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..a63f2c53 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,8 @@ +David Paleino (Debian) <d.paleino@gmail.com> +Freddy Vulto <fvulto@gmail.com> +Guillame Rousse (Mandriva) <Guillaume.Rousse@inria.fr> +Mike Kelly (Exherbo) <pioto@pioto.org> +Santiago M. Mola (Exherbo) <cooldwind@gmail.com> +Ville Skyttä (Fedora/Red Hat) <ville.skytta@iki.fi> + +To contact us: bash-completion-devel@lists.alioth.debian.org diff --git a/CHANGES b/CHANGES new file mode 100644 index 00000000..14d7669a --- /dev/null +++ b/CHANGES @@ -0,0 +1,384 @@ +bash-completion (1.0) + + [ Guillaume Rousse ] + * Make bibtex complete on .aux files + * Add .xvid and .XVID to player completion + * Added cowsay/cowthink completion + * Added brctl completion + * Added cpan2dist completion + * Added qemu completion + * Added net-tools (mii-tool and mii-diag) completions + * Added minicom completion + * Added quota-tools completion + * Added rdesktop completion + * Added tightvncviewer completion + * Cleanup screen completion, and make it completes on options + + [ David Paleino ] + * Added .kar to Timidity completion. + * Fix killall completion, remove trailing ":" on certain process + names + * Fix man -l completing filenames (Debian: #497074) + * (Partly) fixed java classes completion (Debian: #496828). Look for + FIXME in source. + * Dump to /dev/null error message from look(1) with no arguments + (Debian: #495142) + * Set ssh as default for rsync (was rsh) (Debian: #492328) + * Added .oga, .ogv, .ogx to mplayer completion (Debian: #496162) + * Added .epub to unzip|zipinfo completion (Debian: #492476) + * Added ssh-copy-id completion (Debian: #491856) + * Moved ssh completion to separate file (Debian: #360628) + * Bogus completion when mounting subdirs fixed (Debian: #322238) + * Fix `apt-cache showsrc` completing only on source package names + (Debian: #361535) + * Fixed bugs with gdb completion: + - when an empty directory is in $PATH (thanks to Morita Sho) + (Debian: #497597) + - when a non-existing directory is in $PATH (Debian: #499780) + * Fix missing completion for "-n" and "-e" (we were using echo, now + using printf) (thanks to Morita Sho) (Debian: #498105) + * Fixed gpg completion: + - --@(export|@(?(l|nr|nrl)sign|edit)-key)) (Debian: #500316) + - -@(r|-recipient)) + * Fixed .cb[rz] completion for evince (Debian: #502885) + * Added gksudo, gksu, kdesudo completion + * Added apache2ctl completion + * Added gpg2 completion (Debian: #489927) + * Fixed mplayer -skin completion (Debian: #501473) + * Fixed errors with POSIX enabled (Debian: #502804) + * Fixed dpkg-source wrong exit() with return() (Debian: #) + * Added --schedule-only to aptitude's completion (Debian: #502664) + * Added build-dep to aptitude's completion (Debian: #495883) + * Added support for `-F configfile' to _known_hosts(), ssh, scp and + sftp, thanks to Freddy Vulto (Debian: #504141) + * Fixed sed quoting bug in _known_hosts(), thanks to Freddy Vulto + (Debian: #504650) + * Allow `Host(Name)' in ssh config file to be indented + * Allow `Host(Name)' in ssh config file to have trailing comment. + * Allow for comments in known_hosts files (Debian: #511789) + * Fixed perl -I/-x completion, thanks to Freddy Vulto + (Debian: #504547) + * README updated: explain how to use bash-completion correctly. + (Debian: #506560) + * TODO updated: the Alioth team is now upstream. + * Added qdbus completion, thanks to Terence Simpson (Ubuntu: #257903) + * Added monodevelop and mdtool completions. + * Split subversion-related completions to contrib/_subversion + (prefixed with _ to avoid file conflicts with upstream's one) + * Fixed completion of environment variables, thanks to Morita Sho + (Debian: #272660) + * Fix dpkg completion bug: it listed only non-Essential packages + (Debian: #511790) + * Fixed _dpkg_source completion (Debian: #503317) + * Added _parse_help() to try to parse options listed in $command + --help + * Fixed gzip completion to use _parse_help(), since the available + options vary with distributions + * Added to_review/ directory, where completions needing a review would + go. After it gets accepted, the completion would go into contrib/. + * Remove unused UNAME local variable in _info() (Debian: #501843) + * AUTHORS added + * Make _alias() use _get_cword + * Added .zip to jar completions (Debian: #521041) + * Merge from Gentoo: + - fix 'find' completion so that it properly completes on -?(i)whilename. + Patch by Ciaran McCreesh. + - use make -qp to parse the Makefile for us, so we get proper completion + on things like pattern rules. Patch by Mike Kelly <pioto@exherbo.org>. + - complete on gkrellm2 as well. Patch by Aaron Walker. + - fix CVS completion + * Merge from Ubuntu: + - consume error messages in configure completion (Ubuntu: #223882) + (Mika Fischer) + - quote $xspec in _filedir_xspec in case it is empty, which would + cause errors if there was no match under failglob. (Ubuntu: #194419) + (Mika Fischer) + * debian/links fixed (Debian: #494292) + * debian/control: + - fixed typo in the long description + - added Vcs-* fields + * debian/install: + - correctly install contrib/* under /etc/bash_completion.d/ + * debian/copyright updated + * extra/dh_bash-completion: + - updated to support a list of files in debian/<package>.bash-completion + (Debian: #512917) + + [ Ville Skyttä ] + * Added JPEG 2000 files to display completion, thanks to Bastien Nocera + (RedHat: #304771) + * Improved rpm macro completion. + * Added -E to rpm completion. + * Improved rpm backup file avoidance. + * Improved /var/log/rpmpkgs based rpm installed package completion. + * Improved performance of rpm -qa based rpm installed package completion. + * Improved features and performance of yum completion. + * Added support for p (POSIX) and x (x.org) man sections. + * Improved filename based man page completion. + * Added minimal sqlite3 completion. + * Improved getent completion (Ville Skyttä, Guillaume Rousse). + * (Re)fix gzip and bzip2 options completion. + * Improved svn filename completion (RedHat: #430059). + * Add lzma completion (Per Øyvind Karlsen, Ville Skyttä). + * Add .mp2 and .vdr to mplayer completion (RedHat: #444467). + * Add .mkv, .mp2 and .vdr to *xine completion (RedHat: #444467). + * Added lzop completion. + * Fix scp metacharacter escaping. + * Remove duplicate cpio completion, thanks to Freddy Vulto (Debian: #512823) + * Fix awk error in "modprobe -r /" completion (Debian: #512556). + * Expand ~foo to dir name more eagerly to avoid quoting issues. + * Fix -sourcepath handling in javadoc packages completion. + * Extract process name completion from _killall to _pnames, make it work + for others than Linux and FreeBSD. + * Fix process name completion with relative paths (RedHat: #484578). + * Use improved process name completion in pgrep in addition to killall. + * Enable pgrep and pkill completion if the commands are available, not just + on Linux and FreeBSD. + * Drop hg completion, an improved version is shipped with Mercurial + (contrib/bash_completion in the tarball). + * Make okular complete on same files as evince, thanks to Mary Ellen Foster + (RedHat: #486998). + * Apply ps2pdf completion to ps2pdf{12,13,14,wr} too. + * Simplify bash_completion.sh, return earlier in non-applicable environments. + * Remove obsolete --buildarch and --buildos rpm(build) completions. + * Add rpmbuild --target completion. + * Use "-profile help" to get mplayer and friends -profile completions. + * Fix local array initialization under bash 3.0, prevents "()" occurring in + file and dir name completions. + + [ Freddy Vulto ] + * Restored `_display()' completion for `display' by removing + completion-by-extension for `display' (Alioth#311429) + * Removed duplicate completion option `-borderwidth' for `display' + * Prevent completion dir from being sourced twice if + BASH_COMPLETION_DIR and BASH_COMPLETION_COMPAT_DIR are equal (Alioth#311433) + * Make `_mii-tool()' and `_mii-diag()' POSIX-compliant + * Fix _isql completion waiting for grep input if $ODBCINI not set; handle + whitespace in $ODBCINI. + * Split vncviewer completion in _tightvncviewer() and _xvnc4viewer() + Added _realcommand() global function. + + [ Jakob Unterwurzacher ] + * ps2pdf can run on .pdf files as well. (Debian: #516614, Ubuntu: #316943) + + [ Santiago M. Mola ] + * Add .ape to mplayer supported extensions (Alioth#311510). + + -- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100 + +bash-completion (20080705) unstable; urgency=low + + [ David Paleino ] + * Added more completions to imagemagick (thanks to Nelson A. de + Oliveira) (Debian: #487786) + * Added xrandr completion (thanks to Anton Khirnov) (Debian: #487825) + * Improving _gdb completion: + - $filenames to $default (Debian: #463969) + - also show directory names (i.e. compgen -d) in COMPREPLY. + - added . to $PATH, to allow debugging "local" executables. + - do not complete Bash's builtins (thanks to Morita Sho) + + [ Luk Claes ] + * Remove use of ucf for /etc/bash-completion (Debian: #488171). + + -- Luk Claes <luk@debian.org> Sat, 05 Jul 2008 16:14:15 +0200 + +bash-completion (20080617.5) unstable; urgency=medium + + * Revert way of setting environment variables (Debian: #487774). + * Add equals sign to _get_cword for mutt_aliases (Debian: #482635). + * Enhance mlayer completion (Debian: #487826, #487838). + + -- Luk Claes <luk@debian.org> Tue, 24 Jun 2008 19:50:57 +0200 + +bash-completion (20080617.4) experimental; urgency=low + + [ David Paleino ] + * Merged Ubuntu changes: + - added quote(), quote_readline(), dequote() helper functions. + - added _remove_word() + - fixed _get_cword() + - refactored _filedir using quote_readline() + - refactored _filedir_xspec using quote_readline() + - fixed COMPREPLY's in _iwconfig + - fixed _cvs() + - _known_hosts(): use files from UserKnownHostsFile options in + addition to standard ones. + - fixed _command() to correctly prune the command line + - disabled completion of PostgreSQL users and databases + - fixed _java_packages() + - fixed _muttquery() + - added flv/FLV completion to mplayer + - added --installed to apt-cache + - only complete on filenames for aspell + - fixed code for exclusions compspecs + - added code to gracefully handle debug options (set +/-v) + + -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 19:25:25 +0200 + +bash-completion (20080617.3) unstable; urgency=low + + [ David Paleino ] + * Fixed IFS for filedir_xspec - Thanks to Stefan Lippers-Hollmann + (Debian: #487571) + + [ Luk Claes ] + * Install dh-bash-completion to ease installation of completions. + + -- Luk Claes <luk@debian.org> Mon, 23 Jun 2008 07:24:21 +0200 + +bash-completion (20080617.2) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - provide a manpage for extra/dh_bash-completion + - fix semi-serious problem with _filedir() (Debian: #487449) + * debian/rules: + - added rule to generate dh_bash-completion's manpage + * debian/install, debian/dirs: + - installing dh_bash-completion into /usr/bin + * debian/control: + - new package dh-bash-completion + + [ Luk Claes ] + * Comment new package to make sure current fix gets in the archive first. + * Add compression completion for vi(m). + + -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 19:47:23 +0200 + +bash-completion (20080617.1) unstable; urgency=medium + + [ David Paleino ] + * Urgency set to medium because the package is currently unusable. + * New upstream sub-release + - fixed some typos here and there which prevented bash completions + at all (Debian: #487441). + - really closing Debian bug #455510. + + -- Luk Claes <luk@debian.org> Sun, 22 Jun 2008 00:22:53 +0200 + +bash-completion (20080617) unstable; urgency=low + + [ David Paleino ] + * New upstream release + - add more completions to aptitude (Debian: #432289) + - fixed UTF-8 problem with _get_cword(), thanks to + Andrei Paskevich (Debian: #472132) + - fixed autoremove completion, thanks to Flavio Visentin + (Debian: #474974) + - cmf and CMF added to playmidi completion (Debian: #365658) + - added rrdtool completion, thanks to Justin Pryzby (Debian: #428641) + - added OpenDocument completion for unzip/zipinfo (.od{f,g,p,s,t}) + (Debian: #472940) + - fixed escaping problems with job control (i.e. disown, jobs, bg, + fg): the argument is now surrounded by "" (Debian: #347316) + - make mkdir complete also on filenames (Debian: #376433) + - {bz,z}{cat,cmp,diff,egrep,fgrep,grep,less,more} now should complete + on all filenames, not just compressed archives (just commented out) + (Debian: #455510) + - fixes Perl completion (Debian: #470742) + - fixes get_cword -> _get_cword typo (Debian: #478596) + - fixes _get_cword() function to properly handle filenames with + whitespaces (Debian: #394636, #468254, #474094) + - added .pdf.bz2 completion to evince (Debian: #424736) + - added .svg completion to display (Debian: #441017) + - added .m2ts completion to mplayer (Debian: #480879) + - added extra/dh_bash-completion to ease future rewrite of bc. + * debian/copyright - now in a fancier machine-parsable format. + * debian/control: + - added myself to Uploaders + - debhelper Build-Depends updated to >= 6. + * debian/watch: + - improved current watch line regex + - added (commented out) probable future watch line + * debian/compat bumped to 6 + * debian/dirs, debian/install and debian/links added + * debian/rules: + - refactored to make use of debian/{dirs,install,links} + + [ Steve Kemp ] + * Applied patch to fix completion of umount command. + (Debian: #470539) + * Fixed the completion of Perl manpages. + (Debian: #404976) + * Added 'aif' to the filenames offed for completion for mplayer. + (Debian: #474517) + * Allow tsocks completion. + (Debian: #409423) + * Update mutt completion to handle local usernames. + (Debian: #416655) + * Update apt-get completion to include the flag "--no-install-recommends" + (Debian: #475242) + + -- Luk Claes <luk@debian.org> Sat, 21 Jun 2008 21:59:43 +0200 + +bash-completion (20060301-4) unstable; urgency=low + + * Add some fixes from Ubuntu: + * Fix completion of filenames with spaces (Debian: #468254). + * Fix parsing of SSH config files (Debian: #435117). + * Change priority to standard (Debian: #471666). + * Add some more completions for xine (Debian: #452083, #471249). + * Fix completion of gzip (Debian: #351913). + * Also use $HOSTFILE in hostname completion (Debian: #400380). + + -- Luk Claes <luk@debian.org> Sat, 22 Mar 2008 23:10:30 +0000 + +bash-completion (20060301-3) unstable; urgency=low + + * Fix kpdf completion (Debian: #468163, #413374). + * Fix completion of - or -- with _command (Debian: #415276). + * Add sux to the complete -u list (Debian: #466089). + * Add dvipdfm to the list of dvi programs (Debian: #396644). + * Add --purge-unused option completion for aptitude (Debian: #438471). + * Add divx extension completion for mplayer (Debian: #444294). + * Add pdf.gz completion for evince (Debian: #456887). + * Add --remove-all completion for update-alternatives (Debian: #269173). + + -- Luk Claes <luk@debian.org> Wed, 05 Mar 2008 22:57:27 +0100 + +bash-completion (20060301-2) unstable; urgency=low + + * Take over the package. + + -- Luk Claes <luk@debian.org> Wed, 27 Feb 2008 19:22:03 +0100 + +bash-completion (20060301-1) unstable; urgency=low + + * Upload to unstable. + + -- Matthias Klose <doko@debian.org> Sat, 09 Feb 2008 23:18:20 +0100 + +bash-completion (20060301-0ubuntu2) hardy; urgency=low + + * Replace bash (<< 3.1dfsg-9), handle upgrade in preinst. + * Exclude hashed hostnames from ssh host completion results. Debian: #428085. + * Fix: ifup/down don't really complete. Debian: #463756. + * Allow perl completion to complete filenames, complete -I and -x arguments. + Debian: #443394. + * Add find -wholename completion. Debian: #431220. + * Handle whitespaces in $HOME for _known_hosts() completion. Debian: #414821. + * dpkg -L: complete for removed-but-not-purged packages. Debian: #372156. + * Complete for apt-get autoremove. Debian: #433542, #443816, #445332. + * Update completion for mplayer (mka/flac). Debian: #340452. + * Add ping6/fping6 completion. Debian: #413170. + * Handle whitespace in paths for mount/umount completion. Debian: #367957. + * apt-get: Support --auto-remove. Ubuntu: #60666. + + -- Matthias Klose <doko@ubuntu.com> Sat, 09 Feb 2008 23:11:32 +0100 + +bash-completion (20060301-0ubuntu1) hardy; urgency=low + + * Initial release, split out from the bash package. + The software currently is unsupported upstream. + * Don't try to set a readonly variable. Ubuntu: #149527. + * Support purge in apt-get auto completion (Mathias Gug). Ubuntu: #151677. + * evince: Autocomplete on cbr/cbz/djvu files. Ubuntu: #156200, #175220. + Debian: #400678. + * kdvi: complete .*\.dvi\.(gz|bz2). Ubuntu: #128234. + * kpdf: Complete postscript files. Ubuntu: #162319. + * Make completion working in the middle of a word (Adam Simpkins). + Ubuntu: #139666. + + -- Matthias Klose <doko@ubuntu.com> Fri, 08 Feb 2008 16:46:34 +0100 + diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..d511905c --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..416be54a --- /dev/null +++ b/Makefile.am @@ -0,0 +1,49 @@ + +sysconf_DATA = bash_completion + +bashcompdir = $(sysconfdir)/bash_completion.d +bashcomp_DATA = contrib/apache2ctl \ + contrib/bitkeeper \ + contrib/bittorrent \ + contrib/brctl \ + contrib/cksfv \ + contrib/clisp \ + contrib/cowsay \ + contrib/cpan2dist \ + contrib/dsniff \ + contrib/freeciv \ + contrib/gcl \ + contrib/gkrellm \ + contrib/gnatmake \ + contrib/gpg2 \ + contrib/harbour \ + contrib/isql \ + contrib/larch \ + contrib/lilypond \ + contrib/lisp \ + contrib/lzma \ + contrib/lzop \ + contrib/mailman \ + contrib/mcrypt \ + contrib/minicom \ + contrib/modules \ + contrib/monodevelop \ + contrib/mtx \ + contrib/net-tools \ + contrib/p4 \ + contrib/povray \ + contrib/qdbus \ + contrib/qemu \ + contrib/quota-tools \ + contrib/rdesktop \ + contrib/ri \ + contrib/sbcl \ + contrib/sitecopy \ + contrib/snownews \ + contrib/ssh \ + contrib/_subversion \ + contrib/svk \ + contrib/unace \ + contrib/unrar + +EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..3f5510b5 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,500 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ + TODO install-sh missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(sysconfdir)" +bashcompDATA_INSTALL = $(INSTALL_DATA) +sysconfDATA_INSTALL = $(INSTALL_DATA) +DATA = $(bashcomp_DATA) $(sysconf_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +sysconf_DATA = bash_completion +bashcompdir = $(sysconfdir)/bash_completion.d +bashcomp_DATA = contrib/apache2ctl \ + contrib/bitkeeper \ + contrib/bittorrent \ + contrib/brctl \ + contrib/cksfv \ + contrib/clisp \ + contrib/cowsay \ + contrib/cpan2dist \ + contrib/dsniff \ + contrib/freeciv \ + contrib/gcl \ + contrib/gkrellm \ + contrib/gnatmake \ + contrib/gpg2 \ + contrib/harbour \ + contrib/isql \ + contrib/larch \ + contrib/lilypond \ + contrib/lisp \ + contrib/lzma \ + contrib/lzop \ + contrib/mailman \ + contrib/mcrypt \ + contrib/minicom \ + contrib/modules \ + contrib/monodevelop \ + contrib/mtx \ + contrib/net-tools \ + contrib/p4 \ + contrib/povray \ + contrib/qdbus \ + contrib/qemu \ + contrib/quota-tools \ + contrib/rdesktop \ + contrib/ri \ + contrib/sbcl \ + contrib/sitecopy \ + contrib/snownews \ + contrib/ssh \ + contrib/_subversion \ + contrib/svk \ + contrib/unace \ + contrib/unrar + +EXTRA_DIST = $(sysconf_DATA) $(bashcomp_DATA) +all: all-am + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +install-bashcompDATA: $(bashcomp_DATA) + @$(NORMAL_INSTALL) + test -z "$(bashcompdir)" || $(MKDIR_P) "$(DESTDIR)$(bashcompdir)" + @list='$(bashcomp_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(bashcompDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(bashcompdir)/$$f'"; \ + $(bashcompDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(bashcompdir)/$$f"; \ + done + +uninstall-bashcompDATA: + @$(NORMAL_UNINSTALL) + @list='$(bashcomp_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(bashcompdir)/$$f'"; \ + rm -f "$(DESTDIR)$(bashcompdir)/$$f"; \ + done +install-sysconfDATA: $(sysconf_DATA) + @$(NORMAL_INSTALL) + test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" + @list='$(sysconf_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \ + $(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \ + done + +uninstall-sysconfDATA: + @$(NORMAL_UNINSTALL) + @list='$(sysconf_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bashcompdir)" "$(DESTDIR)$(sysconfdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-bashcompDATA + +install-dvi: install-dvi-am + +install-exec-am: install-sysconfDATA + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-bashcompDATA uninstall-sysconfDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am am--refresh check check-am clean clean-generic dist \ + dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ + dist-zip distcheck distclean distclean-generic distcleancheck \ + distdir distuninstallcheck dvi dvi-am html html-am info \ + info-am install install-am install-bashcompDATA install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip install-sysconfDATA \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-bashcompDATA \ + uninstall-sysconfDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: @@ -0,0 +1,486 @@ +INSTALLATION +------------ + +The easiest way to install this software is to use a package, such as +the RPM that I maintain for Red Hat Linux, the .deb package for +Debian/GNU Linux or Ubuntu, etc. You still need to source it from either +/etc/bashrc or ~/.bashrc (or any other file sourcing those). You can do +this by simply using: + +# Use bash-completion, if available +if [ -f /etc/bash_completion ]; then + . /etc/bash_completion +fi + +(if you happen to have *only* bash >= 2.04, see further if not) + +If you don't have the package readily available for your distribution, or +you simply don't want to do this, put the bash_completion file somewhere +on your system and source it from either /etc/bashrc or ~/.bashrc, as +explained above. + +Here's another possible way of doing that from /etc/bashrc: + +# Check for interactive shell. +if [ -n "$PS1" ]; then + if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then + if [ -r /etc/bash_completion ]; then + # Source completion code. + . /etc/bash_completion + fi + fi +fi +unset bash bminor bmajor + +This code checks that the version of bash that is parsing the code is +later than 2.04 and, if so, sources the bash completion code. + +While this code may, at first, seem overly complex, the advantage of +using it is that it will also parse correctly when interpreted by bash +1.x. If you have bash 1.x and bash 2/3.x users on your system, you +must avoid using constructs that were not valid under 1.x syntax. + +If your system has an /etc/profile.d directory, you might instead want +to add a script called bash_completion.sh to that directory. Add the +above code, preceded by the following: + +# Check for bash. +[ -z "$BASH_VERSION" ] && return + +In this case, all *.sh scripts in /etc/profile.d are sourced from +/etc/bashrc by Bourne-like shells, so you need the extra check for bash +in order to avoid sourcing the rest of the script if a shell other than +bash is running. + +For your convenience, a sample bash_completion.sh file is included in +the package. + +If you're using MacOS X, /etc/bashrc is apparently not sourced at all. +In that case, you should put the bash_completion file in /sw/etc and add +the following code to ~/.bash_profile: + +if [ -f /sw/etc/bash_completion ]; then + . /sw/etc/bash_completion +fi + +If you are putting the bash completion source file somewhere other +than /etc/bash_completion, you should ensure that $BASH_COMPLETION is +set to point to it before you source it. Your ~/.bashrc file is a good +place to do this. + + +TROUBLESHOOTING +--------------- + +If you get errors about 'complete' or 'compgen' not accepting the -g +flag, you are probably running bash 2.05 and should either apply the +group completion patch, download a prepatched bash binary of 2.05, or +upgrade to 2.05a or later. + +If you find that some commands, such as 'cd /usr<Tab>', end with a +trailing space instead of appending a /, you are probably running the +base version of bash 2.05, which suffers from a bug that causes the +'-o filenames' option to the complete built-in to be ignored. You can +fix this by applying the following official patch from the bash +maintainer: + + ftp://ftp.gnu.org/gnu/bash/bash-2.05b-patches/bash205b-006 + +If you get errors about 'complete' not accepting the -o flag, you are +probably running bash 2.04. In this case, you should upgrade to bash +2.05a or later. However, I have endeavoured to make the code detect +this version of bash and work around this issue, so please inform me +if you still encounter this error. + +Copies of the patches and prepatched versions of bash are available +from: + + http://www.caliban.org/bash/ + +If you find that a given function is producing errors under certain +circumstances when you attempt completion, try running 'set -v' or +'set -x' prior to attempting the completion again. This will produce +useful debugging output that will aid me in fixing the problem if you +are unable to do so yourself. Turn off the trace output by running +either 'set +v' or 'set +x'. + + +KNOWN PROBLEMS +-------------- + +I. + +There seems to be some issue with using the bash built-in cd within +Makefiles. When invoked as /bin/sh within Makefiles, bash seems to +have a problem changing directory via the cd command. A work-around +for this is to define SHELL=/bin/bash within your Makefile. This is +believed to be a bug in bash. + +II. + +The have() function is used to conserve memory by only installing +completion functions for those programs that are actually present on +your system. The current method of determining whether or not a given +binary is present is whether or not it can be found along a certain +path of directories. The path that is currently searched is: + + $PATH:/sbin:/usr/sbin:/usr/local/sbin + +where $PATH is your user path at the time the bash completion file is +sourced. + +III. + +Many of the completion functions assume GNU versions of the various +text utilities that they call (e.g. grep, sed and awk). Your mileage +may vary. + +IV. + +If you are seeing 'unbound variable' warnings from bash when hitting +<Tab>, this is because you have either 'set -u' or 'set -o nounset' +somewhere in your start-up files. This causes bash to flag the use of +any uninitialised shell variables as an error. + +Whilst I try to avoid references to uninitialised variables in the +code, there seem to be at least some cases where bash issues this +warning even though the variable in question has been initialised. + +One place this appears to occur is within the _muttconffiles() helper +function used by mutt completion, where the function calls itself +recursively. This seems to confuse bash and it issues spurious +warnings if 'nounset' is set. + +V. + +After upgrading to bash 3.1, you may notice that completing on certain +commands now fails with a message something like this: + + sed: -e expression #1, char 20: unterminated `s' command + +The reason for this is that bash 3.1 contains the following, +innocent-looking bug fix (from bash's CHANGES file): + + t. Fixed a bug that caused the expanded value of a $'...' string + to be incorrectly re-quoted if it occurred within a + double-quoted ${...} parameter expansion. + +Unfortunately, this also had the side effect of causing single quotes +to be stripped from $'...' strings inside double-quoted command +substitutions. Confused? + +Efforts have been made to work around this issue in the bash +completion code as of the 20060301 release. All previous versions are +vulnerable to the problem. However, it's possible that, even in the +20060301 release and later, affected code remains. + +The issue has now been officially recognised as a regression in the +bash 3.1 release and is fixed by official patch 11. If you encounter +problems of this nature, please apply the patch below to your copy of +bash: + + ftp://ftp.gnu.org/gnu/bash/bash-3.1-patches/bash31-011 + + +FAQ +--- + +Q. The bash completion code inhibits some commands from completing on + files with extensions that are legitimate in my environment. Do I + have to disable completion for that command in order to complete on + the files that I need to? + +A. No. Use M-/ to (in the words of the man page) attempt file name + completion on the text to the left of the cursor. This will + circumvent any file type restrictions put in place by the bash + completion code. + +Q. How can I insert my own local completions without having to + reinsert them every time you issue a new release? + +A. Put them in ~/.bash_completion, which is parsed at the end of the + main completion script. See also the next question. + +Q. I author/maintain package X and would like to maintain my own + completion code for this package. Where should I put it to be sure + that interactive bash shells will find it and source it? + + Put it in the directory pointed to by $BASH_COMPLETION_DIR, which + is defined at the beginning of the main completion script. Any + scripts placed in this directory will be sourced by interactive + bash shells. Usually, this is /etc/bash_completion.d. + +Q. I use CVS in combination with passwordless ssh access to my remote + repository. How can I have the cvs command complete on remotely + checked-out files where relevant? + +A. Define $COMP_CVS_REMOTE. Setting this to anything will result in + the behaviour you would like. + +Q. When I'm running a ./configure script and completion returns a list + of long options to me, some of these take a parameter, + e.g. --this-option=DESCRIPTION. + + Running ./configure --help lists these descriptions, but everything + after the '=' is stripped when returning completions, so I don't + know what kind of data is expected as a given option's parameter. + + Is there a way of getting ./configure completion to return the + entire option string, so that I can see what kind of data is + required and then simply delete the descriptive text and add my own + data? + +A. Define $COMP_CONFIGURE_HINTS. Setting this to anything will result + in the behaviour you would like. + +Q. When doing tar completion on a file within a tar file like this: + + tar tzvf foo.tar.gz <Tab> + + the pathnames contained in the tar file are not displayed + correctly. The slashes are removed and everything looks like it's + in a single directory. Why is this? + +A. It's a choice I had to make. bash's programmable completion is + limited in how it handles the list of possible completions it + returns. + + Because the paths returned from within the tar file are likely not + existing paths on the file system, '-o dirnames' must be passed to + the complete built-in to make it treat them as such. However, then + bash will append a space when completing on directories during + pathname completion to the tar files themselves. + + It's more important to have proper completion of paths to tar files + than it is to have completion for their contents, so this sacrifice + was made and '-o filenames' is used with complete instead. + + If you would rather have correct path completion for tar file + contents, define $COMP_TAR_INTERNAL_PATHS *before* sourcing + bash_completion. + +Q. When completing on a symlink to a directory, bash does not append + the trailing / and I have to hit <Tab> again. I don't like this. + +A. This has nothing to do with bash_completion. It's the default for + completing symlinks to directories in bash 2.05a, and was added + because sometimes you want to operate on the symlink itself, rather + than what it points to. + + In bash 2.05b and later, you can get the pre-2.05a behaviour back + by putting 'set mark-symlinked-directories on' in your /etc/inputrc + or ~/.inputrc file. + +Q. Completion goes awry when I try to complete on something that contains + a colon. + +A. This is actually a 'feature' of bash. bash recognises a colon as + starting a new completion token, which is often what you want when + completing something like a PATH variable: + + $ export PATH=/bin:/sbin:/usr<Tab> + + Without the special treatment of the colon, the above wouldn't work + without programmable completion, so it has long been a feature of + the shell. + + Unfortunately, you don't want the colon to be treated as a special + case when doing something like: + + $ man File::B<Tab> + + Here, the colons make bash think that it's completing the a new + token that begins with 'B'. + + Unfortunately, there's no way to turn this off. The only thing you + can do is escape the colons with a backslash. + +Q. Where did urpmi completion go? + +A. Guillaume Rousse <rousse@ccr.jussieu.fr> now maintains it separately as + part of the urpmi RPM package. + + CVS: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/urpmi/ + Web: http://urpmi.org/ + +Q. Why is rpm completion so slow with -q? + +A. Probably because the database is being queried every time and this uses a + lot of memory. + + You can make this faster by pregenerating the list of installed packages on + the system. Make sure you have a readable file called /var/log/rpmpkgs. + It's generated by /etc/cron.daily/rpm on modern Red Hat and Mandrake + Linux systems. + + If you don't have such a cron job, make one: + + #!/bin/sh + + rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' 2>&1 \ + | sort > /var/log/rpmpkgs + + rpm completion will use this flat text file instead of the RPM database, + unless it detects that the database has changed since the file was created, + in which case it will still use the database to ensure accuracy. + +Q. Can tab completion be made even easier? + +A. The readline(3) library offers a few settings that can make tab + completion easier (or at least different) to use. + + For example, try putting the following in either /etc/inputrc or + ~/.inputrc: + + set show-all-if-ambiguous on + + This will allow single tab completion as opposed to requiring a + double tab. This makes things much more pleasant, in my opinion. + + set visible-stats on + + This will suffix each returned file completion with a character + denoting its type, in a similar way to ls(1) with -F or --classify. + + set page-completions off + + This turns off the use of the internal pager when returning long + completion lists. + +Q. This code is rubbish/not bad/pretty good/the best thing since + sliced bread. How can I show my appreciation? + +A. If you're a registered Freshmeat user, take a moment to rate the + project at: + + http://freshmeat.net/rate/19041/ + + Of course, writing to me and letting me know how you feel also works. + Patches and new completion routines are most welcome, too. + +Q. How can I stay abreast of new releases? + +A. If you're a registered Freshmeat user, you can subscribe to new release + announcements at: + + http://freshmeat.net/subscribe/19041/ + +Q. Is bash the be-all-and-end-all of completion as far as shells go? + +A. Absolutely not. zsh has an extremely sophisticated completion system + that offers many features absent from the bash implementation. Its + users often cannot resist pointing this out. More information can + be found at: + + http://www.zsh.org/ + + +CONTRIBUTING +------------ + +Contributions to the bash completion project are more than +welcome. Fixes, clean-ups and improvements of existing code are much +appreciated, as are completion functions for new commands. + +If you wish to contribute code, please bare the following coding +guidelines in mind: + +- Do not use Perl, Ruby, Python etc. to do text processing unless the + command for which you are writing the completion code implies the + presence of one of those languages. + + For example, if you were writing completion code for perldoc(1), the + use of Perl to achieve your goal would be acceptable. irb(1) + completion would similarly make the use of Ruby acceptable. + + Even so, please consider alternatives to these large and slow to + start interpreters. Use lightweight programs such as grep(1), awk(1) + and sed(1). + +- Use the full power of bash 2.x. Programmable completion has only + been available since bash 2.04, so you may as well use all the + features of that version of bash to optimise your code. However, be + careful when using features added since 2.04, since not everyone + will be able to use them. Be ESPECIALLY careful of using features + exclusive to 3.x, as many people are still using 2.x. + + For example, here strings (<<<) were not added until 2.05b, so don't + use them for the time being. + + Similarly, 3.0 added the use of the regex operator '=~', commonly + found in Perl and Ruby. Whilst this is very useful, it's not yet + safe to assume its ubiquity. + + On the other hand, extended globs were added in bash 2.02 and often + enable you to avoid the use of external programs, which are + expensive to fork and execute, so do make full use of those: + + ?(pattern-list) - match zero or one occurrences of patterns + *(pattern-list) - match zero or more occurrences of patterns + +(pattern-list) - match one or more occurrences of patterns + @(pattern-list) - match exactly one of the given patterns + !(pattern-list) - match anything except one of the given patterns + +- Following on from the last point, be sparing with the use of + external processes whenever you can. Completion functions need to be + fast, so sacrificing some code legibility for speed is acceptable. + + For example, judicious use of sed(1) can save you from having to + call grep(1) and pipe the output to cut(1), which saves a fork(2) + and exec(3). + + Sometimes you don't even need sed(1) or other external programs at + all, though. Use of constructs such as ${parameter#word}, + ${parameter%word} and ${parameter/pattern/string} can provide you a + lot of power without having to leave the shell. + + For example, if $foo contains the path to an executable, ${foo##*/} + will give you the basename of the program, without having to call + basename(1). Similarly, ${foo%/*} will give you the dirname, without + having to call dirname(1). + + As another example, + + bar=$( echo $foo | sed -e 's/bar/baz/g' ) + + can be replaced by: + + bar=${foo//bar/baz} + + These forms of parameter substitutions can also be used on arrays, + which makes them very powerful (if a little slow). + +- Do not write to the file-system under any circumstances. This can + create race conditions, is inefficient, violates the principle of + least surprise and lacks robustness. + +- Send your patches as unified diffs. You can make these with + 'diff -u'. + +- Send small, incremental diffs that affect a single function. Don't + cram massive, unrelated patches into a single diff. + +- If your code was written for a particular platform, try to make it + portable to other platforms, so that everyone may enjoy it. If your + code works only with the version of a binary on a particular + platform, ensure that it will not be loaded on other platforms that + have a command with the same name. + + In particular, do not use GNU extensions to commands like sed and + awk if you can write your code another way. If you really must use + them, however, do feel free to do so. + +- Read the existing source code for examples of how to solve + particular problems. Read the bash man page for details of all the + programming tools available to you within the shell. + +- Please test your code thoroughly before sending it to me. I don't + have access to all the commands for which I am sent completion + functions, so I am unable to test them all personally. If your code + is accepted into the distribution, a lot of people will try it out, + so try to do a thorough job of eradicating all the bugs before you + send it to me. + +-- +Ian Macdonald +ian@caliban.org @@ -0,0 +1,33 @@ +bash completion needs to be rewritten from the ground up. +--------------------------------------------------------- + +bash completion really needs to be rewritten from the ground up, using all of +the features available in bash 3.1 and without regard for compatibility with +the 2.x line. + +At that time, it should be split into multiple files for easier source +management. Whether or not it is actually installed on the destination +computer as separate files is a matter for future debate. + +If it were installed as tens or even hundreds of files, each of which had to +be opened to decide whether it should be sourced in its entirety, that could +prove very expensive on some systems. + +Alternatively, a master file could decide which of the individual completion +files should be sourced. In that way, we wouldn't need to open extra files +just to ascertain that the commands for those functions aren't on the system, +anyway. + +A further alternative is that a build process be created, which would +concatenate the various files into a single completion file, similar to what +we have now. This option is my least favourite, because a system with a lot of +packages installed currently has to deal with sourcing over 200 kB of bash +code for each invocation of an interactive shell. + +An even better alternative would be if bash supported dynamic loading of shell +functions (in the manner of zsh), but I don't believe there are any plans to +add this feature. + +-- +Ian Macdonald +Amsterdam, March 2006 diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..be700abf --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,554 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.63],, +[m4_warning([this file was generated for autoconf 2.63. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..6868f2de --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +autoreconf -i +rm -rf autom4te.cache/ diff --git a/bash_completion b/bash_completion new file mode 100644 index 00000000..552f8085 --- /dev/null +++ b/bash_completion @@ -0,0 +1,9340 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash_completion - programmable completion functions for bash 3.x +# (backwards compatible with bash 2.05b) +# +# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org> +# © 2009, Bash Completion Maintainers +# <bash-completion-devel@lists.alioth.debian.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The latest version of this software can be obtained here: +# +# http://bash-completion.alioth.debian.org/ +# +# RELEASE: 1.0 + +if [[ $- == *v* ]]; then + BASH_COMPLETION_ORIGINAL_V_VALUE="-v" +else + BASH_COMPLETION_ORIGINAL_V_VALUE="+v" +fi + +if [[ -n $BASH_COMPLETION_DEBUG ]]; then + set -v +else + set +v +fi + +# Alter the following to reflect the location of this file. +# +[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash_completion +[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash_completion.d +readonly BASH_COMPLETION BASH_COMPLETION_DIR + +# Set a couple of useful vars +# +UNAME=$( uname -s ) +# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin) +UNAME=${UNAME/CYGWIN_*/Cygwin} +RELEASE=$( uname -r ) + +# features supported by bash 2.05 and higher +if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] || + [ ${BASH_VERSINFO[0]} -gt 2 ]; then + declare -r bash205=$BASH_VERSION 2>/dev/null || : + default="-o default" + dirnames="-o dirnames" + filenames="-o filenames" +fi +# features supported by bash 2.05b and higher +if [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] || + [ ${BASH_VERSINFO[0]} -gt 2 ]; then + declare -r bash205b=$BASH_VERSION 2>/dev/null || : + nospace="-o nospace" +fi +# features supported by bash 3.0 and higher +if [ ${BASH_VERSINFO[0]} -gt 2 ]; then + declare -r bash3=$BASH_VERSION 2>/dev/null || : + bashdefault="-o bashdefault" + plusdirs="-o plusdirs" +fi + +# Turn on extended globbing and programmable completion +shopt -s extglob progcomp + +# A lot of the following one-liners were taken directly from the +# completion examples provided with the bash 2.04 source distribution + +# Make directory commands see only directories +complete -d pushd + +# The following section lists completions that are redefined later +# Do NOT break these over multiple lines. +# +# START exclude -- do NOT remove this line +complete -f -X '!*.?(t)bz?(2)' bunzip2 +# TODO: see #455510 +#complete -f -X '!*.?(t)bz?(2)' bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep +complete -f -X '!*.*' bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep +complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott|od[fgpst]|epub)' unzip zipinfo +complete -f -X '*.Z' compress znew +complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip +# TODO: see #455510 +#complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' zcmp zdiff zcat zegrep zfgrep zgrep zless zmore +complete -f -X '!*.*' zcmp zdiff zcat zegrep zfgrep zgrep zless zmore +complete -f -X '!*.Z' uncompress +complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee +complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv +complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview +complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi +complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' kdvi +complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx +complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf +complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf +complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2)|cb[rz]|CB[RZ]|djv?(u)|DJV?(U)|dvi|DVI|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince okular +complete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr +complete -f -X '!*.texi*' makeinfo texi2html +complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi +complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay +complete -f -X '!*@(.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp[234]|MP[234]|m4[pv]|M4[PV]|mkv|MKV|ogg|OGG|ogm|OGM|wav|WAV|asx|ASX|mng|MNG|srt)|+([0-9]).@(vdr|VDR))' xine aaxine fbxine kaffeine +complete -f -X '!*.@(avi|asf|wmv)' aviplay +complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay +complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim +complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123 +complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp +complete -f -X '!*.fig' xfig +complete -f -X '!*.@(mid?(i)|MID?(I)|cmf|CMF)' playmidi +complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M|kar|KAR)' timidity +complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview +complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' emacs +complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine +complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme +complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya +complete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter +complete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress +complete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc +complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw +complete -f -X '!*.@(sxm|smf|mml|odf)' oomath +complete -f -X '!*.odb' oobase +complete -f -X '!*.rpm' rpm2cpio +complete -f -X '!*.sqlite' sqlite3 +complete -f -X '!*.aux' bibtex +# FINISH exclude -- do not remove this line + +# start of section containing compspecs that can be handled within bash + +# user commands see only users +complete -u su usermod userdel passwd chage write chfn groups slay w sux + +# group commands see only groups +[ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null + +# bg completes with stopped jobs +complete -A stopped -P '"%' -S '"' bg + +# other job commands +complete -j -P '"%' -S '"' fg jobs disown + +# readonly and unset complete with shell variables +complete -v readonly unset + +# set completes with set options +complete -A setopt set + +# shopt completes with shopt options +complete -A shopt shopt + +# helptopics +complete -A helptopic help + +# unalias completes with aliases +complete -a unalias + +# bind completes with readline bindings (make this more intelligent) +complete -A binding bind + +# type and which complete on commands +complete -c command type which + +# builtin completes on builtins +complete -b builtin + +# start of section containing completion functions called by other functions + +# This function checks whether we have a given program on the system. +# No need for bulky functions in memory if we don't. +# +have() +{ + unset -v have + PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null && + have="yes" +} + +# use GNU sed if we have it, since its extensions are still used in our code +# +[ $UNAME != Linux ] && have gsed && alias sed=gsed + +# This function checks whether a given readline variable +# is `on'. +# +_rl_enabled() +{ + [[ "$( bind -v )" = *$1+([[:space:]])on* ]] +} + +# This function shell-quotes the argument +quote() +{ + echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting +} + +# This function quotes the argument in a way so that readline dequoting +# results in the original argument +quote_readline() +{ + local t="${1//\\/\\\\}" + echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting +} + +# This function shell-dequotes the argument +dequote() +{ + eval echo "$1" +} + +# Get the word to complete +# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases +# where the user is completing in the middle of a word. +# (For example, if the line is "ls foobar", +# and the cursor is here --------> ^ +# it will complete just "foo", not "foobar", which is what the user wants.) +# +# +# Accepts an optional parameter indicating which characters out of +# $COMP_WORDBREAKS should NOT be considered word breaks. This is useful +# for things like scp where we want to return host:path and not only path. +_get_cword() +{ + if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then + printf "%s" "${COMP_WORDS[COMP_CWORD]}" + else + local i + local cur="$COMP_LINE" + local index="$COMP_POINT" + for (( i = 0; i <= COMP_CWORD; ++i )); do + while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do + cur="${cur:1}" + index="$(( index - 1 ))" + done + if [[ "$i" -lt "$COMP_CWORD" ]]; then + local old_size="${#cur}" + cur="${cur#${COMP_WORDS[i]}}" + local new_size="${#cur}" + index="$(( index - old_size + new_size ))" + fi + done + + if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then + # We messed up! At least return the whole word so things + # keep working + printf "%s" "${COMP_WORDS[COMP_CWORD]}" + else + printf "%s" "${cur:0:$index}" + fi + fi +} + +# This function performs file and directory completion. It's better than +# simply using 'compgen -f', because it honours spaces in filenames. +# If passed -d, it completes only on directories. If passed anything else, +# it's assumed to be a file glob to complete on. +# +_filedir() +{ + local IFS=$'\t\n' xspec + + _expand || return 0 + + local -a toks + local tmp + + # TODO: I've removed a "[ -n $tmp ] &&" before `echo $tmp', + # and everything works again. If this bug + # suddenly appears again (i.e. "cd /b<TAB>" + # becomes "cd /"), remember to check for + # other similar conditionals (here and + # _filedir_xspec()). --David + # NOTE: The comment above has been moved outside of the subshell below, + # because quotes-in-comments-in-a-subshell cause errors on + # bash-3.1. See also: + # http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html + toks=( ${toks[@]-} $( + compgen -d -- "$(quote_readline "$cur")" | { + while read -r tmp; do + echo $tmp + done + } + )) + + if [[ "$1" != -d ]]; then + xspec=${1:+"!*.$1"} + toks=( ${toks[@]-} $( + compgen -f -X "$xspec" -- "$(quote_readline "$cur")" | { + while read -r tmp; do + [ -n $tmp ] && echo $tmp + done + } + )) + fi + + COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" ) +} + +# This function tries to parse the output of $command --help +# +_parse_help() { + local cmd + cmd=$1 + $cmd --help | \ + grep -- "^[[:space:]]*-" | \ + tr "," " " | \ + awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | \ + sed -e "s:=.*::g" +} + +# This function completes on signal names +# +_signals() +{ + local i + + # standard signal completion is rather braindead, so we need + # to hack around to get what we want here, which is to + # complete on a dash, followed by the signal name minus + # the SIG prefix + COMPREPLY=( $( compgen -A signal SIG${cur#-} )) + for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do + COMPREPLY[i]=-${COMPREPLY[i]#SIG} + done +} + +# This function completes on configured network interfaces +# +_configured_interfaces() +{ + if [ -f /etc/debian_version ]; then + # Debian system + COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \ + /etc/network/interfaces ) ) + elif [ -f /etc/SuSE-release ]; then + # SuSE system + COMPREPLY=( $( command ls \ + /etc/sysconfig/network/ifcfg-* | \ + sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) + elif [ -f /etc/pld-release ]; then + # PLD Linux + COMPREPLY=( $( command ls -B \ + /etc/sysconfig/interfaces | \ + sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) + else + # Assume Red Hat + COMPREPLY=( $( command ls \ + /etc/sysconfig/network-scripts/ifcfg-* | \ + sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) + fi +} + +# This function completes on available kernels +# +_kernel_versions() +{ + COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) ) +} + +# This function completes on all available network interfaces +# -a: restrict to active interfaces only +# -w: restrict to wireless interfaces only +# +_available_interfaces() +{ + local cmd + + if [ "${1:-}" = -w ]; then + cmd="iwconfig" + elif [ "${1:-}" = -a ]; then + cmd="ifconfig" + else + cmd="ifconfig -a" + fi + + COMPREPLY=( $( eval $cmd 2>/dev/null | \ + sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') ) +} + +# This function expands tildes in pathnames +# +_expand() +{ + # FIXME: Why was this here? + #[ "$cur" != "${cur%\\}" ] && cur="$cur\\" + + # Expand ~username type directory specifications. We want to expand + # ~foo/... to /home/foo/... to avoid problems when $cur starting with + # a tilde is fed to commands and ending up quoted instead of expanded. + + if [[ "$cur" == \~*/* ]]; then + eval cur=$cur + elif [[ "$cur" == \~* ]]; then + cur=${cur#\~} + COMPREPLY=( $( compgen -P '~' -u $cur ) ) + [ ${#COMPREPLY[@]} -eq 1 ] && eval COMPREPLY[0]=${COMPREPLY[0]} + return ${#COMPREPLY[@]} + fi +} + +# This function completes on process IDs. +# AIX and Solaris ps prefers X/Open syntax. +[ $UNAME = SunOS -o $UNAME = AIX ] && +_pids() +{ + COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur )) +} || +_pids() +{ + COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) ) +} + +# This function completes on process group IDs. +# AIX and SunOS prefer X/Open, all else should be BSD. +[ $UNAME = SunOS -o $UNAME = AIX ] && +_pgids() +{ + COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur )) +} || +_pgids() +{ + COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur )) +} + +# This function completes on process names. +# AIX and SunOS prefer X/Open, all else should be BSD. +[ $UNAME = SunOS -o $UNAME = AIX ] && +_pnames() +{ + COMPREPLY=( $( compgen -W '$( command ps -efo comm | \ + sed -e 1d -e "s:.*/::" -e "s/^-//" \ + -e "s/^<defunct>$//")' \ + -- $cur ) ) +} || +_pnames() +{ + # FIXME: completes "[kblockd/0]" to "0". Previously it was completed + # to "kblockd" which isn't correct either. "kblockd/0" would be + # arguably most correct, but killall from psmisc 22 treats arguments + # containing "/" specially unless -r is given so that wouldn't quite + # work either. Perhaps it'd be best to not complete these to anything + # for now. + # Not using "ps axo comm" because under some Linux kernels, it + # truncates command names (see e.g. http://bugs.debian.org/497540#19) + COMPREPLY=( $( compgen -W '$( command ps axo command | \ + sed -e "1d; s/ .*//; s:.*/::; s/:$//;" \ + -e "s/^[[(-]//; s/[])]$//" \ + -e "s/^<defunct>$//")' \ + -- $cur ) ) +} + +# This function completes on user IDs +# +_uids() +{ + if type getent &>/dev/null; then + COMPREPLY=( $( getent passwd | \ + awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) ) + elif type perl &>/dev/null; then + COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) ) + else + # make do with /etc/passwd + COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\ + /etc/passwd ) ) + fi +} + +# This function completes on group IDs +# +_gids() +{ + if type getent &>/dev/null; then + COMPREPLY=( $( getent group | \ + awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) ) + elif type perl &>/dev/null; then + COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) ) + else + # make do with /etc/group + COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\ + /etc/group ) ) + fi +} + +# This function completes on services +# +_services() +{ + local sysvdir famdir + [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d + famdir=/etc/xinetd.d + COMPREPLY=( $( builtin echo $sysvdir/!(*.rpm@(orig|new|save)|*~|functions)) ) + + if [ -d $famdir ]; then + COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpm@(orig|new|save)|*~)) ) + fi + + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) ) +} + +# This function completes on modules +# +_modules() +{ + local modpath + modpath=/lib/modules/$1 + COMPREPLY=( $( command ls -R $modpath | \ + sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') ) +} + +# This function completes on installed modules +# +_installed_modules() +{ + COMPREPLY=( $( compgen -W "$( /sbin/lsmod | \ + awk '{if (NR != 1) print $1}' )" -- $1 ) ) +} + +# This function completes on user:group format +# +_usergroup() +{ + local IFS=$'\n' + cur=${cur//\\\\ / } + if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then + user=${cur%%*([^:.])} + COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) ) + elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then + COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) ) + else + COMPREPLY=( $( compgen -S : -u -- $cur ) ) + fi +} + + +# Get real command. +# - arg: $1 Command +# - stdout: Filename of command in PATH with possible symbolic links resolved. +# Empty string if command not found. +# - return: True (0) if command found, False (> 0) if not. +_realcommand() { + type -P "$1" > /dev/null && { + if type -p realpath > /dev/null; then + realpath "$(type -P "$1")" + elif type -p readlink > /dev/null; then + readlink -f "$(type -P "$1")" + else + type -P "$1" + fi + } +} + + +# this function count the number of mandatory args +# +_count_args() +{ + args=1 + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" != -* ]]; then + args=$(($args+1)) + fi + done +} + +# This function complete on PCI IDs +# +_pci_ids() +{ + COMPREPLY=( ${COMPREPLY[@]:-} \ + $( compgen -W "$( lspci -n | awk '{print $3}')" -- $cur ) ) +} + +# This function complete on USB IDs +# +_usb_ids() +{ + COMPREPLY=( ${COMPREPLY[@]:-} \ + $( compgen -W "$( lsusb | awk '{print $6}')" -- $cur ) ) +} + +# start of section containing completion functions for bash built-ins + +# bash alias completion +# +_alias() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$COMP_LINE" in + *[^=]) + COMPREPLY=( $( compgen -A alias -- $cur ) ) + ;; + *=) + COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \ + sed -e 's|^alias '$cur'\(.*\)$|\1|' )" ) + ;; + esac +} +complete -F _alias $nospace alias + +# bash export completion +# +_export() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$COMP_LINE" in + *=\$*) + COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) ) + ;; + *[^=]) + COMPREPLY=( $( compgen -v -S '=' -- $cur ) ) + ;; + *=) + COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" | + ( echo -n \' + sed -e 's/'\''/'\''\\\'\'''\''/g' + echo -n \' ) )" ) + ;; + esac +} +complete -F _export $default $nospace export + +# bash shell function completion +# +_function() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $1 == @(declare|typeset) ]]; then + if [ "$prev" = -f ]; then + COMPREPLY=( $( compgen -A function -- $cur ) ) + elif [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \ + $cur ) ) + fi + elif [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -A function -- $cur ) ) + else + COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" ) + fi +} +complete -F _function function declare typeset + +# bash complete completion +# +_complete() +{ + local cur prev options + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -o) + options="default dirnames filenames" + [ -n "$bash205b" ] && options="$options nospace" + [ -n "$bash3" ] && options="$options bashdefault plusdirs" + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + return 0 + ;; + + -A) + COMPREPLY=( $( compgen -W 'alias arrayvar binding \ + builtin command directory disabled enabled \ + export file function group helptopic hostname \ + job keyword running service setopt shopt \ + signal stopped user variable' -- $cur ) ) + return 0 + ;; + + -C) + COMPREPLY=( $( compgen -A command -- $cur ) ) + return 0 + ;; + -F) + COMPREPLY=( $( compgen -A function -- $cur ) ) + return 0 + ;; + -@(p|r)) + COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \ + grep "^$cur" ) ) + return 0 + ;; + + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C" + [ -n "$bash205" ] && options="$options -o" + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + COMPREPLY=( $( compgen -A command -- $cur ) ) + fi +} +complete -F _complete complete + +# start of section containing completion functions for external programs + +# a little help for FreeBSD ports users +[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \ + extract patch configure build install reinstall \ + deinstall clean clean-depends kernel buildworld' make + +# This completes on a list of all available service scripts for the +# 'service' command and/or the SysV init.d directory, followed by +# that script's available commands +# +{ have service || [ -d /etc/init.d/ ]; } && +_service() +{ + local cur sysvdir + + COMPREPLY=() + prev=${COMP_WORDS[COMP_CWORD-1]} + cur=`_get_cword` + + # don't complete for things like killall, ssh and mysql if it's + # the standalone command, rather than the init script + [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0 + + # don't complete past 2nd token + [ $COMP_CWORD -gt 2 ] && return 0 + + [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ + || sysvdir=/etc/init.d + + if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then + _services + else + COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ + s/^.*Usage.*{\(.*\)}.*$/\1/p" \ + $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) ) + fi + + return 0 +} && +complete -F _service service +[ -d /etc/init.d/ ] && complete -F _service $default \ + $(for i in /etc/init.d/*; do echo ${i##*/}; done) + +# chown(1) completion +# +_chown() +{ + local cur + cur=`_get_cword` + + # options completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \ + --dereference --no-dereference --from= --silent --quiet \ + --reference= --recursive --verbose --help --version' -- $cur ) ) + else + _count_args + + case $args in + 1) + _usergroup + ;; + *) + _filedir + ;; + esac + fi +} +complete -F _chown $filenames chown + +# chgrp(1) completion +# +_chgrp() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + cur=${cur//\\\\/} + prev=${COMP_WORDS[COMP_CWORD-1]} + + # options completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \ + --dereference --no-dereference --silent --quiet \ + --reference= --recursive --verbose --help --version' -- $cur ) ) + return 0 + fi + + # first parameter on line or first since an option? + if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \ + [[ "$prev" == -* ]] && [ -n "$bash205" ]; then + local IFS=$'\n' + COMPREPLY=( $( compgen -g $cur 2>/dev/null ) ) + else + _filedir || return 0 + fi + + return 0 +} +complete -F _chgrp $filenames chgrp + +# umount(8) completion. This relies on the mount point being the third +# space-delimited field in the output of mount(8) +# +_umount() +{ + local cur IFS=$'\n' + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) ) + + return 0 +} +complete -F _umount $dirnames umount + +# mount(8) completion. This will pull a list of possible mounts out of +# /etc/{,v}fstab, unless the word being completed contains a ':', which +# would indicate the specification of an NFS server. In that case, we +# query the server for a list of all available exports and complete on +# that instead. +# +_mount() +{ + local cur i sm host + + COMPREPLY=() + cur=`_get_cword` + [[ "$cur" == \\ ]] && cur="/" + + for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done + + if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then + COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \ + grep ^${cur#*:} | awk '{print $1}' ) ) + elif [[ "$cur" == //* ]]; then + host=${cur#//} + host=${host%%/*} + if [ -n "$host" ]; then + COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null| + sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' | + sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) ) + fi + elif [ -r /etc/vfstab ]; then + # Solaris + COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \ + /etc/vfstab | grep "^$cur" ) ) + elif [ ! -e /etc/fstab ]; then + # probably Cygwin + COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \ + | grep "^$cur" ) ) + else + # probably Linux + COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \ + /etc/fstab | grep "^$cur" ) ) + fi + + return 0 +} +complete -F _mount $default $dirnames mount + +# Linux rmmod(8) completion. This completes on a list of all currently +# installed kernel modules. +# +have rmmod && { +_rmmod() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _installed_modules "$cur" + return 0 +} +complete -F _rmmod rmmod + +# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a +# list of all available modules for the version of the kernel currently +# running. +# +_insmod() +{ + local cur prev modpath + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # behave like lsmod for modprobe -r + if [ $1 = "modprobe" ] && + [ "${COMP_WORDS[1]}" = "-r" ]; then + _installed_modules "$cur" + return 0 + fi + + # do filename completion if we're giving a path to a module + if [[ "$cur" == */* ]]; then + _filedir '@(?(k)o?(.gz))' + return 0 + fi + + if [ $COMP_CWORD -gt 1 ] && + [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then + # do module parameter completion + COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \ + awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \ + else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) ) + else + _modules $(uname -r) + fi + + return 0 +} +complete -F _insmod $filenames insmod modprobe modinfo +} + +# man(1) completion +# +[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ + -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ + -o $UNAME = OpenBSD ] && +_man() +{ + local cur prev sect manpath manext mansect UNAME + + manext="@([0-9lnp]|[0-9][px]|man)?(.@(gz|bz2|lzma))" + mansect="@([0-9lnp]|[0-9][px])" + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ "$prev" == -l ]]; then + _filedir $manext + return 0 + fi + + _expand || return 0 + + # file based completion if parameter contains / + if [[ "$cur" == */* ]]; then + _filedir $manext + return 0 + fi + + UNAME=$( uname -s ) + # strip OS type and version under Cygwin + UNAME=${UNAME/CYGWIN_*/Cygwin} + if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \ + -o $UNAME = Cygwin ]; then + manpath=$( manpath 2>/dev/null || command man --path ) + else + manpath=$MANPATH + fi + + if [ -z "$manpath" ]; then + COMPREPLY=( $( compgen -c -- $cur ) ) + return 0 + fi + + # determine manual section to search + [[ "$prev" == $mansect ]] && sect=$prev || sect='*' + + manpath=$manpath: + if [ -n "$cur" ]; then + manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }" + else + manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }" + fi + + # redirect stderr for when path doesn't exist + COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) ) + # weed out directory path names and paths to man pages + COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) + # strip suffix from man pages + COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) + + if [[ "$prev" != $mansect ]]; then + # File based completion for the rest, prepending ./ if needed + # (man 1.6f needs that for man pages in current dir) + local start=${#COMPREPLY[@]} + _filedir $manext + for (( i=$start; i < ${#COMPREPLY[@]}; i++ )); do + [[ ${COMPREPLY[i]} == */* ]] || COMPREPLY[i]=./${COMPREPLY[i]} + done + fi + + return 0 +} +[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ + -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ + -o $UNAME = OpenBSD ] && \ +complete -F _man $filenames man apropos whatis + +# renice(8) completion +# +_renice() +{ + local command cur curopt i + + COMPREPLY=() + cur=`_get_cword` + command=$1 + + i=0 + # walk back through command line and find last option + while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do + curopt=${COMP_WORDS[COMP_CWORD-$i]} + case "$curopt" in + -u) + COMPREPLY=( $( compgen -u -- $cur ) ) + ;; + -g) + _pgids + ;; + -p|$command) + _pids + ;; + esac + i=$(( ++i )) + done +} +complete -F _renice renice + +# kill(1) completion +# +_kill() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then + # return list of available signals + _signals + else + # return list of available PIDs + _pids + fi +} +complete -F _kill kill + +# killall(1) (Linux and FreeBSD) and pkill(1) completion. +# +[ $UNAME = Linux -o $UNAME = FreeBSD ] || have pkill && +_killall() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then + _signals + else + _pnames + fi + + return 0 +} +[ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall +have pkill && complete -F _killall pkill + +# pgrep(1) completion. +# +[ $UNAME = Linux ] || have pgrep && +_pgrep() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _pnames + + return 0 +} +have pgrep && complete -F _pgrep pgrep + +# Linux pidof(8) completion. +[ $UNAME = Linux ] && complete -F _pgrep pidof + +# GNU find(1) completion. This makes heavy use of ksh style extended +# globs and contains Linux specific code for completing the parameter +# to the -fstype option. +# +_find() +{ + local cur prev i exprfound onlyonce + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(max|min)depth) + COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) ) + return 0 + ;; + -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename) + _filedir + return 0 + ;; + -fstype) + # this is highly non-portable + [ -e /proc/filesystems ] && + COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \ + grep "^$cur" ) ) + return 0 + ;; + -gid) + _gids + return 0 + ;; + -group) + if [ -n "$bash205" ]; then + COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) ) + fi + return 0 + ;; + -?(x)type) + COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) ) + return 0 + ;; + -uid) + _uids + return 0 + ;; + -user) + COMPREPLY=( $( compgen -u -- $cur ) ) + return 0 + ;; + -exec|-ok) + COMP_WORDS=(COMP_WORDS[0] $cur) + COMP_CWORD=1 + _command + return 0 + ;; + -[acm]min|-[acm]time|-?(i)?(l)?(whole)name|-inum|-?(i)path|-?(i)regex| \ + -links|-perm|-size|-used|-printf) + # do nothing, just wait for a parameter to be given + return 0 + ;; + esac + + _expand || return 0 + + # set exprfound to 1 if there is already an expression present + for i in ${COMP_WORDS[@]}; do + [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break + done + + # handle case where first parameter is not a dash option + if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then + _filedir -d + return 0 + fi + + # complete using basic options + COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \ + -mindepth -mount -noleaf -version -xdev -amin -anewer \ + -atime -cmin -cnewer -ctime -empty -false -fstype \ + -gid -group -ilname -iname -inum -ipath -iregex \ + -wholename \ + -links -lname -mmin -mtime -name -newer -nouser \ + -nogroup -perm -regex -size -true -type -uid -used \ + -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \ + -print -print0 -printf -prune -ls -wholename -iwholename' -- $cur ) ) + + # this removes any options from the list of completions that have + # already been specified somewhere on the command line, as long as + # these options can only be used once (in a word, "options", in + # opposition to "tests" and "actions", as in the find(1) manpage). + onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \ + -noleaf -version -xdev ' + COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \ + (while read -d ' ' i; do + [ "$i" == "" ] || + [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] && + continue + # flatten array with spaces on either side, + # otherwise we cannot grep on word boundaries of + # first and last word + COMPREPLY=" ${COMPREPLY[@]} " + # remove word from list of completions + COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) + done + echo "${COMPREPLY[@]}") + ) ) + + _filedir + + return 0 +} +complete -F _find $filenames find + +# Linux iwconfig(8) completion +# +[ $UNAME = Linux ] && have iwconfig && +_iwconfig() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + mode) + COMPREPLY=( $( compgen -W 'managed ad-hoc master \ + repeater secondary monitor' -- $cur ) ) + return 0 + ;; + essid) + COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) + if [ -n "${COMP_IWLIST_SCAN:-}" ]; then + COMPREPLY=( "${COMPREPLY[@]}" \ + $( iwlist ${COMP_WORDS[1]} scan | \ + awk -F '"' '/ESSID/ {print $2}' | \ + grep "^$cur" )) + fi + return 0 + ;; + nwid) + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) + return 0 + ;; + channel) + COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ + awk '/^[[:space:]]*Channel/ {print $2}' | \ + grep "^$cur" ) ) + return 0 + ;; + + freq) + COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ + awk '/^[[:space:]]*Channel/ {print $4"G"}' | \ + grep "^$cur" ) ) + return 0 + ;; + ap) + COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) + if [ -n "${COMP_IWLIST_SCAN:-}" ]; then + COMPREPLY=( "${COMPREPLY[@]}" \ + $( iwlist ${COMP_WORDS[1]} scan | \ + awk -F ': ' '/Address/ {print $2}' | \ + grep "^$cur" ) ) + fi + return 0 + ;; + rate) + COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) ) + COMPREPLY=( "${COMPREPLY[@]}" \ + $( iwlist ${COMP_WORDS[1]} rate | \ + awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \ + grep "^$cur" ) ) + return 0 + ;; + rts) + COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) + return 0 + ;; + frag) + COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) + return 0 + ;; + key) + COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) + return 0 + ;; + enc) + COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) + return 0 + ;; + power) + COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) ) + return 0 + ;; + txpower) + COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) ) + return 0 + ;; + retry) + COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) ) + return 0 + ;; + esac + + if [ $COMP_CWORD -eq 1 ]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \ + ap nick rate rts frag enc key power txpower commit' -- $cur ) ) + fi + +} && +complete -F _iwconfig iwconfig + +# Linux iwlist(8) completion +# +[ $UNAME = Linux ] && have iwlist && +_iwlist() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ $COMP_CWORD -eq 1 ]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'scan scanning freq frequency \ + channel rate bit bitrate key enc encryption power \ + txpower retry ap accesspoint peers event' -- $cur ) ) + fi +} && +complete -F _iwlist iwlist + +# Linux iwspy(8) completion +# +[ $UNAME = Linux ] && have iwspy && +_iwspy() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) ) + fi +} && +complete -F _iwspy iwspy + +# Linux iwpriv(8) completion +# +[ $UNAME = Linux ] && have iwpriv && +_iwpriv() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + roam) + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) + return 0 + ;; + port) + COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) ) + return 0 + ;; + esac + + if [ $COMP_CWORD -eq 1 ]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) + else + _available_interfaces -w + fi + else + COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) ) + fi +} && +complete -F _iwpriv iwpriv + +# Red Hat & Debian GNU/Linux if{up,down} completion +# +[ $UNAME = Linux ] && { have ifup || have ifdown; } && +_ifupdown() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + _configured_interfaces + COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") ) + fi + + return 0 +} && +complete -F _ifupdown ifup ifdown +[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus + +# Linux ipsec(8) completion (for FreeS/WAN) +# +[ $UNAME = Linux ] && have ipsec && +_ipsec() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \ + manual pluto ranbits rsasigkey \ + setup showdefaults showhostkey spi \ + spigrp tncfg whack' -- $cur ) ) + return 0 + fi + + case ${COMP_WORDS[1]} in + auto) + COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \ + --replace --down --route --unroute \ + --ready --status --rereadsecrets' \ + -- $cur ) ) + ;; + manual) + COMPREPLY=( $( compgen -W '--up --down --route --unroute \ + --union' -- $cur ) ) + ;; + ranbits) + COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \ + -- $cur ) ) + ;; + setup) + COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) ) + ;; + + *) + ;; + esac + + return 0 +} && +complete -F _ipsec ipsec + +# Postfix completion. +# +have postfix && { +# postfix(1) +# +_postfix() +{ + local cur prev + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $cur == '-' ]]; then + COMPREPLY=(-c -D -v) + return 0 + fi + if [[ $prev == '-c' ]]; then + _filedir -d + return 0 + fi + if [[ $prev == '-D' ]]; then + COMPREPLY=( $( compgen -W 'start' -- "`_get_cword`" ) ) + return 0 + fi + COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \ + "`_get_cword`" ) ) +} +complete -F _postfix postfix + +# postalias(1) and postmap(1) +# +_postmap() +{ + local cur prev len idx + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $cur == '-' ]]; then + COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q) + return 0 + fi + if [[ $prev == '-c' ]]; then + _filedir -d + return 0 + fi + if [[ $prev == -[dq] ]]; then + return 0 + fi + + if [[ "$cur" == *:* ]]; then + COMPREPLY=( $( compgen -f -- ${cur#*:} ) ) + else + len=${#cur} + idx=0 + for pval in $( /usr/sbin/postconf -m ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]="$pval:" + idx=$(($idx+1)) + fi + done + if [[ $idx -eq 0 ]]; then + COMPREPLY=( $( compgen -f -- "$cur" ) ) + fi + fi + return 0 +} +complete -F _postmap postmap postalias + +# postcat(1) +# +_postcat() +{ + local cur prev pval len idx qfile + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $cur == '-' ]]; then + COMPREPLY=(-c -q -v) + return 0 + fi + if [[ $prev == '-c' ]]; then + _filedir -d + return 0 + fi + + qfile=0 + for idx in "${COMP_WORDS[@]}"; do + [[ "$idx" = -q ]] && qfile=1 && break + done + if [[ $qfile == 1 ]]; then + len=${#cur} + idx=0 + for pval in $( mailq | \ + sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + else + _filedir + return 0 + fi +} +complete -F _postcat postcat + +# postconf(1) +# +_postconf() +{ + local cur prev pval len idx eqext + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + if [[ $cur == '-' ]]; then + COMPREPLY=(-c -d -e -h -m -l -n -v) + return 0 + fi + if [[ $prev == '-c' ]]; then + _filedir -d + return 0 + fi + if [[ $prev == '-e' ]]; then + cur=${cur#[\"\']} + eqext='=' + fi + len=${#cur} + idx=0 + for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]="$pval$eqext" + idx=$(($idx+1)) + fi + done + return 0 +} +complete -F _postconf postconf + +# postsuper(1) +# +_postsuper() +{ + local cur prev pval len idx + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ $cur == '-' ]]; then + COMPREPLY=(-c -d -h -H -p -r -s -v) + return 0 + fi + case $prev in + -[dr]) + len=${#cur} + idx=0 + for pval in $( echo ALL; mailq | \ + sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + -h) + len=${#cur} + idx=0 + for pval in $( echo ALL; mailq | \ + sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + -H) + len=${#cur} + idx=0 + for pval in $( echo ALL; mailq | \ + sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do + if [[ "$cur" == "${pval:0:$len}" ]]; then + COMPREPLY[$idx]=$pval + idx=$(($idx+1)) + fi + done + return 0 + ;; + esac + COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) ) + return 0 +} +complete -F _postsuper postsuper +} + +# cvs(1) completion +# +have cvs && { +set_prefix() +{ + [ -z ${prefix:-} ] || prefix=${cur%/*}/ + [ -r ${prefix:-}CVS/Entries ] || prefix="" +} + +get_entries() +{ + local IFS=$'\n' + [ -r ${prefix:-}CVS/Entries ] && \ + entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries) +} + +get_modules() +{ + if [ -n "$prefix" ]; then + COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) ) + else + COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) ) + fi +} + +_cvs() +{ + local cur count mode i cvsroot cvsroots pwd + local -a flags miss files entries changed newremoved + + COMPREPLY=() + cur=`_get_cword` + + count=0 + for i in "${COMP_WORDS[@]}"; do + [ $count -eq $COMP_CWORD ] && break + # Last parameter was the CVSROOT, now go back to mode selection + if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then + mode="" + fi + if [ -z "$mode" ]; then + case $i in + -d) + mode=cvsroot + cvsroot=${COMP_WORDS[((count+1))]} + ;; + @(ad?(d)|new)) + mode=add + ;; + @(adm?(in)|rcs)) + mode=admin + ;; + ann?(notate)) + mode=annotate + ;; + @(checkout|co|get)) + mode=checkout + ;; + @(com?(mit)|ci)) + mode=commit + ;; + di?(f?(f))) + mode=diff + ;; + ex?(p?(ort))) + mode=export + ;; + ?(un)edit) + mode=$i + ;; + hi?(s?(tory))) + mode=history + ;; + im?(p?(ort))) + mode=import + ;; + re?(l?(ease))) + mode=release + ;; + ?(r)log) + mode=log + ;; + @(rdiff|patch)) + mode=rdiff + ;; + @(remove|rm|delete)) + mode=remove + ;; + @(rtag|rfreeze)) + mode=rtag + ;; + st?(at?(us))) + mode=status + ;; + @(tag|freeze)) + mode=tag + ;; + up?(d?(ate))) + mode=update + ;; + *) + ;; + esac + elif [[ "$i" = -* ]]; then + flags=( "${flags[@]}" $i ) + fi + count=$((++count)) + done + + case "$mode" in + add) + if [[ "$cur" != -* ]]; then + set_prefix + if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then + get_entries + [ -z "$cur" ] && \ + files=$( command ls -Ad !(CVS) ) || \ + files=$( command ls -d ${cur}* 2>/dev/null ) + for i in "${entries[@]}"; do + files=( ${files[@]/#$i//} ) + done + COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- \ + $cur ) ) + fi + else + COMPREPLY=( $( compgen -W '-k -m' -- $cur ) ) + fi + ;; + admin) + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \ + -L -U -m -M -n -N -o -q -I \ + -s -t -t- -T -V -x -z' -- \ + $cur ) ) + fi + ;; + annotate) + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) ) + else + get_entries + COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) ) + fi + ;; + checkout) + if [[ "$cur" != -* ]]; then + [ -z "$cvsroot" ] && cvsroot=$CVSROOT + COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \ + awk '{print $1}' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) ) + else + COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \ + -s -r -D -d -k -j' -- $cur ) ) + fi + ;; + commit) + set_prefix + + if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then + # if $COMP_CVS_REMOTE is not null, 'cvs commit' will + # complete on remotely checked-out files (requires + # passwordless access to the remote repository + if [ -n "${COMP_CVS_REMOTE:-}" ]; then + # this is the least computationally intensive + # way found so far, but other changes + # (something other than changed/removed/new) + # may be missing + changed=( $( cvs -q diff --brief 2>&1 | \ + sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) ) + newremoved=( $( cvs -q diff --brief 2>&1 | \ + sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) ) + COMPREPLY=( $( compgen -W '${changed[@]:-} \ + ${newremoved[@]:-}' -- $cur ) ) + else + COMPREPLY=( $(compgen $default -- "$cur") ) + fi + else + COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \ + $cur ) ) + fi + ;; + cvsroot) + if [ -r ~/.cvspass ]; then + # Ugly escaping because of bash treating ':' specially + cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass ) + COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) ) + fi + ;; + export) + if [[ "$cur" != -* ]]; then + [ -z "$cvsroot" ] && cvsroot=$CVSROOT + COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) ) + else + COMPREPLY=( $( compgen -W '-N -f -l -R -n \ + -r -D -d -k' -- $cur ) ) + fi + ;; + diff) + if [[ "$cur" == -* ]]; then + _longopt diff + else + get_entries + COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) ) + fi + ;; + remove) + if [[ "$cur" != -* ]]; then + set_prefix + if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then + get_entries + # find out what files are missing + for i in "${entries[@]}"; do + [ ! -r "$i" ] && miss=( "${miss[@]}" $i ) + done + COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) ) + fi + else + COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) ) + fi + ;; + import) + if [[ "$cur" != -* ]]; then + # starts with same algorithm as checkout + [ -z "$cvsroot" ] && cvsroot=$CVSROOT + prefix=${cur%/*} + if [ -r ${cvsroot}/${prefix} ]; then + get_modules + COMPREPLY=( ${COMPREPLY[@]#$cvsroot} ) + COMPREPLY=( ${COMPREPLY[@]#\/} ) + fi + pwd=$( pwd ) + pwd=${pwd##*/} + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \ + $cur ) ) + else + COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur )) + fi + ;; + update) + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \ + -k -r -D -j -I -W' -- \ + $cur ) ) + fi + ;; + "") + COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \ + commit diff delete edit export \ + freeze get history import log new \ + patch rcs rdiff release remove \ + rfreeze rlog rm rtag stat status \ + tag unedit up update -H -Q -q -b \ + -d -e -f -l -n -t -r -v -w -x -z \ + --help --version' -- $cur ) ) + ;; + *) + ;; + esac + + return 0 +} +complete -F _cvs $default cvs +} + +have rpm && { +# helper functions for rpm completion +# +_rpm_installed_packages() +{ + local ver nodig="$1" nosig="$2" + + if [ -r /var/log/rpmpkgs -a \ + /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then + # using RHL 7.2 or later - this is quicker than querying the DB + COMPREPLY=( $( sed -ne \ + 's|^\('$cur'[^[:space:]]*\)-[^[:space:]-]\+-[^[:space:]-]\+\.rpm$|\1|p' \ + /var/log/rpmpkgs ) ) + else + _rpm_nodigsig + COMPREPLY=( $( rpm -qa $nodig $nosig --qf='%{NAME} ' "$cur*" ) ) + fi +} + +_rpm_groups() +{ + local IFS=$'\t' + # remove trailing backslash, or grep will complain + cur=${cur%"\\"} + COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \ + grep "^$cur" ) ) + # backslash escape spaces and translate newlines to tabs + COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) ) +} + +_rpm_nodigsig() +{ + if [ -z "$nodig" -a -z "$nosig" ]; then + local rpmver + + rpmver=$(rpm --version) + rpmver=${rpmver##* } + + if [[ "$rpmver" > "4.0.4" ]]; then + nodig="--nodigest" + fi + if [[ "$rpmver" > "4.0.99" ]]; then + nosig="--nosignature" + fi + fi +} + +# rpm(8) completion +# +_rpm() +{ + local cur prev nodig nosig + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + nodig="" + nosig="" + _rpm_nodigsig + + if [ $COMP_CWORD -eq 1 ]; then + # first parameter on line + case "$cur" in + -b*) + COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\ + -- $cur ) ) + ;; + -t*) + COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\ + -- $cur ) ) + ;; + --*) + COMPREPLY=( $( compgen -W '--help --version --initdb \ + --checksig --recompile --rebuild --resign --addsign \ + --rebuilddb --showrc --setperms --setugids --tarbuild \ + --eval --install --upgrade --query --freshen --erase \ + --verify --querytags --rmsource --rmspec --clean \ + --import' -- $cur ) ) + ;; + *) + COMPREPLY=( $( compgen -W '-b -e -E -F -i -q -t -U -V' \ + -- $cur ) ) + ;; + esac + + return 0 + fi + + case "$prev" in + --@(@(db|exclude)path|prefix|relocate|root)) + _filedir -d + return 0 + ;; + --eval|-E) + # get a list of macros + COMPREPLY=( $( rpm --showrc | sed -ne \ + 's/^-\?[0-9]\+[:=][[:space:]]\+\('${cur#%}'[^[:space:](]*\).*/\1/p' ) ) + COMPREPLY=( "${COMPREPLY[@]/#/%}" ) + return 0 + ;; + --pipe) + COMPREPLY=( $( compgen -c -- $cur ) ) + return 0 + ;; + --rcfile) + _filedir + return 0 + ;; + --specfile) + # complete on .spec files + _filedir spec + return 0 + ;; + --whatprovides) + if [[ "$cur" == */* ]]; then + _filedir + else + # complete on capabilities + COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \ + '%{providename}\n' | grep "^$cur" ) ) + fi + return 0 + ;; + --whatrequires) + # complete on capabilities + COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \ + '%{requirename}\n' | grep "^$cur" ) ) + return 0 + ;; + --target) + COMPREPLY=( $( compgen -W "$( command rpm --showrc | sed -ne \ + 's/^\s*compatible\s\+build\s\+archs\s*:\s*\(.*\)/\1/ p' )" -- $cur ) ) + return 0 + ;; + esac + + case "${COMP_WORDS[1]}" in + -@([iFU]*|-install|-freshen|-upgrade)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--percent --force --test \ + --replacepkgs --replacefiles --root --excludedocs \ + --includedocs --noscripts --rcfile --ignorearch \ + --dbpath --prefix --ignoreos --nodeps --allfiles \ + --ftpproxy --ftpport --justdb --httpproxy --httpport \ + --noorder --relocate --badreloc --notriggers \ + --excludepath --ignoresize --oldpackage --define \ + --eval --pipe --queryformat --repackage --nosuggests \ + --nodigest --nosignature' -- $cur ) ) + else + _filedir 'rpm' + fi + ;; + -@(e|-erase)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--allmatches --noscripts \ + --notriggers --nodeps --test --repackage' -- $cur ) ) + else + _rpm_installed_packages "$nodig" "$nosig" + fi + ;; + -@(q*|-query)) + # check whether we're doing file completion + if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--scripts --root \ + --rcfile --requires --ftpport --ftpproxy \ + --httpproxy --httpport --provides --triggers \ + --dump --changelog --dbpath \ + --last --filesbypkg \ + --info --list --state \ + --docfiles --configfiles --queryformat \ + --conflicts --obsoletes \ + --nodigest --nosignature \ + --suggests --enhances \ + --triggerscripts' -- $cur ) ) + else + _filedir + fi + elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + _rpm_groups + elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + # uninstalled package completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--scripts --root \ + --rcfile --whatprovides --whatrequires \ + --requires --triggeredby --ftpport --ftpproxy \ + --httpproxy --httpport --provides --triggers \ + --dump --changelog --dbpath --filesbypkg \ + --define --eval --pipe --showrc --info --list \ + --state --docfiles --configfiles --queryformat\ + --conflicts --obsoletes --nodigest \ + --nosignature' -- $cur ) ) + else + _filedir 'rpm' + fi + else + # installed package completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--scripts --root \ + --rcfile --whatprovides --whatrequires \ + --requires --triggeredby --ftpport --ftpproxy \ + --httpproxy --httpport --provides --triggers \ + --dump --changelog --dbpath --specfile \ + --querybynumber --last --filesbypkg --define \ + --eval --pipe --showrc --info --list --state \ + --docfiles --configfiles --queryformat \ + --conflicts --obsoletes --pkgid --hdrid \ + --fileid --tid --nodigest --nosignature \ + --triggerscripts' -- $cur ) ) + elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then + _rpm_installed_packages "$nodig" "$nosig" + fi + fi + ;; + -@(K*|-checksig)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \ + --nodigest --nosignature' -- $cur ) ) + else + _filedir 'rpm' + fi + ;; + -@([Vy]*|-verify)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \ + --nodeps --nogroup --nolinkto --nomode --nomtime \ + --nordev --nouser --nofiles --noscripts --nomd5 \ + --querytags --specfile --whatrequires --whatprovides \ + --nodigest --nosignature' -- $cur ) ) + # check whether we're doing file completion + elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then + _filedir + elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then + _rpm_groups + elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then + _filedir 'rpm' + else + _rpm_installed_packages "$nodig" "$nosig" + fi + ;; + -[bt]*) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--short-circuit --timecheck \ + --clean --rmsource --rmspec --test --sign --buildroot \ + --target --nobuild --nodeps --nodirtokens' -- $cur ) ) + elif [[ ${COMP_WORDS[1]} == -b* ]]; then + _filedir 'spec' + else + _filedir '@(tgz|tar.@(gz|bz2|lzma))' + fi + ;; + --re@(build|compile)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--nodeps --rmsource \ + --rmspec --sign --nodirtokens --target' -- $cur ) ) + else + _filedir '?(no)src.rpm' + fi + ;; + --tarbuild) + _filedir '@(tgz|tar.@(gz|bz2|lzma))' + ;; + --@(re|add)sign) + _filedir 'rpm' + ;; + --set@(perms|gids)) + _rpm_installed_packages "$nodig" "$nosig" + ;; + --@(clean|rms@(ource|pec))) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--clean --rmsource \ + --rmspec' -- $cur ) ) + else + _filedir 'spec' + fi + ;; + --@(import|dbpath|root)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--import --dbpath --root' \ + -- $cur ) ) + else + _filedir + fi + ;; + esac + + return 0 +} +complete -F _rpm $filenames rpm rpmbuild +} + +# Debian apt-get(8) completion. +# +have apt-get && +_apt_get() +{ + local cur prev special i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(install|remove|autoremove|purge|source|build-dep) ]]; then + special=${COMP_WORDS[i]} + fi + done + + if [ -n "$special" ]; then + case $special in + remove|autoremove|purge) + if [ -f /etc/debian_version ]; then + # Debian system + COMPREPLY=( $( _comp_dpkg_installed_packages \ + $cur ) ) + else + # assume RPM based + _rpm_installed_packages + fi + return 0 + ;; + *) + COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) + return 0 + ;; + + esac + fi + + case "$prev" in + -@(c|-config-file)) + _filedir + return 0 + ;; + + -@(t|-target-release|-default-release)) + COMPREPLY=( $( apt-cache policy | \ + grep "release.o=Debian,a=$cur" | \ + sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) ) + return 0 + ;; + + esac + + if [[ "$cur" == -* ]]; then + + COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \ + -u -t -b -c -o --download-only --fix-broken \ + --help --version --ignore-missing \ + --fix-missing --no-download --quiet --simulate \ + --just-print --dry-run --recon --no-act --yes \ + --assume-yes --show-upgraded --only-source \ + --compile --build --ignore-hold \ + --target-release --no-upgrade --force-yes \ + --print-uris --purge --reinstall \ + --list-cleanup --default-release \ + --trivial-only --no-remove --diff-only \ + --no-install-recommends \ + --tar-only --config-file --option --auto-remove' -- $cur ) ) + else + + COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \ + dist-upgrade install remove purge source build-dep \ + check clean autoclean autoremove' -- $cur ) ) + + fi + + + return 0 +} && +complete -F _apt_get $filenames apt-get + +# Debian apt-cache(8) completion. +# +have apt-cache && +_apt_cache() +{ + local cur prev special i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + + if [ "$cur" != show ]; then + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|madison|policy|rdepends|show?(pkg|src|)) ]]; then + special=${COMP_WORDS[i]} + fi + done + fi + + + if [ -n "$special" ]; then + case $special in + add) + _filedir + return 0 + ;; + + showsrc) + COMPREPLY=( $( apt-cache dumpavail | \ + grep "^Source: $cur" | sort | \ + uniq | cut -f2 -d" " ) ) + return 0 + ;; + + *) + COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) + return 0 + ;; + + esac + fi + + + case "$prev" in + -@(c|p|s|-config-file|-@(pkg|src)-cache)) + _filedir + return 0 + ;; + search) + if [[ "$cur" != -* ]]; then + return 0 + fi + ;; + esac + + if [[ "$cur" == -* ]]; then + + COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \ + -o --help --version --pkg-cache --src-cache \ + --quiet --important --full --all-versions \ + --no-all-versions --generate --no-generate \ + --names-only --all-names --recurse \ + --config-file --option --installed' -- $cur ) ) + else + + COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \ + stats dump dumpavail unmet search search \ + depends rdepends pkgnames dotty xvcg \ + policy madison' -- $cur ) ) + + fi + + + return 0 +} && +complete -F _apt_cache $filenames apt-cache + + +# Debian aptitude(1) completion +# +have aptitude && { +have grep-status && { +_comp_dpkg_hold_packages() +{ + grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package +} +} || { +_comp_dpkg_hold_packages() +{ + grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \ + | cut -d\ -f2 +} +} + +_aptitude() +{ + local cur dashoptions prev special i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + + dashoptions='-S -u -i -h --help --version -s --simulate -d \ + --download-only -P --prompt -y --assume-yes -F \ + --display-format -O --sort -w --width -f -r -g \ + --with-recommends --with-suggests -R -G \ + --without-recommends --without-suggests -t \ + --target-release -V --show-versions -D --show-deps\ + -Z -v --verbose --purge-unused --schedule-only' + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|forbid-version|purge|remove|changelog|why|why-not|keep|keep-all|build-dep) ]]; then + special=${COMP_WORDS[i]} + fi + #exclude some mutually exclusive options + [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i} + [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u} + done + + if [[ -n "$special" ]]; then + case $special in + @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not|build-dep)) + COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) + return 0 + ;; + @(purge|remove|reinstall|forbid-version)) + COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) + return 0 + ;; + unhold) + COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) ) + return 0 + ;; + + esac + fi + + case $prev in + # don't complete anything if these options are found + @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all)) + return 0 + ;; + + -S) + _filedir + return 0 + ;; + + -@(t|-target-release|-default-release)) + COMPREPLY=( $( apt-cache policy | \ + grep "release.o=Debian,a=$cur" | \ + sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) ) + return 0 + ;; + + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) ) + else + COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \ + autoclean install reinstall remove \ + hold unhold purge markauto unmarkauto why why-not \ + dist-upgrade full-upgrade download search show \ + forbid-version changelog keep-all' -- $cur ) ) + fi + + + return 0 +} +complete -F _aptitude $default aptitude +} + +# Debian apt-build(1) completion. +# +have apt-build && +_apt_build() +{ + local cur prev special i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then + special=${COMP_WORDS[i]} + fi + done + + if [ -n "$special" ]; then + case $special in + @(install|source|info)) + COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) + return 0 + ;; + remove) + COMPREPLY=( $( _comp_dpkg_installed_packages \ + $cur ) ) + return 0 + ;; + *) + return 0 + ;; + esac + fi + + case "$prev" in + + --@(patch|build-dir|repository-dir)) + _filedir + return 0 + ;; + + -@(h|-help)) + return 0 + ;; + + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \ + --repository-dir --build-only \ + --build-command --reinstall --rebuild \ + --remove-builddep --no-wrapper --purge \ + --patch --patch-strip -p --yes -y \ + --version -v --no-source' -- $cur ) ) + + else + COMPREPLY=( $( compgen -W 'update upgrade install remove \ + source dist-upgrade world clean info \ + clean-build update-repository ' -- $cur ) ) + fi + + + return 0 +} && +complete -F _apt_build $filenames apt-build + +# chsh(1) completion +# +_chsh() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ "$prev" = "-s" ]; then + if [ -f /etc/debian_version ]; then + COMPREPLY=( $( </etc/shells ) ) + else + COMPREPLY=( $( chsh -l | grep "^$cur" ) ) + fi + else + COMPREPLY=( $( compgen -u -- $cur ) ) + fi + + return 0 +} +complete -F _chsh chsh + +# chkconfig(8) completion +# +have chkconfig && +_chkconfig() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + @([1-6]|--@(list|add|del))) + _services + return 0 + ;; + --level) + COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) ) + else + if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then + COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) ) + else + _services + fi + fi +} && +complete -F _chkconfig chkconfig + +# This function provides simple user@host completion +# +_user_at_host() { + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ $cur == *@* ]]; then + _known_hosts + else + COMPREPLY=( $( compgen -u -- "$cur" ) ) + fi + + return 0 +} +shopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger + +# This function performs host completion based on ssh's known_hosts files, +# defaulting to standard host completion if they don't exist. +# +# Arguments: -a Use aliases +# -c Use `:' suffix +# -F configfile Use `configfile' for configuration settings +_known_hosts() +{ + local configfile + local cur curd ocur user suffix aliases global_kh user_kh hosts i host + local -a kh khd config + + COMPREPLY=() + cur=`_get_cword` + ocur=$cur + + local OPTIND=1 + while getopts "acF:" flag "$@"; do + case $flag in + a) aliases='yes' ;; + c) suffix=':' ;; + F) configfile="$OPTARG" ;; + esac + done + + [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@} + kh=() + + # ssh config files + if [ -n "$configfile" ]; then + [ -r "$configfile" ] && + config=( "${config[@]}" "$configfile" ) + else + [ -r /etc/ssh/ssh_config ] && + config=( "${config[@]}" "/etc/ssh/ssh_config" ) + [ -r "${HOME}/.ssh/config" ] && + config=( "${config[@]}" "${HOME}/.ssh/config" ) + [ -r "${HOME}/.ssh2/config" ] && + config=( "${config[@]}" "${HOME}/.ssh2/config" ) + fi + + if [ ${#config[@]} -gt 0 ]; then + # expand path (if present) to global known hosts file + global_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" ) + # expand path (if present) to user known hosts file + user_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" ) + fi + + # Global known_hosts files + [ -r "$global_kh" ] && + kh=( "${kh[@]}" "$global_kh" ) + if [ -z "$configfile" ]; then + [ -r /etc/ssh/ssh_known_hosts ] && + kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts ) + [ -r /etc/ssh/ssh_known_hosts2 ] && + kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 ) + [ -r /etc/known_hosts ] && + kh=( "${kh[@]}" /etc/known_hosts ) + [ -r /etc/known_hosts2 ] && + kh=( "${kh[@]}" /etc/known_hosts2 ) + [ -d /etc/ssh2/knownhosts ] && + khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub ) + fi + + # User known_hosts files + [ -r "$user_kh" ] && + kh=( "${kh[@]}" "$user_kh" ) + if [ -z "$configfile" ]; then + [ -r ~/.ssh/known_hosts ] && + kh=( "${kh[@]}" ~/.ssh/known_hosts ) + [ -r ~/.ssh/known_hosts2 ] && + kh=( "${kh[@]}" ~/.ssh/known_hosts2 ) + [ -d ~/.ssh2/hostkeys ] && + khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub ) + fi + + # If we have known_hosts files to use + if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 -o -n "$configfile" ]; then + # Escape slashes and dots in paths for awk + cur=${cur//\//\\\/} + cur=${cur//\./\\\.} + curd=$cur + + if [[ "$cur" == [0-9]*.* ]]; then + # Digits followed by a dot - just search for that + cur="^$cur.*" + elif [[ "$cur" == [0-9]* ]]; then + # Digits followed by no dot - search for digits followed + # by a dot + cur="^$cur.*\." + elif [ -z "$cur" ]; then + # A blank - search for a dot or an alpha character + cur="[a-z.]" + else + cur="^$cur" + fi + + if [ ${#kh[@]} -gt 0 ]; then + + # FS needs to look for a comma separated list + COMPREPLY=( $( awk 'BEGIN {FS=","} + /^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \ + gsub(" .*$", "", $i); \ + if ($i ~ /'$cur'/) {print $i} \ + }}' "${kh[@]}" 2>/dev/null ) ) + fi + if [ ${#khd[@]} -gt 0 ]; then + # Needs to look for files called + # .../.ssh2/key_22_<hostname>.pub + # dont fork any processes, because in a cluster environment, + # there can be hundreds of hostkeys + for i in "${khd[@]}" ; do + if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then + host=${i/#*key_22_/} + host=${host/%.pub/} + COMPREPLY=( "${COMPREPLY[@]}" $host ) + fi + done + fi + # append any available aliases from config files + if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then + local host_aliases=$( sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^#*?]*\)\(#.*\)\?$/\2/p' "${config[@]}" ) + hosts=$( compgen -W "$host_aliases" -- $ocur ) + COMPREPLY=( "${COMPREPLY[@]}" $hosts ) + fi + + # Now add results of normal hostname completion + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) ) + + # apply suffix + for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do + COMPREPLY[i]=$user${COMPREPLY[i]}$suffix + done + elif [ -z "$configfile" ]; then + # Just do normal hostname completion + COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) ) + fi + + return 0 +} +complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \ + ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr + +# rsync(1) completion +# +have rsync && +_rsync() +{ + local cur prev shell i userhost path + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + _expand || return 0 + + case "$prev" in + --@(config|password-file|include-from|exclude-from)) + _filedir + return 0 + ;; + -@(T|-temp-dir|-compare-dest)) + _filedir -d + return 0 + ;; + -@(e|-rsh)) + COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) ) + return 0 + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \ + -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \ + -z -h -4 -6 --verbose --quiet --checksum \ + --archive --recursive --relative --backup \ + --backup-dir --suffix= --update --links \ + --copy-links --copy-unsafe-links --safe-links \ + --hard-links --perms --owner --group --devices\ + --times --sparse --dry-run --whole-file \ + --no-whole-file --one-file-system \ + --block-size= --rsh= --rsync-path= \ + --cvs-exclude --existing --ignore-existing \ + --delete --delete-excluded --delete-after \ + --ignore-errors --max-delete= --partial \ + --force --numeric-ids --timeout= \ + --ignore-times --size-only --modify-window= \ + --temp-dir= --compare-dest= --compress \ + --exclude= --exclude-from= --include= \ + --include-from= --version --daemon --no-detach\ + --address= --config= --port= --blocking-io \ + --no-blocking-io --stats --progress \ + --log-format= --password-file= --bwlimit= \ + --write-batch= --read-batch= --help' -- $cur )) + ;; + *:*) + # find which remote shell is used + shell=ssh + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then + shell=${COMP_WORDS[i+1]} + break + fi + done + if [[ "$shell" == ssh ]]; then + # remove backslash escape from : + cur=${cur/\\:/:} + userhost=${cur%%?(\\):*} + path=${cur#*:} + # unescape spaces + path=${path//\\\\\\\\ / } + if [ -z "$path" ]; then + # default to home dir of specified + # user on remote host + path=$(ssh -o 'Batchmode yes' \ + $userhost pwd 2>/dev/null) + fi + # escape spaces; remove executables, aliases, pipes + # and sockets; add space at end of file names + COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \ + command ls -aF1d "$path*" 2>/dev/null | \ + sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \ + -e 's/[^\/]$/& /g' ) ) + fi + ;; + *) + _known_hosts -c -a + _filedir + ;; + esac + + return 0 +} && +complete -F _rsync $nospace $filenames rsync + +# Linux route(8) completion +# +[ $UNAME = Linux ] && +_route() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ "$prev" = dev ]; then + COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' )) + return 0 + fi + + COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \ + window irtt reject mod dyn reinstate dev \ + default gw' -- $cur ) ) + + COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \ + (while read -d ' ' i; do + [ "$i" == "" ] && continue + # flatten array with spaces on either side, + # otherwise we cannot grep on word + # boundaries of first and last word + COMPREPLY=" ${COMPREPLY[@]} " + # remove word from list of completions + COMPREPLY=( ${COMPREPLY/ $i / } ) + done + echo "${COMPREPLY[@]}") + ) ) + return 0 +} +[ $UNAME = Linux ] && complete -F _route route + +# GNU make(1) completion +# +have make || have gmake || have gnumake || have pmake && +_make() +{ + local file makef makef_dir="." makef_inc cur prev i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case $prev in + -@(f|o|W)) + _filedir + return 0 + ;; + -@(I|C)) + _filedir -d + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --@(file|makefile)) + _filedir + return 0 + ;; + --@(directory|include-dir)) + _filedir -d + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\ + -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \ + --always-make --directory= --debug \ + --environment-overrides --file= --makefile= --help \ + --ignore-errors --include-dir= --jobs --load-average \ + --max-load --keep-going --just-print --dry-run \ + --recon --old-file= --assume-old= --print-data-base \ + --question --no-builtin-rules --no-builtin-variables \ + --silent --quiet --no-keep-goind --stop --touch \ + --version --print-directory --no-print-directory \ + --what-if= --new-file= --assume-new= \ + --warn-undefined-variables' -- $cur ) ) + else + # before we check for makefiles, see if a path was specified + # with -C + for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do + if [[ ${COMP_WORDS[i]} == -C ]]; then + # eval for tilde expansion + eval makef_dir=${COMP_WORDS[i+1]} + break + fi + done + + # before we scan for targets, see if a Makefile name was + # specified with -f + for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do + if [[ ${COMP_WORDS[i]} == -f ]]; then + # eval for tilde expansion + eval makef=${COMP_WORDS[i+1]} + break + fi + done + + [ -n "$makef" ] && makef="-f ${makef}" + [ -n "$makef_dir" ] && makef_dir="-C ${makef_dir}" + + COMPREPLY=( $( make -qp $makef $makef_dir 2>/dev/null | \ + awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \ + {split($1,A,/ /);for(i in A)print A[i]}' | \ + command grep "^$cur" )) + + fi +} && +complete -f -F _make $filenames make gmake gnumake pmake + +# GNU tar(1) completion +# +_tar() +{ + local cur ext regex tar untar + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) ) + return 0 + fi + + case "${COMP_WORDS[1]}" in + ?(-)[cr]*f) + _filedir + return 0 + ;; + +([^IZzJjy])f) + ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))' + regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\)\)\?\|gz\|bz2\?\|lzma\)' + ;; + *[Zz]*f) + ext='t?(ar.)@(gz|Z)' + regex='t\(ar\.\)\?\(gz\|Z\)' + ;; + *[Ijy]*f) + ext='t?(ar.)bz?(2)' + regex='t\(ar\.\)\?bz2\?' + ;; + *[J]*f) + ext='t?(ar.)lz?(ma)' + regex='t\(ar\.\)\?lzma\?' + ;; + *) + _filedir + return 0 + ;; + + esac + + if [[ "$COMP_LINE" == *$ext' ' ]]; then + # complete on files in tar file + # + # get name of tar file from command line + tar=$( echo "$COMP_LINE" | \ + sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' ) + # devise how to untar and list it + untar=t${COMP_WORDS[1]//[^Izjyf]/} + + COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \ + 2>/dev/null ) )" -- "$cur" ) ) + return 0 + fi + + # file completion on relevant files + _filedir "$ext" + + return 0 +} +[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar || + complete -F _tar $filenames tar + +# jar(1) completion +# +have jar && +_jar() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD = 1 ]; then + COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) ) + return 0 + fi + + case "${COMP_WORDS[1]}" in + *c*f) + _filedir + ;; + *f) + _filedir '?([ejw]ar|zip|[EJW]AR|ZIP)' + ;; + *) + _filedir + ;; + esac +} && +complete -F _jar $filenames jar + +# Linux iptables(8) completion +# +have iptables && +_iptables() +{ + local cur prev table chain + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + chain='s/^Chain \([^ ]\+\).*$/\1/p' + + if [[ $COMP_LINE == *-t\ *filter* ]]; then + table="-t filter" + elif [[ $COMP_LINE == *-t\ *nat* ]]; then + table="-t nat" + elif [[ $COMP_LINE == *-t\ *mangle* ]]; then + table="-t mangle" + fi + + case "$prev" in + -*[AIDRPFXLZ]) + COMPREPLY=( $( compgen -W '`iptables $table -nL | \ + sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) ) + ;; + -*t) + COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) ) + ;; + -j) + if [ "$table" = "-t filter" -o "$table" = "" ]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ + `iptables $table -nL | sed -ne "$chain" \ + -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ + $cur ) ) + elif [ "$table" = "-t nat" ]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ + MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ + sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ + -- $cur ) ) + elif [ "$table" = "-t mangle" ]; then + COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ + MARK TOS `iptables $table -nL | sed -ne "$chain" \ + -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ + $cur ) ) + fi + ;; + *) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \ + --delete --insert --replace --list --flush --zero --new \ + --delete-chain --policy --rename-chain --proto --source \ + --destination --in-interface --jump --match --numeric \ + --out-interface --table --verbose --line-numbers --exact \ + --fragment --modprobe= --set-counters --version' -- "$cur") ) + fi + ;; + esac + +} && +complete -F _iptables iptables + +# tcpdump(8) completion +# +have tcpdump && +_tcpdump() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(r|w|F)) + _filedir + return 0 + ;; + -i) + _available_interfaces -a + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \ + -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \ + -E' -- $cur ) ) + fi + +} && +complete -F _tcpdump tcpdump + +# autorpm(8) completion +# +have autorpm && +_autorpm() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( compgen -W '--notty --debug --help --version \ + auto add fullinfo info help install list \ + remove set' -- $cur ) ) + +} && +complete -F _autorpm autorpm + +# This meta-cd function observes the CDPATH variable, so that cd additionally +# completes on directories under those specified in CDPATH. +# +_cd() +{ + local IFS=$'\t\n' cur=`_get_cword` i j k + + # try to allow variable completion + if [[ "$cur" == ?(\\)\$* ]]; then + COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) ) + return 0 + fi + + # Enable -o filenames option, see Debian bug #272660 + compgen -f /non-existing-dir/ >/dev/null + + # Use standard dir completion if no CDPATH or parameter starts with /, + # ./ or ../ + if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then + _filedir -d + return 0 + fi + + local -r mark_dirs=$(_rl_enabled mark-directories && echo y) + local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y) + + # we have a CDPATH, so loop on its contents + for i in ${CDPATH//:/$'\t'}; do + # create an array of matched subdirs + k="${#COMPREPLY[@]}" + for j in $( compgen -d $i/$cur ); do + if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then + j="${j}/" + fi + COMPREPLY[k++]=${j#$i/} + done + done + + _filedir -d + + if [[ ${#COMPREPLY[@]} -eq 1 ]]; then + i=${COMPREPLY[0]} + if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then + COMPREPLY[0]="${i}/" + fi + fi + + return 0 +} +if shopt -q cdable_vars; then + complete -v -F _cd $nospace cd +else + complete -F _cd $nospace cd +fi + +# a wrapper method for the next one, when the offset is unknown +_command() +{ + local offset i + + # find actual offset, as position of the first non-option + offset=1 + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" != -* ]]; then + offset=$i + break + fi + done + _command_offset $offset +} + +# A meta-command completion function for commands like sudo(8), which need to +# first complete on a command, then complete according to that command's own +# completion definition - currently not quite foolproof (e.g. mount and umount +# don't work properly), but still quite useful. +# +_command_offset() +{ + local cur func cline cspec noglob cmd i char_offset word_offset \ + _COMMAND_FUNC _COMMAND_FUNC_ARGS + + word_offset=$1 + + # rewrite current completion context before invoking + # actual command completion + + # find new first word position, then + # rewrite COMP_LINE and adjust COMP_POINT + local first_word=${COMP_WORDS[$word_offset]} + for (( i=0; i <= ${#COMP_LINE}; i++ )); do + if [[ "${COMP_LINE:$i:${#first_word}}" == "$first_word" ]]; then + char_offset=$i + break + fi + done + COMP_LINE=${COMP_LINE:$char_offset} + COMP_POINT=$(( COMP_POINT - $char_offset )) + + # shift COMP_WORDS elements and adjust COMP_CWORD + for (( i=0; i <= COMP_CWORD - $word_offset; i++ )); do + COMP_WORDS[i]=${COMP_WORDS[i+$word_offset]} + done + for (( i; i <= COMP_CWORD; i++ )); do + unset COMP_WORDS[i]; + done + COMP_CWORD=$(( $COMP_CWORD - $word_offset )) + + COMPREPLY=() + cur=`_get_cword` + + if [[ $COMP_CWORD -eq 0 ]]; then + COMPREPLY=( $( compgen -c -- $cur ) ) + else + cmd=${COMP_WORDS[0]} + if complete -p $cmd &>/dev/null; then + cspec=$( complete -p $cmd ) + if [ "${cspec#* -F }" != "$cspec" ]; then + # complete -F <function> + + # get function name + func=${cspec#*-F } + func=${func%% *} + + if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then + $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}" + else + $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" + fi + + # remove any \: generated by a command that doesn't + # default to filenames or dirnames (e.g. sudo chown) + # FIXME: I'm pretty sure this does not work! + if [ "${cspec#*-o }" != "$cspec" ]; then + cspec=${cspec#*-o } + cspec=${cspec%% *} + if [[ "$cspec" != @(dir|file)names ]]; then + COMPREPLY=("${COMPREPLY[@]//\\\\:/:}") + fi + fi + elif [ -n "$cspec" ]; then + cspec=${cspec#complete}; + cspec=${cspec%%$cmd}; + COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) ); + fi + fi + fi + + [ ${#COMPREPLY[@]} -eq 0 ] && _filedir +} +complete -F _command $filenames nohup exec nice eval time ltrace then \ + else do vsound command xargs tsocks + +_root_command() +{ + PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin _command $1 $2 $3 +} +complete -F _root_command $filenames sudo fakeroot really gksudo gksu kdesudo + +# ant(1) completion +# +have ant && { +_ant() +{ + local cur prev buildfile i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -buildfile|-f) + _filedir 'xml' + return 0 + ;; + -logfile) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \ + -verbose -debug -emacs -logfile -logger \ + -listener -buildfile -f -D -find' -- $cur ) ) + else + # available targets completion + # find which buildfile to use + buildfile=build.xml + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then + buildfile=${COMP_WORDS[i+1]} + break + fi + done + [ ! -f $buildfile ] && return 0 + + # parse buildfile for targets + COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \ + $buildfile | grep "^$cur" ) + $( awk -F"'" "/<target name='/ "'{print $2}' \ + $buildfile | grep "^$cur" ) + $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \ + $buildfile | grep "^$cur" ) ) + fi +} +have complete-ant-cmd.pl && \ + complete -C complete-ant-cmd.pl -F _ant $filenames ant || \ + complete -F _ant $filenames ant +} + +have nslookup && +_nslookup() +{ + local cur + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]#-} + + COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \ + srchlist= defname search port= querytype= \ + type= recurse retry root timeout vc \ + ignoretc' -- $cur ) ) +} && +complete -F _nslookup nslookup + +# mysqladmin(1) completion +# +have mysqladmin && +_mysqladmin() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -u) + COMPREPLY=( $( compgen -u -- $cur ) ) + return 0 + ;; + *) + ;; + esac + + COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \ + -v -V -w' -- $cur ) ) + + COMPREPLY=( "${COMPREPLY[@]}" \ + $( compgen -W 'create drop extended-status flush-hosts \ + flush-logs flush-status flush-tables \ + flush-threads flush-privileges kill \ + password ping processlist reload refresh \ + shutdown status variables version' \ + -- $cur ) ) +} && +complete -F _mysqladmin mysqladmin + +# gzip(1) completion +# +have gzip && +_gzip() +{ + local cur prev xspec helpopts + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + helpopts=`_parse_help gzip` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$helpopts -2 -3 -4 -5 -6 -7 -8" \ + -- "$cur" ) ) + return 0 + fi + + local IFS=$'\t\n' + + xspec="*.?(t)gz" + if [[ "$prev" == --* ]]; then + [[ "$prev" == --decompress || \ + "$prev" == --list || \ + "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --force ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec + [[ "$prev" == -*f* ]] && xspec= + elif [ "$prev" = '>' ]; then + xspec= + elif [ "$prev" = '<' ]; then + xspec= + fi + + _expand || return 0 + + COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \ + $( compgen -d -- $cur ) ) +} && +complete -F _gzip $filenames gzip + +# bzip2(1) completion +# +have bzip2 && +_bzip2() +{ + local cur prev xspec + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \ + -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \ + --help --decompress --compress --keep --force \ + --test --stdout --quiet --verbose --license \ + --version --small --fast --best' -- $cur ) ) + return 0 + fi + + local IFS=$'\t\n' + + xspec="*.bz2" + if [[ "$prev" == --* ]]; then + [[ "$prev" == --decompress || \ + "$prev" == --list || \ + "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --compress ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec + [[ "$prev" == -*z* ]] && xspec= + fi + + _expand || return 0 + + COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \ + $( compgen -d -- $cur ) ) +} && +complete -F _bzip2 $filenames bzip2 + +# openssl(1) completion +# +have openssl && { +_openssl_sections() +{ + local config + + config=/etc/ssl/openssl.cnf + [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf + for (( i=2; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -config ]]; then + config=${COMP_WORDS[i+1]} + break + fi + done + [ ! -f $config ] && return 0 + + COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) ) +} + +_openssl() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \ + dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \ + genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \ + rsautl s_client s_server s_time sess_id smime speed \ + spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \ + sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \ + cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \ + des-cbc des-cfb des-ecb des-ede des-ede-cbc \ + des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \ + des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \ + rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \ + rc4 rc4-40' -- $cur ) ) + else + prev=${COMP_WORDS[COMP_CWORD-1]} + case ${COMP_WORDS[1]} in + asn1parse) + case $prev in + -inform) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out|oid)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -in -out -noout -offset \ + -length -i -oid -strparse' -- $cur ) ) + fi + ;; + ca) + case $prev in + -@(config|revoke|cert|in|out|spkac|ss_cert)) + _filedir + return 0 + ;; + -outdir) + _filedir -d + return 0 + ;; + -@(name|crlexts|extensions)) + _openssl_sections + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-verbose -config -name \ + -gencrl -revoke -crldays -crlhours -crlexts \ + -startdate -enddate -days -md -policy -keyfile \ + -key -passin -cert -in -out -notext -outdir \ + -infiles -spkac -ss_cert -preserveDN -batch \ + -msie_hack -extensions' -- $cur ) ) + fi + ;; + ciphers) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ) ) + fi + ;; + crl) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out|CAfile)) + _filedir + return 0 + ;; + -CAPath) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -text -in -out -noout \ + -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ) ) + fi + ;; + crl2pkcs7) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs' -- $cur ) ) + fi + ;; + dgst) + case $prev in + -@(out|sign|verify|prvrify|signature)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \ + -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ) ) + else + _filedir + fi + ;; + dsa) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \ + -modulus -pubin -pubout' -- $cur ) ) + fi + ;; + dsaparam) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -out -noout \ + -text -C -rand -genkey' -- $cur ) ) + fi + ;; + enc) + case $prev in + -@(in|out|kfile)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-ciphername -in -out -pass \ + -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ) ) + fi + ;; + dhparam) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -out -dsaparam -noout \ + -text -C -2 -5 -rand' -- $cur ) ) + fi + ;; + gendsa) + case $prev in + -@(out|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-out -des -des3 -idea -rand' -- $cur ) ) + else + _filedir + fi + ;; + genrsa) + case $prev in + -@(out|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ) ) + fi + ;; + pkcs7) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ) ) + fi + ;; + rand) + case $prev in + -@(out|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-out -rand -base64' -- $cur ) ) + fi + ;; + req) + case "$prev" in + -@(in|out|key)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + + -@(in|out|rand|key|keyout|config)) + _filedir + return 0 + ;; + -extensions) + _openssl_sections + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in \ + -passin -out -passout -text -noout -verify \ + -modulus -new -rand -newkey -newkey -nodes \ + -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \ + -config -x509 -days -asn1-kludge -newhdr \ + -extensions -reqexts section' -- $cur ) ) + fi + ;; + rsa) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER NET PEM' -- $cur ) ) + return 0 + ;; + -@(in|out)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout \ + -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \ + -pubout -engine' -- $cur ) ) + fi + ;; + rsautl) + case $prev in + -@(in|out|inkey)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-in -out -inkey -pubin -certin -sign -verify \ + -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ) ) + fi + ;; + s_client) + case $prev in + -connect) + _known_hosts + return 0 + ;; + -@(cert|key|CAfile|rand)) + _filedir + return 0 + ;; + -CApath) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-connect -verify -cert -key -CApath -CAfile \ + -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \ + -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \ + -bugs -cipher -starttls -engine -rand' -- $cur ) ) + fi + ;; + s_server) + case $prev in + -@(cert|key|dcert|dkey|dhparam|CAfile|rand)) + _filedir + return 0 + ;; + -CApath) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-accept -context -verify -Verify -cert -key \ + -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \ + -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \ + -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \ + -rand' -- $cur ) ) + fi + ;; + s_time) + case $prev in + -connect) + _known_hosts + return 0 + ;; + -@(cert|key|CAfile)) + _filedir + return 0 + ;; + -CApath) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \ + -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ) ) + fi + ;; + + sess_id) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out)) + _filedir + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform -in -out -text -noout \ + -context ID' -- $cur ) ) + fi + ;; + smime) + case $prev in + -@(in|out)form) + COMPREPLY=( $( compgen -W 'SMIME DER PEM' -- $cur ) ) + return 0 + ;; + -@(in|out|certfile|signer|recip|inkey|content|rand)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \ + -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \ + -recip -inform -passin -inkey -out -outform -content -to -from -subject \ + -text -rand' -- $cur ) ) + else + _filedir + fi + ;; + speed) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-engine' -- $cur ) ) + else + COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \ + rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \ + rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ) ) + fi + ;; + verify) + case $prev in + -@(CAfile|untrusted)) + _filedir + return 0 + ;; + -CApath) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \ + -verbose -certificates' -- $cur ) ) + else + _filedir + fi + ;; + x509) + case "$prev" in + -@(in|out|CA|CAkey|CAserial|extfile)) + _filedir + return 0 + ;; + -@(in|out)form) + COMPREPLY=( $( compgen -W 'DER PEM NET' -- $cur ) ) + return 0 + ;; + -@(key|CA|CAkey)form) + COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) ) + return 0 + ;; + -extensions) + _openssl_sections + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-inform -outform \ + -keyform -CAform -CAkeyform -in -out \ + -serial -hash -subject -issuer -nameopt \ + -email -startdate -enddate -purpose \ + -dates -modulus -fingerprint -alias \ + -noout -trustout -clrtrust -clrreject \ + -addtrust -addreject -setalias -days \ + -set_serial -signkey -x509toreq -req \ + -CA -CAkey -CAcreateserial -CAserial \ + -text -C -md2 -md5 -sha1 -mdc2 -clrext \ + -extfile -extensions -engine' -- $cur ) ) + fi + ;; + @(md5|md4|md2|sha1|sha|mdc2|ripemd160)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -d' -- $cur ) ) + else + _filedir + fi + ;; + esac + fi + + return 0 +} +complete -F _openssl $default openssl +} + +# screen(1) completion +# +have screen && +_screen() +{ + local cur prev preprev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]} + + if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \ + "$prev" = "-R" ]; then + # list all + COMPREPLY=( $( command screen -ls | \ + sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) ) + else + case "$prev" in + -[rR]) + # list detached + COMPREPLY=( $( command screen -ls | \ + sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) ) + ;; + -[dDx]) + # list attached + COMPREPLY=( $( command screen -ls | \ + sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) ) + ;; + -s) + # shells + COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) ) + ;; + *) + ;; + esac + fi + + return 0 +} && +complete -F _screen $default screen + +# lftp(1) bookmark completion +# +have lftp && +_lftp() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then + COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \ + ~/.lftp/bookmarks )' -- $cur ) ) + fi + + return 0 +} && +complete -F _lftp $default lftp + +# ncftp(1) bookmark completion +# +have ncftp && +_ncftp() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then + COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \ + ~/.ncftp/bookmarks )' -- $cur ) ) + fi + + return 0 +} && +complete -F _ncftp $default ncftp + +# gdb(1) completion +# +have gdb && +_gdb() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ $COMP_CWORD -eq 1 ]; then + local IFS + if [[ "$cur" == */* ]]; then + # compgen -c works as expected if $cur contains any slashes. + IFS=$'\n' + COMPREPLY=( $( PATH="$PATH:." compgen -d -c -- "$cur" ) ) + else + # otherwise compgen -c contains Bash's built-in commands, + # functions and aliases. Thus we need to retrieve the program + # names manually. + IFS=":" + local path_array=( $(echo "$PATH" | sed 's/::\+/:/g;s/^:\|:$//g') ) + IFS=$'\n' + COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ + -mindepth 1 -maxdepth 1 -not -type d -executable -printf "%f\\n" 2>/dev/null)' \ + -- "$cur" ) ) + fi + elif [ $COMP_CWORD -eq 2 ]; then + prev=${prev##*/} + COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \ + awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \ + -- "$cur" ) ) + fi +} && +complete -F _gdb $default gdb + +# Postgresql completion +# +have psql && { +_pg_databases() +{ + return + COMPREPLY=( $( psql -l 2>/dev/null | \ + sed -e '1,/^-/d' -e '/^(/,$d' | \ + awk '{print $1}' | grep "^$cur" ) ) +} + +_pg_users() +{ + #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \ + # grep "^ $cur" ) ) + #[ ${#COMPREPLY[@]} -eq 0 ] && COMPREPLY=( $( compgen -u -- $cur ) ) + COMPREPLY=( $( compgen -u -- $cur ) ) +} + +# createdb(1) completion +# +_createdb() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(h|-host=)) + _known_hosts + return 0 + ;; + -@(U|-username=)) + _pg_users + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \ + --location= --template= --encoding= --host= --port= \ + --username= --password --echo --quiet --help' -- $cur )) + else + _pg_databases + fi +} +complete -F _createdb $default createdb + +# dropdb(1) completion +# +_dropdb() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(h|-host=)) + _known_hosts + return 0 + ;; + -@(U|-username=)) + _pg_users + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \ + --host= --port= --username= --password \ + --interactive --echo --quiet --help' -- $cur ) ) + else + _pg_databases + fi +} +complete -F _dropdb $default dropdb + +# psql(1) completion +# +_psql() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -h|--host) + _known_hosts + return 0 + ;; + -U|--username) + _pg_users + return 0 + ;; + -d|--dbname) + _pg_databases + return 0 + ;; + -@(o|f)|--output|--file) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # return list of available options + COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \ + -c --command -d --dbname -e --echo-queries \ + -E --echo-hidden -f --file -F --filed-separator \ + -h --host -H --html -l --list -n -o --output \ + -p --port -P --pset -q -R --record-separator \ + -s --single-step -S --single-line -t --tuples-only \ + -T --table-attr -U --username -v --variable \ + -V --version -W --password -x --expanded -X --nopsqlrc \ + -? --help ' -- $cur ) ) + else + # return list of available databases + _pg_databases + fi +} +complete -F _psql $default psql +} + +_longopt() +{ + local cur opt + + cur=`_get_cword` + + if [[ "$cur" == --*=* ]]; then + opt=${cur%%=*} + # cut backslash that gets inserted before '=' sign + opt=${opt%\\*} + cur=${cur#*=} + _filedir + # FIXME: see #297065... adding "-o nospace" (or $nospace), + # should do the trick, but seems not working... ideas? + COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur)) + return 0 + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \ + -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \ + command grep "^$cur" | sort -u ) ) + elif [[ "$1" == rmdir ]]; then + _filedir -d + else + _filedir + fi +} +# makeinfo and texi2dvi are defined elsewhere. +for i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \ + bison diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \ + touch vdir awk gperf grep grub indent less m4 sed shar date \ + tee who texindex cat csplit cut expand fmt fold head \ + md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \ + uniq wc ldd bash id irb mkdir rmdir; do + have $i && complete -F _longopt $filenames $i +done + +# These commands use filenames, so '-o filenames' is not needed. +for i in env netstat seq uname units wget; do + have $i && complete -F _longopt $default $i +done +unset i + +# gcc(1) completion +# +# The only unusual feature is that we don't parse "gcc --help -v" output +# directly, because that would include the options of all the other backend +# tools (linker, assembler, preprocessor, etc) without any indication that +# you cannot feed such options to the gcc driver directly. (For example, the +# linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we +# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the +# --help output of the compiler. +# +have gcc && +_gcc() +{ + local cur cc backend + + COMPREPLY=() + cur=`_get_cword` + + _expand || return 0 + + case "$1" in + gcj) + backend=jc1 + ;; + gpc) + backend=gpc1 + ;; + *77) + backend=f771 + ;; + *) + backend=cc1 # (near-)universal backend + ;; + esac + + if [[ "$cur" == -* ]]; then + cc=$( $1 -print-prog-name=$backend ) + # sink stderr: + # for C/C++/ObjectiveC it's useless + # for FORTRAN/Java it's an error + COMPREPLY=( $( $cc --help 2>/dev/null | tr '\t' ' ' | \ + sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \ + command grep "^$cur" | sort -u ) ) + else + _filedir + fi +} && +complete $filenames -F _gcc gcc g++ c++ g77 gcj gpc +[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \ +[ -n "${have:-}" ] && complete $filenames -F _gcc cc + +# Linux cardctl(8) completion +# +have cardctl && +_cardctl() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'status config ident suspend \ + resume reset eject insert scheme' \ + -- $cur ) ) + fi +} && +complete -F _cardctl cardctl + +# This function is required by _dpkg() and _dpkg-reconfigure() +# +# TODO: Ubuntu (and Debian) folks removed the "have grep-status" part. In my Debian I got it, +# and I believe it's ok if we leave it like it is now. Was that removed because +# of Ubuntu's (and Debian's? :() inner weirdness? :) -- David (hanska-guest) +have dpkg && { +#have grep-status && { +#_comp_dpkg_installed_packages() +#{ +# grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package +#} +#} || { +_comp_dpkg_installed_packages() +{ + grep -A 1 "Package: $1" /var/lib/dpkg/status | \ + grep -B 1 -Ee "ok installed|half-installed|unpacked| \ + half-configured|config-files" \ + -Ee "^Essential: yes" | \ + grep "Package: $1" | cut -d\ -f2 +} +#} + +# Debian dpkg(8) completion +# +_dpkg() +{ + local cur prev i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + i=$COMP_CWORD + + _expand || return 0 + + # find the last option flag + if [[ $cur != -* ]]; then + while [[ $prev != -* && $i != 1 ]]; do + i=$((i-1)) + prev=${COMP_WORDS[i-1]} + done + fi + + case "$prev" in + -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract))) + _filedir '?(u)deb' + return 0 + ;; + -@(b|-build)) + _filedir -d + return 0 + ;; + -@(s|p|l|-@(status|print-avail|list))) + COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) ) + return 0 + ;; + -@(S|-search)) + _filedir + return 0 + ;; + -@(r|L|P|-@(remove|purge|listfiles))) + COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) + return 0 + ;; + *) + + COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \ + --configure -r --remove -P --purge --get-selections \ + --set-selections --update-avail --merge-avail \ + --clear-avail --command-fd --forget-old-unavail -s \ + --status -p --print-avail -L --listfiles -l --list \ + -S --search -C --audit --print-architecture \ + --print-gnu-build-architecture \ + --print-installation-architecture \ + --compare-versions --help --version --force-help \ + --force-all --force-auto-select --force-downgrade \ + --force-configure-any --force-hold --force-bad-path \ + --force-not-root --force-overwrite \ + --force-overwrite-diverted --force-bad-verify \ + --force-depends-version --force-depends \ + --force-confnew --force-confold --force-confdef \ + --force-confmiss --force-conflicts --force-architecture\ + --force-overwrite-dir --force-remove-reinstreq \ + --force-remove-essential -Dh \ + --debug=help --licence --admindir= --root= --instdir= \ + -O --selected-only -E --skip-same-version \ + -G --refuse-downgrade -B --auto-deconfigure \ + --no-debsig --no-act -D --debug= --status-fd \ + -b --build -I --info -f --field -c --contents \ + -x --extract -X --vextract --fsys-tarfile -e --control \ + --ignore-depends= --abort-after' -- $cur ) ) + ;; + esac + + +} +complete -F _dpkg $filenames dpkg dpkg-deb +} + +# Debian GNU dpkg-reconfigure(8) completion +# +have dpkg-reconfigure && +_dpkg_reconfigure() +{ + local cur prev opt + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + + case "$prev" in + -@(f|-frontend)) + opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) ) + opt=( ${opt[@]##*/} ) + opt=( ${opt[@]%.pm} ) + COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) ) + return 0 + ;; + -@(p|-priority)) + COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \ + -u --unseen-only -h --help -s --showold \ + --force --terse' -- $cur ) ) + else + COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) + fi +} && +complete -F _dpkg_reconfigure $default dpkg-reconfigure + +# Debian dpkg-source completion +# +have dpkg-source && +_dpkg_source() +{ + local cur prev options work i action packopts unpackopts + + packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR" + unpackopts="-sp -sn -su" + options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo` + + COMPREPLY=() + if [ "$1" != "dpkg-source" ]; then + return 1 + fi + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + action="options" + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[$i]} == "-x" ]]; then + action=unpack + elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then + action=pack + elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then + action=help + fi + done + # if currently seeing a complete option, return just itself. + for i in $options; do + if [ "$cur" = "$i" ]; then + COMPREPLY=( "$cur" ) + return 0 + fi + done + case "$action" in + "unpack") + if [ "$cur" = "-" -o "$cur" = "-s" ]; then + COMPREPLY=( $unpackopts ) + return 0 + fi + case "$prev" in + "-x") + COMPREPLY=( $( compgen -d -- "$cur" ) \ + $( compgen -f -X '!*.dsc' -- "$cur" ) ) + return 0 + ;; + *) + COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) ) + return 0 + ;; + esac + return 0 + ;; + "pack") + if [ "$cur" = "-" ]; then + COMPREPLY=( $packopts ) + return 0 + fi + if [ "$cur" = "-s" ]; then + COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ + "-sA" "-sK" "-sP" "-sU" "-sR" ) + return 0 + fi + case "$prev" in + "-b") + COMPREPLY=( $( compgen -d -- "$cur" ) ) + return 0 + ;; + "-c"|"-l"|"-T"|"-i"|"-I") + # -c: get controlfile + # -l: get per-version info from this file + # -T: read variables here, not debian/substvars + # -i: <regexp> filter out files to ignore diffs of. + # -I: filter out files when building tarballs. + # return directory names and file names + COMPREPLY=( $( compgen -d -f ) ) + return 0 + ;; + "-F") + # -F: force change log format + COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) ) + return 0 + ;; + "-V"|"-D") + # -V: set a substitution variable + # we don't know anything about possible variables or values + # so we don't try to suggest any completion. + COMPREPLY=() + return 0 + ;; + "-D") + # -D: override or add a .dsc field and value + # if $cur doesn't contain a = yet, suggest variable names + if echo -- "$cur" | grep -q "="; then + # $cur contains a "=" + COMPREPLY=() + return 0 + else + COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) + return 0 + fi + ;; + "-U") + # -U: remove a field + # Suggest possible fieldnames + COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) + return 0 + ;; + *) + COMPREPLY=( $packopts ) + return 0 + ;; + esac + return 0 + ;; + *) + # if seeing a partial option, return possible completions. + if [ "$cur" = "-s" ]; then + COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ + "-sA" "-sK" "-sP" "-sU" "-sR" ) + return 0 + fi + # else return all possible options. + COMPREPLY=( $options ) + return 0 + ;; + esac +} && +complete -F _dpkg_source dpkg-source + +# Debian Linux dselect(8) completion. +# +have dselect && +_dselect() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --admindir) + _filedir -d + return 0 + ;; + + -@(D|debug)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--admindir --help --version --licence \ + --license --expert --debug' -- $cur ) ) + else + COMPREPLY=( $( compgen -W 'access update select install config \ + remove quit' -- $cur ) ) + fi + + + return 0 +} && +complete -F _dselect $filenames dselect + +# Java completion +# + +# available path elements completion +have java && { +_java_path() +{ + cur=${cur##*:} + _filedir '@(jar|zip)' +} + +# exact classpath determination +_java_find_classpath() +{ + local i + + # search first in current options + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then + classpath=${COMP_WORDS[i+1]} + break + fi + done + + # default to environment + [ -z "$classpath" ] && classpath=$CLASSPATH + + # default to current directory + [ -z "$classpath" ] && classpath=. +} + +# exact sourcepath determination +_java_find_sourcepath() +{ + local i + + # search first in current options + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then + sourcepath=${COMP_WORDS[i+1]} + break + fi + done + + # default to classpath + if [ -z "$sourcepath" ]; then + _java_find_classpath + sourcepath=$classpath + fi +} + +# available classes completion +_java_classes() +{ + local classpath i + + # find which classpath to use + _java_find_classpath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each classpath element for classes + for i in ${classpath//:/ }; do + if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then + if type zipinfo &> /dev/null; then + COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \ + "$i" | grep "^$cur" | grep '\.class$' | \ + grep -v "\\$" ) ) + else + COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \ + "$cur" | grep "\.class$" | grep -v "\\$" ) ) + fi + + elif [ -d $i ]; then + i=${i%/} + + # See bug #496828 + COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \ + -maxdepth 1 -path "$i/$cur*.class" 2>/dev/null | \ + grep -v "\\$" | sed -e "s|^$i/||" ) ) + + # FIXME: if we have foo.class and foo/, the completion + # returns "foo/"... how to give precedence to files + # over directories? + fi + done + + # remove class extension + COMPREPLY=( ${COMPREPLY[@]%.class} ) + # convert path syntax to package syntax + COMPREPLY=( ${COMPREPLY[@]//\//.} ) +} + +# available packages completion +_java_packages() +{ + local sourcepath i + + # find which sourcepath to use + _java_find_sourcepath + + # convert package syntax to path syntax + cur=${cur//.//} + # parse each sourcepath element for packages + for i in ${sourcepath//:/ }; do + if [ -d $i ]; then + COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \ + $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) ) + fi + done + # keep only packages + COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) ) + # remove packages extension + COMPREPLY=( ${COMPREPLY[@]%/} ) + # convert path syntax to package syntax + cur=${COMPREPLY[@]//\//.} +} + +# java completion +# +_java() +{ + local cur prev i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + for ((i=1; i < $COMP_CWORD; i++)); do + case ${COMP_WORDS[$i]} in + -cp|-classpath) + ((i++)) # skip the classpath string. + ;; + -*) + # this is an option, not a class/jarfile name. + ;; + *) + # once we've seen a class, just do filename completion + _filedir + return 0 + ;; + esac + done + + case $prev in + -@(cp|classpath)) + _java_path + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \ + -cp -classpath -D -verbose -verbose:class \ + -verbose:gc -version:jni -version \ + -showversion -? -help -X -jar \ + -ea -enableassertions -da -disableassertions \ + -esa -enablesystemassertions \ + -dsa -disablesystemassertions ' -- $cur ) ) + else + if [[ "$prev" == -jar ]]; then + # jar file completion + _filedir jar + else + # classes completion + _java_classes + fi + fi +} +complete -F _java $filenames java +} + +# javadoc completion +# +have javadoc && +_javadoc() +{ + COMPREPLY=() + local cur prev + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(overview|helpfile|stylesheetfile)) + _filedir + return 0 + ;; + -d) + _filedir -d + return 0 + ;; + -@(classpath|bootclasspath|docletpath|sourcepath|extdirs)) + _java_path + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-overview -public -protected \ + -package -private -help -doclet -docletpath \ + -sourcepath -classpath -exclude -subpackages \ + -breakiterator -bootclasspath -source -extdirs \ + -verbose -locale -encoding -J -d -use -version \ + -author -docfilessubdirs -splitindex \ + -windowtitle -doctitle -header -footer -bottom \ + -link -linkoffline -excludedocfilessubdir \ + -group -nocomment -nodeprecated -noqualifier \ + -nosince -nodeprecatedlist -notree -noindex \ + -nohelp -nonavbar -quiet -serialwarn -tag \ + -taglet -tagletpath -charset -helpfile \ + -linksource -stylesheetfile -docencoding' -- \ + $cur ) ) + else + # source files completion + _filedir java + # packages completion + _java_packages + fi +} && +complete -F _javadoc $filenames javadoc + +# javac completion +# +have javac && +_javac() +{ + COMPREPLY=() + local cur prev + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -d) + _filedir -d + return 0 + ;; + -@(classpath|bootclasspath|sourcepath|extdirs)) + _java_path + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\ + -g:source -O -nowarn -verbose -deprecation -classpath\ + -sourcepath -bootclasspath -extdirs -d -encoding -source\ + -target -help' -- $cur ) ) + else + # source files completion + _filedir java + fi +} && +complete -F _javac $filenames javac + +# PINE address-book completion +# +have pine && +_pineaddr() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \ + -- $cur ) ) +} && +complete -F _pineaddr $default pine + +# mutt completion +# +# Mutt doesn't have an "addressbook" like Pine, but it has aliases and +# a "query" function to retrieve addresses, so that's what we use here. +have mutt || have muttng && { +_muttaddr() +{ + _muttaliases + _muttquery + + cur=`_get_cword` + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -u -- $cur ) ) + + return 0 +} + +_muttconffiles() +{ + local file sofar + local -a newconffiles + + sofar=" $1 " + shift + while [[ "$1" ]]; do + newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) ) + for file in "${newconffiles[@]}"; do + [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] && + continue + sofar="$sofar $file" + sofar=" $(eval _muttconffiles \"$sofar\" $file) " + done + shift + done + echo $sofar +} + +_muttaliases() +{ + local cur muttrc + local -a conffiles aliases + cur=`_get_cword =` + + [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc" + [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc" + [ -z "$muttrc" ] && return 0 + + conffiles=( $(eval _muttconffiles $muttrc $muttrc) ) + aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \ + $(eval echo "${conffiles[@]}") ) ) + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) ) + + return 0 +} + +_muttquery() +{ + local cur querycmd + local -a queryresults + cur=`_get_cword` + + querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )" + if [ -z "$cur" -o -z "$querycmd" ]; then + queryresults=() + else + queryresults=( $( $querycmd | \ + sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) ) + fi + + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \ + -- $cur ) ) + + return 0 +} + +_muttfiledir() +{ + local cur folder spoolfile + cur=`_get_cword` + + # This is currently not working so well. Perhaps this function should + # just call _filedir() for the moment. + if [[ $cur == [=+]* ]]; then + folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )" + : folder:=~/Mail + + # Match any file in $folder beginning with $cur + # (minus the leading '=' sign). + COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) ) + COMPREPLY=( ${COMPREPLY[@]#$folder/} ) + return 0 + elif [ "$cur" == !* ]; then + spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )" + [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}"; + fi + _filedir + + return 0 +} + +_mutt() +{ + local cur prev + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + COMPREPLY=() + + [ ${COMP_WORDS[0]} == muttng ] && muttcmd="muttng" || muttcmd="mutt" + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \ + -p -Q -R -s -v -x -y -z -Z -h' \ + -- $cur ) ) + return 0 + ;; + *) + case "$prev" in + -@(a|f|F|H|i)) + _muttfiledir + return 0 + ;; + -A) + _muttaliases + return 0 + ;; + -@(e|m|Q|s|h|p|R|v|y|z|Z)) + return 0 + ;; + *) + _muttaddr + return 0 + ;; + esac + ;; + esac + +} +complete -F _mutt $default $filenames mutt muttng +} + +_configure_func() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + # if $COMP_CONFIGURE_HINTS is not null, then completions of the form + # --option=SETTING will include 'SETTING' as a contextual hint + [[ "$cur" != -* ]] && return 0 + + if [ -n "$COMP_CONFIGURE_HINTS" ]; then + COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) ) + else + COMPREPLY=( $( $1 --help 2>&1 | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) ) + fi +} +complete -F _configure_func $default configure + +# Debian reportbug(1) completion +# +have reportbug && +_reportbug() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -f|--filename|-i|--include|--mta|-o|--output) + _filedir + return 0 + ;; + -B|--bts) + COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ + $cur )) + return 0 + ;; + -e|--editor|--mua) + COMP_WORDS=(COMP_WORDS[0] $cur) + COMP_CWORD=1 + _command + return 0 + ;; + --mode) + COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) ) + return 0 + ;; + -S|--severity) + COMPREPLY=( $( compgen -W "grave serious important normal \ + minor wishlist" -- $cur ) ) + return 0 + ;; + -u|--ui|--interface) + COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) ) + return 0 + ;; + -t|--type) + COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) ) + return 0 + ;; + -T|--tags) + COMPREPLY=( $( compgen -W "none \ + woody potato sarge sarge-ignore etch etch-ignore \ + lenny lenny-ignore sid experimental confirmed \ + d-i fixed fixed-in-experimental fixed-upstream \ + help l10n moreinfo patch pending security \ + unreproducible upstream wontfix ipv6 lfs" -- $cur )) + return 0 + ;; + *) + ;; + esac + + COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \ + --no-query-bts --query-bts -B --bts -c --configure \ + --no-config-files --check-available -d --debug \ + --no-check-available -e --editor --email -f \ + --filename -g --gnupg -H --header -i --include -j \ + --justification -l --ldap --no-ldap -L --list-cc -m \ + --maintonly --mode --mua --mta --mutt -n --mh --nmh \ + -o --output -p --print -P --pgp --proxy --http_proxy\ + -q --quiet -Q --query-only --realname --report-quiet \ + --reply-to --replyto -s --subject -S --severity \ + --smtphost -t --type -T --tags --template -V -x \ + --no-cc --package-version -z --no-compress \ + --ui --interface -u \ + wnpp boot-floppies kernel bugs.debian.org \ + cdimage.debian.org general installation-reports \ + listarchives lists.debian.org mirrors nm.debian.org \ + press project qa.debian.org release-notes \ + security.debian.org tech-ctte upgrade-reports \ + www.debian.org' -- $cur ) \ + $( apt-cache pkgnames -- $cur 2> /dev/null) ) + _filedir + return 0 +} && +complete -F _reportbug $filenames reportbug + +# Debian querybts(1) completion +# +have querybts && +_querybts() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -B|--bts) + COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ + $cur )) + return 0 + ;; + -u|--ui|--interface) + COMPREPLY=($( compgen -W "newt text gnome" -- $cur )) + return 0 + ;; + *) + ;; + esac + + COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \ + -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \ + -s --source -w --web -u --ui --interface \ + wnpp boot-floppies kernel bugs.debian.org \ + cdimage.debian.org general installation-reports \ + listarchives lists.debian.org mirrors nm.debian.org \ + press project qa.debian.org release-notes \ + security.debian.org tech-ctte upgrade-reports \ + www.debian.org' -- $cur ) \ + $( apt-cache pkgnames -- $cur 2> /dev/null) ) +} && +complete -F _querybts $filenames querybts + +# update-alternatives completion +# +have update-alternatives && { +installed_alternatives() +{ + local admindir + # find the admin dir + for i in alternatives dpkg/alternatives rpm/alternatives; do + [ -d /var/lib/$i ] && admindir=/var/lib/$i && break + done + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == --admindir ]]; then + admindir=${COMP_WORDS[i+1]} + break + fi + done + COMPREPLY=( $( command ls $admindir | grep "^$cur" ) ) +} + +_update_alternatives() +{ + local cur prev mode args i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --@(altdir|admindir)) + _filedir -d + return 0 + ;; + --@(help|version)) + return 0 + ;; + esac + + # find which mode to use and how many real args used so far + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then + mode=${COMP_WORDS[i]} + args=$(($COMP_CWORD - i)) + break + fi + done + + case $mode in + --install) + case $args in + 1) + _filedir + ;; + 2) + installed_alternatives + ;; + 3) + _filedir + ;; + esac + ;; + --remove) + case $args in + 1) + installed_alternatives + ;; + 2) + _filedir + ;; + esac + ;; + --auto) + installed_alternatives + ;; + --remove-all) + installed_alternatives + ;; + --display) + installed_alternatives + ;; + --config) + installed_alternatives + ;; + *) + COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \ + --altdir --admindir' -- $cur ) \ + $( compgen -W '--install --remove --auto --display \ + --config' -- $cur ) ) + esac +} +complete -F _update_alternatives update-alternatives +} + +# Python completion +# +have python && +_python() +{ + local prev cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]##*/} + + case "$prev" in + -Q) + COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) ) + return 0 + ;; + -W) + COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) ) + return 0 + ;; + -c) + _filedir '@(py|pyc|pyo)' + return 0 + ;; + !(python|-?)) + [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir + ;; + esac + + + # if '-c' is already given, complete all kind of files. + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == -c ]]; then + _filedir + fi + done + + + if [[ "$cur" != -* ]]; then + _filedir '@(py|pyc|pyo)' + else + COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \ + -U -v -V -W -x -c" -- $cur ) ) + fi + + + + return 0 +} && +complete -F _python $filenames python + +# Perl completion +# +have perl && +{ +_perlmodules() +{ + COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur ) ) +} + +_perl() +{ + local cur prev prefix temp + local optPrefix optSuffix + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + prefix="" + + # If option not followed by whitespace, reassign prev and cur + if [[ "$cur" == -?* ]]; then + temp=$cur + prev=${temp:0:2} + cur=${temp:2} + optPrefix=-P$prev + optSuffix=-S/ + prefix=$prev + fi + + # only handle module completion for now + case "$prev" in + -I|-x) + local IFS=$'\t\n' + COMPREPLY=( $( compgen -d $optPrefix $optSuffix -- "$cur" ) ) + return 0 + ;; + -m|-M) + _perlmodules + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \ + -D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) ) + else + _filedir + fi +} +complete -F _perl $nospace $filenames perl + +_perldoc() +{ + local cur prev prefix temp + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + prefix="" + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -?* ]]; then + temp=$cur + prev=${temp:0:2} + cur=${temp:2} + prefix=$prev + fi + + # complete builtin perl functions + case $prev in + -f) + COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \ + lcfirst length oct ord pack q qq reverse rindex sprintf \ + substr tr uc ucfirst y m pos quotemeta s split study qr abs \ + atan2 cos exp hex int log oct rand sin sqrt srand pop push \ + shift splice unshift grep join map qw reverse sort unpack \ + delete each exists keys values binmode close closedir \ + dbmclose dbmopen die eof fileno flock format getc print \ + printf read readdir rewinddir seek seekdir select syscall \ + sysread sysseek syswrite tell telldir truncate warn write \ + pack read syscall sysread syswrite unpack vec -X chdir chmod \ + chown chroot fcntl glob ioctl link lstat mkdir open opendir \ + readlink rename rmdir stat symlink umask unlink utime caller \ + continue do dump eval exit goto last next redo return \ + sub wantarray caller import local my our package use defined \ + formline reset scalar undef \ + alarm exec fork getpgrp getppid getpriority kill pipe qx \ + setpgrp setpriority sleep system times wait waitpid \ + import no package require use bless dbmclose dbmopen package \ + ref tie tied untie use accept bind connect getpeername \ + getsockname getsockopt listen recv send setsockopt shutdown \ + socket socketpair msgctl msgget msgrcv msgsnd semctl semget \ + semop shmctl shmget shmread shmwrite endgrent endhostent \ + endnetent endpwent getgrent getgrgid getgrnam getlogin \ + getpwent getpwnam getpwuid setgrent setpwent endprotoent \ + endservent gethostbyaddr gethostbyname gethostent \ + getnetbyaddr getnetbyname getnetent getprotobyname \ + getprotobynumber getprotoent getservbyname getservbyport \ + getservent sethostent setnetent setprotoent setservent \ + gmtime localtime time times' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur )) + else + # return available modules (unless it is clearly a file) + if [[ "$cur" != */* ]]; then + _perlmodules + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) ) + fi + fi +} +complete -F _perldoc $default perldoc +} + +# rcs(1) completion +# +have rcs && +_rcs() +{ + local cur prev file dir i + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + file=${cur##*/} + dir=${cur%/*} + + # deal with relative directory + [ "$file" = "$dir" ] && dir=. + + COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) ) + + for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do + file=${COMPREPLY[$i]##*/} + dir=${COMPREPLY[$i]%RCS/*} + COMPREPLY[$i]=$dir$file + done + + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) ) + + for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do + COMPREPLY[$i]=${COMPREPLY[$i]%,v} + done + + # default to files if nothing returned and we're checking in. + # otherwise, default to directories + [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d +} && +complete -F _rcs $filenames ci co rlog rcs rcsdiff + +# lilo(8) completion +# +have lilo && { +_lilo_labels() +{ + COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \ + /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) ) +} + +_lilo() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(C|i|m|s|S)) + _filedir + return 0 + ;; + -r) + _filedir -d + return 0 + ;; + -@(I|D|R)) + # label completion + _lilo_labels + return 0 + ;; + -@(A|b|M|u|U)) + # device completion + cur=${cur:=/dev/} + _filedir + return 0 + ;; + -T) + # topic completion + COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \ + table= video' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + # relevant options completion + COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \ + -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \ + $cur ) ) + fi +} +complete -F _lilo lilo +} + +# links completion +# +have links && +_links() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + --*) + COMPREPLY=( $( compgen -W '--help' -- $cur ) ) + ;; + -*) + COMPREPLY=( $( compgen -W '-async-dns -max-connections \ + -max-connections-to-host -retries \ + -receive-timeout -unrestartable-receive-timeout\ + -format-cache-size -memory-cache-size \ + -http-proxy -ftp-proxy -download-dir \ + -assume-codepage -anonymous -dump -no-connect \ + -source -version -help' -- $cur ) ) + ;; + *) + if [ -r ~/.links/links.his ]; then + COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \ + -- $cur ) ) + fi + _filedir '@(htm|html)' + return 0 + ;; + esac + + return 0 +} && +complete -F _links $filenames links + +[ $UNAME = FreeBSD ] && { +# FreeBSD package management tool completion +# +_pkg_delete() +{ + local cur pkgdir prev + + pkgdir=${PKG_DBDIR:-/var/db/pkg}/ + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0 + + COMPREPLY=( $( compgen -d $pkgdir$cur ) ) + COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) + + return 0 +} +complete -F _pkg_delete $dirnames pkg_delete pkg_info +have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall + +# FreeBSD kernel module commands +# +_kldload() +{ + local cur moddir + + moddir=/modules/ + [ -d $moddir ] || moddir=/boot/kernel/ + cur=`_get_cword` + + COMPREPLY=( $( compgen -f $moddir$cur ) ) + COMPREPLY=( ${COMPREPLY[@]#$moddir} ) + COMPREPLY=( ${COMPREPLY[@]%.ko} ) + + return 0 +} +complete -F _kldload $filenames kldload + +_kldunload() +{ + local cur + cur=`_get_cword` + COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") ) +} +complete -F _kldunload $filenames kldunload +} + +# FreeBSD portupgrade completion +# +have portupgrade && +_portupgrade() +{ + local cur pkgdir prev + + pkgdir=${PKG_DBDIR:-/var/db/pkg}/ + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 + + COMPREPLY=( $( compgen -d $pkgdir$cur ) ) + COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) + COMPREPLY=( ${COMPREPLY[@]%-*} ) + + return 0 +} && +complete -F _portupgrade $dirnames portupgrade + +# FreeBSD portinstall completion +# +have portinstall && +_portinstall() +{ + local cur portsdir prev indexfile + local -a COMPREPLY2 + + portsdir=${PORTSDIR:-/usr/ports}/ + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + # First try INDEX-5 + indexfile=$portsdir/INDEX-5 + # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x + [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] || + indexfile=$portsdir/INDEX + + [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 + + COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) ) + COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \ + cut -d'|' -f2 ) ) + COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) + COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" ) + + return 0 +} && +complete -F _portinstall $dirnames portinstall + +# Slackware Linux removepkg completion +# +have removepkg && [ -f /etc/slackware-version ] && +_removepkg() +{ + local packages cur + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) ) +} && +complete -F _removepkg $filenames removepkg && + complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg + +# look(1) completion +# +have look && +_look() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD = 1 ]; then + COMPREPLY=( $( compgen -W '$(look $cur 2>/dev/null)' ) ) + fi +} && +complete -F _look $default look + +# ypcat(1) and ypmatch(1) completion +# +have ypmatch && +_ypmatch() +{ + local cur map + + COMPREPLY=() + cur=`_get_cword` + + [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0 + [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0 + + if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \ + [ ${#COMP_WORDS[@]} -eq 3 ]; then + map=${COMP_WORDS[2]} + COMPREPLY=( $( compgen -W '$( ypcat $map | \ + cut -d':' -f 1 )' -- $cur) ) + else + [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0 + COMPREPLY=( $( compgen -W \ + '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur)) + fi + + return 0 +} && +complete -F _ypmatch ypmatch ypcat + +#xrandr(1) completion +# +have xrandr && +_xrandr() +{ + local cur prev output modes + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --output) + local outputs=$(xrandr|grep 'connected'|awk '{print $1}') + COMPREPLY=( $(compgen -W "$outputs" -- $cur)) + return 0 + ;; + --mode) + for(( i = 1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == "--output" ]]; then + output=${COMP_WORDS[i+1]} + break + fi + done + modes=$(xrandr|sed -e "1,/$output/ d" \ + -e "/connected/,$ d"|awk '{print $1}') + COMPREPLY=( $( compgen -W "$modes" -- $cur)) + return 0 + ;; + esac + + case "$cur" in + *) + COMPREPLY=( $(compgen -W '-d -display -help -o \ + --orientation -q --query -s --size\ + -r --rate -v --version -x -y --screen \ + --verbose --dryrun --prop --fb --fbmm --dpi \ + --output --auto --mode --preferred --pos \ + --reflect --rotate --left-of --right-of \ + --above --below --same-as --set --off --crtc \ + --newmode --rmmode --addmode --delmode' -- $cur)) + return 0 + ;; + esac + + return 0 +} && +complete -F _xrandr xrandr + + + +# mplayer(1) completion +# +have mplayer && { +_mplayer_options_list() +{ + cur=${cur%\\} + COMPREPLY=( $( $1 $2 help 2> /dev/null | \ + sed -e '1,/^Available/d' | awk '{print $1}' | \ + sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \ + grep "^$cur" ) ) +} + +_mplayer() +{ + local cmd cur prev skinsdir IFS=$' \t\n' i j k=0 + + COMPREPLY=() + cmd=${COMP_WORDS[0]} + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(ac|afm|vc|vfm|ao|vo|vop|fstype|demuxer|vf|af)) + _mplayer_options_list mplayer $prev + return 0 + ;; + -@(oac|ovc|of)) + _mplayer_options_list mencoder $prev + return 0 + ;; + -audiofile) + _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|w?(a)v|W?(A)V|mid|MID|flac|FLAC|mka|MKA|ape|APE)' + return 0 + ;; + -font) + _filedir '@(desc|ttf)' + return 0 + ;; + -sub) + _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)' + return 0 + ;; + -vobsub) + _filedir '@(idx|IDX|ifo|IFO|sub|SUB)' + IFS=$'\t\n' + COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do + if [ -f $i -a -r $i ]; then + echo ${i%.*} + else + echo $i + fi + done ) ) + IFS=$' \t\n' + return 0 + ;; + -ifo) + _filedir '@(ifo|IFO)' + return 0 + ;; + -cuefile) + _filedir '@(bin|BIN|cue|CUE)' + return 0 + ;; + -skin) + # if you don't have installed mplayer in /usr you + # may want to set the MPLAYER_SKINS_DIR global variable + if [ -n "$MPLAYER_SKINS_DIR" ]; then + skinsdir=$MPLAYER_SKINS_DIR + else + skinsdir=/usr/share/mplayer/Skin + fi + + IFS=$'\t\n' + for i in ~/.mplayer/Skin $skinsdir; do + if [ -d $i -a -r $i ]; then + for j in $( compgen -d $i/$cur ); do + COMPREPLY[$k]=${j#$i/} + k=$((++k)) + done + fi + done + IFS=$' \t\n' + return 0 + ;; + -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev)) + cur=${cur:=/dev/} + _filedir + return 0 + ;; + -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \ + -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \ + -passlogfile) + _filedir + return 0 + ;; + -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \ + -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \ + -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \ + -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \ + -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \ + -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \ + -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \ + -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \ + -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \ + -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \ + -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \ + -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \ + -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale))) + return 0 + ;; + -lavdopts) + COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \ + -- $cur ) ) + return 0 + ;; + -lavcopts) + COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \ + vqmax= mbqmin= mbqmax= vqdiff= \ + vmax_b_frames= vme= vhq v4mv \ + keyint= vb_strategy= vpass= \ + aspect= vbitrate= vratetol= \ + vrc_maxrate= vrc_minrate= \ + vrc_buf_size= vb_qfactor= vi_qfactor= \ + vb_qoffset= vi_qoffset= vqblur= \ + vqcomp= vrc_eq= vrc_override= \ + vrc_init_cplx= vqsquish= vlelim= \ + vcelim= vstrict= vdpart vpsize= gray \ + vfdct= idct= lumi_mask= dark_mask= \ + tcplx_mask= scplx_mask= naq ildct \ + format= pred qpel precmp= cmp= \ + subcmp= predia= dia= trell last_pred= \ + preme= subq= psnr mpeg_quant aic umv' \ + -- $cur ) ) + return 0 + ;; + -ssf) + COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \ + cvs=' -- $cur ) ) + return 0 + ;; + -jpeg) + COMPREPLY=( $( compgen -W 'noprogressive progressive \ + nobaseline baseline optimize= \ + smooth= quality= outdir=' -- $cur ) ) + return 0 + ;; + -xvidopts) + COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) ) + return 0 + ;; + -xvidencopts) + COMPREPLY=( $( compgen -W 'pass= bitrate= \ + fixed_quant= me_quality= 4mv \ + rc_reaction_delay_factor= \ + rc_averaging_period= rc_buffer= \ + quant_range= min_key_interval= \ + max_key_interval= mpeg_quant \ + mod_quant lumi_mask hintedme \ + hintfile debug keyframe_boost= \ + kfthreshold= kfreduction=' -- $cur ) ) + return 0 + ;; + -divx4opts) + COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \ + min_quant= max_quant= rc_period= \ + rc_reaction_period= crispness= \ + rc_reaction_ratio= pass= vbrpass= \ + help' -- $cur ) ) + return 0 + ;; + -info) + COMPREPLY=( $( compgen -W 'name= artist= genre= \ + subject= copyright= srcform= \ + comment= help' -- $cur ) ) + return 0 + ;; + -lameopts) + COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \ + ratio= vol= mode= padding= fast \ + preset= help' -- $cur ) ) + return 0 + ;; + -rawaudio) + COMPREPLY=( $( compgen -W 'on channels= rate= \ + samplesize= format=' -- $cur ) ) + return 0 + ;; + -rawvideo) + COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \ + 4cif pal ntsc w= h= y420 yv12 yuy2 \ + y8 format= size=' -- $cur ) ) + return 0 + ;; + -aop) + COMPREPLY=( $( compgen -W 'list= delay= format= fout= \ + volume= mul= softclip' -- $cur ) ) + return 0 + ;; + -dxr2) + COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \ + iec958-decoded mute ucode= 75ire bw \ + color interlaced macrovision= norm= \ + square-pixel ccir601-pixel cr-left= \ + cr-right= cr-top= cr-bot= ck-rmin= \ + ck-gmin= ck-bmin= ck-rmax= ck-gmax= \ + ck-bmax= ck-r= ck-g= ck-b= \ + ignore-cache= ol-osd= olh-cor= \ + olw-cor= olx-cor= oly-cor= overlay \ + overlay-ratio= update-cache' -- $cur )) + return 0 + ;; + -tv) + COMPREPLY=( $( compgen -W 'on noaudio driver= device= \ + input= freq= outfmt= width= height= \ + buffersize= norm= channel= chanlist= \ + audiorate= forceaudio alsa amode= \ + forcechan= adevice= audioid= volume= \ + bass= treble= balance= fps= \ + channels= immediatemode=' -- $cur ) ) + return 0 + ;; + -mf) + COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \ + -- $cur ) ) + return 0 + ;; + -cdda) + COMPREPLY=( $( compgen -W 'speed= paranoia= \ + generic-dev= sector-size= overlap= \ + toc-bias toc-offset= skip noskip' \ + -- $cur ) ) + return 0 + ;; + -input) + COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \ + keylist cmdlist js-dev file' -- $cur ) ) + return 0 + ;; + -af) + COMPREPLY=( $( compgen -W 'resample resample= \ + channels channels= format format= \ + volume volume= delay delay= pan \ + pan= sub sub= surround surround=' \ + -- $cur ) ) + return 0 + ;; + -af-adv) + COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) ) + return 0 + ;; + -profile) + _mplayer_options_list $cmd $prev + return 0 + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \ + -audiofile -cdrom-device -cache -cdda \ + -channels -chapter -csslib -demuxer \ + -dvd -dvd-device -dvdangle -dvdauth \ + -dvdkey -dvdnav -forceidx -fps -frames \ + -hr-mp3-seek -idx -mc -mf -ni -nobps \ + -passwd -rawaudio -rtsp-stream-over-tcp\ + -skipopening -sb -srate -ss -tv -user \ + -vcd -vid -vivo -ifo -ffactor -font \ + -noautosub -nooverlapsub -sid -slang \ + -sub -subcc -subcp -sub-demuxer \ + -subdelay -subfont-autoscale \ + -subfont-blur -subfont-encoding \ + -subfont-osd-scale -subfont-outline \ + -subfont-text-scale -subfps -subfile \ + -subpos -unicode -utf8 -vobsub \ + -vobsubid -ac -afm -aspect -flip \ + -lavdopts -noaspect -nosound -pp -ssf \ + -stereo -sws -vc -vfm -vop -xvidopts\ + -xy -zoom -bandwidth -cuefile \ + -noextbased -rawvideo -overlapsub \ + -sub-bg-alpha -sub-bg-color -subalign \ + -subwidth -sub-no-text-pp -spualign \ + -spuaa -spugauss -pphelp -verbose -v \ + -noni -noidx -nohr-mp3-seek -extbased \ + -bps -oldpp -nozoom -noflip -nounicode \ + -noutf8 -profile -vf -af' -- $cur ) ) + # add mplayer specific options + [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \ + $(compgen -W '-autoq -autosync -benchmark \ + -framedrop -h -help -hardframedrop \ + -identify -input -lircconf -loop \ + -nojoystick -nolirc -nortc -playlist \ + -quiet -really-quiet -rnd -sdp -skin \ + -slave -softsleep -speed -sstep \ + -use-stdin -dumpaudio -dumpfile \ + -dumpstream -dumpvideo -dumpmicrodvdsub\ + -dumpmpsub -dumpsrtsub -dumpjacosub \ + -dumpsami -dumpsub -osdlevel -af \ + -af-adv -ao -aofile -aop -delay -mixer \ + -nowaveheader -bpp -brightness \ + -contrast -display -double -dr -dxr2 \ + -fb -fbmode -fbmodeconfig -forcexv -fs \ + -geometry -hue -icelayer -jpeg \ + -monitor-dotclock -monitor-hfreq \ + -monitor-vfreq -monitoraspect \ + -nograbpointer -noslices -panscan \ + -rootwin -saturation -screenw -screenh \ + -stop-xscreensaver -vm -vo -vsync -wid \ + -xineramascreen -z -zrbw -zrcrop \ + -zrdev -zrfd -zrhelp -zrnorm -zrquality \ + -zrvdec -zrhdec -zrxdoff -zrydoff -y \ + -edl -edlout -enqueue -fixed-vo \ + -menu -menu-root -menu-cfg -shuffle \ + -format -aahelp -dfbopts -fstype \ + -guiwid -nokeepaspect -x --help \ + -aaosdcolor -aasubcolor -aadriver \ + -aaextended -aaeight' -- $cur) ) + # add mencoder specific options + [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \ + $(compgen -W '-audio-density -audio-delay \ + -audio-preload -divx4opts -endpos \ + -ffourcc -include -info -lameopts \ + -lavcopts -noskip -o -oac -ofps -ovc \ + -passlogfile -skiplimit -vobsubout \ + -vobsuboutindex -vobsuboutid \ + -xvidencopts -of --verbose' -- $cur) ) + ;; + *) + _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3g[p2]|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2ts|M2TS|vdr|VDR|xvid|XVID|ape|APE)' + ;; + esac + + return 0 +} +complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer +} + +# KDE dcop completion +# +have dcop && +_dcop() +{ + local cur compstr + + COMPREPLY=() + cur=`_get_cword` + if [ -z $cur ]; then + compstr=${COMP_WORDS[*]} + else + compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" ) + fi + COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) ) +} && +complete -F _dcop dcop + +# wvdial(1) completion +# +have wvdial && +_wvdial() +{ + local cur prev config i IFS=$'\t\n' + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + --config) + _filedir + return 0 + ;; + esac + + case $cur in + -*) + COMPREPLY=( $( compgen -W '--config --chat \ + --remotename --help --version --no-syslog' \ + -- $cur ) ) + ;; + *) + # start with global and personal config files + config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc" + # replace with command line config file if present + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == "--config" ]]; then + config=${COMP_WORDS[i+1]} + break + fi + done + # parse config files for sections and + # remove default section + COMPREPLY=( $( sed -ne \ + "s|^\[Dialer \($cur.*\)\]$|\1|p" \ + $config 2>/dev/null |grep -v '^Defaults$')) + # escape spaces + COMPREPLY=${COMPREPLY// /\\ } + ;; + esac + +} && +complete -F _wvdial wvdial + +# gpg(1) completion +# +have gpg && +_gpg() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(s|-sign|-clearsign|-decrypt-files|-load-extension)) + _filedir + return 0 + ;; + --@(export|@(?(l|nr|nrl)sign|edit)-key)) + # return list of public keys + COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) + return 0 + ;; + -@(r|-recipient)) + COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )) + if [ -e ~/.gnupg/gpg.conf ]; then + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") ) + fi + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\ + -q -n -N $(gpg --dump-options)' -- $cur ) ) + fi + +} && +complete -F _gpg $default gpg + +# iconv(1) completion +# +have iconv && +_iconv() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(f|t|-@(from|to)-code)) + COMPREPLY=( $( compgen -W \ + '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) ) + return 0 + ;; + esac + + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list + --output -o --verbose' -- "$cur" ) ) + return 0 + fi +} && +complete -F _iconv $default iconv + +# dict(1) completion +# +{ have dict || have rdict; } && { +_dictdata() +{ + dict $host $port $1 2>/dev/null | sed -ne \ + 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p' +} + +_dict() +{ + local cur prev host port db dictfile + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + dictfile=/usr/share/dict/words + + for (( i=1; i < COMP_CWORD; i++ )); do + case "${COMP_WORDS[i]}" in + -@(h|--host)) + host=${COMP_WORDS[i+1]} + [ -n "$host" ] && host="-h $host" + i=$((++i)) + ;; + -@(p|-port)) + port=${COMP_WORDS[i+1]} + [ -n "$port" ] && port="-p $port" + i=$((++i)) + ;; + -@(d|-database)) + db=${COMP_WORDS[i+1]} + [ -n "$db" ] && host="-d $db" + i=$((++i)) + ;; + *) + ;; + esac + done + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \ + -m --match -s --strategy -c --config -C \ + --nocorrect -D --dbs -S --strats -H \ + --serverhelp -i --info -I --serverinfo \ + -a --noauth -u --user -k --key -V --version \ + -L --license --help -v --verbose -r --raw \ + -P --pager --debug --html --pipesize --client' \ + -- "$cur" ) ) + return 0 + fi + + case "$prev" in + -@(d|-database|i|info)) + COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) ) + return 0 + ;; + -@(s|-strategy)) + COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) ) + return 0 + ;; + *) + ;; + esac + + [ -r $dictfile ] && \ + COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) ) +} +complete -F _dict $default dict rdict +} + +# cdrecord(1) completion +# +(have cdrecord || have wodim) && +_cdrecord() +{ + local cur prev i generic_options track_options track_mode + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # foo=bar style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + @(text|cue)file) + _filedir + return 0 + ;; + blank) + COMPREPLY=( $( compgen -W 'help all fast \ + track unreserve trtail unclose session' \ + -- $cur ) ) + return 0 + ;; + driveropts) + COMPREPLY=( $( compgen -W 'burnfree noburnfree\ + varirec= audiomaster forcespeed noforcespeed\ + speedread nospeedread singlesession \ + nosinglesession hidecdr nohidecdr tattooinfo\ + tattoofile=' -- $cur ) ) + return 0 + ;; + esac + fi + + generic_options=(-version -v -V -d -silent -s -force -immed -dummy \ + -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \ + -atip -fix -nofix -waiti -load -lock -eject -format \ + -setdropts -checkdrive -prcap -inq -scanbus -reset \ + -abort -overburn -ignsize -useinfo -packet -noclose \ + -text debug= kdebug= kd= minbuf= speed= blank= fs= \ + dev= gracetime= timeout= driver= driveropts= \ + defpregap= pktsize= mcn= textfile= cuefile=) + track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \ + -isosize -pad padsize= -nopad -shorttrack -noshorttrack\ + pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \ + isrc= index=) + # look if previous was either a file or a track option + track_mode=0 + if [ $COMP_CWORD -gt 1 ]; then + if [ -f "$prev" ]; then + track_mode=1 + else + for (( i=0; i < ${#track_options[@]}; i++ )); do + if [[ "${track_options[i]}" == "$prev" ]]; then + track_mode=1 + break + fi + done + fi + fi + + # files are always eligible completion + _filedir + # track options are always available + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) ) + # general options are no more available after file or track option + if [ $track_mode -eq 0 ]; then + COMPREPLY=( "${COMPREPLY[@]}" \ + $( compgen -W '${generic_options[@]}' -- $cur ) ) + fi + +} && +complete -F _cdrecord $filenames cdrecord wodim + +# mkisofs(8) completion +# +(have mkisofs || have genisoimage) && +_mkisofs() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list)) + _filedir + return 0 + ;; + -*-charset) + COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \ + tail +3 | grep "^$cur") ) + return 0 + ;; + -uid) + _uids + return 0 + ;; + -gid) + _gids + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \ + -allow-multidot -biblio -cache-inodes \ + -no-cache-inodes -b -eltorito-alt-boot -B -G \ + -hard-disk-boot -no-emul-boot -no-boot \ + -boot-load-seg -boot-load-size \ + -boot-info-table -C -c -check-oldname \ + -check-session -copyright -d -D -dir-mode \ + -dvd-video -f -file-mode -gid -gui \ + -graft-points -hide -hide-list -hidden \ + -hidden-list -hide-joliet -hide-joliet-list \ + -hide-joliet-trans-tbl -hide-rr-moved \ + -input-charset -output-charset -iso-level -J \ + -joliet-long -jcharset -l -L -log-file -m \ + -exclude-list -max-iso9660-filenames -M -N \ + -new-dir-mode -nobak -no-bak -force-rr -no-rr \ + -no-split-symlink-components \ + -no-split-symlink-fields -o -pad -no-pad \ + -path-list -P -p -print-size -quiet -R -r \ + -relaxed-filenames -sort -split-output \ + -stream-media-size -stream-file-name -sysid -T\ + -table-name -ucs-level -udf -uid \ + -use-fileversion -U -no-iso-translate -V \ + -volset -volset-size -volset-seqno -v -x -z \ + -hfs -apple -map -magic -hfs-creator \ + -hfs-type -probe -no-desktop -mac-name \ + -boot-hfs-file -part -auto -cluster-size \ + -hide-hfs -hide-hfs-list -hfs-volid \ + -icon-position -root-info -prep-boot \ + -input-hfs-charset -output-hfs-charset \ + -hfs-unlock -hfs-bless -hfs-parms --cap \ + --netatalk --double --ethershare --ushare \ + --exchange --sgi --xinet --macbin --single \ + --dave --sfm --osx-double --osx-hfs' -- $cur )) + else + _filedir + fi + +} && +complete -F _mkisofs $filenames mkisofs genisoimage + +# mc(1) completion +# +have mc && +_mc() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # -name value style option + case "$prev" in + -@(e|v|l|P)) + _filedir + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --@(edit|view|ftplog|printwd)) + _filedir + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \ + --color -C --colors= -d --nomouse -e --edit= -f \ + --datadir -k --resetsoft -l --ftplog= -P --printwd= \ + -s --slow -t --termcap -u --nosubshell -U --subshell \ + -v --view= -V --version -x --xterm -h --help' -- $cur ) ) + else + _filedir -d + fi +} && +complete -F _mc $filenames mc + +# yum(8) completion +# +have yum && { +_yum_list() +{ + if [[ "$1" == all ]] ; then + # Try to strip in between headings like "Available Packages" + # This will obviously only work for English :P + COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + grep -iv '^\(Available\|Installed\|Updated\) Packages' | \ + sed -e 's/[[:space:]].*//' ) ) + else + # Drop first line (e.g. "Updated Packages") + COMPREPLY=( $( yum -d 0 -C list $1 "$cur*" 2>/dev/null | \ + sed -ne 1d -e 's/[[:space:]].*//p' ) ) + fi +} + +_yum() +{ + local cur prev special + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist|info) ]]; then + special=${COMP_WORDS[i]} + fi + done + + if [ -n "$special" ]; then + case $special in + install) + _yum_list available + return 0 + ;; + deplist|info) + _yum_list all + return 0 + ;; + upgrade|update) + _yum_list updates + return 0 + ;; + remove|erase) + # _rpm_installed_packages is not arch-qualified + _yum_list installed + return 0 + ;; + esac + fi + + case $cur in + --*) + COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) ) + return 0 + ;; + -*) + COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) ) + return 0 + ;; + esac + + case $prev in + list) + COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) ) + ;; + clean) + COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) ) + ;; + localinstall|localupdate) + # TODO: should not match *src.rpm + _filedir rpm + ;; + -c) + _filedir + ;; + --installroot) + _filedir -d + ;; + *) + COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \ + search info provides clean groupinstall groupupdate \ + grouplist deplist erase groupinfo groupremove \ + localinstall localupdate makecache resolvedep \ + shell whatprovides' -- $cur ) ) + ;; + esac +} +complete -F _yum $filenames yum + +# yum-arch(8) completion +# +_yum_arch() +{ + local cur + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) ) + ;; + *) + _filedir -d + ;; + esac + + return 0 + +} +complete -F _yum_arch $filenames yum-arch +} + +# ImageMagick completion +# +have convert && { +_ImageMagick() +{ + local prev + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -channel) + COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \ + Matte Cyan Magenta Yellow Black' -- $cur ) ) + return 0 + ;; + -colormap) + COMPREPLY=( $( compgen -W 'shared private' -- $cur ) ) + return 0 + ;; + -colorspace) + COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \ + XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) ) + return 0 + ;; + -compose) + COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \ + Minus Add Subtract Difference Multiply Bumpmap\ + Copy CopyRed CopyGreen CopyBlue CopyOpacity' \ + -- $cur ) ) + return 0 + ;; + -compress) + COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \ + Lossless LZW RLE Zip' -- $cur ) ) + return 0 + ;; + -dispose) + COMPREPLY=( $( compgen -W 'Undefined None Background \ + Previous' -- $cur ) ) + return 0 + ;; + -encoding) + COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \ + AdobeStandard AppleRoman BIG5 GB2312 Latin2 \ + None SJIScode Symbol Unicode Wansung' -- $cur)) + return 0 + ;; + -endian) + COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) ) + return 0 + ;; + -filter) + COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \ + Hanning Hamming Blackman Gaussian Quadratic \ + Cubic Catrom Mitchell Lanczos Bessel Sinc' \ + -- $cur ) ) + return 0 + ;; + -format) + COMPREPLY=( $( convert -list format | \ + awk '/ [r-][w-][+-] / {print $1}' | \ + tr -d '*' | tr [:upper:] [:lower:] | \ + grep "^$cur" ) ) + return 0 + ;; + -gravity) + COMPREPLY=( $( compgen -W 'Northwest North NorthEast \ + West Center East SouthWest South SouthEast' \ + -- $cur ) ) + return 0 + ;; + -intent) + COMPREPLY=( $( compgen -W 'Absolute Perceptual \ + Relative Saturation' -- $cur ) ) + return 0 + ;; + -interlace) + COMPREPLY=( $( compgen -W 'None Line Plane Partition' \ + -- $cur ) ) + return 0 + ;; + -limit) + COMPREPLY=( $( compgen -W 'Disk File Map Memory' \ + -- $cur ) ) + return 0 + ;; + -list) + COMPREPLY=( $( compgen -W 'Delegate Format Magic \ + Module Resource Type' -- $cur ) ) + return 0 + ;; + -map) + COMPREPLY=( $( compgen -W 'best default gray red \ + green blue' -- $cur ) ) + _filedir + return 0 + ;; + -noise) + COMPREPLY=( $( compgen -W 'Uniform Gaussian \ + Multiplicative \ + Impulse Laplacian Poisson' -- $cur ) ) + return 0 + ;; + -preview) + COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \ + Saturation Brightness Gamma Spiff \ + Dull Grayscale Quantize Despeckle \ + ReduceNoise AddNoise Sharpen Blur \ + Treshold EdgeDetect Spread Shade \ + Raise Segment Solarize Swirl Implode \ + Wave OilPaint CharcoalDrawing JPEG' \ + -- $cur ) ) + return 0 + ;; + -@(mask|profile|texture|tile|write)) + _filedir + return 0 + ;; + -type) + COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \ + PaletteMatte TrueColor TrueColorMatte \ + ColorSeparation ColorSeparationlMatte \ + Optimize' -- $cur ) ) + return 0 + ;; + -units) + COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \ + PixelsPerCentimeter' -- $cur ) ) + return 0 + ;; + -virtual-pixel) + COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \ + -- $cur ) ) + return 0 + ;; + -visual) + COMPREPLY=( $( compgen -W 'StaticGray GrayScale \ + StaticColor PseudoColor TrueColor \ + DirectColor defaut visualid' -- $cur )) + return 0 + ;; + esac +} + +_convert() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \ + -adaptive-sharpen -adjoin -affine -alpha -annotate \ + -antialias -append -attenuate -authenticate \ + -auto-orient -average -background -bench -bias \ + -black-point-compensation -black-threshold \ + -blue-primary -blur -border -bordercolor -caption \ + -channel -charcoal -chop -clip -clip-mask -clip-path \ + -clone -clut -coalesce -colorize -colors -colorspace \ + -combine -comment -compose -composite -compress \ + -contrast -contrast-stretch -convolve -crop -cycle \ + -debug -decipher -deconstruct -define -delay -delete \ + -density -depth -despeckle -display -dispose -distort \ + -dither -draw -edge -emboss -encipher -encoding \ + -endian -enhance -equalize -evaluate -extent -extract \ + -family -fill -filter -flatten -flip -floodfill -flop \ + -font -format -frame -fuzz -fx -gamma -gaussian-blur \ + -geometry -gravity -green-primary -help -identify \ + -implode -insert -intent -interlace -interpolate \ + -label -lat -layers -level -limit -linear-stretch \ + -liquid-rescale -list -log -loop -map -mask \ + -mattecolor -median -modulate -monitor -monochrome \ + -morph -mosaic -motion-blur -negate -noise -normalize \ + -opaque -ordered-dither -orient -page -paint -ping \ + -pointsize -polaroid -posterize -preview -print \ + -process -profile -quality -quantize -quiet \ + -radial-blur -raise -random-threshold -recolor \ + -red-primary -regard-warnings -region -render -repage \ + -resample -resize -respect-parenthesis -reverse -roll \ + -rotate -sample -sampling-factor -scale -scene -seed \ + -segment -separate -sepia-tone -set -shade -shadow \ + -sharpen -shave -shear -sigmoidal-contrast -size \ + -sketch -solarize -splice -spread -stretch -strip \ + -stroke -strokewidth -style -swap -swirl -taint \ + -texture -threshold -thumbnail -tile -tile-offset \ + -tint -transform -transparent -transparent-color \ + -transpose -transverse -treedepth -trim -type \ + -undercolor -unique-colors -units -unsharp -verbose \ + -version -view -vignette -virtual-pixel -wave \ + -weight -white-point -white-threshold \ + -write' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+adjoin +append +compress \ + +contrast +debug +dither +endian +gamma +label +map \ + +mask +matte +negate +noise +page +raise +render \ + +write' -- $cur ) ) + else + _filedir + fi +} +complete -F _convert $filenames convert + +_mogrify() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-adaptive-blur -adaptive-resize \ + -adaptive-sharpen -adjoin -affine -alpha -annotate \ + -antialias -attenuate -authenticate -auto-orient \ + -background -bias -black-point-compensation \ + -black-threshold -blue-primary -blur -border \ + -bordercolor -caption -channel -charcoal -chop -clip \ + -clip-mask -clip-path -clut -colorize -colors \ + -colorspace -comment -compose -compress -contrast \ + -contrast-stretch -convolve -cycle -debug -decipher \ + -define -delay -density -depth -despeckle -display \ + -dispose -distort -dither -draw -edge -emboss \ + -encipher -encoding -endian -enhance -equalize \ + -evaluate -extent -extract -family -fill -filter \ + -flip -floodfill -flop -font -format -frame -fuzz \ + -gamma -gaussian-blur -geometry -gravity \ + -green-primary -help -identify -implode -intent \ + -interlace -interpolate -label -lat -layers -level \ + -limit -linear-stretch -liquid-rescale -list -log \ + -loop -mask -mattecolor -median -modulate -monitor \ + -monochrome -motion-blur -negate -noise -normalize \ + -opaque -ordered-dither -orient -page -paint -path \ + -ping -pointsize -polaroid -posterize -preview -print \ + -profile -quality -quantize -quiet -radial-blur \ + -raise -random-threshold -recolor -red-primary \ + -regard-warnings -region -render -repage -resample \ + -resize -roll -rotate -sample -sampling-factor -scale \ + -scene -seed -segment -sepia-tone -set -shade -shadow \ + -sharpen -shave -shear -sigmoidal-contrast -size \ + -sketch -solarize -splice -spread -stretch -strip \ + -stroke -strokewidth -style -swirl -taint -texture \ + -threshold -thumbnail -tile -tile-offset -tint \ + -transform -transparent -transparent-color -transpose \ + -transverse -treedepth -trim -type -undercolor \ + -unique-colors -units -unsharp -verbose -version \ + -view -vignette -virtual-pixel -wave -weight \ + -white-point -white-threshold' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \ + +endian +gamma +label +map +mask +matte +negate +page \ + +raise' -- $cur ) ) + else + _filedir + fi +} +complete -F _mogrify $filenames mogrify + +_display() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \ + -auto-orient -backdrop -background -border \ + -bordercolor -borderwidth -channel -clip \ + -clip-path -coalesce -colormap -colors -colorspace \ + -comment -compress -contrast -crop -debug -decipher \ + -define -delay -density -depth -despeckle -display \ + -dispose -dither -edge -endian -enhance -extract \ + -filter -flatten -flip -flop -font -foreground \ + -format -frame -gamma -geometry -help -iconGeometry \ + -iconic -identify -immutable -interlace -interpolate \ + -label -limit -list -log -loop -map -mattecolor \ + -monitor -monochrome -name -negate -page -profile \ + -quality -quantize -quiet -raise -regard-warnings \ + -remote -repage -resample -resize \ + -respect-parenthesis -roll -rotate -sample \ + -sampling-factor -scenes -seed -segment -set \ + -shared-memory -sharpen -size -strip -texture -title \ + -transparent-color -treedepth -trim -update \ + -usePixmap -verbose -version -virtual-pixel -visual \ + -window -window-group -write' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \ + +endian +gamma +label +map +matte +negate +page \ + +raise +write' -- $cur ) ) + else + _filedir + fi +} +complete -F _display $filenames display + +_animate() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-alpha -authenticate -backdrop \ + -background -bordercolor -borderwidth -channel \ + -coalesce -colormap -colors -colorspace -crop -debug \ + -decipher -define -delay -density -depth -display \ + -dispose -dither -extract -filter -flatten -font \ + -foreground -format -gamma -geometry -help \ + -iconGeometry -iconic -identify -immutable -interlace \ + -interpolate -limit -list -log -loop -map -mattecolor \ + -mattecolor -monitor -monochrome -name -page -pause \ + -quantize -quiet -regard-warnings -remote -repage \ + -resample -resize -respect-parenthesis -rotate \ + -sampling-factor -scenes -seed -set -shared-memory \ + -size -strip -title -transparent-color -treedepth \ + -trim -verbose -version -virtual-pixel -visual \ + -window' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) ) + else + _filedir + fi +} +complete -F _animate $filenames animate + +_identify() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-alpha -antialias -authenticate \ + -channel -colorspace -crop -debug -define -density \ + -depth -extract -format -fuzz -gamma -help -interlace \ + -interpolate -limit -list -log -monitor -ping -quiet \ + -regard-warnings -respect-parenthesis \ + -sampling-factor -seed -set -size -strip -units \ + -verbose -version -virtual-pixel' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- $cur ) ) + else + _filedir + fi +} +complete -F _identify $filenames identify + +_montage() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-adjoin -affine -alpha \ + -authenticate -background -blue-primary -blur -border \ + -bordercolor -borderwidth -caption -channel -clone \ + -coalesce -colors -colorspace -comment -compose \ + -compress -crop -debug -define -density -depth \ + -display -dispose -dither -draw -encoding -endian \ + -extract -fill -filter -flatten -flip -flop -font \ + -format -frame -gamma -geometry -gravity \ + -green-primary -help -identify -interlace \ + -interpolate -label -limit -list -log -mattecolor \ + -mode -monitor -monochrome -origin -page -pointsize \ + -polaroid -profile -quality -quantize -quiet \ + -red-primary -regard-warnings -repage -resize \ + -respect-parenthesis -rotate -sampling-factor -scenes \ + -seed -set -shadow -size -strip -stroke -texture \ + -thumbnail -tile -title -transform -transparent \ + -transparent-color -treedepth -trim -type -units \ + -verbose -version -virtual-pixel \ + -white-point' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \ + +endian +gamma +label +matte +page' -- $cur ) ) + else + _filedir + fi +} +complete -F _montage $filenames montage + +_composite() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-affine -alpha -authenticate \ + -blend -blue-primary -border -bordercolor -channel \ + -colors -colorspace -comment -compose -compress \ + -debug -decipher -define -density -depth -displace \ + -display -dispose -dissolve -dither -encipher \ + -encoding -endian -extract -filter -font -format \ + -geometry -gravity -green-primary -help -identify \ + -interlace -interpolate -label -limit -list -log \ + -monitor -monochrome -negate -page -profile -quality \ + -quantize -quiet -red-primary -regard-warnings \ + -repage -resize -respect-parenthesis -rotate \ + -sampling-factor -scene -seed -sharpen -shave -size \ + -stegano -stereo -strip -swap -thumbnail -tile \ + -transform -transparent-color -treedepth -type -units \ + -unsharp -verbose -version -virtual-pixel -watermark \ + -white-point -write' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \ + +matte +negate +page +write' -- $cur ) ) + else + _filedir + fi +} +complete -F _composite $filenames composite + +_compare() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-alpha -authenticate -channel \ + -colorspace -compress -debug -decipher -define \ + -density -depth -encipher -extract -format -fuzz \ + -help -highlight-color -identify -interlace -limit \ + -list -log -metric -monitor -passphrase -profile \ + -quality -quantize -quiet -regard-warnings \ + -respect-parenthesis -sampling-factor -seed -set \ + -size -transparent-color -type -verbose -version \ + -virtual-pixel' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- $cur ) ) + else + _filedir + fi +} +complete -F _compare $filenames compare + +_conjure() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-debug -help -list -log -monitor \ + -quiet -regard-warnings -seed -verbose \ + -version' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- $cur ) ) + else + _filedir + fi +} +complete -F _conjure $filenames conjure + +_import() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-adjoin -annotate -border -channel \ + -colors -colorspace -comment -compress -crop -debug \ + -define -delay -density -depth -descend -display \ + -dispose -dither -encipher -encoding -endian -filter \ + -format -frame -geometry -gravity -help -identify \ + -interlace -interpolate -label -limit -list -log \ + -monitor -monochrome -negate -page -pause -pointsize \ + -quality -quantize -quiet -regard-warnings -repage \ + -resize -respect-parenthesis -rotate -sampling-factor \ + -scene -screen -seed -set -silent -snaps -strip \ + -thumbnail -transparent -transparent-color -treedepth \ + -trim -type -verbose -version -virtual-pixel \ + -window' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- $cur ) ) + else + _filedir + fi +} +complete -F _import $filenames import + +_stream() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + _ImageMagick + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-authenticate -channel -colorspace \ + -compress -debug -define -density -depth -extract \ + -help -identify -interlace -interpolate -limit -list \ + -log -map -monitor -quantize -quiet -regard-warnings \ + -respect-parenthesis -sampling-factor -seed -set \ + -size -storage-type -transparent-color -verbose \ + -version -virtual-pixel' -- $cur ) ) + elif [[ "$cur" == +* ]]; then + COMPREPLY=( $( compgen -W '+debug' -- $cur ) ) + else + _filedir + fi +} +complete -F _stream $filenames stream +} + +# dd(1) completion +# +have dd && +_dd() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + if=*|of=*) + cur=${cur#*=} + _filedir + return 0 + ;; + conv=*) + cur=${cur#*=} + COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \ + lcase notrunc ucase swab noerror sync' \ + -- $cur ) ) + return 0 + ;; + esac + + _expand || return 0 + + COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \ + $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\ + -S '=' -- $cur ) ) +} && +complete -F _dd $nospace $filenames dd + +# CUPS cancel(1) completion +# +have cancel && +_cancel() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) ) +} && +complete -F _cancel $filenames cancel + +# aspell(1) completion +# +have aspell && { +_aspell_dictionary() +{ + local datadir + datadir=/usr/lib/aspell + COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) ) + COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) ) +} + +_aspell() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case "$prev" in + @(-c|-p|check)) + _filedir + return 0 + ;; + @(dump|create|merge)) + COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) ) + return 0 + ;; + -d) + _aspell_dictionary + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --@(conf|personal|repl|per-conf)) + _filedir + return 0 + ;; + --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix)) + _filedir -d + return 0 + ;; + --master) + _aspell_dictionary + return 0 + ;; + --mode) + COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) ) + return 0 + ;; + --sug-mode) + COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) ) + return 0 + ;; + --keymapping) + COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) ) + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \ + --encoding= --add-filter= --rem-filter= --mode= -e \ + -H -t --add-extra-dicts= --rem-extra-dicts= \ + --home-dir= -W --ignore= --ignore-accents \ + --dont-ignore-accents --ignore-case --dont-ignore-case \ + --ignore-repl --dont-ignore-repl --jargon= --keyboard= \ + --lang= --language-tag= --local-data-dir= -d --master= \ + --module= --add-module-search-order= \ + --rem-module-search-order= --per-conf= -p --personal= \ + --prefix= --repl= -C -B --run-together --dont-run-together \ + --run-together-limit= --run-together-min= --save-repl \ + --dont-save-repl --set-prefix --dont-set-prefix --size= \ + --spelling= --strip-accents --dont-strip-accents \ + --sug-mode= --add-word-list-path= --rem-word-list-path= \ + -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \ + --time --dont-time --keymapping= --add-email-quote= \ + --rem-email-quote= --email-margin= --add-tex-command= \ + --rem-tex-command= --tex-check-comments \ + --dont-tex-check-comments --add-tex-extension= \ + --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \ + --add-sgml-extension= --rem-sgml-extension=' -- $cur ) ) + else + COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \ + config config soundslike filter -v version dump \ + create merge' -- $cur ) ) + fi + +} +complete -F _aspell $filenames aspell +} + +# xmms(1) completion +# +have xmms && +_xmms() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \ + -u --pause -s --stop -t --play-pause -f --fwd -e \ + --enqueue -m --show-main-window -i --sm-client-id \ + -v --version' -- $cur ) ) + else + _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)' + + fi + +} && +complete -F _xmms $filenames xmms + +# info(1) completion +# +have info && +_info() +{ + local cur infopath + + COMPREPLY=() + cur=`_get_cword` + + _expand || return 0 + + # default completion if parameter contains / + if [[ "$cur" == */* ]]; then + _filedir + return 0 + fi + + infopath='/usr/share/info' + + if [ "${INFOPATH: -1:1}" == ':' ]; then + infopath=${INFOPATH}${infopath} + elif [ ${INFOPATH:+set} ]; then + infopath=$INFOPATH + fi + + infopath=$infopath: + if [ -n "$cur" ]; then + infopath="${infopath//://$cur* }" + else + infopath="${infopath//:// }" + fi + + # redirect stderr for when path doesn't exist + COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) ) + # weed out directory path names and paths to info pages + COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) + # weed out info dir file + for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do + if [ "${COMPREPLY[$i]}" == 'dir' ]; then + unset COMPREPLY[$i]; + fi; + done + # strip suffix from info pages + COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) + + return 0 +} && +complete -F _info $filenames info + +# dhclient(1) completion +# +have dhclient && _dhclient() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(cf|lf|pf|sf)) + _filedir + return 0 + ;; + -s) + _known_hosts + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \ + -cf -sf -s -g -n -nw -w' -- $cur ) ) + else + _available_interfaces + fi +} && +complete -F _dhclient dhclient + +# lvm(8) completion +# +have lvm && { +_volumegroups() +{ + COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ + sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) ) +} + +_physicalvolumes() +{ + COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ + sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) ) +} + +_logicalvolumes() +{ + COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ + sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) ) +} + +_units() +{ + COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) ) +} + +_sizes() +{ + COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) ) +} + +_args() +{ + args=0 + if [[ "${COMP_WORDS[0]}" == lvm ]]; then + offset=2 + else + offset=1 + fi + for (( i=$offset; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" != -* ]]; then + args=$(($args + 1)) + fi + done +} + +_lvmdiskscan() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \ + --lvmpartition -v --verbose --version' -- $cur ) ) + fi +} +complete -F _lvmdiskscan lvmdiskscan + +_pvscan() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -e \ + --exported -n --novolumegroup -h -? \ + --help --ignorelockingfailure -P \ + --partial -s --short -u --uuid -v \ + --verbose --version' -- $cur ) ) + fi +} +complete -F _pvscan pvscan + +_pvs() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(o|O|-options|-sort)) + COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \ + pv_size pv_free pv_used pv_name \ + pv_attr pv_pe_count \ + pv_pe_alloc_count' -- $cur ) ) + return 0 + ;; + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \ + -h -? --help --ignorelockingfailure --noheadings \ + --nosuffix -o --options -O --sort \ + --separator --unbuffered --units \ + -v --verbose --version' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvs pvs + +_pvdisplay() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ + -v --verbose -d --debug -h --help --version' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvdisplay pvdisplay + +_pvchange() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|x|-autobackup|--allocatable)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -A --autobackup \ + -d --debug -h --help -t --test -u --uuid -x \ + --allocatable -v --verbose --addtag --deltag \ + --version' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvchange pvchange + +_pvcreate() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --restorefile) + _filedir + return 0 + ;; + -@(M|-metadatatype)) + COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) + return 0 + ;; + --metadatacopies) + COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) ) + return 0 + ;; + --@(metadatasize|setphysicalvolumesize)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \ + --force -h -? --help --labelsector -M --metadatatype \ + --metadatacopies --metadatasize \ + --setphysicalvolumesize -t --test -u --uuid uuid -v \ + --verbose -y --yes --version' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvcreate pvcreate + +_pvmove() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(n|-name)) + _logicalvolumes + return 0 + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--abort -A --autobackup \ + -b --background -d --debug -f --force -h -? \ + --help -i --interval -t --test -v --verbose \ + --version -n --name' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvmove pvmove + +_pvremove() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \ + --help -y --yes -t --test -v --verbose \ + --version' -- $cur ) ) + else + _physicalvolumes + fi +} +complete -F _pvremove pvremove + +_vgscan() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h --help \ + --ignorelockingfailure --mknodes -P \ + --partial -v --verbose --version' -- $cur ) ) + fi +} +complete -F _vgscan vgscan + +_vgs() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(o|O|-options|-sort)) + COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \ + vg_attr vg_size vg_free vg_sysid \ + vg_extent_size vg_extent_count vg_free_count \ + max_lv max_pv pv_count lv_count snap_count \ + vg_seqno' -- $cur ) ) + return 0 + ;; + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--aligned -d --debug \ + -h --help --ignorelockingfailure --noheadings \ + --nosuffix -o --options -O --sort -P --partial \ + --separator --unbuffered --units \ + -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgs vgs + +_vgdisplay() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ + -P --partial -A --activevolumegroups -v --verbose \ + -d --debug -h --help --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgdisplay vgdisplay + +_vgchange() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(a|A|x|-available|-autobackup|-resizeable)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \ + --partial -d --debug -h --help --ignorelockingfailure \ + -t --test -u --uuid -v --verbose --version -a \ + --available -x --resizeable -l --logicalvolume \ + --addtag --deltag' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgchange vgchange + +_vgcreate() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(M|-metadatatype)) + COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) + return 0 + ;; + -@(s|-physicalextentsize)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup --addtag \ + --alloc -d --debug -h --help -l --maxlogicalvolumes \ + -M --metadatatype -p --maxphysicalvolumes -s \ + --physicalextentsize -t --test -v --verbose \ + --version' -- $cur ) ) + else + _args + if [ $args -eq 0 ]; then + _volumegroups + else + _physicalvolumes + fi + fi +} +complete -F _vgcreate vgcreate + +_vgremove() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \ + -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgremove vgremove + +_vgrename() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ + -? --help -t --test -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgrename vgrename + +_vgreduce() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \ + --debug -h --help --removemissing -t --test -v \ + --verbose --version' -- $cur ) ) + + else + _args + if [ $args -eq 0 ]; then + _volumegroups + else + _physicalvolumes + fi + fi +} +complete -F _vgreduce vgreduce + +_vgextend() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(L|-size)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ + -? --help -t --test -v --verbose --version' -- $cur ) ) + else + _args + if [ $args -eq 0 ]; then + _volumegroups + else + _physicalvolumes + fi + fi +} +complete -F _vgextend vgextend + +_vgport() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -d --debug -h \ + -? --help -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgport vgimport vgexport + +_vgck() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h \ + -? --help -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgck vgck + +_vgconvert() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(M|-metadatatype)) + COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) + return 0 + ;; + --metadatacopies) + COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) ) + return 0 + ;; + --metadatasize) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \ + -M --metadatatype --metadatacopies --metadatasize \ + -t --test -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgconvert vgconvert + +_vgcfgbackup() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(f|-file)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \ + --ignorelockingfailure -P --partial -v --verbose \ + --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgcfgbackup vgcfgbackup + +_vgcfgrestore() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(f|-file)) + _filedir + return 0 + ;; + -@(M|-metadatatype)) + COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) + return 0 + ;; + -@(n|-name)) + _volumegroups + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \ + -h --help -M --Metadatatype -n --name -t --test \ + -v --verbose --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgcfgrestore vgcfgrestore + +_vgmerge() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \ + -h --help -l --list -t --test -v --verbose \ + --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgmerge vgmerge + +_vgsplit() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(M|-metadatatype)) + COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \ + -h --help -l --list -M --metadatatype -t --test \ + -v --verbose --version' -- $cur ) ) + else + _args + if [ $args -eq 0 -o $args -eq 1 ]; then + _volumegroups + else + _physicalvolumes + fi + fi +} +complete -F _vgsplit vgsplit + +_vgmknodes() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \ + --version' -- $cur ) ) + else + _volumegroups + fi +} +complete -F _vgmknodes vgmknodes + +_lvscan() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \ + -h -? --help --ignorelockingfailure -P \ + --partial -v --verbose --version' -- $cur ) ) + fi +} +complete -F _lvscan lvscan + +_lvs() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(o|O|-options|-sort)) + COMPREPLY=( $( compgen -W 'lv_uuid lv_name \ + lv_attr lv_minor lv_size seg_count \ + origin snap_percent segtype stripes \ + stripesize chunksize seg_start \ + seg_size' -- $cur ) ) + return 0 + ;; + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--aligned -d --debug \ + -h --help --ignorelockingfailure --noheadings \ + --nosuffix -o --options -O --sort -P --partial \ + --segments --separator --unbuffered --units \ + -v --verbose --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvs lvs + +_lvdisplay() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --units) + _units + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ + -P --partial -m --maps -v --verbose -d --debug -h \ + --help --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvdisplay lvdisplay + +_lvchange() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(a|A|C|M|-available|-autobackup|-continguous|-persistent)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(p|-permission)) + COMPREPLY=( $( compgen -W 'r rw' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -a --available \ + --addtag --alloc -C --contiguous -d --debug --deltag \ + -f --force -h --help --ignorelockingfailure -M \ + --persistent --major major --minor minor -P --partial \ + -p --permission -r --readahead --refresh -t --test \ + -v --verbose --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvchange lvchange + +_lvcreate() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(L|-size)) + _sizes + return 0 + ;; + -@(p|-permission)) + COMPREPLY=( $( compgen -W 'r rw' -- $cur ) ) + return 0 + ;; + -@(n|-name)) + _logicalvolumes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \ + -C --contiguous -d --debug -h -? --help -i --stripes \ + -I --stripesize -l --extents -L --size -M --persistent \ + --major --minor -n --name -p --permission -r \ + --readahead -t --test --type -v --verbose -Z --zero \ + --version' -- $cur ) ) + else + _args + if [ $args -eq 0 ]; then + _volumegroups + else + _physicalvolumes + fi + fi +} +complete -F _lvcreate lvcreate + +_lvremove() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \ + --force -h -? --help -t --test -v --verbose \ + --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvremove lvremove + +_lvrename() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ + -? --help -t --test -v --verbose --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvrename lvrename + +_lvreduce() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(L|-size)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup -d \ + --debug -f --force -h --help -l --extents \ + -L --size -n --nofsck -r --resizefs -t --test \ + -v --verbose --version' -- $cur ) ) + else + _logicalvolumes + fi +} +complete -F _lvreduce lvreduce + +_lvresize() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(L|-size)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \ + --debug -h --help -i --stripes -I --stripesize \ + -l --extents -L --size -n --nofsck -r --resizefs \ + -t --test --type -v --verbose --version' -- $cur ) ) + else + _args + if [ $args -eq 0 ]; then + _logicalvolumes + else + _physicalvolumes + fi + fi +} +complete -F _lvresize lvresize + +_lvextend() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(A|-autobackup)) + COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) + return 0 + ;; + -@(L|-size)) + _sizes + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \ + --debug -h --help -i --stripes -I --stripesize \ + -l --extents -L --size -n --nofsck -r --resizefs \ + -t --test --type -v --verbose --version' -- $cur ) ) + else + _args + if [ $args -eq 0 ]; then + _logicalvolumes + else + _physicalvolumes + fi + fi +} +complete -F _lvextend lvextend + +_lvm() +{ + local prev + + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \ + lvcreate lvdisplay lvextend lvmchange \ + lvmdiskscan lvmsadc lvmsar lvreduce \ + lvremove lvrename lvresize lvs lvscan \ + pvchange pvcreate pvdata pvdisplay pvmove \ + pvremove pvresize pvs pvscan vgcfgbackup \ + vgcfgrestore vgchange vgck vgconvert \ + vgcreate vgdisplay vgexport vgextend \ + vgimport vgmerge vgmknodes vgreduce \ + vgremove vgrename vgs vgscan vgsplit \ + version' -- $cur ) ) + else + case ${COMP_WORDS[1]} in + pvchange) + _pvchange + ;; + pvcreate) + _pvcreate + ;; + pvdisplay) + _pvdisplay + ;; + pvmove) + _pvmove + ;; + pvremove) + _pvremove + ;; + pvresize) + _pvresize + ;; + pvs) + _pvs + ;; + pvscan) + _pvscan + ;; + vgcfgbackup) + _vgcfgbackup + ;; + vgcfgrestore) + _vgcfgrestore + ;; + vgchange) + _vgchange + ;; + vgck) + _vgck + ;; + vgconvert) + _vgconvert + ;; + vgcreate) + _vgcreate + ;; + vgdisplay) + _vgdisplay + ;; + vgexport) + _vgexport + ;; + vgextend) + _vgextend + ;; + vgimport) + _vgimport + ;; + vgmerge) + _vgmerge + ;; + vgmknodes) + _vgmknodes + ;; + vgreduce) + _vgreduce + ;; + vgremove) + _vgremove + ;; + vgrename) + _vgrename + ;; + vgs) + _vgs + ;; + vgscan) + _vgscan + ;; + vgsplit) + _vgsplit + ;; + lvchange) + _lvchange + ;; + lvcreate) + _lvcreate + ;; + lvdisplay) + _lvdisplay + ;; + lvextend) + _lvextend + ;; + lvreduce) + _lvreduce + ;; + lvremove) + _lvremove + ;; + lvrename) + _lvrename + ;; + lvresize) + _lvresize + ;; + lvs) + _lvs + ;; + lvscan) + _lvscan + ;; + esac + fi +} +complete -F _lvm lvm +} + +# mkinitrd(8) completion +# +have mkinitrd && +_mkinitrd() +{ + local cur args + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case "$prev" in + --preload) + _modules + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --@(with|builtin)) + _modules + return 0 + ;; + --@(fstab|dsdt)) + _filedir + return 0 + ;; + --tmpdir) + _filedir -d + return 0 + ;; + esac + fi + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version -v -f --preload \ + --with= --omit-scsi-modules --omit-raid-modules \ + --images-version --fstab= --nocompress --builtin= \ + --nopivot --noudev --allow-missing --tmpdir= \ + --initrdfs= --dsdt= --lvm-version= --froce-usb' \ + -- $cur ) ) + else + _count_args + + case $args in + 1) + _filedir + ;; + 2) + COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) ) + ;; + esac + fi + +} && +complete -F _mkinitrd mkinitrd + +# pkgconfig(1) completion +# +have pkg-config && +_pkg_config() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + # return list of available options + COMPREPLY=( $( compgen -W '-version --modversion \ + --atleast-pkgconfig-version= --libs --libs-only-l \ + --libs-only-other --libs-only-L --cflags \ + --cflags-only-I --cflags-only-other --variable= \ + --define-variable= --exists --uninstalled \ + --atleast-version= --exact-version= --max-version= \ + --list-all --debug --print-errors --silence-errors \ + --errors-to-stdout -? --help --usage' -- $cur)) + else + COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \ + awk '{print $1}' | grep "^$cur" ) ) + fi +} && +complete -F _pkg_config pkg-config + + +# cpio(1) completion +# +have cpio && { +_cpio_format() +{ + COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) ) +} + +_cpio() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case $prev in + -H) + _cpio_format + return 0 + ;; + -@(E|F|I)) + _filedir + return 0 + ;; + -R) + _usergroup + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _cpio_format + return 0 + ;; + --@(file|pattern-file)) + _filedir + return 0 + ;; + --owner) + _usergroup + return 0 + ;; + --rsh-command) + COMPREPLY=( $( compgen -c -- $cur ) ) + return 0 + ;; + esac + fi + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) ) + else + case ${COMP_WORDS[1]} in + -@(o|-create)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\ + -L -V -C -H -M -O -F --file= --format=\ + --message= --null --reset-access-time\ + --verbose --dot --append --block-size=\ + --dereference --io-size= --quiet\ + --force-local --rsh-command= --help\ + --version' -- $cur ) ) + fi + ;; + -@(i|-extract)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\ + -t -s -u -v -B -S -V -C -E -H -M -R -I\ + -F --file= --make-directories\ + --nonmatching\ + --preserve-modification-time\ + --numeric-uid-gid --rename -t --list\ + --swap-bytes --swap --dot\ + --unconditional --verbose --block-size=\ + --swap-halfwords --io-size=\ + --pattern-file= --format= --owner=\ + --no-preserve-owner --message=\ + --force-local --no-absolute-filenames\ + --sparse --only-verify-crc --quiet\ + --rsh-command= --help\ + --version' -- $cur ) ) + fi + ;; + -@(p|-pass-through)) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\ + -L -V -R --null --reset-access-time\ + --make-directories --link --quiet\ + --preserve-modification-time\ + --unconditional --verbose --dot\ + --dereference --owner=\ + --no-preserve-owner --sparse --help\ + --version' -- $cur ) ) + else + _filedir -d + fi + ;; + esac + fi +} +complete -F _cpio cpio +} + +# id(1) completion +# +have id && +_id() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\ + -r --real -u --user --help --version' -- $cur ) ) + else + COMPREPLY=( $( compgen -u $cur ) ) + fi +} && +complete -F _id id + +# getent(1) completion +# +have getent && +_getent() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + passwd) + COMPREPLY=( $( compgen -u $cur ) ) + return 0 + ;; + group) + COMPREPLY=( $( compgen -g $cur ) ) + return 0 + ;; + services) + COMPREPLY=( $( compgen -s $cur ) ) + return 0 + ;; + hosts) + COMPREPLY=( $( compgen -A hostname $cur ) ) + return 0 + ;; + protocols|networks|ahosts|ahostsv4|ahostsv6|rpc) + COMPREPLY=( $( getent $prev | \ + sed -ne 's|^\('$cur'[^[:space:]]*\).*|\1|p' ) ) + return 0 + ;; + aliases|shadow) + COMPREPLY=( $( getent $prev | \ + sed -ne 's|^\('$cur'[^:]*\).*|\1|p' ) ) + return 0 + ;; + esac + + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'passwd group hosts services \ + protocols networks ahosts ahostsv4 \ + ahostsv6 aliases ethers netgroup \ + rpc shadow' -- $cur ) ) + fi +} && +complete -F _getent getent + +# ntpdate(1) completion +# +have ntpdate && +_ntpdate() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -k) + _filedir + return 0 + ;; + -U) + COMPREPLY=( $( compgen -u $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\ + -e -k -p -o -r -t' -- $cur ) ) + else + _known_hosts + fi +} && +complete -F _ntpdate ntpdate + +# smartctl(8) completion +# +have smartctl && { +_smartctl_quietmode() +{ + COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) ) +} +_smartctl_device() +{ + COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) ) +} +_smartctl_tolerance() +{ + COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) ) +} +_smartctl_badsum() +{ + COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) ) +} +_smartctl_report() +{ + COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) ) +} +_smartctl_feature() +{ + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) +} +_smartctl_log() +{ + COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) ) +} +_smartctl_vendorattribute() +{ + COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \ + 9,temp 192,emergencyretractcyclect 193,loadunload \ + 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \ + 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) ) +} +_smartctl_firmwarebug() +{ + COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) ) +} +_smartctl_presets() +{ + COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) ) +} +_smartctl_test() +{ + COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) ) +} + +_smartctl() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case "$prev" in + -q) + _smartctl_quietmode + ;; + -d) + _smartctl_device + return 0 + ;; + -t) + _smartctl_tolerance + return 0 + ;; + -b) + _smartctl_badsum + return 0 + ;; + -r) + _smartctl_report + return 0 + ;; + -s) + _smartctl_feature + return 0 + ;; + -o) + _smartctl_feature + return 0 + ;; + -S) + _smartctl_feature + return 0 + ;; + -l) + _smartctl_log + return 0 + ;; + -v) + _smartctl_vendorattribute + return 0 + ;; + -F) + _smartctl_firmwarebug + return 0 + ;; + -P) + _smartctl_presets + return 0 + ;; + -t) + _smartctl_test + return 0 + ;; + esac + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --quietmode) + _smartctl_quietmode + return 0 + ;; + --device) + _smartctl_device + return 0 + ;; + --tolerance) + _smartctl_tolerance + return 0 + ;; + --badsum) + _smartctl_badsum + return 0 + ;; + --report) + _smartctl_report + return 0 + ;; + --smart) + _smartctl_feature + return 0 + ;; + --offlineauto) + _smartctl_feature + return 0 + ;; + --saveauto) + _smartctl_feature + return 0 + ;; + --log) + _smartctl_log + return 0 + ;; + --vendorattribute) + _smartctl_vendorattribute + return 0 + ;; + --firmwarebug) + _smartctl_firmwarebug + return 0 + ;; + --presets) + _smartctl_presets + return 0 + ;; + --test) + _smartctl_test + return 0 + ;; + esac + fi + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help --usage -V --version \ + --copyright --license-i --info -a --all -q \ + --quietmode= -d --device= -T --tolerance= -b --badsum= \ + -r --report= -s --smart= -o --offlineauto= -S \ + --saveauto= -H --health -c --capabilities -A \ + --attributes -l --log= -v --vendorattribute= -F \ + --firmwarebug= -P --presets= -t --test= -C \ + --captive -X --abort' -- $cur ) ) + else + cur=${cur:=/dev/} + _filedir + fi +} +complete -F _smartctl smartctl +} + +# sysctl(8) completion +# +have sysctl && +_sysctl() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) ) + + return 0 +} && +complete -F _sysctl sysctl + +# update-rc.d(8) completion +# +# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> +# +have update-rc.d && +_update_rc_d() +{ + local cur prev sysvdir services options valid_options + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ + || sysvdir=/etc/init.d + + services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) ) + services=( ${services[@]#$sysvdir/} ) + options=( -f -n ) + + if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then + valid_options=( $( \ + echo "${COMP_WORDS[@]} ${options[@]}" \ + | tr " " "\n" \ + | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \ + | sort | uniq -u \ + ) ) + COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \ + -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) ) + elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then + COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) ) + elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then + COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) + elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then + COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) + elif [[ "$prev" == defaults && -z "$cur" ]]; then + COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k ) + elif [[ "$prev" == ?(start|stop) ]]; then + if [[ "$cur" == [0-9] || -z "$cur" ]]; then + COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) + elif [[ "$cur" == [0-9][0-9] ]]; then + COMPREPLY=( $cur ) + else + COMPREPLY=() + fi + elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then + if [[ -z "$cur" ]]; then + if [[ $prev == [0-9][0-9] ]]; then + COMPREPLY=( 0 1 2 3 4 5 6 S ) + else + COMPREPLY=( 0 1 2 3 4 5 6 S . ) + fi + elif [[ "$cur" == [0-6S.] ]]; then + COMPREPLY=( $cur ) + else + COMPREPLY=() + fi + elif [[ "$prev" == "." ]]; then + COMPREPLY=( $(compgen -W "start stop" -- $cur) ) + else + COMPREPLY=() + fi + + return 0 +} && +complete -F _update_rc_d update-rc.d + +# invoke-rc.d(8) completion +# +# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com> +# +have invoke-rc.d && +_invoke_rc_d() +{ + local cur prev sysvdir services options valid_options + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ + || sysvdir=/etc/init.d + + services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm@(orig|new|save))) ) + services=( ${services[@]#$sysvdir/} ) + options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback ) + + if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then + valid_options=( $( \ + echo ${COMP_WORDS[@]} ${options[@]} \ + | tr " " "\n" \ + | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \ + | sort | uniq -u \ + ) ) + COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \ + $cur ) ) + elif [ -x $sysvdir/$prev ]; then + COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ + s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ + $sysvdir/$prev`' -- \ + $cur ) ) + else + COMPREPLY=() + fi + + return 0 +} && +complete -F _invoke_rc_d invoke-rc.d + +# minicom(1) completion +# +have minicom && +_minicom() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(a|c)) + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) + return 0 + ;; + -@(S|C)) + _filedir + return 0 + ;; + -P) + COMPREPLY=( $( command ls /dev/tty* ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) ) + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \ + -c -S -d -p -C -T -8' -- $cur ) ) + else + COMPREPLY=( $( command ls /etc/minicom/minirc.* 2>/dev/null | sed -e 's|/etc/minicom/minirc.||' | grep "^$cur" ) ) + fi +} && +complete -F _minicom minicom + +have rrdtool && +_rrdtool () +{ + cur=`_get_cword` + COMPREPLY=( $( compgen -W 'create update updatev graph dump \ + restore last lastupdate first info \ + fetch tune resize xport' -- $cur ) ) +} && +complete -F _rrdtool rrdtool + +_filedir_xspec() +{ + local IFS cur xspec + + IFS=$'\t\n' + COMPREPLY=() + cur=`_get_cword` + + _expand || return 0 + + # get first exclusion compspec that matches this command + xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \ + $BASH_COMPLETION ) + # prune to leave nothing but the -X spec + xspec=${xspec#*-X } + xspec=${xspec%% *} + + local -a toks + local tmp + + toks=( ${toks[@]-} $( + compgen -d -- "$(quote_readline "$cur")" | { + while read -r tmp; do + # see long TODO comment in _filedir() --David + echo $tmp + done + } + )) + + toks=( ${toks[@]-} $( + eval compgen -f -X "$xspec" -- "\$(quote_readline "\$cur")" | { + while read -r tmp; do + [ -n $tmp ] && echo $tmp + done + } + )) + + COMPREPLY=( "${toks[@]}" ) +} +list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \ + $BASH_COMPLETION | \ + # read exclusion compspecs + ( + while read line + do + # ignore compspecs that are commented out + if [ "${line#\#}" != "$line" ]; then continue; fi + line=${line%# START exclude*} + line=${line%# FINISH exclude*} + line=${line##*\'} + list=( "${list[@]}" $line ) + done + echo "${list[@]}" + ) + ) ) +# remove previous compspecs +if [ ${#list[@]} -gt 0 ]; then + eval complete -r ${list[@]} + # install new compspecs + eval complete -F _filedir_xspec $filenames "${list[@]}" +fi +unset list + +# source completion directory definitions +if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \ + -x $BASH_COMPLETION_DIR ]; then + for i in $BASH_COMPLETION_DIR/*; do + [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) ]] && + [ \( -f $i -o -h $i \) -a -r $i ] && . $i + done +fi +unset i + +# source user completion file +[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \ + && . ~/.bash_completion +unset -f have +unset UNAME RELEASE default dirnames filenames have nospace bashdefault \ + plusdirs + +set $BASH_COMPLETION_ORIGINAL_V_VALUE +unset BASH_COMPLETION_ORIGINAL_V_VALUE diff --git a/bash_completion.sh b/bash_completion.sh new file mode 100644 index 00000000..915960b6 --- /dev/null +++ b/bash_completion.sh @@ -0,0 +1,12 @@ +# Check for interactive bash and that we haven't already been sourced. +[ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$BASH_COMPLETION" ] && return + +# Check for recent enough version of bash. +bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.} +if [ $bmajor -eq 2 -a $bminor '>' 04 ] || [ $bmajor -gt 2 ]; then + if [ -r /etc/bash_completion ]; then + # Source completion code. + . /etc/bash_completion + fi +fi +unset bash bminor bmajor diff --git a/configure b/configure new file mode 100755 index 00000000..60b1ed16 --- /dev/null +++ b/configure @@ -0,0 +1,3351 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.63 for bash-completion 1.0. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 </dev/null 6>&1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='bash-completion' +PACKAGE_TARNAME='bash-completion' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='bash-completion 1.0' +PACKAGE_BUGREPORT='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures bash-completion 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/bash-completion] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of bash-completion 1.0:";; + esac + cat <<\_ACEOF + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +bash-completion configure 1.0 +generated by GNU Autoconf 2.63 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by bash-completion $as_me 1.0, which was +generated by GNU Autoconf 2.63. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version='1.10' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + +done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='bash-completion' + VERSION='1.0' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by bash-completion $as_me 1.0, which was +generated by GNU Autoconf 2.63. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTION]... [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +bash-completion config.status 1.0 +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr='
' +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' <conf$$subs.awk | sed ' +/^[^""]/{ + N + s/\n// +} +' >>$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + ac_file_inputs="$ac_file_inputs '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..3c7bf00a --- /dev/null +++ b/configure.ac @@ -0,0 +1,5 @@ +AC_PREREQ([2.59]) +AC_INIT([bash-completion], [1.0]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/contrib/_subversion b/contrib/_subversion new file mode 100644 index 00000000..5489f8a3 --- /dev/null +++ b/contrib/_subversion @@ -0,0 +1,426 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# svn completion +# +have svn && +{ +_svn() +{ + local cur prev commands options command + + COMPREPLY=() + cur=`_get_cword` + + commands='add blame praise annotate ann cat checkout co cleanup commit \ + ci copy cp delete del remove rm diff di export help ? h import \ + info list ls lock log merge mkdir move mv rename ren \ + propdel pdel pd propedit pedit pe propget pget pg \ + proplist plist pl propset pset ps resolved revert \ + status stat st switch sw unlock update up' + + if [[ $COMP_CWORD -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- $cur ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + fi + else + + prev=${COMP_WORDS[COMP_CWORD-1]} + case $prev in + --config-dir) + _filedir -d + return 0; + ;; + -@(F|-file|-targets)) + _filedir + return 0; + ;; + --encoding) + COMPREPLY=( $( compgen -W \ + '$( iconv --list | sed -e "s@//@@;" )' \ + -- "$cur" ) ) + return 0; + ;; + --@(editor|diff|diff3)-cmd) + COMP_WORDS=(COMP_WORDS[0] $cur) + COMP_CWORD=1 + _command + return 0; + ;; + esac + + command=${COMP_WORDS[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + case $command in + add) + options='--auto-props --no-auto-props \ + --force --targets --no-ignore \ + --non-recursive -N -q --quiet' + ;; + @(blame|annotate|ann|praise)) + options='-r --revisions --username \ + --password --no-auth-cache \ + --non-interactive -v \ + --verbose --incremental --xml' + ;; + cat) + options='-r --revision --username \ + --password --no-auth-cache \ + --non-interactive' + ;; + @(checkout|co)) + options='-r --revision -q --quiet -N \ + --non-recursive --username \ + --password --no-auth-cache \ + --non-interactive \ + --ignore-externals' + ;; + cleanup) + options='--diff3-cmd' + ;; + @(commit|ci)) + options='-m --message -F --file \ + --encoding --force-log -q \ + --quiet --non-recursive -N \ + --targets --editor-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive --no-unlock' + ;; + @(copy|cp)) + options='-m --message -F --file \ + --encoding --force-log -r \ + --revision -q --quiet \ + --editor-cmd -username \ + --password --no-auth-cache \ + --non-interactive' + ;; + @(delete|del|remove|rm)) + options='--force -m --message -F \ + --file --encoding --force-log \ + -q --quiet --targets \ + --editor-cmd -username \ + --password --no-auth-cache \ + --non-interactive' + ;; + @(diff|di)) + options='-r --revision -x --extensions \ + --diff-cmd --no-diff-deleted \ + -N --non-recursive --username \ + --password --no-auth-cache \ + --non-interactive --force \ + --old --new --notice-ancestry' + ;; + export) + options='-r --revision -q --quiet \ + --username --password \ + --no-auth-cache \ + --non-interactive -N \ + --non-recursive --force \ + --native-eol --ignore-externals' + ;; + import) + options='--auto-props --no-auto-props \ + -m --message -F --file \ + --encoding --force-log -q \ + --quiet --non-recursive \ + --no-ignore --editor-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive' + ;; + info) + options='--username --password \ + --no-auth-cache \ + --non-interactive -r \ + --revision --xml --targets \ + -R --recursive --incremental' + ;; + @(list|ls)) + options='-r --revision -v --verbose -R \ + --recursive --username \ + --password --no-auth-cache \ + --non-interactive \ + --incremental --xml' + ;; + lock) + options='-m --message -F --file \ + --encoding --force-log \ + --targets --force --username \ + --password --no-auth-cache \ + --non-interactive' + ;; + log) + options='-r --revision -v --verbose \ + --targets --username \ + --password --no-auth-cache \ + --non-interactive \ + --stop-on-copy --incremental \ + --xml -q --quiet --limit' + ;; + merge) + options='-r --revision -N \ + --non-recursive -q --quiet \ + --force --dry-run --diff3-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive \ + --ignore-ancestry' + ;; + mkdir) + options='-m --message -F --file \ + --encoding --force-log -q \ + --quiet --editor-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive' + ;; + @(move|mv|rename|ren)) + options='-m --message -F --file \ + --encoding --force-log -r \ + --revision -q --quiet \ + --force --editor-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive' + ;; + @(propdel|pdel|pd)) + options='-q --quiet -R --recursive -r \ + --revision --revprop \ + --username --password \ + --no-auth-cache \ + --non-interactive' + ;; + @(propedit|pedit|pe)) + options='-r --revision --revprop \ + --encoding --editor-cmd \ + --username --password \ + --no-auth-cache \ + --non-interactive --force' + ;; + @(propget|pget|pg)) + options='-R --recursive -r --revision \ + --revprop --strict --username \ + --password --no-auth-cache \ + --non-interactive' + ;; + @(proplist|plist|pl)) + options='-v --verbose -R --recursive \ + -r --revision --revprop -q \ + --quiet --username --password \ + --no-auth-cache \ + --non-interactive' + ;; + @(propset|pset|ps)) + options='-F --file -q --quiet \ + --targets -R --recursive \ + --revprop --encoding \ + --username --password \ + --no-auth-cache \ + --non-interactive -r \ + --revision --force' + ;; + resolved) + options='--targets -R --recursive -q \ + --quiet' + ;; + revert) + options='--targets -R --recursive -q \ + --quiet' + ;; + @(status|stat|st)) + options='-u --show-updates -v \ + --verbose -N --non-recursive \ + -q --quiet --username \ + --password --no-auth-cache \ + --non-interactive --no-ignore \ + --ignore-externals \ + --incremental --xml' + ;; + @(switch|sw)) + options='--relocate -r --revision -N \ + --non-recursive -q --quiet \ + --username --password \ + --no-auth-cache \ + --non-interactive --diff3-cmd' + ;; + unlock) + options='--targets --force --username \ + --password --no-auth-cache \ + --non-interactive' + ;; + @(update|up)) + options='-r --revision -N \ + --non-recursive -q --quiet \ + --username --password \ + --no-auth-cache \ + --non-interactive \ + --diff3-cmd --ignore-externals' + ;; + esac + options="$options --help -h --config-dir" + + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + if [[ "$command" == @(help|h|\?) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + else + _filedir + fi + fi + fi + + return 0 +} +complete -F _svn $filenames svn + +_svnadmin() +{ + local cur prev commands options mode + + COMPREPLY=() + cur=`_get_cword` + + commands='create deltify dump help ? hotcopy list-dblogs \ + list-unused-dblogs load lslocks lstxns recover rmlocks \ + rmtxns setlog verify' + + if [[ $COMP_CWORD -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- $cur ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + fi + else + prev=${COMP_WORDS[COMP_CWORD-1]} + case $prev in + --config-dir) + _filedir -d + return 0; + ;; + --fs-type) + COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) ) + return 0; + ;; + esac + + command=${COMP_WORDS[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + case $command in + create) + options='--bdb-txn-nosync \ + --bdb-log-keep --config-dir \ + --fs-type' + ;; + deltify) + options='-r --revision -q --quiet' + ;; + dump) + options='-r --revision --incremental \ + -q --quiet --deltas' + ;; + hotcopy) + options='--clean-logs' + ;; + load) + options='--ignore-uuid --force-uuid \ + --parent-dir -q --quiet \ + --use-pre-commit-hook \ + --use-post-commit-hook' + ;; + rmtxns) + options='-q --quiet' + ;; + setlog) + options='-r --revision --bypass-hooks' + ;; + esac + + options="$options --help -h" + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + if [[ "$command" == @(help|h|\?) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + else + _filedir + fi + fi + fi + + return 0 +} +complete -F _svnadmin $default svnadmin + +_svnlook() +{ + local cur prev commands options mode + + COMPREPLY=() + cur=`_get_cword` + + commands='author cat changed date diff dirs-changed help ? h history \ + info lock log propget pget pg proplist plist pl tree uuid \ + youngest' + + if [[ $COMP_CWORD -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- $cur ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + fi + else + command=${COMP_WORDS[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + case $command in + @(author|cat|date|dirs-changed|info|log)) + options='-r --revision -t \ + --transaction' + ;; + changed) + options='-r --revision -t \ + --transaction --copy-info' + ;; + diff) + options='-r --revision -t \ + --transaction \ + --no-diff-deleted \ + --no-diff-added \ + --diff-copy-from' + ;; + history) + options='-r --revision --show-ids' + ;; + prop@(get|list)) + options='-r --revision -t \ + --transaction --revprop' + ;; + tree) + options='-r --revision -t \ + --transaction --show-ids \ + --full-paths' + ;; + esac + + options="$options --help -h" + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + if [[ "$command" == @(help|h|\?) ]]; then + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + else + _filedir + fi + fi + fi + + return 0 +} +complete -F _svnlook $default svnlook +} diff --git a/contrib/apache2ctl b/contrib/apache2ctl new file mode 100644 index 00000000..8794b4a9 --- /dev/null +++ b/contrib/apache2ctl @@ -0,0 +1,18 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# apache2ctl(1) completion +# +have apache2ctl && { +_apache2ctl() { + local APWORDS + + COMPREPLY=() + cur=`_get_cword` + + APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | tr "|" " ") + + COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) ) +} +complete -F _apache2ctl apache2ctl +} diff --git a/contrib/bitkeeper b/contrib/bitkeeper new file mode 100644 index 00000000..8e1cc3cd --- /dev/null +++ b/contrib/bitkeeper @@ -0,0 +1,20 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# BitKeeper completion adapted from code by Bart Trojanowski <bart@jukie.net> + +_bk() { + local BKCMDS + + COMPREPLY=() + cur=`_get_cword` + + BKCMDS="$( bk help topics | grep '^ bk' | cut -d ' ' -f 4 | \ + xargs echo )" + + COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) ) + _filedir + + return 0 +} +complete -F _bk bk diff --git a/contrib/bittorrent b/contrib/bittorrent new file mode 100644 index 00000000..a240d47c --- /dev/null +++ b/contrib/bittorrent @@ -0,0 +1,38 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# btdownloadheadless(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_btdownload() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --@(responsefile|saveas)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--max_uploads --keepalive_interval \ + --download_slice_size --request_backlog \ + --max_message_length --ip --minport --maxport \ + --responsefile --url --saveas --timeout \ + --timeout_check_interval --max_slice_length \ + --max_rate_period --bind --upload_rate_fudge \ + --display_interval --rerequest_interval \ + --min_peers --http_timeout --max_initiate \ + --max_allow_in --check_hashes \ + --max_upload_rate --snub_time --spew \ + --rarest_first_cutoff --min_uploads \ + --report_hash_failures' -- $cur ) ) + else + _filedir + fi +} +complete -F _btdownload btdownloadheadless.py btdownloadcurses.py btdownloadgui.py diff --git a/contrib/brctl b/contrib/brctl new file mode 100644 index 00000000..1ecdc127 --- /dev/null +++ b/contrib/brctl @@ -0,0 +1,44 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for brctl + +have brctl && +_brctl() +{ + local cur command + + COMPREPLY=() + cur=`_get_cword` + command=${COMP_WORDS[1]} + + case $COMP_CWORD in + 1) + COMPREPLY=( $( compgen -W "addbr delbr addif delif \ + setageing setbridgeprio setfd sethello \ + setmaxage setpathcost setportprio show \ + showmacs showstp stp" -- $cur ) ) + ;; + 2) + case $command in + show) + ;; + *) + COMPREPLY=( $( compgen -W "$(brctl \ + show | sed '1d' | \ + awk '{print $1}' )" -- $cur ) ) + esac + ;; + 3) + case $command in + @(add|del)if) + _configured_interfaces + ;; + stp) + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) + ;; + esac + ;; + esac +} && +complete -F _brctl $default brctl diff --git a/contrib/cksfv b/contrib/cksfv new file mode 100644 index 00000000..f759e9ee --- /dev/null +++ b/contrib/cksfv @@ -0,0 +1,30 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# cksfv completion by Chris <xris@forevermore.net> + +_cksfv() +{ + COMPREPLY=() + cur=`_get_cword` + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W '-C -f -i -q -v' -- $cur ) ) + return 0 + fi + + case "${COMP_WORDS[$COMP_CWORD-1]}" in + -C) + _filedir -d + return 0 + ;; + -f) + _filedir 'sfv' + return 0 + ;; + esac + + _filedir + return 0 +} +complete -F _cksfv cksfv diff --git a/contrib/clisp b/contrib/clisp new file mode 100644 index 00000000..6c6d9b63 --- /dev/null +++ b/contrib/clisp @@ -0,0 +1,26 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash brogrammable completion for various Common Lisp implementations by +# Nikodemus Siivola <nikodemus@random-state.net> + +_clisp() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help --version --license -B -K \ + -M -m -L -N -E -q --quiet --silent -w -I -ansi \ + -traditional -p -C -norc -i -c -l -o -x ' \ + -- $cur ) ) + else + _filedir + fi + + return 0 +} +complete -F _clisp $default clisp diff --git a/contrib/cowsay b/contrib/cowsay new file mode 100644 index 00000000..d9f8bc46 --- /dev/null +++ b/contrib/cowsay @@ -0,0 +1,26 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for cowsay + +have cowsay && +_cowsay() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -f) + COMPREPLY=( $( cowsay -l | tail -n +2 | tr " " "\n" | grep "^$cur" ) ) + return 0 + ;; + esac + + # relevant options completion + COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' -- $cur ) ) + +} && +complete -F _cowsay $default cowsay cowthink diff --git a/contrib/cpan2dist b/contrib/cpan2dist new file mode 100644 index 00000000..caec18fa --- /dev/null +++ b/contrib/cpan2dist @@ -0,0 +1,45 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for cpan2dist + +have cpan2dist && +_cpan2dist() +{ + local cur prev packagelist cpandirs + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + --format) + # should remove ":" from COMP_WORDBREAKS, but doesn't work (?) + COMPREPLY=( $( compgen -W '$(perl -MCPANPLUS::Dist -e "print map { \"\$_\n\" } CPANPLUS::Dist->dist_types")' -- "$cur" ) ) + return 0 + ;; + --@(banlist|ignorelist|modulelist|logfile)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help --skiptest --force --install \ + --verbose --keepsource --makefile --buildprereq \ + --archive --flushcache --defaults --edit-metafile \ + --format --ban --banlist --ignore --ignorelist \ + --modulelist --logfile --timeout --set-config \ + --set-program --dist-opts --default-banlist \ + --default-ignorelist' -- $cur ) ) + else + cpandirs=( "$HOME/.cpanplus/" "$HOME/.cpan/source/modules/" ) + for dir in ${cpandirs[@]}; do + [ -d "$dir" -a -r "$dir/02packages.details.txt.gz" ] && packagelist="$dir/02packages.details.txt.gz" + done + COMPREPLY=( $( zgrep "^${cur//-/::}" \ + $packagelist 2>/dev/null \ + | awk '{print $1}' | sed -e 's/::/-/g' ) ) + fi +} && +complete -F _cpan2dist $default cpan2dist diff --git a/contrib/dsniff b/contrib/dsniff new file mode 100644 index 00000000..614005a2 --- /dev/null +++ b/contrib/dsniff @@ -0,0 +1,272 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# dsniff util completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +# arpspoof(8) completion +# +_arpspoof() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + -t) + _known_hosts + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -t' -- $cur ) ) + else + _known_hosts + fi + +} +complete -F _arpspoof arpspoof + +# dnsspoof(8) completion +# +_dnsspoof() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + -f) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -f' -- $cur ) ) + fi + +} +complete -F _dnsspoof dnsspoof + +# dsniff(8) completion +# +_dsniff() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(r|w|f)) + _filedir + return 0 + ;; + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -d -m -n -i -s -f -t \ + -r -w' -- $cur ) ) + fi + +} +complete -F _dsniff dsniff + +# filesnarf(8), mailsnarf(8) and msgsnarf (8) completion +# +_snarf() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -v' -- $cur ) ) + fi + +} +complete -F _snarf filesnarf mailsnarf msgsnarf + +# macof(8) completion +# +_macof() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -s -d -e -x -y -n' -- $cur ) ) + fi + +} +complete -F _macof macof + +# sshmitm(8) completion +# +_sshmitm() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d -I -p' -- $cur ) ) + else + _known_hosts + fi + +} +complete -F _sshmitm sshmitm + +# sshow(8) completion +# +_sshow() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d -i' -- $cur ) ) + fi + +} +complete -F _sshow sshow + +# tcpkill(8) completion +# +_tcpkill() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-i -1 -2 -3 -4 -5 -6 -7 -8 -9' -- $cur ) ) + fi + +} +complete -F _tcpkill tcpkill + +# tcpnice(8) completion +# +_tcpnice() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A -I -M -i' -- $cur ) ) + fi + +} +complete -F _tcpnice tcpnice + +# urlsnarf(8) completion +# +_urlsnarf() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -i) + _interfaces + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-n -i -v' -- $cur ) ) + fi + +} +complete -F _urlsnarf urlsnarf + +# webmitm(8) completion +# +_webmitm() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d' -- $cur ) ) + else + _known_hosts + fi + +} +complete -F _webmitm webmitm diff --git a/contrib/freeciv b/contrib/freeciv new file mode 100644 index 00000000..0a5cf359 --- /dev/null +++ b/contrib/freeciv @@ -0,0 +1,64 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# civserver completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_civserver() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(f|g|l|r|-file|-log|-gamelog|-read)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d -f -g -h -i -l -m -M -p -q -r -v\ + --debug --file --gamelog --help --info --log --meta \ + --Metaserver --port --quitidle --read --version' \ + -- $cur ) ) + fi + +} +complete -F _civserver civserver + +# civclient completion by Guillaume Rousse <rousse@ccr.jussieu.fr> +# +_civclient() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(l|S|t|-log|-Sound|-tiles)) + _filedir + return 0 + ;; + -@(P|-Plugin)) + COMPREPLY=( $( compgen -W 'none esd sdl' -- $cur ) ) + return 0 + ;; + -@(s|-server)) + _known_hosts + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a -d -h -l -m -n -p -P -s -S -t -v\ + --autoconnect --debug --help --log --meta --name \ + --port --Plugin --server --Sound --tiles --version' \ + -- $cur ) ) + fi + +} +complete -F _civclient civclient diff --git a/contrib/gcl b/contrib/gcl new file mode 100644 index 00000000..dd4f25e0 --- /dev/null +++ b/contrib/gcl @@ -0,0 +1,25 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola <nikodemus@random-state.net> + +_gcl() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-eval -load -f -batch -dir -libdir \ + -compile -o-file -c-file -h-file -data-file -system-p '\ + -- $cur ) ) + else + _filedir + fi + + return 0 +} +complete -F _gcl -o default gcl diff --git a/contrib/gkrellm b/contrib/gkrellm new file mode 100644 index 00000000..43603b10 --- /dev/null +++ b/contrib/gkrellm @@ -0,0 +1,37 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# gkrellm(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_gkrellm() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(t|-theme)) + _filedir -d + return 0 + ;; + -@(p|-plugin)) + _filedir 'so' + return 0 + ;; + -@(s|-server)) + _known_hosts + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--help -t --theme -s --server \ + -g --geometry -wm -w --withdrawn -c --config -nc \ + -f --force-host-config -demo -p --plugin -P \ + --port' -- $cur ) ) + fi + +} +complete -F _gkrellm gkrellm gkrellm2 diff --git a/contrib/gnatmake b/contrib/gnatmake new file mode 100644 index 00000000..e4d4e41f --- /dev/null +++ b/contrib/gnatmake @@ -0,0 +1,32 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# Gnatmake completion by Ralf_Schroth@t-online.de (Ralf Schroth) + +_gnatmake() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + # relevant (and less relevant ;-) )options completion + COMPREPLY=( $( compgen -W '-a -c -f -i -j -k -m -M -n -o \ + -q -s -v -z -aL -A -aO -aI -I -I- -L -nostdinc \ + -nostdlib -cargs -bargs -largs -fstack-check \ + -fno-inline -g -O1 -O0 -O2 -O3 -gnata -gnatA \ + -gnatb -gnatc -gnatd -gnatD -gnate -gnatE \ + -gnatf -gnatF -gnatg -gnatG -gnath -gnati \ + -gnatk -gnatl -gnatL -gnatm -gnatn -gnato \ + -gnatO -gnatp -gnatP -gnatq -gnatR -gnats \ + -gnatt -gnatT -gnatu -gnatU -gnatv -gnatws \ + -gnatwe -gnatwl -gnatwu -gnatW -gnatx -gnatX \ + -gnaty -gnatz -gnatZ -gnat83' -- $cur ) ) + else + # source file completion + _filedir '@(adb|ads)' + + fi +} +complete -F _gnatmake -o filenames gnatmake diff --git a/contrib/gpg2 b/contrib/gpg2 new file mode 100644 index 00000000..c41aa0af --- /dev/null +++ b/contrib/gpg2 @@ -0,0 +1,44 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# gpg2(1) completion +# +have gpg2 && { +_gpg2 () +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + --homedir) + _filedir -d + return 0 + ;; + -@(s|-sign|-clearsign|-options|-decrypt)) + _filedir + return 0 + ;; + --@(export|@(?(l|nr|nrl)sign|edit)-key)) + # return list of public keys + COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) + return 0 + ;; + -@(r|-recipient)) + COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | sed -ne 's@^.*<\([^>]*\)>.*$@\1@p')" -- "$cur" )) + if [ -e ~/.gnupg/gpg.conf ]; then + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf)" -- "$cur")) + fi + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-s -b -e -c -d -k -K -a -r -u -z -o -v \ + -n -N -i -h -R -t $(gpg2 --dump-options)' -- $cur ) ) + fi +} && +complete -F _gpg2 $default gpg2 +} diff --git a/contrib/harbour b/contrib/harbour new file mode 100644 index 00000000..0d111bd1 --- /dev/null +++ b/contrib/harbour @@ -0,0 +1,8 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# harbour completion by Dave Pearson <davep@davep.org> +# http://www.harbour-project.org/ + +complete -f -X '!*.@([Pp][Rr][Gg]|[Cc][Ll][Pp])' harbour gharbour hbpp +complete -f -X '!*.[Hh][Rr][Bb]' hbrun diff --git a/contrib/isql b/contrib/isql new file mode 100644 index 00000000..fd66af58 --- /dev/null +++ b/contrib/isql @@ -0,0 +1,13 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# isql completion by Victor Bogado da Silva Lins <victor@bogado.net> + +_isql() +{ + local cur + cur=`_get_cword` + + [ -f "$ODBCINI" ] && COMPREPLY=( $( grep \\[$cur "$ODBCINI" | tr -d \\[\\] ) ) +} +complete -F _isql isql diff --git a/contrib/larch b/contrib/larch new file mode 100644 index 00000000..3ec04014 --- /dev/null +++ b/contrib/larch @@ -0,0 +1,39 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# larch(1) completion by Alex Shinn <foof@synthcode.com> + +_larch() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then + COMPREPLY=( $( compgen -W ' \ +my-id my-default-archive register-archive whereis-archive archives \ +init-tree tree-root tree-version set-tree-version inventory tagging-method \ +tree-lint missing-tags add delete move explicit-default set-manifest \ +manifest check-manifest mkpatch dopatch patch-report empty-patch \ +make-archive make-category make-branch make-version categories \ +branches versions revisions cat-archive-log archive-cache-revision \ +archive-cached-revisions archive-uncache-revision category-readme \ +branch-readme version-readme make-log logs add-log log-ls cat-log \ +log-header-field changelog log-for-merge merge-points new-on-branch \ +import commit get get-patch lock-branch lock-revision push-mirror \ +build-config update-config replay-config record-config show-config \ +config-history update replay delta-patch star-merge tag prepare-branch \ +finish-branch join-branch whats-missing what-changed file-diffs pristines \ +lock-pristine my-revision-library library-find library-add library-remove \ +library-archives library-categories library-branches library-versions \ +library-revisions library-log library-file touched-files-prereqs \ +patch-set-web update-distributions distribution-name notify my-notifier \ +mail-new-categories mail-new-branches mail-new-versions mail-new-revisions \ +notify-library notify-browser push-new-revisions sendmail-mailx' $cur )) + fi + + return 0 +} +complete -F _larch -o default larch diff --git a/contrib/lilypond b/contrib/lilypond new file mode 100644 index 00000000..9c523efd --- /dev/null +++ b/contrib/lilypond @@ -0,0 +1,6 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# lilypond completion by Laurent Martelli <laurent@bearteam.org> + +complete -f -X '!*.ly' lilypond ly2dvi diff --git a/contrib/lisp b/contrib/lisp new file mode 100644 index 00000000..be8e1f92 --- /dev/null +++ b/contrib/lisp @@ -0,0 +1,26 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola <nikodemus@random-state.net> + +_lisp() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-core -lib -batch -quit -edit -eval -init \ + -dynamic-space-size -hinit -noinit -nositeinit -load \ + -slave ' \ + -- $cur ) ) + else + _filedir + fi + + return 0 +} +complete -F _lisp -o default lisp diff --git a/contrib/lzma b/contrib/lzma new file mode 100644 index 00000000..99005bc8 --- /dev/null +++ b/contrib/lzma @@ -0,0 +1,42 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# lzma(1) completion by Per Øyvind Karlsen <peroyvind@mandriva.org> +# +have lzma && +_lzma() +{ + local cur prev xspec + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \ + -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \ + --help --decompress --compress --keep --force \ + --test --stdout --quiet --verbose --license \ + --version --small --fast --best --text' -- $cur ) ) + return 0 + fi + + local IFS=$'\t\n' + + xspec="*.lzma" + if [[ "$prev" == --* ]]; then + [[ "$prev" == --decompress || \ + "$prev" == --list || \ + "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --compress ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec + [[ "$prev" == -*z* ]] && xspec= + fi + + _expand || return 0 + + COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \ + $( compgen -d -- $cur ) ) +} && +complete -F _lzma $filenames lzma diff --git a/contrib/lzop b/contrib/lzop new file mode 100644 index 00000000..59a7a429 --- /dev/null +++ b/contrib/lzop @@ -0,0 +1,53 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# lzop(1) completion + +have lzop && +_lzop() +{ + local cur prev xspec + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # TODO: -p: takes a dir argument, without a separating space + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-d -x -l -t -h -I -V -L -1 -2 -3 \ + -4 -5 -6 -7 -8 -9 -q -v -c -f -F -n -N -P -k -U -o \ + -S --fast --best --decompress --uncompress --extract \ + --test --list --ls --info --sysinfo --license --help \ + --version --stdout --to-stdout --output --path \ + --force --no-checksum --no-name --name --no-mode \ + --no-time --suffix --keep --unlink --delete --crc32 \ + --no-warn --ignore-warn --quiet --silent --verbose \ + --no-stdin --filter --checksum --no-color --mono \ + --color' -- $cur ) ) + return 0 + fi + + case "$prev" in + -o|--output) _filedir ; return 0 ;; + --path) _filedir -d ; return 0 ;; + -S|--suffix) return 0 ;; + esac + + xspec="*.?(t)lzo" + case "$prev" in + --@(@(de|un)compress|extract|list|ls|info|test)) + xspec="!"$xspec ;; + --force) xspec= ;; + --*) ;; + -*f*|'<'|'>') xspec= ;; + -*[dltx]*) xspec="!"$xspec ;; + esac + + _expand || return 0 + + local IFS=$'\t\n' + COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \ + $( compgen -d -- $cur ) ) +} && +complete -F _lzop $filenames lzop diff --git a/contrib/mailman b/contrib/mailman new file mode 100644 index 00000000..45b7db36 --- /dev/null +++ b/contrib/mailman @@ -0,0 +1,533 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# Mailman completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_mailman_lists() +{ + COMPREPLY=( $( list_lists -b | grep "^$cur") ) +} + +_add_members() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(r|d|-regular-members-file=|-digest-members-file=)) + _filedir + return 0 + ;; + -@(w|a|-welcome-msg=|-admin-notify=)) + COMPREPLY=( $( compgen -W 'y n' -- $cur) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--regular-members-file= -r \ + --digest-members-file= -d --welcome-msg= -w \ + --admin-notify= -a --help -h' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _add_members add_members + +_remove_members() +{ + + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(f|-file=)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--file= -f --all -a \ + --fromall --nouserack -n --noadminack -N \ + --help -h' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _remove_members remove_members + +_find_member() +{ + + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(l|x|-listname=|-exclude=)) + _mailman_lists + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --listname= -x \ + --exclude= --owners -w --help -h' -- $cur ) ) + fi + +} +complete -F _find_member find_member + +_clone_member() +{ + + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(l|-listname=)) + _mailman_lists + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --listname= --remove -r \ + --admin -a --quiet -q --nomodify -n --help -h' -- $cur ) ) + fi + +} +complete -F _clone_member clone_member + +_sync_members() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=)) + COMPREPLY=( $( compgen -W 'y n' -- $cur) ) + return 0 + ;; + -@(d|-file)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--no-change -n --welcome-msg= -w \ + --goodbye-msg= -g --digest= -d --notifyadmin= -a \ + -f --file -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _sync_members sync_members + +_list_lists() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --advertised \ + --virtual-host-overview= -V -b --bare \ + -h --help' -- $cur ) ) + fi + +} +complete -F _list_lists list_lists + +_unshunt() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-h --help' -- $cur ) ) + else + _filedir -d + fi + +} +complete -F _unshunt unshunt + +_list_admins() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all-vhost= -v \ + --all -a -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _list_admins list_admins + +_list_owners() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-w --with-listnames \ + -m --moderators -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _list_owners list_owners + +_list_members() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(o|-output)) + _filedir + return 0 + ;; + -@(d|-digest=)) + COMPREPLY=( $( compgen -W 'mime plain' -- $cur) ) + return 0 + ;; + -@(n|-nomail=)) + COMPREPLY=( $( compgen -W 'byadmin byuser bybounce unknown' -- $cur) ) + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--output -o --regular -r \ + --digest= -d --nomail= -n --fullnames -f \ + --preserve -p -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _list_members list_members + +_change_pw() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(l|-listname=)) + _mailman_lists + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all --domain= -d --listname= -l \ + --password= -p --quiet -q -h --help' -- $cur ) ) + fi + +} +complete -F _change_pw change_pw + +_withlist() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --lock -i --interactive \ + -r --run -a --all -q --quiet -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _withlist withlist + +_newlist() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --language -q --quiet -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _newlist newlist + +_rmlist() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--archives -a \ + -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _rmlist rmlist + +_config_list() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(i|o|-inputfile|-outputfile)) + _filedir + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--inputfile -i --outputfile -o \ + --checkonly -c --verbose -v -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _config_list $filenames config_list + +_arch() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(w|g|d|--welcome-msg=|-goodbye-msg|-digest=)) + COMPREPLY=( $( compgen -W 'y n' -- $cur) ) + return 0 + ;; + -@(d|-file)) + _filedir + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--wipe -s --start= -e --end= \ + -q --quiet -h --help' -- $cur ) ) + else + args=$COMP_CWORD + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -* ]]; then + args=$(($args-1)) + fi + done + case $args in + 1) + _mailman_lists + ;; + 2) + _filedir + ;; + esac + fi + +} +complete -F _arch $filenames arch + +_cleanarch() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-s --status -n --dry-run \ + -q --quiet -h --help' -- $cur ) ) + fi + +} +complete -F _cleanarch cleanarch + +_inject() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(l|-listname=)) + _mailman_lists + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-l --listname= -q --queue= \ + -h --help' -- $cur ) ) + else + _filedir + fi + +} +complete -F _inject $filenames inject + +_dumpdb() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--marshal -m --pickle -p --noprint -n -h --help' -- $cur ) ) + else + _filedir + fi + +} +complete -F _dumpdb $filenames dumpdb + +_check_db() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--all -a --verbose -v \ + -h --help' -- $cur ) ) + else + _mailman_lists + fi + +} +complete -F _check_db check_db + +_check_perms() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-f -v -h' -- $cur ) ) + fi + +} +complete -F _check_perms check_perms + +_genaliases() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-q --quiet -h --help' -- $cur ) ) + fi + +} +complete -F _genaliases genaliases + +_mmsitepass() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c --listcreator -h --help' -- $cur ) ) + fi + +} +complete -F _mmsitepass mmsitepass + +_qrunner() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-r --runner= --once -o \ + -l --list -v --verbose -s --subproc -h --help' -- $cur ) ) + fi + +} +complete -F _qrunner qrunner + +_mailmanctl() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-n --no-restart -u --run-as-user \ + -s --stale-lock-cleanup --quiet -q -h --help' -- $cur ) ) + else + COMPREPLY=( $( compgen -W 'start stop restart reopen' -- $cur ) ) + fi + +} +complete -F _mailmanctl mailmanctl diff --git a/contrib/mcrypt b/contrib/mcrypt new file mode 100644 index 00000000..81f5d8b3 --- /dev/null +++ b/contrib/mcrypt @@ -0,0 +1,80 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# mcrypt(1) completion by Ariel Fermani <the_end@bbs.frc.utn.edu.ar> + +_mcrypt() +{ + local cur prev i decrypt + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -@(g|-openpgp-z)) + COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' \ + -- $cur ) ) + return 0 + ;; + -@(o|-keymode)) + COMPREPLY=( $( mcrypt --list-keymodes 2> /dev/null | + grep "^$cur" ) ) + return 0 + ;; + -@(m|-mode)) + COMPREPLY=( $( mcrypt --list 2> /dev/null | + sed -e 's/.*: //' -e 's/ $//' | sort | + uniq | tr " " "\n" | grep "^$cur" ) ) + return 0 + ;; + -@(a|-algorithm)) + COMPREPLY=( $( mcrypt --list 2> /dev/null | + awk '{print $1}' | grep "^$cur" ) ) + return 0 + ;; + -@(h|-hash)) + COMPREPLY=( $( mcrypt --list-hash 2> /dev/null | + sed 1d | grep "^$cur" ) ) + return 0 + ;; + -@(k|s|-@(key?(size)))) + return 0 + ;; + -@(f|c|-@(keyfile|config))) + _filedir + return 0 + ;; + --@(algorithm|mode)s-directory) + _filedir -d + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-g --openpgp --openpgp-z -d \ + --decrypt -s --keysize -o --keymode -f --keyfile \ + -c --config -a --algorithm --algorithms-directory \ + -m --mode --modes-directory -h --hash -k --key \ + --noiv -b --bare -z --gzip -p --bzip2 --flush -l \ + --doublecheck -u --unlink --nodelete -t --time -F \ + --force --echo -r --random --list --list-keymodes \ + --list-hash -V --verbose -q --quiet --help -v \ + --version -L --license' -- $cur ) ) + elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then + _filedir '@(nc)' + else + decrypt=0 + for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then + _filedir '@(nc)' + decrypt=1 + break + fi + done + if [[ $decrypt -eq 0 ]]; then + _filedir + fi + fi +} +complete -o filenames -F _mcrypt mcrypt mdecrypt diff --git a/contrib/minicom b/contrib/minicom new file mode 100644 index 00000000..dcc4b5f2 --- /dev/null +++ b/contrib/minicom @@ -0,0 +1,46 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for minicom + +have minicom && +_minicom() +{ + local cur prev confdir + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(a|c)) + COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) + return 0 + ;; + -@(S|C)) + _filedir + return 0 + ;; + -P) + COMPREPLY=( $( command ls /dev/tty* ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) ) + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \ + -c -S -d -p -C -T -7 -8' -- $cur ) ) + return 0 + else + [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] && confdir=/etc + [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] && confdir=/etc/minicom + if [ -n "$confdir" ]; then + COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \ + sed -e "s|$confdir/minirc.||")' -- $cur ) ) + return 0 + fi + fi +} && +complete -F _minicom $default minicom diff --git a/contrib/modules b/contrib/modules new file mode 100644 index 00000000..9218d0b8 --- /dev/null +++ b/contrib/modules @@ -0,0 +1,84 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# module completion by Ted Stern <stern@cray.com> +# +# Completion for Environment Modules `module' alias. +# +# See http://sourceforge.net/projects/modules/ +# http://modules.sourceforge.net/ +# +# There are several versions of modules that are commonly used. Older +# Cray UNICOS systems and many other sites use 2.2.2b. The latest GPL'd +# version is 3.1.6. But the module alias is somewhat self-documenting +# via the `module help' command, so use that to print the options. +# +# Programmable completion might be more difficult under tcsh since the +# module command is an alias, and the `module avail' command returns +# its output as stderr. + +type module &>/dev/null && { + +_module_list () +{ + local modules="$( echo $LOADEDMODULES | sed 's/:/ /g' | sort )" + compgen -W "$modules" -- $1 +} + +_module_path () +{ + local modules="$( echo $MODULEPATH | sed 's/:/ /g' | sort )" + compgen -W "$modules" -- $1 +} + +_module_avail () +{ + local modules="$( \ + module avail 2>&1 | \ + egrep -v '^(-|$)' | \ + xargs printf '%s\n' | sort )" + + compgen -W "$modules" -- $1 +} + +# A completion function for the module alias +_module () { + local cur prev options + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [ $COMP_CWORD -eq 1 ] ; then + # First parameter on line -- we expect it to be a mode selection + + options="$( module help 2>&1 | egrep '^[[:space:]]*\+' | \ + awk '{print $2}' | sed -e 's/|/ /g' | sort )" + + COMPREPLY=( $(compgen -W "$options" -- $cur) ) + + elif [ $COMP_CWORD -eq 2 ] ; then + + case "$prev" in + @(add|display|help|load|show|whatis)) + COMPREPLY=( $(_module_avail $cur) ) + ;; + + @(rm|switch|swap|unload|update)) + COMPREPLY=( $(_module_list $cur) ) + ;; + unuse) + COMPREPLY=( $(_module_path $cur) ) + ;; + esac + elif [ $COMP_CWORD -eq 3 ] ; then + case ${COMP_WORDS[1]} in + @(sw?(ap|itch))) + COMPREPLY=( $(_module_avail $cur) ) + ;; + esac + fi + return 0 +} +complete -o default -F _module module +} diff --git a/contrib/monodevelop b/contrib/monodevelop new file mode 100644 index 00000000..3d8430cb --- /dev/null +++ b/contrib/monodevelop @@ -0,0 +1,97 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# Monodevelop completion +# +have monodevelop && +_monodevelop() +{ + local cur + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-? -help \ + -help2 \ + -ipc-tcp \ + -newwindow \ + -nologo \ + -usage \ + -V -version' -- "$cur" ) ) + else + _filedir + fi + return 0 +} && +complete -F _monodevelop monodevelop + +have mdtool && +_mdtool() +{ + local cur prev command i + + COMPREPLY=() + + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do + if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then + command=${COMP_WORDS[i]} + fi + done + + if [[ -n "$command" ]]; then + case $command in + "build") + COMPREPLY=( $( compgen -W '--f --buildfile --p --project' -S":" -- "$cur" ) ) + # TODO: This does not work :( + #if [[ "$prev" == *: ]]; then + # case "$prev" in + # @(--p:|--project:)) + # COMPREPLY=( $( compgen -f -G "*.mdp" -- "$cur" ) ) + # ;; + # @(--f:|--buildfile:)) + # COMPREPLY=( $( compgen -f -G "*.mdp" -G "*.mds" -- "$cur" ) ) + # ;; + # esac + #fi + return 0 + ;; + "generate-makefiles") + COMPREPLY=( $( compgen $filenames -G"*.mds" -- "$cur" ) ) + if [[ "$prev" == *mds ]]; then + COMPREPLY=( $( compgen -W '--simple-makefiles --s --d:' -- "$cur" ) ) + fi + return 0 + ;; + "setup") + # TODO: at least return filenames after these options. + COMPREPLY=( $( compgen -W 'install i \ + uninstall u \ + check-install ci \ + update up \ + list l \ + list-av la \ + list-update lu \ + rep-add ra \ + rep-remove rr \ + rep-update ru \ + rep-list rl \ + reg-update reg-build rgu \ + info \ + rep-build rb \ + pack p \ + help h \ + dump-file' -- "$cur" ) ) + return 0 + ;; + esac + fi + + COMPREPLY=( $( compgen -W 'gsetup build dbgen project-export \ + generate-makefiles gettext-update \ + setup -q' -- "$cur" ) ) + + return 0 +} && +complete -F _mdtool $filenames mdtool diff --git a/contrib/mtx b/contrib/mtx new file mode 100644 index 00000000..82652054 --- /dev/null +++ b/contrib/mtx @@ -0,0 +1,46 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# mtx completion by Jon Middleton <jjm@ixtab.org.uk> + +_mtx() +{ + local cur prev options tapes drives + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + options="-f nobarcode invert noattach --version inquiry noattach \ + inventory status load unload eepos first last next" + + tapes=$(mtx status | \ + awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }') + tapes=${tapes//:Full} + + drives=$(mtx status | \ + awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }') + drives=${drives//:Full} + drives=${drives//:Empty} + + if [ $COMP_CWORD -gt 1 ]; then + case $prev in + load) + COMPREPLY=( $( compgen -W "$tapes" -- $cur ) ) + ;; + unload|first|last|next) + COMPREPLY=( $( compgen -W "$drives" -- $cur ) ) + ;; + -f) + true + ;; + *) + true + ;; + esac + else + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + fi + return 0 +} +complete -F _mtx mtx diff --git a/contrib/net-tools b/contrib/net-tools new file mode 100644 index 00000000..d926e084 --- /dev/null +++ b/contrib/net-tools @@ -0,0 +1,89 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for net tools + +have mii-tool && +_mii_tool() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case $prev in + -F) + COMPREPLY=( $( compgen -W '100baseTx-FD 100baseTx-HD \ + 10baseT-FD 10baseT-HD' -- $cur ) ) + return 0 + ;; + -A) + COMPREPLY=( $( compgen -W '100baseT4 100baseTx-FD 100baseTx-HD \ + 10baseT-FD 10baseT-HD' -- $cur ) ) + return 0 + ;; + esac + + + # --name=value style option + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case "$prev" in + --force) + COMPREPLY=( $( compgen -W '100baseTx-FD \ + 100baseTx-HD 10baseT-FD \ + 10baseT-HD' -- $cur ) ) + return 0 + ;; + --advertise) + COMPREPLY=( $( compgen -W '100baseT4 \ + 100baseTx-FD 100baseTx-HD 10baseT-FD \ + 10baseT-HD' -- $cur ) ) + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-v --verbose -V --version -R \ + --reset -r --restart -w --watch -l --log -A \ + --advertise= -F --force=' -- $cur ) ) + else + _available_interfaces -a + fi +} && +complete -F _mii_tool $default mii-tool + +have mii-diag && +_mii_diag() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # --name value style option + case $prev in + -@(F|A|-advertise|-fixed-speed)) + COMPREPLY=( $( compgen -W '100baseT4 100baseTx \ + 100baseTx-FD 100baseTx-HD 10baseT 10baseT-FD \ + 10baseT-HD' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-A --advertise -F --fixed-speed -a \ + --all-interfaces -s --status -D --debug -g \ + --read-parameters -G --set-parameters -M --msg-level \ + -p --phy -r --restart -R --reset -v -V -w --watch \ + -? --help' -- $cur ) ) + else + _available_interfaces -a + fi +} && +complete -F _mii_diag $default mii-diag diff --git a/contrib/p4 b/contrib/p4 new file mode 100644 index 00000000..ada8a57f --- /dev/null +++ b/contrib/p4 @@ -0,0 +1,55 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# Perforce completion by Frank Cusack <frank@google.com> + +_p4() +{ + local cur prev prev2 p4commands p4filetypes + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # rename isn't really a command + p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )" + p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \ + uresource uxbinary xbinary xltext xtempobj xtext \ + text binary resource" + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) ) + elif [ $COMP_CWORD -eq 2 ]; then + case "$prev" in + help) + COMPREPLY=( $( compgen -W "simple commands \ + environment filetypes jobview revisions \ + usage views $p4commands" -- $cur ) ) + ;; + admin) + COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) ) + ;; + *) + ;; + esac + elif [ $COMP_CWORD -gt 2 ]; then + prev2=${COMP_WORDS[COMP_CWORD-2]} + case "$prev" in + -t) + case "$prev2" in + add|edit|reopen) + COMPREPLY=( $( compgen -W "$p4filetypes" \ + -- $cur) ) + ;; + *) + ;; + esac + ;; + *) + ;; + esac + fi + + return 0 +} +complete -F _p4 $default p4 g4 diff --git a/contrib/povray b/contrib/povray new file mode 100644 index 00000000..c69b0db4 --- /dev/null +++ b/contrib/povray @@ -0,0 +1,59 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# povray completion by "David Necas (Yeti)" <yeti@physics.muni.cz> + +_povray() +{ + local cur prev povcur pfx oext defoext + defoext=png # default output extension, if cannot be determined FIXME + + COMPREPLY=() + povcur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + _expand || return 0 + + case $povcur in + [-+]I*) + cur="${povcur#[-+]I}" # to confuse _filedir + pfx="${povcur%"$cur"}" + _filedir pov + COMPREPLY=( ${COMPREPLY[@]/#/$pfx} ) + return 0 + ;; + [-+]O*) + # guess what output file type user may want + case $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]F' ) ) in + [-+]FN) oext=png ;; + [-+]FP) oext=ppm ;; + [-+]F[CT]) oext=tga ;; + *) oext=$defoext ;; + esac + # complete filename corresponding to previously specified +I + COMPREPLY=( $( ( IFS=$'\n'; echo "${COMP_WORDS[*]}" | grep '^[-+]I' ) ) ) + COMPREPLY=( ${COMPREPLY[@]#[-+]I} ) + COMPREPLY=( ${COMPREPLY[@]/%.pov/.$oext} ) + cur="${povcur#[-+]O}" # to confuse _filedir + pfx="${povcur%"$cur"}" + _filedir $oext + COMPREPLY=( ${COMPREPLY[@]/#/$pfx} ) + return 0 + ;; + *.ini\[|*.ini\[*[^]]) # sections in .ini files + cur="${povcur#*\[}" + pfx="${povcur%\["$cur"}" # prefix == filename + [ -r "$pfx" ] || return 0 + COMPREPLY=( $(sed -e 's/^[[:space:]]*\[\('"$cur"'[^]]*\]\).*$/\1/' -e 't' -e 'd' -- "$pfx") ) + # to prevent [bar] expand to nothing. can be done more easily? + COMPREPLY=( "${COMPREPLY[@]/#/$pfx[}" ) + return 0 + ;; + *) + cur="$povcur" + _filedir '?(ini|pov)' + return 0 + ;; + esac +} +complete -F _povray $filenames povray xpovray spovray diff --git a/contrib/qdbus b/contrib/qdbus new file mode 100644 index 00000000..ba749c6a --- /dev/null +++ b/contrib/qdbus @@ -0,0 +1,20 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# Qt qdbus completion +# +have qdbus && +_qdbus() +{ + local cur compstr + + COMPREPLY=() + cur=`_get_cword` + if [ -z "$cur" ]; then + compstr=${COMP_WORDS[*]} + else + compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ ${cur/\//\\/}$//" ) + fi + COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- "$cur" ) ) +} && +complete -F _qdbus qdbus diff --git a/contrib/qemu b/contrib/qemu new file mode 100644 index 00000000..7baeddf3 --- /dev/null +++ b/contrib/qemu @@ -0,0 +1,100 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for qemu + +have qemu && +_qemu() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -@(fd[ab]|hd[abcd]|cdrom|option-rom|kernel|initrd|bootp|pidfile|loadvm)) + _filedir + return 0 + ;; + -@(tftp|smb|L)) + _filedir -d + return 0 + ;; + -boot) + COMPREPLY=( $( compgen -W 'a c d n' -- $cur ) ) + return 0 + ;; + -k) + COMPREPLY=( $( compgen -W 'ar de-ch es fo fr-ca hu ja \ + mk no pt-br sv da en-gb et fr fr-ch is lt nl pl\ + ru th de en-us fi fr-be hr it lv nl-be pt sl \ + tr' -- $cur ) ) + return 0 + ;; + -soundhw) + COMPREPLY=( $( compgen -W "$( qemu -soundhw ? | awk \ + '/^[[:lower:]]/ {print $1}' ) all" -- $cur ) ) + return 0 + ;; + -M) + COMPREPLY=( $( compgen -W "$( qemu -M ? | awk \ + '/^[[:lower:]]/ {print $1}' )" -- $cur ) ) + return 0 + ;; + -cpu) + COMPREPLY=( $( compgen -W "$( qemu -cpu ? | awk \ + '{print $2}' )" -- $cur ) ) + return 0 + ;; + -usbdevice) + COMPREPLY=( $( compgen -W 'mouse tablet disk: host: \ + serial: braille net' -- $cur ) ) + return 0 + ;; + -net) + COMPREPLY=( $( compgen -W 'nic user tap socket vde none' \ + -- $cur ) ) + return 0 + ;; + -@(serial|parallel|monitor)) + COMPREPLY=( $( compgen -W 'vc pty none null /dev/ \ + file: stdio pipe: COM udp: tcp: telnet: unix: \ + mon: braille' -- $cur ) ) + return 0 + ;; + -redir) + COMPREPLY=( $( compgen -S":" -W 'tcp udp' -- $cur ) ) + return 0 + ;; + -bt) + COMPREPLY=( $( compgen -W 'hci vhci device' -- $cur ) ) + return 0 + ;; + -vga) + COMPREPLY=( $( compgen -W 'cirrus std vmware' -- $cur ) ) + return 0 + ;; + -drive) + COMPREPLY=( $( compgen -S"=" -W 'file if bus index media \ + cyls snapshot cache format' -- $cur ) ) + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-M -fda -fdb -hda -hdb -hdc -hdd \ + -cdrom -boot -snapshot -no-fd-bootchk -m -smp -nographic -vnc \ + -k -audio-help -soundhw -localtime -full-screen -pidfile \ + -daemonize -win2k-hacks -option-rom -usb -usbdevice -net -tftp \ + -smb -redir -kernel -append -initrd -serial -parallel -monitor \ + -s -p -S -d -hdachs -L -std-vga -no-acpi -no-reboot -loadvm \ + -semihosting -cpu -bt -vga -drive -startdate -name -curses \ + -no-frame -no-quit -bootp -echr -no-shutdown -icount -g \ + -prom-env' -- $cur ) ) + else + _filedir + fi +} && +complete -F _qemu $filenames qemu diff --git a/contrib/quota-tools b/contrib/quota-tools new file mode 100644 index 00000000..f77d1c35 --- /dev/null +++ b/contrib/quota-tools @@ -0,0 +1,309 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for quota-tools + +have quota && { +_user_or_group() +{ + local i + + # complete on groups if -g was given + for (( i=1; i < COMP_CWORD; i++ )); do + if [[ "${COMP_WORDS[i]}" == -g ]]; then + COMPREPLY=( $( compgen -g -- $cur ) ) + return 0 + fi + done + + # otherwise complete on users + COMPREPLY=( $( compgen -u -- $cur ) ) +} + +_quota_formats() +{ + COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- $cur ) ) +} + +_filesystems() +{ + # Only list filesystems starting with "/", otherwise we also get + #+ "binfmt_misc", "proc", "tmpfs", ... + COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \ + -- $cur ) ) +} + +_quota() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-F --format= -g --group -u --user -v --verbose \ + -s --human-readable -p --raw-grace -i --no-autofs -l --local-only \ + -A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \ + -w --no-wrap' -- $cur ) ) + else + _user_or_group + fi +} +complete -F _quota $default quota + +_setquota() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \ + -F --format= -g --group -u --user -p --prototype= -b --batch \ + -c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) ) + else + _count_args + + case $args in + 1) + _user_or_group + ;; + 2) + _filesystems + ;; + esac + + fi +} +complete -F _setquota $default setquota + +_edquota() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + -@(f|-filesystem)) + _filesystems + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \ + -g --group -u --user -p --prototype= -F --format= -f --filesystem \ + -t --edit-period -T --edit-times' -- $cur ) ) + else + _user_or_group + fi +} +complete -F _edquota $default edquota + +_quotacheck() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \ + -g --group -u --user -c --create-files -f --force -i \ + --interactive -n --use-first-dquot -M --try-remount -m \ + --no-remount -R --exclude-root -F --format= -a --all' \ + -- $cur ) ) + else + _filesystems + fi +} +complete -F _quotacheck $default quotacheck + +_repquota() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \ + -c --batch-translation -C --no-batch-translation -t \ + --truncate-names -n --no-names -p --raw-grace -i --no-autofs \ + -u --user -g --group -F --format=' -- $cur ) ) + else + _filesystems + fi +} +complete -F _repquota $default repquota + +_quotaon() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + echo --$cmd-- + case $prev in + -F) + _quota_formats + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \ + -g --group -f --off -p --print-state -F --format=' -- $cur ) ) + else + _filesystems + fi +} +complete -F _quotaon $default quotaon + +_quotaoff() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -F) + _quota_formats + return 0 + ;; + -@(x|-xfs-command)) + COMPREPLY=( $( compgen -W 'delete enforce' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == *=* ]]; then + prev=${cur/=*/} + cur=${cur/*=/} + case $prev in + --format) + _quota_formats + return 0 + ;; + esac + fi + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \ + -g --group -p --print-state -x --xfs-command -F --format=' \ + -- $cur ) ) + else + _filesystems + fi +} +complete -F _quotaoff $default quotaoff +} diff --git a/contrib/rdesktop b/contrib/rdesktop new file mode 100644 index 00000000..ba941eec --- /dev/null +++ b/contrib/rdesktop @@ -0,0 +1,53 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for rdesktop + +have rdesktop && +_rdesktop() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -k) + COMPREPLY=( $( command ls \ + /usr/share/rdesktop/keymaps 2>/dev/null | \ + egrep -v '(common|modifiers)' ) ) + COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \ + $HOME/.rdesktop/keymaps 2>/dev/null ) ) + COMPREPLY=( ${COMPREPLY[@]:-} $( command ls \ + ./keymaps 2>/dev/null ) ) + COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) ) + return 0 + ;; + -a) + COMPREPLY=( $( compgen -W '8 15 16 24' -- $cur ) ) + return 0 + ;; + -x) + COMPREPLY=( $( compgen -W 'b broadband m modem l lan' \ + -- $cur ) ) + return 0 + ;; + -r) + # FIXME: should do $nospace for the colon options + COMPREPLY=( $( compgen -W 'comport: disk: lptport: \ + printer: sound: lspci scard' -- $cur ) ) + return 0 + ;; + esac + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \ + -A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \ + -0 -4 -5' -- $cur ) ) + else + _known_hosts + fi + +} && +complete -F _rdesktop rdesktop diff --git a/contrib/ri b/contrib/ri new file mode 100644 index 00000000..9ec520c0 --- /dev/null +++ b/contrib/ri @@ -0,0 +1,89 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# ri completion for Ruby documentation by Ian Macdonald <ian@caliban.org> + +ri_get_methods() +{ + local regex + + if [ "$ri_version" = integrated ]; then + if [ -z "$separator" ]; then + regex="(Instance|Class)" + elif [ "$separator" = "#" ]; then + regex=Instance + else + regex=Class + fi + + COMPREPLY=( ${COMPREPLY[@]} \ + "$( ri ${classes[@]} 2>/dev/null | \ + ruby -ane 'if /^'"$regex"' methods:/.../^------------------|^$/ and \ + /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \ + end' | sort -u )" ) + else + # older versions of ri didn't distinguish between class/module and + # instance methods + COMPREPLY=( ${COMPREPLY[@]} \ + "$( ruby -W0 $ri_path ${classes[@]} | ruby -ane 'if /^-/.../^-/ and \ + ! /^-/ and ! /^ +(class|module): / then \ + print $_.split(/, |,$| +/).grep(/^[^\[]*$/).join("\n"); \ + end' | sort -u )" ) + fi + COMPREPLY=( $( compgen $prefix -W '${COMPREPLY[@]}' -- $method ) ) +} + +# needs at least Ruby 1.8.0 in order to use -W0 +_ri() +{ + local cur class method prefix ri_path ri_version separator IFS + local -a classes + + COMPREPLY=() + cur=`_get_cword` + + ri_path=$(type -p ri) + # which version of ri are we using? + # -W0 is required here to stop warnings from older versions of ri + # from being captured when used with Ruby 1.8.1 and later + ri_version="$(ruby -W0 $ri_path -v 2>&1)" || ri_version=integrated + [ "$ri_version" != "${ri_version%200*}" ] && ri_version=integrated + + # need to also split on commas + IFS=$', \n\t' + if [[ "$cur" == [A-Z]*[#.]* ]]; then + [[ "$cur" == *#* ]] && separator=# || separator=. + # we're completing on class and method + class=${cur%$separator*} + method=${cur#*$separator} + classes=( $class ) + prefix="-P $class$separator" + ri_get_methods + return 0 + fi + + if [ "$ri_version" = integrated ]; then + # integrated ri from Ruby 1.9 + classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \ + if /, [A-Z]+/ then print; end; end' ) ) + elif [ "$ri_version" = "ri 1.8a" ]; then + classes=( $( ruby -W0 $ri_path | \ + ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \ + if /^ .*[A-Z]/ then print; end; end' )) + else + classes=( $( ruby -W0 $ri_path | \ + ruby -ne 'if /^I have/..$stdin.eof then \ + if /^ .*[A-Z]/ then print; end; end' )) + fi + + COMPREPLY=( $( compgen -W '${classes[@]}' -- $cur ) ) + if [[ "$cur" == [A-Z]* ]]; then + # we're completing on class or module alone + return 0 + fi + + # we're completing on methods + method=$cur + ri_get_methods +} +complete -F _ri ri diff --git a/contrib/sbcl b/contrib/sbcl new file mode 100644 index 00000000..1b14eea3 --- /dev/null +++ b/contrib/sbcl @@ -0,0 +1,25 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash programmable completion for various Common Lisp implementations by +# Nikodemus Siivola <nikodemus@random-state.net> + +_sbcl() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + # completing an option (may or may not be separated by a space) + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--core --noinform --help --version \ + --sysinit --userinit --eval --noprint --disable-debugger \ + --end-runtime-options --end-toplevel-options ' -- $cur ) ) + else + _filedir + fi + + return 0 +} +complete -F _sbcl $default sbcl sbcl-mt diff --git a/contrib/sitecopy b/contrib/sitecopy new file mode 100644 index 00000000..088951cd --- /dev/null +++ b/contrib/sitecopy @@ -0,0 +1,31 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# sitecopy(1) completion +# Copyright 2003 Eelco Lempsink <eelcolempsink@gmx.net> +# License: GNU GPL v2 or later + +_sitecopy() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + --*) + COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '--\w' | awk '{sub (/=(FILE|PATH)/, "", $2); print $2}')" -- $cur ) ) + ;; + -*) + COMPREPLY=( $( compgen -W "$(sitecopy -h | grep -e '-\w' | awk '{sub (",", "", $1); print $1}')" -- $cur ) ) + ;; + *) + if [ -r ~/.sitecopyrc ]; then + COMPREPLY=( $( compgen -W "$(grep '^["$'\t '"]*site' ~/.sitecopyrc | awk '{print $2}')" -- $cur ) ) + fi + ;; + esac + + return 0 +} +complete -F _sitecopy $default sitecopy diff --git a/contrib/snownews b/contrib/snownews new file mode 100644 index 00000000..89007678 --- /dev/null +++ b/contrib/snownews @@ -0,0 +1,19 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# snownews completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_snownews() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + if [[ "$cur" == -* ]]; then + # return list of available options + COMPREPLY=( $( compgen -W '--update --help --version \ + --disable-versioncheck -u -h -V' -- $cur)) + fi +} +complete -F _snownews snownews diff --git a/contrib/ssh b/contrib/ssh new file mode 100644 index 00000000..85325aa2 --- /dev/null +++ b/contrib/ssh @@ -0,0 +1,142 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# ssh(1) completion +# +have ssh && { +_ssh() +{ + local cur prev + local optconfigfile + local -a config + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -F) + _filedir + ;; + -*c) + COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \ + arcfour cast128-cbc' -- $cur ) ) + ;; + -*i) + _filedir + ;; + -*l) + COMPREPLY=( $( compgen -u -- $cur ) ) + ;; + *) + # Search COMP_WORDS for '-F configfile' argument + set -- "${COMP_WORDS[@]}" + while [ $# -gt 0 ]; do + if [ "${1:0:2}" = -F ]; then + if [ ${#1} -gt 2 ]; then + optconfigfile="$(dequote "$1")" + else + shift + [ "$1" ] && optconfigfile="$(dequote "-F$1")" + fi + break + fi + shift + done + + _known_hosts -a "$optconfigfile" + + [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \ + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) ) + esac + + return 0 +} +shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh + +# scp(1) completion +# +_scp() +{ + local cur userhost path + local optconfigfile + + COMPREPLY=() + cur=`_get_cword ":"` + + _expand || return 0 + + if [[ "$cur" == *:* ]]; then + local IFS=$'\t\n' + # remove backslash escape from : + cur=${cur/\\:/:} + userhost=${cur%%?(\\):*} + path=${cur#*:} + # unescape spaces + path=${path//\\\\\\\\ / } + if [ -z "$path" ]; then + # default to home dir of specified user on remote host + path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null) + fi + # escape spaces; remove executables, aliases, pipes and sockets; + # add space at end of file names + COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \ + command ls -aF1d "$path*" 2>/dev/null | \ + sed -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\\\\\\\\\&/g" \ + -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) ) + return 0 + fi + + # Search COMP_WORDS for '-F configfile' argument + set -- "${COMP_WORDS[@]}" + while [ $# -gt 0 ]; do + if [ "${1:0:2}" = -F ]; then + if [ ${#1} -gt 2 ]; then + optconfigfile="$(dequote "$1")" + else + shift + [ "$1" ] && optconfigfile="$(dequote "-F$1")" + fi + break + fi + shift + done + + [[ "$cur" == */* ]] || _known_hosts -c -a "$optconfigfile" + + # This approach is used instead of _filedir to get a space appended + # after local file/dir completions, and $nospace retained for others. + local IFS=$'\t\n' + COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \ + 2>/dev/null | sed \ + -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" \ + -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) ) + + return 0 +} +complete -F _scp $nospace scp + +# ssh-copy-id(1) completion +# +_ssh_copy_id() { + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case "$prev" in + -*i) + _filedir + ;; + *) + _known_hosts -a + + [ $COMP_CWORD -eq 1 ] || \ + COMPREPLY=( "${COMPREPLY[@]}" $( compgen -- $cur ) ) + esac + + return 0 +} +complete -F _ssh_copy_id $filenames ssh-copy-id +} diff --git a/contrib/svk b/contrib/svk new file mode 100644 index 00000000..e2d0fac7 --- /dev/null +++ b/contrib/svk @@ -0,0 +1,263 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# svk completion by Guillaume Rousse <guillomovitch@zarb.org> + +_svk() +{ + local cur prev commands options command + + COMPREPLY=() + cur=`_get_cword` + + commands='add admin annotate ann blame praise cat checkout co cleanup \ + cmerge cm commit ci copy cp delete del remove rm depotmap \ + depot describe desc diff di help h ? import info list ls log \ + merge mirror mi mkdir move mv ren rename patch propdel pd pdel \ + propedit pe pedit propget pg pget proplist pl plist propset ps \ + pset pull push resolved revert smerge sm status st stat switch \ + sw sync sy update up verify' + + if [[ $COMP_CWORD -eq 1 ]] ; then + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '--version' -- $cur ) ) + else + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + fi + else + + prev=${COMP_WORDS[COMP_CWORD-1]} + case $prev in + -@(F|-file|-targets)) + _filedir + return 0; + ;; + --encoding) + COMPREPLY=( $( compgen -W \ + '$( iconv --list | sed -e "s@//@@;" )' \ + -- "$cur" ) ) + return 0; + ;; + esac + + command=${COMP_WORDS[1]} + + if [[ "$cur" == -* ]]; then + # possible options for the command + case $command in + add) + options=' --non-recursive -N -q --quiet' + ;; + @(blame|annotate|ann|praise)) + options='-r --revisions -x --cross' + ;; + cat) + options='-r --revision' + ;; + @(checkout|co)) + options='-r --revision -q --quiet -N \ + --non-recursive -l --list -d \ + --detach --export --relocate \ + --purge' + ;; + cleanup) + options='-a --all' + ;; + @(cmerge|cm)) + options='-c --change -l --log -r \ + --revision -a --auto \ + --verbatim --no-ticket -m \ + --message -F --file --template \ --encoding -P --patch -S \ + --sign -C --check-only --direct' + ;; + @(commit|ci)) + options='--import -m --message -F \ + --file --encoding --template \ + -P --patch -S --sign -C \ + --check-only -N \ + --non-recursive --direct' + ;; + @(copy|cp)) + options='-r --revision -p --parent -q \ + --quiet -m --message -F --file \ + --template --encoding -P \ + --patch -S --sign -C \ + --check-only --direct' + ;; + @(delete|del|remove|rm)) + options='-k --keep-local -m --message \ + -F --file --encoding \ + --template -P --patch -S \ + --sign -C --check-only --direct' + ;; + @(depotmap|depot)) + options='-i --init -l --list -d \ + --detach --relocate' + ;; + @(diff|di)) + options='-r --revision -s --summarize \ + -b --verbose -N --non-recursive' + ;; + import) + options='-f --from-checkout -t \ + --to-checkout -m --message -F \ + --file --template --encoding \ + -P --patch -S --sign -C \ + --check-only -N \ + --non-recursive --direct' + ;; + @(list|ls)) + options='-r --revision -v --verbose -R \ + --recursive -d --depth -f \ + --full-path' + ;; + log) + options='-r --revision -l --limit -q \ + --quiet -x --cross -v --verbose' + ;; + merge) + options='-r --revision -c --change -I \ + --incremental -a --auto -l \ + --log -s --sync -t --to -f \ + --from --verbatim --no-ticket \ + --track-rename -m --message \ + -F --file --template \ + --encoding -P --patch -S \ + --sign -C --check-only --direct' + ;; + @(mirror|mi)) + options='-l --list -d --detach \ + --relocate --recover --unlock \ + --upgrade' + ;; + mkdir) + options='-p --parent -m --message -F \ + --file --template --encoding \ + -P --patch -S --sign -C \ + --check-only --direct' + ;; + @(move|mv|rename|ren)) + options='-r --revision -p --parent -q \ + --quiet -m --message -F --file \ + --encoding --template -P \ + --patch -S --sign -C \ + --check-only --direct' + ;; + patch) + options='--depot' + ;; + @(propdel|propset|pdel|pset|pd|ps)) + options='-R --recursive -r --revision \ + --revprop -m --message -F \ + --file --template --encoding \ + -P --patch -S --sign -C \ + --check-only -q --quiet \ + --direct' + ;; + @(propedit|pedit|pe)) + options='-R --recursive -r --revision \ + --revprop -m --message -F \ + --file --template --encoding \ + -P --patch -S --sign -C \ + --check-only --direct' + ;; + @(propget|pget|pg)) + options='-R --recursive -r --revision \ + --revprop --strict' + ;; + @(proplist|plist|pl)) + options='-R --recursive -v --verbose \ + -r --revision --revprop' + ;; + pull) + options='-a --all -l --lump' + ;; + push) + options='-f --from -l --lump -C \ + --check -P --patch -S --sign \ + --verbatim' + ;; + resolved) + options='-R --recursive' + ;; + revert) + options='-R --recursive -q --quiet' + ;; + @(smerge|sm)) + options='-I --incremental -l --log -B \ + --baseless -b --base -s --sync \ + -t --to -f --from --verbatim \ + --no-ticket --track-rename \ + --host --remoterev -m \ + --message -F --file --template \ + --encoding -P --patch -S \ + --sign -C --check-only --direct' + ;; + @(status|stat|st)) + options='-q --quiet --no-ignore -N \ + --non-recursive -v --verbose' + ;; + @(switch|sw)) + options='-r --revision -d --detach -q \ + --quiet' + ;; + @(sync|sy)) + options='-a --all -s --skipto -t \ + --torev' + ;; + @(update|up)) + options='-r --revision -N \ + --non-recursive -C \ + --check-only -s --sync -m \ + --merge -q --quiet' + ;; + esac + options="$options --help -h" + + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + case $command in + @(help|h|\?)) + COMPREPLY=( $( compgen -W "$commands \ + environment commands intro" -- $cur ) ) + ;; + admin) + COMPREPLY=( $( compgen -W 'help \ + deltify dump hotcopy \ + list-dblogs list-unused-dblogs \ + load lstxns recover rmtxns \ + setlog verify rmcache' \ + -- $cur ) ) + ;; + patch) + COMPREPLY=( $( compgen -W '--ls --list \ + --cat --view --regen \ + --regenerate --up --update \ + --apply --rm --delete' \ + -- $cur ) ) + ;; + sync) + COMPREPLY=( $( compgen -W "$( svk \ + mirror --list 2>/dev/null | \ + awk '/^\//{print $1}' )" \ + -- $cur ) ) + ;; + @(co|checkout|push|pull)) + if [[ "$cur" == //*/* ]]; then + path=${cur%/*}/ + else + path=// + fi + COMPREPLY=( $( compgen -W "$( svk \ + list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ) ) + ;; + *) + _filedir + ;; + esac + fi + fi + + return 0 +} +complete -F _svk $default svk diff --git a/contrib/unace b/contrib/unace new file mode 100644 index 00000000..c6376742 --- /dev/null +++ b/contrib/unace @@ -0,0 +1,29 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# unace(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_unace() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- $cur ) ) + ;; + *) + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'e l t v x' -- $cur ) ) + else + _filedir '@(ace|ACE)' + fi + ;; + esac + + return 0 + +} +complete -F _unace $filenames unace diff --git a/contrib/unrar b/contrib/unrar new file mode 100644 index 00000000..9dcd2065 --- /dev/null +++ b/contrib/unrar @@ -0,0 +1,30 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# unrar(1) completion by Guillaume Rousse <rousse@ccr.jussieu.fr> + +_unrar() +{ + local cur + + COMPREPLY=() + cur=`_get_cword` + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \ + -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \ + -tb -tn -to -u -v -ver -vp -x -x@ -y' -- $cur ) ) + ;; + *) + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- $cur ) ) + else + _filedir '@(rar|RAR)' + fi + ;; + esac + + return 0 +} +complete -F _unrar $filenames unrar diff --git a/contrib/vncviewer b/contrib/vncviewer new file mode 100644 index 00000000..933783a4 --- /dev/null +++ b/contrib/vncviewer @@ -0,0 +1,126 @@ +# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- +# ex: ts=8 sw=8 noet filetype=sh +# +# bash completion for vncviewer + + +_vncviewer_bootstrap() { + local fname + case "$(_realcommand vncviewer)" in + # If `vncviewer' not installed, default file-dir completion + '') _filedir `_get_cword` ;; + *xvnc4viewer) fname=_xvnc4viewer ;; + *tightvncviewer|*) fname=_tightvncviewer ;; + esac + if [ $fname ]; then + # Install real completion for subsequent completions + complete -F $fname vncviewer + $fname # Generate completions once for now + unset -f _vncviewer_bootstrap + fi +} && +complete -F _vncviewer_bootstrap vncviewer + + +_tightvncviewer() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + case $prev in + -passwd) + _filedir + return 0 + ;; + -encodings) + COMPREPLY=( $( compgen -W 'copyrect tight hextile zlib \ + corre rre raw' -- $cur ) ) + return 0 + ;; + -via) + _known_hosts + return 0 + ;; + esac + + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-help -listen -via -shared -noshared\ + -viewonly -fullscreen -noraiseonbeep -passwd -encodings\ + -bgr233 -owncmap -truecolour -truecolor -depth \ + -compresslevel -quality -nojpeg -nocursorshape \ + -x11cursor' -- $cur ) ) + else + _known_hosts + fi +} && +complete -F _tightvncviewer tightvncviewer + + +# NOTE: - VNC Viewer options are case-insensivite. Preferred case is taken from -help. +# - Both single dash (-) and double dash (--) are allowed as option prefix +_xvnc4viewer() +{ + local cur prev + + COMPREPLY=() + cur=`_get_cword` + prev=${COMP_WORDS[COMP_CWORD-1]} + + # Convert double dash to single dash + case ${prev/#--/-} in + # -passwd, -PasswordFile + -[pP][aA][sS][sS][wW][dD]|-[pP][aA][sS][sS][wW][oO][rR][dD][fF][iI][lL][eE]) + _filedir + return 0 + ;; + # -PreferredEncoding + -[pP][rR][eE][fF][eE][rR][rR][eE][dD][eE][nN][cC][oO][dD][iI][nN][gG]) + COMPREPLY=( $( compgen -W 'zrle hextile raw' -- $cur ) ) + return 0 + ;; + # -via + -[vV][iI][aA]) + _known_hosts + return 0 + ;; + esac + + if [[ "$cur" == -* || "$cur" == --* ]]; then + # Default to vncviewer camelcase options, see `vncviewer -help' + local dash options=( \ + AcceptClipboard AutoSelect DebugDelay display \ + DotWhenNoCursor FullColor FullColour FullScreen \ + geometry help listen Log \ + LowColourLevel MenuKey name Parent \ + passwd PasswordFile PointerEventInterval PreferredEncoding \ + SendClipboard SendPrimary Shared UseLocalCursor \ + via ViewOnly WMDecorationHeight WMDecorationWidth \ + ZlibLevel \ + ) + [[ "$cur" == --* ]] && dash=-- || dash=- + # Is a `nocasematch' variable available (bash > v3.1)? + if shopt nocasematch 2> /dev/null | grep -q ^nocasematch; then + # Variable `nocasematch' is available + # Use vncviewer camelcase options + local option oldNoCaseMatch=$(shopt -p nocasematch) + shopt -s nocasematch + COMPREPLY=( $( for option in "${options[@]}"; do + [[ $dash$option == "$cur"* ]] && echo $dash$option + done ) ) + eval "$oldNoCaseMatch" 2> /dev/null + else + # Variable 'nocasematch' isn't available; + # Convert completions to lowercase + COMPREPLY=( $( compgen -W "$( + echo ${options[@]/#/$dash} | tr [:upper:] [:lower:] + )" -- "$(echo "$cur" | tr [:upper:] [:lower:])" ) ) + fi + else + _known_hosts + fi +} && +complete -F _xvnc4viewer xvnc4viewer diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..a5897de6 --- /dev/null +++ b/install-sh @@ -0,0 +1,519 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-12-25.00 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/missing b/missing new file mode 100755 index 00000000..1c8ff704 --- /dev/null +++ b/missing @@ -0,0 +1,367 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to <bug-automake@gnu.org>." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: |