1 |
/* Declarations for getopt. |
/* Declarations for getopt. |
2 |
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1989-1994,1996-1999,2001,2003,2004 |
3 |
|
Free Software Foundation, Inc. |
4 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
5 |
|
|
6 |
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 |
35 |
# include <ctype.h> |
# include <ctype.h> |
36 |
#endif |
#endif |
37 |
|
|
38 |
|
#ifndef __THROW |
39 |
|
# ifndef __GNUC_PREREQ |
40 |
|
# define __GNUC_PREREQ(maj, min) (0) |
41 |
|
# endif |
42 |
|
# if defined __cplusplus && __GNUC_PREREQ (2,8) |
43 |
|
# define __THROW throw () |
44 |
|
# else |
45 |
|
# define __THROW |
46 |
|
# endif |
47 |
|
#endif |
48 |
|
|
49 |
#ifdef __cplusplus |
#ifdef __cplusplus |
50 |
extern "C" { |
extern "C" { |
51 |
#endif |
#endif |
105 |
|
|
106 |
struct option |
struct option |
107 |
{ |
{ |
|
# if (defined __STDC__ && __STDC__) || defined __cplusplus |
|
108 |
const char *name; |
const char *name; |
|
# else |
|
|
char *name; |
|
|
# endif |
|
109 |
/* has_arg can't be an enum because some compilers complain about |
/* has_arg can't be an enum because some compilers complain about |
110 |
type mismatches in all the code that assumes it is an int. */ |
type mismatches in all the code that assumes it is an int. */ |
111 |
int has_arg; |
int has_arg; |
145 |
arguments to the option '\0'. This behavior is specific to the GNU |
arguments to the option '\0'. This behavior is specific to the GNU |
146 |
`getopt'. */ |
`getopt'. */ |
147 |
|
|
148 |
#if (defined __STDC__ && __STDC__) || defined __cplusplus |
#ifdef __GNU_LIBRARY__ |
|
# ifdef __GNU_LIBRARY__ |
|
149 |
/* Many other libraries have conflicting prototypes for getopt, with |
/* Many other libraries have conflicting prototypes for getopt, with |
150 |
differences in the consts, in stdlib.h. To avoid compilation |
differences in the consts, in stdlib.h. To avoid compilation |
151 |
errors, only prototype getopt for the GNU C library. */ |
errors, only prototype getopt for the GNU C library. */ |
152 |
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); |
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) |
153 |
# else /* not __GNU_LIBRARY__ */ |
__THROW; |
154 |
|
#else /* not __GNU_LIBRARY__ */ |
155 |
extern int getopt (); |
extern int getopt (); |
156 |
# endif /* __GNU_LIBRARY__ */ |
#endif /* __GNU_LIBRARY__ */ |
157 |
|
|
158 |
# ifndef __need_getopt |
#ifndef __need_getopt |
159 |
extern int getopt_long (int ___argc, char *const *___argv, |
extern int getopt_long (int ___argc, char *const *___argv, |
160 |
const char *__shortopts, |
const char *__shortopts, |
161 |
const struct option *__longopts, int *__longind); |
const struct option *__longopts, int *__longind) |
162 |
|
__THROW; |
163 |
extern int getopt_long_only (int ___argc, char *const *___argv, |
extern int getopt_long_only (int ___argc, char *const *___argv, |
164 |
const char *__shortopts, |
const char *__shortopts, |
165 |
const struct option *__longopts, int *__longind); |
const struct option *__longopts, int *__longind) |
166 |
|
__THROW; |
167 |
|
|
168 |
/* Internal only. Users should not call this directly. */ |
#endif |
|
extern int _getopt_internal (int ___argc, char *const *___argv, |
|
|
const char *__shortopts, |
|
|
const struct option *__longopts, int *__longind, |
|
|
int __long_only); |
|
|
# endif |
|
|
#else /* not __STDC__ */ |
|
|
extern int getopt (); |
|
|
# ifndef __need_getopt |
|
|
extern int getopt_long (); |
|
|
extern int getopt_long_only (); |
|
|
|
|
|
extern int _getopt_internal (); |
|
|
# endif |
|
|
#endif /* __STDC__ */ |
|
169 |
|
|
170 |
#ifdef __cplusplus |
#ifdef __cplusplus |
171 |
} |
} |