Documentation update for getopt
Andreas Jaeger
aj@suse.de
Wed Dec 29 06:07:00 GMT 1999
Here's an update of the documentation of getopt.
Andreas
1999-12-29 Andreas Jaeger <aj@suse.de>
* manual/getopt.texi (Using Getopt): Document ordering of
options.
============================================================
Index: manual/getopt.texi
--- manual/getopt.texi 1999/03/19 02:17:38 2.2
+++ manual/getopt.texi 1999/12/29 13:58:31
@@ -71,9 +71,28 @@
required argument. If an option character is followed by two colons
(@samp{::}), its argument is optional; this is a GNU extension.
+@code{getopt} has three ways to deal with options that follow
+non-options @var{argv} elements. The special argument @samp{--} forces
+in all cases the end of option scanning.
+
+@itemize @bullet
+@item
+The default is to permute the contents of @var{argv} while scanning it
+so that eventually all the non-options are at the end. This allows
+options to be given in any order, even with programs that were not
+written to expect this.
+
+@item
If the @var{options} argument string begins with a hyphen (@samp{-}), this
is treated specially. It permits arguments that are not options to be
returned as if they were associated with option character @samp{\0}.
+
+@item
+POSIX demands the following behaviour: The first non-option stops option
+processing. This mode is selected by either setting the environment
+variable @code{POSIXLY_CORRECT} or beginning the @var{options} argument
+string with a plus sign (@samp{+}).
+@end itemize
The @code{getopt} function returns the option character for the next
command line option. When no more option arguments are available, it
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.rhein-neckar.de
More information about the Libc-hacker
mailing list