json-gen-c  0.1.5
json-gen-c generate C code for json manipulation
getopt_compat.h
Go to the documentation of this file.
1
11#ifndef GETOPT_COMPAT_H
12#define GETOPT_COMPAT_H
13
14#ifdef _WIN32
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20extern char *optarg;
21extern int optind, opterr, optopt;
22
23struct option {
24 const char *name;
25 int has_arg;
26 int *flag;
27 int val;
28};
29
30#define no_argument 0
31#define required_argument 1
32#define optional_argument 2
33
39int getopt_long_only(int argc, char *const argv[], const char *optstring,
40 const struct option *longopts, int *longindex);
41
42#ifdef __cplusplus
43}
44#endif
45
46#else /* POSIX */
47
48#include <getopt.h>
49
50#endif /* _WIN32 */
51
52#endif /* GETOPT_COMPAT_H */