Mercurial > hg > octave-jordi > gnulib-hg
view doc/glibc-functions/getopt_long_only.texi @ 12473:81590e0c5feb
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.
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 01 Dec 2009 17:21:34 -0700 |
parents | 9f4c9181d1d6 |
children | 266f24fed73e |
line wrap: on
line source
@node getopt_long_only @subsection @code{getopt_long_only} @findex getopt_long_only Gnulib module: getopt-gnu Portability problems fixed by Gnulib: @itemize @item The function @code{getopt_long_only} 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_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. @item This function is missing on some platforms: MacOS X 10.3, FreeBSD 5.2.1, NetBSD 3.0, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, mingw, 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. @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