| 1 |
#ifndef __GETOPT_H__ |
| 2 |
#define __GETOPT_H__ |
| 3 |
|
| 4 |
#ifdef __cplusplus |
| 5 |
extern "C" { |
| 6 |
#endif |
| 7 |
|
| 8 |
extern int opterr; /* if error message should be printed */ |
| 9 |
extern int optind; /* index into parent argv vector */ |
| 10 |
extern int optopt; /* character checked for validity */ |
| 11 |
extern int optreset; /* reset getopt */ |
| 12 |
extern char *optarg; /* argument associated with option */ |
| 13 |
|
| 14 |
struct option |
| 15 |
{ |
| 16 |
const char *name; |
| 17 |
int has_arg; |
| 18 |
int *flag; |
| 19 |
int val; |
| 20 |
}; |
| 21 |
|
| 22 |
#define no_argument 0 |
| 23 |
#define required_argument 1 |
| 24 |
#define optional_argument 2 |
| 25 |
|
| 26 |
int getopt(int, char**, const char*); |
| 27 |
int getopt_long(int, char**, const char*, const struct option*, int*); |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
} |
| 31 |
#endif |
| 32 |
|
| 33 |
#endif /* __GETOPT_H__ */ |