38 #define GETOPT_INTERFACE_VERSION 2 39 #if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 40 #include <gnu-versions.h> 41 #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION 51 #ifdef __GNU_LIBRARY__ 60 getopt_long (
int argc,
char *
const *argv,
const char *options,
61 const struct option *long_options,
int *opt_index)
73 const struct option *long_options,
int *opt_index)
86 main (
int argc,
char **argv)
95 static struct option long_options[] =
100 {
"verbose", 0, 0, 0},
107 long_options, &option_index);
114 printf (
"option %s", long_options[option_index].
name);
116 printf (
" with arg %s",
optarg);
130 if (digit_optind != 0 && digit_optind != this_option_optind)
131 printf (
"digits occur in two different argv-elements.\n");
132 digit_optind = this_option_optind;
133 printf (
"option %c\n", c);
137 printf (
"option a\n");
141 printf (
"option b\n");
145 printf (
"option c with value `%s'\n",
optarg);
149 printf (
"option d with value `%s'\n",
optarg);
156 printf (
"?? getopt returned character code 0%o ??\n", c);
162 printf (
"non-option ARGV-elements: ");
164 printf (
"%s ", argv[
optind++]);
int _getopt_internal(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only)
int getopt_long_only(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index)
int getopt_long(int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index)
int main(int argc, char **argv)