1 |
/* Declarations for getopt. |
/* Declarations for getopt. |
2 |
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. |
|
3 |
|
Copyright (C) 1989-1994, 1996-1999, 2001, 2002 Free Software Foundation, |
4 |
|
Inc. |
5 |
|
|
6 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
7 |
|
|
8 |
The GNU C Library is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or modify |
9 |
modify it under the terms of the GNU Lesser General Public |
it under the terms of the GNU General Public License as published by |
10 |
License as published by the Free Software Foundation; either |
the Free Software Foundation; either version 2, or (at your option) |
11 |
version 2.1 of the License, or (at your option) any later version. |
any later version. |
12 |
|
|
13 |
The GNU C Library is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
Lesser General Public License for more details. |
GNU General Public License for more details. |
17 |
|
|
18 |
You should have received a copy of the GNU Lesser General Public |
You should have received a copy of the GNU General Public License |
19 |
License along with the GNU C Library; if not, write to the Free |
along with this program; if not, write to the Free Software Foundation, |
20 |
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
02111-1307 USA. */ |
|
21 |
|
|
22 |
#ifndef _GETOPT_H |
#ifndef _GETOPT_H |
23 |
|
|
29 |
standalone, or this is the first header included in the source file. |
standalone, or this is the first header included in the source file. |
30 |
If we are being used with glibc, we need to include <features.h>, but |
If we are being used with glibc, we need to include <features.h>, but |
31 |
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is |
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is |
32 |
not defined, include <ctype.h>, which will pull in <features.h> for us |
not defined, include <stdlib.h>, which will pull in <features.h> for us |
33 |
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it |
if it's from glibc (and will declare getopt). Fall back on <ctype.h> if |
34 |
|
<stdlib.h> might not exist. (Why ctype.h? It's guaranteed to exist and it |
35 |
doesn't flood the namespace with stuff the way some other headers do.) */ |
doesn't flood the namespace with stuff the way some other headers do.) */ |
36 |
#if !defined __GNU_LIBRARY__ |
#if !defined __GNU_LIBRARY__ |
37 |
# include <ctype.h> |
# if HAVE_STDLIB_H || STDC_HEADERS |
38 |
|
# include <stdlib.h> |
39 |
|
# else |
40 |
|
# include <ctype.h> |
41 |
|
# endif |
42 |
#endif |
#endif |
43 |
|
|
44 |
#ifdef __cplusplus |
#ifdef __cplusplus |
145 |
`getopt'. */ |
`getopt'. */ |
146 |
|
|
147 |
#if (defined __STDC__ && __STDC__) || defined __cplusplus |
#if (defined __STDC__ && __STDC__) || defined __cplusplus |
148 |
# ifdef __GNU_LIBRARY__ |
# if defined HAVE_DECL_GETOPT && !HAVE_DECL_GETOPT |
149 |
|
# ifdef __GNU_LIBRARY__ |
150 |
/* Many other libraries have conflicting prototypes for getopt, with |
/* Many other libraries have conflicting prototypes for getopt, with |
151 |
differences in the consts, in stdlib.h. To avoid compilation |
differences in the consts, in stdlib.h. To avoid compilation |
152 |
errors, only prototype getopt for the GNU C library. */ |
errors, only prototype getopt for the GNU C library. */ |
153 |
extern int getopt (int __argc, char *const *__argv, const char *__shortopts); |
extern int getopt (int __argc, char *const *__argv, const char *__shortopts); |
154 |
# else /* not __GNU_LIBRARY__ */ |
# else /* not __GNU_LIBRARY__ */ |
155 |
extern int getopt (); |
extern int getopt (); |
156 |
# endif /* __GNU_LIBRARY__ */ |
# endif /* __GNU_LIBRARY__ */ |
157 |
|
# endif /* defined HAVE_DECL_GETOPT && !HAVE_DECL_GETOPT */ |
158 |
|
|
159 |
# ifndef __need_getopt |
# ifndef __need_getopt |
160 |
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, |
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, |