diff options
Diffstat (limited to 'lib/getopt.h')
-rw-r--r-- | lib/getopt.h | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/lib/getopt.h b/lib/getopt.h index 4283c35b..5e15191e 100644 --- a/lib/getopt.h +++ b/lib/getopt.h | |||
@@ -1,21 +1,23 @@ | |||
1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
2 | Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. | 2 | |
3 | Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, | ||
4 | 1999, 2001, 2003 Free Software Foundation, Inc. | ||
5 | |||
3 | This file is part of the GNU C Library. | 6 | This file is part of the GNU C Library. |
4 | 7 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | 8 | This program is free software; you can redistribute it and/or modify |
6 | modify it under the terms of the GNU Lesser General Public | 9 | it under the terms of the GNU General Public License as published by |
7 | License as published by the Free Software Foundation; either | 10 | the Free Software Foundation; either version 2, or (at your option) |
8 | version 2.1 of the License, or (at your option) any later version. | 11 | any later version. |
9 | 12 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | Lesser General Public License for more details. | 16 | GNU General Public License for more details. |
14 | 17 | ||
15 | You should have received a copy of the GNU Lesser General Public | 18 | You should have received a copy of the GNU General Public License along |
16 | License along with the GNU C Library; if not, write to the Free | 19 | with this program; if not, write to the Free Software Foundation, |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | 20 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
18 | 02111-1307 USA. */ | ||
19 | 21 | ||
20 | #ifndef _GETOPT_H | 22 | #ifndef _GETOPT_H |
21 | 23 | ||
@@ -78,7 +80,7 @@ extern int optopt; | |||
78 | The field `has_arg' is: | 80 | The field `has_arg' is: |
79 | no_argument (or 0) if the option does not take an argument, | 81 | no_argument (or 0) if the option does not take an argument, |
80 | required_argument (or 1) if the option requires an argument, | 82 | required_argument (or 1) if the option requires an argument, |
81 | optional_argument (or 2) if the option takes an optional argument. | 83 | optional_argument (or 2) if the option takes an optional argument. |
82 | 84 | ||
83 | If the field `flag' is not NULL, it points to a variable that is set | 85 | If the field `flag' is not NULL, it points to a variable that is set |
84 | to the value given in the field `val' when the option is found, but | 86 | to the value given in the field `val' when the option is found, but |
@@ -93,11 +95,7 @@ extern int optopt; | |||
93 | 95 | ||
94 | struct option | 96 | struct option |
95 | { | 97 | { |
96 | # if (defined __STDC__ && __STDC__) || defined __cplusplus | ||
97 | const char *name; | 98 | const char *name; |
98 | # else | ||
99 | char *name; | ||
100 | # endif | ||
101 | /* has_arg can't be an enum because some compilers complain about | 99 | /* has_arg can't be an enum because some compilers complain about |
102 | type mismatches in all the code that assumes it is an int. */ | 100 | type mismatches in all the code that assumes it is an int. */ |
103 | int has_arg; | 101 | int has_arg; |
@@ -137,17 +135,16 @@ struct option | |||
137 | arguments to the option '\0'. This behavior is specific to the GNU | 135 | arguments to the option '\0'. This behavior is specific to the GNU |
138 | `getopt'. */ | 136 | `getopt'. */ |
139 | 137 | ||
140 | #if (defined __STDC__ && __STDC__) || defined __cplusplus | 138 | #ifdef __GNU_LIBRARY__ |
141 | # ifdef __GNU_LIBRARY__ | ||
142 | /* Many other libraries have conflicting prototypes for getopt, with | 139 | /* Many other libraries have conflicting prototypes for getopt, with |
143 | differences in the consts, in stdlib.h. To avoid compilation | 140 | differences in the consts, in stdlib.h. To avoid compilation |
144 | errors, only prototype getopt for the GNU C library. */ | 141 | errors, only prototype getopt for the GNU C library. */ |
145 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); | 142 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); |
146 | # else /* not __GNU_LIBRARY__ */ | 143 | #else /* not __GNU_LIBRARY__ */ |
147 | extern int getopt (); | 144 | extern int getopt (); |
148 | # endif /* __GNU_LIBRARY__ */ | 145 | #endif /* __GNU_LIBRARY__ */ |
149 | 146 | ||
150 | # ifndef __need_getopt | 147 | #ifndef __need_getopt |
151 | extern int getopt_long (int ___argc, char *const *___argv, | 148 | extern int getopt_long (int ___argc, char *const *___argv, |
152 | const char *__shortopts, | 149 | const char *__shortopts, |
153 | const struct option *__longopts, int *__longind); | 150 | const struct option *__longopts, int *__longind); |
@@ -160,16 +157,7 @@ extern int _getopt_internal (int ___argc, char *const *___argv, | |||
160 | const char *__shortopts, | 157 | const char *__shortopts, |
161 | const struct option *__longopts, int *__longind, | 158 | const struct option *__longopts, int *__longind, |
162 | int __long_only); | 159 | int __long_only); |
163 | # endif | 160 | #endif |
164 | #else /* not __STDC__ */ | ||
165 | extern int getopt (); | ||
166 | # ifndef __need_getopt | ||
167 | extern int getopt_long (); | ||
168 | extern int getopt_long_only (); | ||
169 | |||
170 | extern int _getopt_internal (); | ||
171 | # endif | ||
172 | #endif /* __STDC__ */ | ||
173 | 161 | ||
174 | #ifdef __cplusplus | 162 | #ifdef __cplusplus |
175 | } | 163 | } |