summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-12-01 17:21:34 -0700
committerEric Blake <ebb9@byu.net>2009-12-22 06:42:33 -0700
commita8ec28b6975fc065b84c511b8108dc3658d2ccd4 (patch)
tree0ad3e9a11b9a04b5c5294f811c6160993e65f5dc /doc
parent2c77d283b12521cd05a63a4188f68cd595b0a8f9 (diff)
downloadgnulib-a8ec28b6975fc065b84c511b8108dc3658d2ccd4.tar.gz
test-getopt: enhance test
Add coverage of optind==0 for getopt_long, since coreutils depends on it. Also test an optstring containing "W;", since that tends to expose corner-case bugs (even in glibc, so the test is weaker than it could be). * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Require that getopt_long supports optind=0. * tests/test-getopt.c (OPTIND_MIN): Move... * tests/test-getopt.h (OPTIND_MIN): ...here. * tests/test-getopt_long.h (test_getopt_long): Add more coverage. Require that optind=0 works, since modern BSD supports it in addition to optreset, and since coreutils expects it. (test_getopt_long_only): New test. * doc/glibc-functions/getopt_long.texi (getopt_long): Document glibc shortcomings with 'W;', and enforcement of optind=0. * doc/glibc-functions/getopt_long_only.texi (getopt_long_only): Likewise.
Diffstat (limited to 'doc')
-rw-r--r--doc/glibc-functions/getopt_long.texi12
-rw-r--r--doc/glibc-functions/getopt_long_only.texi16
2 files changed, 18 insertions, 10 deletions
diff --git a/doc/glibc-functions/getopt_long.texi b/doc/glibc-functions/getopt_long.texi
index c9843ea50d..a0f8cf4cb7 100644
--- a/doc/glibc-functions/getopt_long.texi
+++ b/doc/glibc-functions/getopt_long.texi
@@ -15,6 +15,10 @@ 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.
@@ -26,9 +30,7 @@ AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Interix 3.5.
Portability problems not fixed by Gnulib:
@itemize
@item
-The glibc implementation allows a complete reset of the environment,
-including re-checking for @env{POSIXLY_CORRECT}, by setting
-@code{optind} to 0. Other implementations provide @code{optreset},
-causing a reset by setting it non-zero, although it does not
-necessarily re-read @env{POSIXLY_CORRECT}.
+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.
@end itemize
diff --git a/doc/glibc-functions/getopt_long_only.texi b/doc/glibc-functions/getopt_long_only.texi
index ed6cd7bad2..fcda30073a 100644
--- a/doc/glibc-functions/getopt_long_only.texi
+++ b/doc/glibc-functions/getopt_long_only.texi
@@ -15,6 +15,10 @@ The function @code{getopt_long_only} 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_only} does not support options with
optional arguments on some platforms:
MacOS X 10.5, OpenBSD 4.0, AIX 5.2, Solaris 10, Cygwin 1.5.x.
@@ -27,9 +31,11 @@ OSF/1 5.1, mingw, Interix 3.5.
Portability problems not fixed by Gnulib:
@itemize
@item
-The glibc implementation allows a complete reset of the environment,
-including re-checking for @env{POSIXLY_CORRECT}, by setting
-@code{optind} to 0. Other implementations provide @code{optreset},
-causing a reset by setting it non-zero, although it does not
-necessarily re-read @env{POSIXLY_CORRECT}.
+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.
+@item
+Some implementations return success instead of reporting an ambiguity
+if user's option is a prefix of two long options with the same flag:
+FreeBSD.
@end itemize