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