| 1 | This package contains a reimplementation of getopt(1). | 
| 2 |  | 
| 3 | PREFACE | 
| 4 |  | 
| 5 | Getopt(1) is a program to help shell scripts parse command-line parameters. | 
| 6 | It is for example included in the util-linux distribution (upto version | 
| 7 | 2.7.1). But, there are some problems with that getopt(1) implementation, | 
| 8 | as listed in the 'BUGS' section of its man-page: | 
| 9 |  | 
| 10 | >BUGS | 
| 11 | >     Whatever getopt(3) has. | 
| 12 | > | 
| 13 | >     Arguments containing white space or imbedded shell metacharacters gener- | 
| 14 | >     ally will not survive intact;  this looks easy to fix but isn't. | 
| 15 | > | 
| 16 | >     The error message for an invalid option is identified as coming from | 
| 17 | >     getopt rather than from the shell procedure containing the invocation of | 
| 18 | >     getopt; this again is hard to fix. | 
| 19 | > | 
| 20 | >     The precise best way to use the set command to set the arguments without | 
| 21 | >     disrupting the value(s) of shell options varies from one shell version to | 
| 22 | >     another. | 
| 23 |  | 
| 24 | This implementation of getopt(1) is written to solve some of these problems, | 
| 25 | while still staying (for all practical purposes) completely compatible with | 
| 26 | other getopt(1) implementations. | 
| 27 |  | 
| 28 |  | 
| 29 | INSTALLATION | 
| 30 |  | 
| 31 | Installation should be very easy. Just type 'make' to compile the sources. | 
| 32 | It should compile cleanly, without any warnings, but even if it does not | 
| 33 | you probably don't have to worry. You must use GNU Make and gcc, or you | 
| 34 | will have to edit the Makefile. | 
| 35 |  | 
| 36 | Type 'make install' to install the binary and the manual page. It installs | 
| 37 | by default in /usr/local/bin and /usr/local/man/man1, to install in /usr/bin | 
| 38 | and /usr/man/man1 try 'make install prefix=/usr'. | 
| 39 |  | 
| 40 | The example files can be installed in /usr/local/lib/getopt by calling | 
| 41 | 'make install_doc'. | 
| 42 |  | 
| 43 | If you do not trust the getopt(3) in your libc, or if you do not use a libc | 
| 44 | with the GNU getopt(3) routines, you can use the gnu sources as provided | 
| 45 | in the gnu directory. Try 'make LIBCGETOPT=0'. Ignore any compile warnings. | 
| 46 |  | 
| 47 | You can check whether the new implementation of getopt is found first | 
| 48 | in your path by calling 'bash test.bash'. | 
| 49 |  | 
| 50 |  | 
| 51 | HIGHLIGHTS | 
| 52 |  | 
| 53 | It can do anything that the GNU getopt(3) routines can do. | 
| 54 |  | 
| 55 | It can cope with spaces and shell metacharacters within arguments. | 
| 56 |  | 
| 57 | It can parse long parameters. | 
| 58 |  | 
| 59 | It can shuffle parameters, so you can mix options and other parameters on | 
| 60 | the command-line. | 
| 61 |  | 
| 62 | It can be easily identified as an enhanced getopt(1) from within shell scripts. | 
| 63 |  | 
| 64 | It can report parse errors as coming from the shell script. | 
| 65 |  | 
| 66 | It is fully compatible with other getopt(1) implementations. | 
| 67 |  | 
| 68 | COPYING | 
| 69 |  | 
| 70 | This program comes under the GNU general public licence version 2. See the | 
| 71 | file COPYING included in this package. Note that though you may freely | 
| 72 | copy it, it is copyright (c) 1997-2005 by Frodo Looijaard | 
| 73 | <frodo@frodo.looijaard.name>. | 
| 74 | Files in the gnu directory are from glibc-2.0.4: copyright (C) 1987, 88, | 
| 75 | 89, 90, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. | 
| 76 |  | 
| 77 |  | 
| 78 | DOWNLOADING | 
| 79 |  | 
| 80 | You can find the latest version of this program at: | 
| 81 | http://software.frodo.looijaard.name/getopt/ |