1 |
/* Declarations for getopt. |
/* Declarations for getopt. |
2 |
Copyright (C) 1989-1994,1996-1999,2001,2003,2004 |
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. |
|
Free Software Foundation, Inc. |
|
3 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
4 |
|
|
5 |
The GNU C Library is free software; you can redistribute it and/or |
The GNU C Library is free software; you can redistribute it and/or |
34 |
# include <ctype.h> |
# include <ctype.h> |
35 |
#endif |
#endif |
36 |
|
|
|
#ifndef __THROW |
|
|
# ifndef __GNUC_PREREQ |
|
|
# define __GNUC_PREREQ(maj, min) (0) |
|
|
# endif |
|
|
# if defined __cplusplus && __GNUC_PREREQ (2,8) |
|
|
# define __THROW throw () |
|
|
# else |
|
|
# define __THROW |
|
|
# endif |
|
|
#endif |
|
|
|
|
37 |
#ifdef __cplusplus |
#ifdef __cplusplus |
38 |
extern "C" { |
extern "C" { |
39 |
#endif |
#endif |
93 |
|
|
94 |
struct option |
struct option |
95 |
{ |
{ |
96 |
|
# if (defined __STDC__ && __STDC__) || defined __cplusplus |
97 |
const char *name; |
const char *name; |
98 |
|
# else |
99 |
|
char *name; |
100 |
|
# endif |
101 |
/* has_arg can't be an enum because some compilers complain about |
/* 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. */ |
type mismatches in all the code that assumes it is an int. */ |
103 |
int has_arg; |
int has_arg; |
137 |
arguments to the option '\0'. This behavior is specific to the GNU |
arguments to the option '\0'. This behavior is specific to the GNU |
138 |
`getopt'. */ |
`getopt'. */ |
139 |
|
|
140 |
#ifdef __GNU_LIBRARY__ |
#if (defined __STDC__ && __STDC__) || defined __cplusplus |
141 |
|
# ifdef __GNU_LIBRARY__ |
142 |
/* Many other libraries have conflicting prototypes for getopt, with |
/* Many other libraries have conflicting prototypes for getopt, with |
143 |
differences in the consts, in stdlib.h. To avoid compilation |
differences in the consts, in stdlib.h. To avoid compilation |
144 |
errors, only prototype getopt for the GNU C library. */ |
errors, only prototype getopt for the GNU C library. */ |
145 |
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) |
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); |
146 |
__THROW; |
# else /* not __GNU_LIBRARY__ */ |
|
#else /* not __GNU_LIBRARY__ */ |
|
147 |
extern int getopt (); |
extern int getopt (); |
148 |
#endif /* __GNU_LIBRARY__ */ |
# endif /* __GNU_LIBRARY__ */ |
149 |
|
|
150 |
#ifndef __need_getopt |
# ifndef __need_getopt |
151 |
extern int getopt_long (int ___argc, char *const *___argv, |
extern int getopt_long (int ___argc, char *const *___argv, |
152 |
const char *__shortopts, |
const char *__shortopts, |
153 |
const struct option *__longopts, int *__longind) |
const struct option *__longopts, int *__longind); |
|
__THROW; |
|
154 |
extern int getopt_long_only (int ___argc, char *const *___argv, |
extern int getopt_long_only (int ___argc, char *const *___argv, |
155 |
const char *__shortopts, |
const char *__shortopts, |
156 |
const struct option *__longopts, int *__longind) |
const struct option *__longopts, int *__longind); |
|
__THROW; |
|
157 |
|
|
158 |
#endif |
/* Internal only. Users should not call this directly. */ |
159 |
|
extern int _getopt_internal (int ___argc, char *const *___argv, |
160 |
|
const char *__shortopts, |
161 |
|
const struct option *__longopts, int *__longind, |
162 |
|
int __long_only); |
163 |
|
# 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 |
|
|
174 |
#ifdef __cplusplus |
#ifdef __cplusplus |
175 |
} |
} |