21 #ifndef XAPIAN_INCLUDED_GNU_GETOPT_H
22 #define XAPIAN_INCLUDED_GNU_GETOPT_H
28 #define GNU_GETOPT_INTERFACE_VERSION 2
29 #if defined __GLIBC__ && __GLIBC__ >= 2
30 # include <gnu-versions.h>
31 # if _GNU_GETOPT_INTERFACE_VERSION == GNU_GETOPT_INTERFACE_VERSION
32 # define USE_GLIBC_GNUGETOPT
36 #ifdef USE_GLIBC_GNUGETOPT
41 gnu_getopt(
int argc_,
char *
const *argv_,
const char *shortopts_) {
42 return getopt(argc_, argv_, shortopts_);
47 const struct option *longopts_,
int *optind_) {
48 return getopt_long(argc_, argv_, shortopts_, longopts_, optind_);
53 const struct option *longopts_,
int *optind_) {
54 return getopt_long_only(argc_, argv_, shortopts_, longopts_, optind_);
78 # define no_argument 0
79 # define required_argument 1
80 # define optional_argument 2
89 gnu_getopt(
int argc_,
char *
const *argv_,
const char *shortopts_) {
91 reinterpret_cast<const struct
option *
>(0),
92 reinterpret_cast<int *
>(0), 0);
97 const struct option *longopts_,
int *optind_) {
103 const struct option *longopts_,
int *optind_) {
int gnu_getopt_long_only(int argc_, char *const *argv_, const char *shortopts_, const struct option *longopts_, int *optind_)
int gnu_getopt_internal_(int, char *const *, const char *, const struct option *, int *, int)
int gnu_getopt_long(int argc_, char *const *argv_, const char *shortopts_, const struct option *longopts_, int *optind_)
int gnu_getopt(int argc_, char *const *argv_, const char *shortopts_)