1 #ifndef GETOPT_H 2 #define GETOPT_H 3 4 /* include files needed by this include file */ 5 6 /* macros defined by this include file */ 7 #define no_argument 0 8 #define required_argument 1 9 #define OPTIONAL_ARG 2 10 11 /* types defined by this include file */ 12 13 /* GETOPT_LONG_OPTION_T: The type of long option */ 14 typedef struct GETOPT_LONG_OPTION_T 15 { 16 const char *name; /* the name of the long option */ 17 int has_arg; /* one of the above macros */ 18 int *flag; /* determines if getopt_long() returns a 19 * value for a long option; if it is 20 * non-NULL, 0 is returned as a function 21 * value and the value of val is stored in 22 * the area pointed to by flag. Otherwise, 23 * val is returned. */ 24 int val; /* determines the value to return if flag is 25 * NULL. */ 26 } GETOPT_LONG_OPTION_T; 27 28 typedef GETOPT_LONG_OPTION_T option; 29 30 #ifdef __cplusplus 31 extern "C" 32 { 33 #endif 34 35 /* externally-defined variables */ 36 extern char *optarg; 37 extern int optind; 38 extern int opterr; 39 extern int optopt; 40 41 /* function prototypes */ 42 #ifndef _AIX 43 int getopt (int argc, char **argv, char *optstring); 44 #endif 45 int getopt_long (int argc, char **argv, const char *shortopts, 46 const GETOPT_LONG_OPTION_T * longopts, int *longind); 47 int getopt_long_only (int argc, char **argv, const char *shortopts, 48 const GETOPT_LONG_OPTION_T * longopts, int *longind); 49 50 #ifdef __cplusplus 51 }; 52 53 #endif 54 55 #endif /* GETOPT_H */ 56 57 /* END OF FILE getopt.h */ 58