00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_GETOPT_H__
00021 #define __CS_GETOPT_H__
00022
00027 #if defined(__NeXT__) || defined(__APPLE__)
00028
00029 #define getopt __getopt
00030 #define optarg __optarg
00031 #define opterr __opterr
00032 #define optind __optind
00033 #define optopt __optopt
00034 #endif
00035
00042 extern char *optarg;
00043
00056 extern int optind;
00057
00061 extern int opterr;
00062
00065 extern int optopt;
00066
00089 struct getopt_option
00090 {
00091 #if defined (__STDC__) && __STDC__
00092 const char *name;
00093 #else
00094 char *name;
00095 #endif
00096
00097
00098 int has_arg;
00099 int *flag;
00100 int val;
00101 };
00106 #define option getopt_option
00107
00108
00109
00110 #define no_argument 0
00111 #define required_argument 1
00112 #define optional_argument 2
00113
00114 extern int getopt (int argc, char *const *argv, const char *shortopts);
00115 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
00116 const struct getopt_option *longopts, int *longind);
00117 extern int getopt_long_only (int argc, char *const *argv,
00118 const char *shortopts,
00119 const struct getopt_option *longopts, int *longind);
00120
00121
00122 extern int _getopt_internal (int argc, char *const *argv,
00123 const char *shortopts,
00124 const struct getopt_option *longopts, int *longind,
00125 int long_only);
00126
00127 #endif // __CS_GETOPT_H__