Ninja
|
00001 #ifndef GETOPT_H 00002 #define GETOPT_H 00003 00004 /* include files needed by this include file */ 00005 00006 /* macros defined by this include file */ 00007 #define no_argument 0 00008 #define REQUIRED_ARG 1 00009 #define OPTIONAL_ARG 2 00010 00011 /* types defined by this include file */ 00012 00013 /* GETOPT_LONG_OPTION_T: The type of long option */ 00014 typedef struct GETOPT_LONG_OPTION_T 00015 { 00016 const char *name; /* the name of the long option */ 00017 int has_arg; /* one of the above macros */ 00018 int *flag; /* determines if getopt_long() returns a 00019 * value for a long option; if it is 00020 * non-NULL, 0 is returned as a function 00021 * value and the value of val is stored in 00022 * the area pointed to by flag. Otherwise, 00023 * val is returned. */ 00024 int val; /* determines the value to return if flag is 00025 * NULL. */ 00026 } GETOPT_LONG_OPTION_T; 00027 00028 typedef GETOPT_LONG_OPTION_T option; 00029 00030 #ifdef __cplusplus 00031 extern "C" 00032 { 00033 #endif 00034 00035 /* externally-defined variables */ 00036 extern char *optarg; 00037 extern int optind; 00038 extern int opterr; 00039 extern int optopt; 00040 00041 /* function prototypes */ 00042 int getopt (int argc, char **argv, char *optstring); 00043 int getopt_long (int argc, char **argv, const char *shortopts, 00044 const GETOPT_LONG_OPTION_T * longopts, int *longind); 00045 int getopt_long_only (int argc, char **argv, const char *shortopts, 00046 const GETOPT_LONG_OPTION_T * longopts, int *longind); 00047 00048 #ifdef __cplusplus 00049 }; 00050 00051 #endif 00052 00053 #endif /* GETOPT_H */ 00054 00055 /* END OF FILE getopt.h */