mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-17 12:41:05 +03:00
Portions of this commit are commented out because they tickle glibc bugs. For a real-life example of the bug: $ env -ua -: env: invalid option -- : Try `env --help' for more information. $ env -: env: invalid option -- : Try `env --help' for more information. $ env -+ env: invalid option -- + Try `env --help' for more information. $ env -ua -+ Try `env --help' for more information. Notice that when -+ is not given as the first argument, the error message is mistakenly suppressed. * modules/getopt-posix-tests (Depends-on): Add dup2. * tests/test-getopt.c (ASSERT): Avoid stderr. (main): Move stderr to a temporary file. * tests/test-getopt.h (getopt_loop): No longer manipulate opterr. Instead, add parameter to inform caller if output occurred. (test_getopt): Adjust all tests to expect silence, and add new tests of leading ":". * doc/glibc-functions/getopt_long.texi (getopt_long): Document glibc shortcomings with leading "-:" or "+:" in optstring. * doc/glibc-functions/getopt_long_only.texi (getopt_long_only): Likewise. * doc/posix-functions/getopt.texi (getopt): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
@node getopt_long
|
|
@subsection @code{getopt_long}
|
|
@findex getopt_long
|
|
|
|
Gnulib module: getopt-gnu
|
|
|
|
Portability problems fixed by Gnulib:
|
|
@itemize
|
|
@item
|
|
The function @code{getopt_long} does not support the @samp{+} flag in
|
|
the options string on some platforms:
|
|
MacOS X 10.5, AIX 5.2, OSF/1 5.1, Solaris 10.
|
|
@item
|
|
The function @code{getopt_long} does not obey the @samp{-} flag in the
|
|
options string when @env{POSIXLY_CORRECT} is set on some platforms:
|
|
Cygwin 1.7.0.
|
|
@item
|
|
Some implementations fail to reset state, including re-checking
|
|
@env{POSIXLY_CORRECT}, when @code{optind} is set to @samp{0}:
|
|
NetBSD, Cygwin 1.7.0.
|
|
@item
|
|
The function @code{getopt_long} does not support options with optional
|
|
arguments on some platforms:
|
|
MacOS X 10.5, OpenBSD 4.0, AIX 5.2, IRIX 6.5, Solaris 10, Cygwin 1.5.x.
|
|
@item
|
|
This function is missing on some platforms:
|
|
AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Interix 3.5.
|
|
@end itemize
|
|
|
|
Portability problems not fixed by Gnulib:
|
|
@itemize
|
|
@item
|
|
The glibc extension of using @samp{W;} in the optstring argument to
|
|
allow @code{-W foo} to behave synonymously with @code{--foo} is not
|
|
very reliable, even in glibc.
|
|
@item
|
|
Mixing a leading @samp{-} or @samp{+} with a leading @samp{:} in the
|
|
optstring argument has inconsistent effects across platforms.
|
|
@end itemize
|