1 |
/* Declarations for getopt. |
/* Declarations for getopt. |
2 |
Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc. |
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. |
3 |
NOTE: The canonical source of this file is maintained with the GNU C Library. |
This file is part of the GNU C Library. |
4 |
Bugs can be reported to bug-glibc@gnu.org. |
|
5 |
This program is free software; you can redistribute it and/or modify it |
This program is free software; you can redistribute it and/or modify |
6 |
under the terms of the GNU General Public License as published by the |
it under the terms of the GNU General Public License as published by |
7 |
Free Software Foundation; either version 2, or (at your option) any |
the Free Software Foundation; either version 2, or (at your option) |
8 |
later version. |
any later version. |
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
GNU General Public License for more details. |
GNU General Public License for more details. |
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License along |
16 |
along with this program; if not, write to the Free Software |
with this program; if not, write to the Free Software Foundation, |
17 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
USA. */ |
|
18 |
|
|
19 |
#ifndef _GETOPT_H |
#ifndef _GETOPT_H |
20 |
|
|
22 |
# define _GETOPT_H 1 |
# define _GETOPT_H 1 |
23 |
#endif |
#endif |
24 |
|
|
25 |
|
/* If __GNU_LIBRARY__ is not already defined, either we are being used |
26 |
|
standalone, or this is the first header included in the source file. |
27 |
|
If we are being used with glibc, we need to include <features.h>, but |
28 |
|
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is |
29 |
|
not defined, include <ctype.h>, which will pull in <features.h> for us |
30 |
|
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it |
31 |
|
doesn't flood the namespace with stuff the way some other headers do.) */ |
32 |
|
#if !defined __GNU_LIBRARY__ |
33 |
|
# include <ctype.h> |
34 |
|
#endif |
35 |
|
|
36 |
#ifdef __cplusplus |
#ifdef __cplusplus |
37 |
extern "C" { |
extern "C" { |
38 |
#endif |
#endif |
92 |
|
|
93 |
struct option |
struct option |
94 |
{ |
{ |
95 |
# if defined __STDC__ && __STDC__ |
# if (defined __STDC__ && __STDC__) || defined __cplusplus |
96 |
const char *name; |
const char *name; |
97 |
# else |
# else |
98 |
char *name; |
char *name; |
136 |
arguments to the option '\0'. This behavior is specific to the GNU |
arguments to the option '\0'. This behavior is specific to the GNU |
137 |
`getopt'. */ |
`getopt'. */ |
138 |
|
|
139 |
#if defined __STDC__ && __STDC__ |
#if (defined __STDC__ && __STDC__) || defined __cplusplus |
140 |
# ifdef __GNU_LIBRARY__ |
# ifdef __GNU_LIBRARY__ |
141 |
/* Many other libraries have conflicting prototypes for getopt, with |
/* Many other libraries have conflicting prototypes for getopt, with |
142 |
differences in the consts, in stdlib.h. To avoid compilation |
differences in the consts, in stdlib.h. To avoid compilation |
143 |
errors, only prototype getopt for the GNU C library. */ |
errors, only prototype getopt for the GNU C library. */ |
144 |
extern int getopt (int __argc, char *const *__argv, const char *__shortopts); |
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); |
145 |
# else /* not __GNU_LIBRARY__ */ |
# else /* not __GNU_LIBRARY__ */ |
146 |
extern int getopt (); |
extern int getopt (); |
147 |
# endif /* __GNU_LIBRARY__ */ |
# endif /* __GNU_LIBRARY__ */ |
148 |
|
|
149 |
# ifndef __need_getopt |
# ifndef __need_getopt |
150 |
extern int getopt_long (int argc, char *const *argv, const char *__shortopts, |
extern int getopt_long (int ___argc, char *const *___argv, |
151 |
|
const char *__shortopts, |
152 |
const struct option *__longopts, int *__longind); |
const struct option *__longopts, int *__longind); |
153 |
extern int getopt_long_only (int argc, char *const *argv, |
extern int getopt_long_only (int ___argc, char *const *___argv, |
154 |
const char *__shortopts, |
const char *__shortopts, |
155 |
const struct option *__longopts, int *__longind); |
const struct option *__longopts, int *__longind); |
156 |
|
|
157 |
/* Internal only. Users should not call this directly. */ |
/* Internal only. Users should not call this directly. */ |
158 |
extern int _getopt_internal (int argc, char *const *argv, |
extern int _getopt_internal (int ___argc, char *const *___argv, |
159 |
const char *__shortopts, |
const char *__shortopts, |
160 |
const struct option *__longopts, int *__longind, |
const struct option *__longopts, int *__longind, |
161 |
int __long_only); |
int __long_only); |