| Line | |
|---|
| 1 | #ifndef __GETOPT_H__ |
|---|
| 2 | #define __GETOPT_H__ |
|---|
| 3 | |
|---|
| 4 | #include <unistd.h> |
|---|
| 5 | |
|---|
| 6 | struct option { |
|---|
| 7 | const char* name; |
|---|
| 8 | int has_arg; |
|---|
| 9 | int* flag; |
|---|
| 10 | int val; |
|---|
| 11 | }; |
|---|
| 12 | |
|---|
| 13 | #define no_argument 0 |
|---|
| 14 | #define required_argument 1 |
|---|
| 15 | #define optional_argument 2 |
|---|
| 16 | |
|---|
| 17 | extern char *optarg; |
|---|
| 18 | extern int optind, opterr, optopt; |
|---|
| 19 | |
|---|
| 20 | extern int getopt_long(int argc, char *const *argv, |
|---|
| 21 | const char *shortopts, const struct option *longopts, |
|---|
| 22 | int *longind); |
|---|
| 23 | |
|---|
| 24 | extern int getopt_long_only(int argc, char *const *argv, |
|---|
| 25 | const char *shortopts, const struct option *longopts, |
|---|
| 26 | int *longind); |
|---|
| 27 | |
|---|
| 28 | extern int getopt(int argc, char * const argv[], const char *optstring); |
|---|
| 29 | |
|---|
| 30 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.