1 /* 2 ** Distributed under the terms of the Haiku License. 3 */ 4 #ifndef _GETOPT_H 5 #define _GETOPT_H 6 7 8 #include <unistd.h> 9 10 11 /* This header defines the available GNU extensions to the getopt() functionality */ 12 13 struct option { 14 const char *name; 15 int has_arg; 16 int *flag; 17 int val; 18 }; 19 20 /* Options for the "has_arg" field */ 21 22 #define no_argument 0 23 #define required_argument 1 24 #define optional_argument 2 25 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 extern int getopt_long(int argc, char * const *argv, const char *shortOptions, 32 const struct option *longOptions, int *_longIndex); 33 extern int getopt_long_only(int argc, char * const *argv, const char *shortOptions, 34 const struct option *longOptions, int *_longIndex); 35 36 #ifdef __cplusplus 37 } 38 #endif 39 40 #endif /* _GETOPT_H */ 41