summaryrefslogtreecommitdiffstats
path: root/gl/getopt.in.h
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-08-19 23:27:12 +0200
commit26fbe7f1e68bb0c96da32491efcf3696fe6c299b (patch)
treec4d95289187a64e9c7517bf73d8208026c3d2fb3 /gl/getopt.in.h
parent5f79e3e9f62ca5487d9881973149136ba1d19d3e (diff)
downloadmonitoring-plugins-26fbe7f1e68bb0c96da32491efcf3696fe6c299b.tar.gz
Sync with the latest Gnulib code (6f2d632)
Diffstat (limited to 'gl/getopt.in.h')
-rw-r--r--gl/getopt.in.h70
1 files changed, 38 insertions, 32 deletions
diff --git a/gl/getopt.in.h b/gl/getopt.in.h
index 57a8e899..d9c7d814 100644
--- a/gl/getopt.in.h
+++ b/gl/getopt.in.h
@@ -1,5 +1,5 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2010 Free Software 2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -16,11 +16,12 @@
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#ifndef _GL_GETOPT_H 19#ifndef _@GUARD_PREFIX@_GETOPT_H
20 20
21#if __GNUC__ >= 3 21#if __GNUC__ >= 3
22@PRAGMA_SYSTEM_HEADER@ 22@PRAGMA_SYSTEM_HEADER@
23#endif 23#endif
24@PRAGMA_COLUMNS@
24 25
25/* The include_next requires a split double-inclusion guard. We must 26/* The include_next requires a split double-inclusion guard. We must
26 also inform the replacement unistd.h to not recursively use 27 also inform the replacement unistd.h to not recursively use
@@ -31,10 +32,10 @@
31# undef _GL_SYSTEM_GETOPT 32# undef _GL_SYSTEM_GETOPT
32#endif 33#endif
33 34
34#ifndef _GL_GETOPT_H 35#ifndef _@GUARD_PREFIX@_GETOPT_H
35 36
36#ifndef __need_getopt 37#ifndef __need_getopt
37# define _GL_GETOPT_H 1 38# define _@GUARD_PREFIX@_GETOPT_H 1
38#endif 39#endif
39 40
40/* Standalone applications should #define __GETOPT_PREFIX to an 41/* Standalone applications should #define __GETOPT_PREFIX to an
@@ -48,7 +49,9 @@
48 linkers. */ 49 linkers. */
49#if defined __GETOPT_PREFIX && !defined __need_getopt 50#if defined __GETOPT_PREFIX && !defined __need_getopt
50# if !@HAVE_GETOPT_H@ 51# if !@HAVE_GETOPT_H@
52# define __need_system_stdlib_h
51# include <stdlib.h> 53# include <stdlib.h>
54# undef __need_system_stdlib_h
52# include <stdio.h> 55# include <stdio.h>
53# include <unistd.h> 56# include <unistd.h>
54# endif 57# endif
@@ -81,7 +84,7 @@
81 getopt_long_only can permute argv; this is required for backward 84 getopt_long_only can permute argv; this is required for backward
82 compatibility (e.g., for LSB 2.0.1). 85 compatibility (e.g., for LSB 2.0.1).
83 86
84 This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', 87 This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
85 but it caused redefinition warnings if both unistd.h and getopt.h were 88 but it caused redefinition warnings if both unistd.h and getopt.h were
86 included, since unistd.h includes getopt.h having previously defined 89 included, since unistd.h includes getopt.h having previously defined
87 __need_getopt. 90 __need_getopt.
@@ -127,29 +130,29 @@
127extern "C" { 130extern "C" {
128#endif 131#endif
129 132
130/* For communication from `getopt' to the caller. 133/* For communication from 'getopt' to the caller.
131 When `getopt' finds an option that takes an argument, 134 When 'getopt' finds an option that takes an argument,
132 the argument value is returned here. 135 the argument value is returned here.
133 Also, when `ordering' is RETURN_IN_ORDER, 136 Also, when 'ordering' is RETURN_IN_ORDER,
134 each non-option ARGV-element is returned here. */ 137 each non-option ARGV-element is returned here. */
135 138
136extern char *optarg; 139extern char *optarg;
137 140
138/* Index in ARGV of the next element to be scanned. 141/* Index in ARGV of the next element to be scanned.
139 This is used for communication to and from the caller 142 This is used for communication to and from the caller
140 and for communication between successive calls to `getopt'. 143 and for communication between successive calls to 'getopt'.
141 144
142 On entry to `getopt', zero means this is the first call; initialize. 145 On entry to 'getopt', zero means this is the first call; initialize.
143 146
144 When `getopt' returns -1, this is the index of the first of the 147 When 'getopt' returns -1, this is the index of the first of the
145 non-option elements that the caller should itself scan. 148 non-option elements that the caller should itself scan.
146 149
147 Otherwise, `optind' communicates from one call to the next 150 Otherwise, 'optind' communicates from one call to the next
148 how much of ARGV has been scanned so far. */ 151 how much of ARGV has been scanned so far. */
149 152
150extern int optind; 153extern int optind;
151 154
152/* Callers store zero here to inhibit the error message `getopt' prints 155/* Callers store zero here to inhibit the error message 'getopt' prints
153 for unrecognized options. */ 156 for unrecognized options. */
154 157
155extern int opterr; 158extern int opterr;
@@ -161,25 +164,26 @@ extern int optopt;
161#ifndef __need_getopt 164#ifndef __need_getopt
162/* Describe the long-named options requested by the application. 165/* Describe the long-named options requested by the application.
163 The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 166 The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
164 of `struct option' terminated by an element containing a name which is 167 of 'struct option' terminated by an element containing a name which is
165 zero. 168 zero.
166 169
167 The field `has_arg' is: 170 The field 'has_arg' is:
168 no_argument (or 0) if the option does not take an argument, 171 no_argument (or 0) if the option does not take an argument,
169 required_argument (or 1) if the option requires an argument, 172 required_argument (or 1) if the option requires an argument,
170 optional_argument (or 2) if the option takes an optional argument. 173 optional_argument (or 2) if the option takes an optional argument.
171 174
172 If the field `flag' is not NULL, it points to a variable that is set 175 If the field 'flag' is not NULL, it points to a variable that is set
173 to the value given in the field `val' when the option is found, but 176 to the value given in the field 'val' when the option is found, but
174 left unchanged if the option is not found. 177 left unchanged if the option is not found.
175 178
176 To have a long-named option do something other than set an `int' to 179 To have a long-named option do something other than set an 'int' to
177 a compiled-in constant, such as set a value from `optarg', set the 180 a compiled-in constant, such as set a value from 'optarg', set the
178 option's `flag' field to zero and its `val' field to a nonzero 181 option's 'flag' field to zero and its 'val' field to a nonzero
179 value (the equivalent single-letter option character, if there is 182 value (the equivalent single-letter option character, if there is
180 one). For long options that have a zero `flag' field, `getopt' 183 one). For long options that have a zero 'flag' field, 'getopt'
181 returns the contents of the `val' field. */ 184 returns the contents of the 'val' field. */
182 185
186# if !GNULIB_defined_struct_option
183struct option 187struct option
184{ 188{
185 const char *name; 189 const char *name;
@@ -189,8 +193,10 @@ struct option
189 int *flag; 193 int *flag;
190 int val; 194 int val;
191}; 195};
196# define GNULIB_defined_struct_option 1
197# endif
192 198
193/* Names for the values of the `has_arg' field of `struct option'. */ 199/* Names for the values of the 'has_arg' field of 'struct option'. */
194 200
195# define no_argument 0 201# define no_argument 0
196# define required_argument 1 202# define required_argument 1
@@ -204,23 +210,23 @@ struct option
204 210
205 Return the option character from OPTS just read. Return -1 when 211 Return the option character from OPTS just read. Return -1 when
206 there are no more options. For unrecognized options, or options 212 there are no more options. For unrecognized options, or options
207 missing arguments, `optopt' is set to the option letter, and '?' is 213 missing arguments, 'optopt' is set to the option letter, and '?' is
208 returned. 214 returned.
209 215
210 The OPTS string is a list of characters which are recognized option 216 The OPTS string is a list of characters which are recognized option
211 letters, optionally followed by colons, specifying that that letter 217 letters, optionally followed by colons, specifying that that letter
212 takes an argument, to be placed in `optarg'. 218 takes an argument, to be placed in 'optarg'.
213 219
214 If a letter in OPTS is followed by two colons, its argument is 220 If a letter in OPTS is followed by two colons, its argument is
215 optional. This behavior is specific to the GNU `getopt'. 221 optional. This behavior is specific to the GNU 'getopt'.
216 222
217 The argument `--' causes premature termination of argument 223 The argument '--' causes premature termination of argument
218 scanning, explicitly telling `getopt' that there are no more 224 scanning, explicitly telling 'getopt' that there are no more
219 options. 225 options.
220 226
221 If OPTS begins with `-', then non-option arguments are treated as 227 If OPTS begins with '-', then non-option arguments are treated as
222 arguments to the option '\1'. This behavior is specific to the GNU 228 arguments to the option '\1'. This behavior is specific to the GNU
223 `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in 229 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
224 the environment, then do not permute arguments. */ 230 the environment, then do not permute arguments. */
225 231
226extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) 232extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
@@ -245,5 +251,5 @@ extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
245/* Make sure we later can get all the definitions and declarations. */ 251/* Make sure we later can get all the definitions and declarations. */
246#undef __need_getopt 252#undef __need_getopt
247 253
248#endif /* getopt.h */ 254#endif /* _@GUARD_PREFIX@_GETOPT_H */
249#endif /* getopt.h */ 255#endif /* _@GUARD_PREFIX@_GETOPT_H */