01e0b1ee489708ad727f7e648b344de39a1a379f
[reactos.git] / reactos / lib / 3rdparty / mingw / tgetopt.h
1 #ifndef _GETOPT_H
2 #define _GETOPT_H 1
3
4 #include <tchar.h>
5
6 #ifdef _UNICODE
7 #define _toption _woption
8 #define _toptarg _woptarg
9 #define _toptind _woptind
10 #define _topterr _wopterr
11 #define _toptopt _woptopt
12 #define _tgetopt _wgetopt
13 #define _tgetopt_long _wgetopt_long
14 #define _tgetopt_long_only _wgetopt_long_only
15 #define _tgetopt_internal _wgetopt_internal
16 #else
17 #define _toption option
18 #define _toptarg optarg
19 #define _toptind optind
20 #define _topterr opterr
21 #define _toptopt optopt
22 #define _tgetopt getopt
23 #define _tgetopt_long getopt_long
24 #define _tgetopt_long_only getopt_long_only
25 #define _tgetopt_internal _getopt_internal
26 #endif
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32
33 extern char *optarg;
34 extern int optind;
35 extern int opterr;
36 extern int optopt;
37
38 extern wchar_t *_woptarg;
39 extern int _woptind;
40 extern int _wopterr;
41 extern int _woptopt;
42
43 struct option
44 {
45 const char *name;
46 int has_arg;
47 int *flag;
48 int val;
49 };
50
51 struct _woption
52 {
53 const wchar_t *name;
54 int has_arg;
55 int *flag;
56 int val;
57 };
58
59 #define no_argument 0
60 #define required_argument 1
61 #define optional_argument 2
62
63 extern int getopt (int argc, char *const *argv, const char *shortopts);
64 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
65 const struct option *longopts, int *longind);
66 extern int getopt_long_only (int argc, char *const *argv,
67 const char *shortopts, const struct option *longopts, int *longind);
68
69 extern int _wgetopt (int argc, wchar_t *const *argv, const wchar_t *shortopts);
70 extern int _wgetopt_long (int argc, wchar_t *const *argv, const wchar_t *shortopts,
71 const struct _woption *longopts, int *longind);
72 extern int _wgetopt_long_only (int argc, wchar_t *const *argv,
73 const wchar_t *shortopts,
74 const struct _woption *longopts, int *longind);
75
76 extern int _getopt_internal (int argc, char *const *argv,
77 const char *shortopts, const struct option *longopts, int *longind,
78 int long_only);
79
80 extern int _wgetopt_internal (int argc, wchar_t *const *argv,
81 const wchar_t *shortopts,
82 const struct _woption *longopts, int *longind,
83 int long_only);
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* _GETOPT_H */
90