annotate doc/posix-functions/getopt.texi @ 16254:da62858ef2f6

doc: Update for Solaris 11 2011-11. * doc/*/*.texi: Mention Solaris 11 2011-11 where appropriate. * m4/printf.m4: Update comments.
author Bruno Haible <bruno@clisp.org>
date Sun, 08 Jan 2012 19:57:28 +0100
parents 6355dc4626b5
children 498a2211d839
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 @node getopt
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 @section @code{getopt}
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 @findex getopt
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
13549
bb0ceefd22dc avoid some overlong lines from posix urls, etc.
Karl Berry <karl@freefriends.org>
parents: 13493
diff changeset
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getopt.html}
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
7 Gnulib module: getopt-posix or getopt-gnu
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
8
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
9 The module @code{getopt-gnu} has support for ``long options'' and for
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
10 ``options that take optional arguments''. Compared to the API defined by POSIX,
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
11 it adds a header file @code{<getopt.h>} and a function @code{getopt_long}.
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
12
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
13 Portability problems fixed by either Gnulib module @code{getopt-posix} or @code{getopt-gnu}:
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
14 @itemize
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
15 @item
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
16 The @code{getopt} function keeps some internal state that cannot be explicitly
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
17 reset on some platforms:
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
18 mingw.
13226
9ab255e8b6a9 getopt-posix: detect MacOS bug
Eric Blake <eblake@redhat.com>
parents: 12474
diff changeset
19 @item
9ab255e8b6a9 getopt-posix: detect MacOS bug
Eric Blake <eblake@redhat.com>
parents: 12474
diff changeset
20 The value of @code{optind} after a missing required argument is wrong
9ab255e8b6a9 getopt-posix: detect MacOS bug
Eric Blake <eblake@redhat.com>
parents: 12474
diff changeset
21 on some platforms:
13493
f3cdb966ff0f getopt: Update regarding AIX.
Bruno Haible <bruno@clisp.org>
parents: 13228
diff changeset
22 MacOS 10.5, AIX 7.1.
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
23 @end itemize
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
25 Portability problems fixed by Gnulib module @code{getopt-gnu}:
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 @itemize
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
27 @item
15607
6355dc4626b5 doc: Update regarding MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15359
diff changeset
28 This function is missing on some platforms:
6355dc4626b5 doc: Update regarding MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15359
diff changeset
29 MSVC 9.
6355dc4626b5 doc: Update regarding MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15359
diff changeset
30 @item
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
31 The function @code{getopt} does not support the @samp{+} flag in the options
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
32 string on some platforms:
13917
3bbfc7e37ec2 Update for Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents: 13892
diff changeset
33 MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11.
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
34 @item
13228
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
35 The function @code{getopt} does not obey the combination of @samp{+}
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
36 and @samp{:} flags in the options string on some platforms:
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
37 glibc 2.11.
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
38 @item
12371
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
39 The function @code{getopt} does not obey the @samp{-} flag in the options
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
40 string when @env{POSIXLY_CORRECT} is set on some platforms:
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
41 Cygwin 1.7.0.
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
42 @item
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
43 The function @code{getopt} does not support options with optional arguments
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
44 on some platforms:
12125
6ade22f26c05 doc: tweak more cygwin information
Eric Blake <ebb9@byu.net>
parents: 11819
diff changeset
45 MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1,
13917
3bbfc7e37ec2 Update for Solaris 11 2010-11.
Bruno Haible <bruno@clisp.org>
parents: 13892
diff changeset
46 Solaris 11 2010-11, Cygwin 1.5.x.
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
47 @item
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
48 The function @code{getopt_long} is missing on some platforms:
15607
6355dc4626b5 doc: Update regarding MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15359
diff changeset
49 AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, MSVC 9, Interix 3.5.
12371
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
50 @item
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
51 The function @code{getopt_long_only} is missing on some platforms:
13892
ac911e0db006 Update for NetBSD 5.0.
Bruno Haible <bruno@clisp.org>
parents: 13549
diff changeset
52 MacOS X 10.3, FreeBSD 5.2.1, NetBSD 5.0, AIX 5.1, HP-UX 11, IRIX 6.5,
15607
6355dc4626b5 doc: Update regarding MSVC 9.
Bruno Haible <bruno@clisp.org>
parents: 15359
diff changeset
53 OSF/1 5.1, Solaris 9, mingw, MSVC 9, Interix 3.5.
15359
be44fb90ec88 getopt-gnu: avoid crash in glibc getopt
Eric Blake <eblake@redhat.com>
parents: 14888
diff changeset
54 @item
be44fb90ec88 getopt-gnu: avoid crash in glibc getopt
Eric Blake <eblake@redhat.com>
parents: 14888
diff changeset
55 This function crashes if the option string includes @code{W;} on some
be44fb90ec88 getopt-gnu: avoid crash in glibc getopt
Eric Blake <eblake@redhat.com>
parents: 14888
diff changeset
56 platforms:
be44fb90ec88 getopt-gnu: avoid crash in glibc getopt
Eric Blake <eblake@redhat.com>
parents: 14888
diff changeset
57 glibc 2.14.
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 @end itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 Portability problems not fixed by Gnulib:
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 @itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 @item
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 The default behavior of the glibc implementation of @code{getopt} allows
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 mixing option and non-option arguments on the command line in any order.
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 Other implementations, such as the one in Cygwin, enforce strict POSIX
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 compliance: they require that the option arguments precede the non-option
12371
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
67 arguments. This is something to watch out in your program's
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
68 testsuite.
11819
245c367e63f4 New modules 'getopt-posix', 'getopt-gnu'.
Bruno Haible <bruno@clisp.org>
parents: 10876
diff changeset
69 @item
12371
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
70 The glibc implementation allows a complete reset of the environment,
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
71 including re-checking for @env{POSIXLY_CORRECT}, by setting
13228
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
72 @code{optind} to 0. Several BSD implementations provide @code{optreset},
12371
9f4c9181d1d6 getopt-gnu: flush out another BSD bug
Eric Blake <ebb9@byu.net>
parents: 12125
diff changeset
73 causing a reset by setting it non-zero, although it does not
13228
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
74 necessarily re-read @env{POSIXLY_CORRECT}. Solaris @code{getopt} does
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
75 not support either reset method, but does not maintain state that
de461a3f23f5 getopt-gnu: match recent glibc fixes and posix ruling
Eric Blake <eblake@redhat.com>
parents: 13226
diff changeset
76 needs the extra level of reset.
14888
805e07cd88c7 test-perror: relax test to ignore cygwin bug
Eric Blake <eblake@redhat.com>
parents: 13917
diff changeset
77 @item
805e07cd88c7 test-perror: relax test to ignore cygwin bug
Eric Blake <eblake@redhat.com>
parents: 13917
diff changeset
78 On some platforms, this function does not set the stream error
805e07cd88c7 test-perror: relax test to ignore cygwin bug
Eric Blake <eblake@redhat.com>
parents: 13917
diff changeset
79 indicator on attempts to write to a read-only stream:
805e07cd88c7 test-perror: relax test to ignore cygwin bug
Eric Blake <eblake@redhat.com>
parents: 13917
diff changeset
80 glibc 2.13, Cygwin 1.7.9.
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 @end itemize