File indexing completed on 2026-05-10 08:42:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_HOST_COMMON_GETOPTINC_H
0010 #define LLDB_HOST_COMMON_GETOPTINC_H
0011
0012 #include "lldb/lldb-defines.h"
0013
0014 #if defined(_MSC_VER) || defined(_AIX)
0015 #define REPLACE_GETOPT
0016 #define REPLACE_GETOPT_LONG
0017 #endif
0018 #if defined(_MSC_VER) || defined(__NetBSD__) || defined(_AIX)
0019 #define REPLACE_GETOPT_LONG_ONLY
0020 #endif
0021
0022 #if defined(REPLACE_GETOPT)
0023
0024 #define no_argument 0
0025 #define required_argument 1
0026 #define optional_argument 2
0027
0028
0029 struct option {
0030 const char *name;
0031
0032
0033 int has_arg;
0034 int *flag;
0035 int val;
0036 };
0037
0038 int getopt(int argc, char *const argv[], const char *optstring);
0039
0040
0041 extern char *optarg;
0042 extern int optind;
0043 extern int opterr;
0044 extern int optopt;
0045
0046
0047 extern int optreset;
0048 #else
0049 #include <getopt.h>
0050 #include <unistd.h>
0051 #endif
0052
0053 #if defined(REPLACE_GETOPT_LONG)
0054 int getopt_long(int argc, char *const *argv, const char *optstring,
0055 const struct option *longopts, int *longindex);
0056 #endif
0057
0058 #if defined(REPLACE_GETOPT_LONG_ONLY)
0059 int getopt_long_only(int argc, char *const *argv, const char *optstring,
0060 const struct option *longopts, int *longindex);
0061 #endif
0062
0063 #endif