aboutsummaryrefslogtreecommitdiff
path: root/src/main/getopt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/getopt.h')
-rw-r--r--src/main/getopt.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/getopt.h b/src/main/getopt.h
index d50c90e..89fd8eb 100644
--- a/src/main/getopt.h
+++ b/src/main/getopt.h
@@ -24,7 +24,7 @@ USA. */
24 24
25#include "config.h" 25#include "config.h"
26 26
27#ifdef __cplusplus 27#ifdef __cplusplus
28extern "C" { 28extern "C" {
29#endif 29#endif
30 30
@@ -67,7 +67,7 @@ extern int optopt;
67 The field `has_arg' is: 67 The field `has_arg' is:
68 no_argument (or 0) if the option does not take an argument, 68 no_argument (or 0) if the option does not take an argument,
69 required_argument (or 1) if the option requires an argument, 69 required_argument (or 1) if the option requires an argument,
70 optional_argument (or 2) if the option takes an optional argument. 70 optional_argument (or 2) if the option takes an optional argument.
71 71
72 If the field `flag' is not NULL, it points to a variable that is set 72 If the field `flag' is not NULL, it points to a variable that is set
73 to the value given in the field `val' when the option is found, but 73 to the value given in the field `val' when the option is found, but
@@ -96,9 +96,9 @@ struct option
96 96
97/* Names for the values of the `has_arg' field of `struct option'. */ 97/* Names for the values of the `has_arg' field of `struct option'. */
98 98
99#define no_argument 0 99#define no_argument 0
100#define required_argument 1 100#define required_argument 1
101#define optional_argument 2 101#define optional_argument 2
102 102
103#if defined (__STDC__) && __STDC__ 103#if defined (__STDC__) && __STDC__
104#ifdef __GNU_LIBRARY__ 104#ifdef __GNU_LIBRARY__
@@ -106,29 +106,36 @@ struct option
106 differences in the consts, in stdlib.h. To avoid compilation 106 differences in the consts, in stdlib.h. To avoid compilation
107 errors, only prototype getopt for the GNU C library. */ 107 errors, only prototype getopt for the GNU C library. */
108extern int getopt (int argc, char *const *argv, const char *shortopts); 108extern int getopt (int argc, char *const *argv, const char *shortopts);
109
109#else /* not __GNU_LIBRARY__ */ 110#else /* not __GNU_LIBRARY__ */
110extern int getopt (); 111extern int getopt ();
112
111#endif /* __GNU_LIBRARY__ */ 113#endif /* __GNU_LIBRARY__ */
112extern int getopt_long (int argc, char *const *argv, const char *shortopts, 114extern int getopt_long (int argc, char *const *argv, const char *shortopts,
113 const struct option *longopts, int *longind); 115 const struct option *longopts, int *longind);
116
114extern int getopt_long_only (int argc, char *const *argv, 117extern int getopt_long_only (int argc, char *const *argv,
115 const char *shortopts, 118 const char *shortopts,
116 const struct option *longopts, int *longind); 119 const struct option *longopts, int *longind);
117 120
118/* Internal only. Users should not call this directly. */ 121/* Internal only. Users should not call this directly. */
119extern int _getopt_internal (int argc, char *const *argv, 122extern int _getopt_internal (int argc, char *const *argv,
120 const char *shortopts, 123 const char *shortopts,
121 const struct option *longopts, int *longind, 124 const struct option *longopts, int *longind,
122 int long_only); 125 int long_only);
126
123#else /* not __STDC__ */ 127#else /* not __STDC__ */
124extern int getopt (); 128extern int getopt ();
129
125extern int getopt_long (); 130extern int getopt_long ();
131
126extern int getopt_long_only (); 132extern int getopt_long_only ();
127 133
128extern int _getopt_internal (); 134extern int _getopt_internal ();
135
129#endif /* __STDC__ */ 136#endif /* __STDC__ */
130 137
131#ifdef __cplusplus 138#ifdef __cplusplus
132} 139}
133#endif 140#endif
134 141