summaryrefslogtreecommitdiff
path: root/src/getopt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/getopt.h')
-rw-r--r--src/getopt.h72
1 files changed, 33 insertions, 39 deletions
diff --git a/src/getopt.h b/src/getopt.h
index 73ec1b7..e8fe13f 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -21,8 +21,7 @@
#define _GETOPT_H 1
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif
/* For communication from `getopt' to the caller.
@@ -31,7 +30,7 @@ extern "C"
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
- extern char *optarg;
+ extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
@@ -45,16 +44,16 @@ extern "C"
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
- extern int optind;
+ extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
- extern int opterr;
+ extern int opterr;
/* Set to an option character which was unrecognized. */
- extern int optopt;
+ extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
@@ -77,19 +76,18 @@ extern "C"
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
- struct option
- {
+ struct option {
#if defined (__STDC__) && __STDC__
- const char *name;
+ const char *name;
#else
- char *name;
+ char *name;
#endif
- /* has_arg can't be an enum because some compilers complain about type
- mismatches in all the code that assumes it is an int. */
- int has_arg;
- int *flag;
- int val;
- };
+ /* has_arg can't be an enum because some compilers complain about type
+ mismatches in all the code that assumes it is an int. */
+ int has_arg;
+ int *flag;
+ int val;
+ };
/* Names for the values of the `has_arg' field of `struct option'. */
@@ -102,35 +100,31 @@ extern "C"
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
- extern int getopt(int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
+ extern int getopt(int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
#ifndef __cplusplus
/* C++ is more pedantic, and demands a full prototype, not this.
Hope that stdlib.h has a prototype for `getopt'. */
- extern int getopt();
-#endif /* __cplusplus */
-#endif /* __GNU_LIBRARY__ */
- extern int getopt_long(int argc, char *const *argv, const char *shortopts,
- const struct option *longopts, int *longind);
- extern int getopt_long_only(int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind);
+ extern int getopt();
+#endif /* __cplusplus */
+#endif /* __GNU_LIBRARY__ */
+ extern int getopt_long(int argc, char *const *argv,
+ const char *shortopts, const struct option *longopts, int *longind);
+ extern int getopt_long_only(int argc, char *const *argv,
+ const char *shortopts, const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
- extern int _getopt_internal(int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
-#else /* not __STDC__ */
- extern int getopt();
- extern int getopt_long();
- extern int getopt_long_only();
-
- extern int _getopt_internal();
-#endif /* __STDC__ */
+ extern int _getopt_internal(int argc, char *const *argv,
+ const char *shortopts, const struct option *longopts, int *longind, int long_only);
+#else /* not __STDC__ */
+ extern int getopt();
+ extern int getopt_long();
+ extern int getopt_long_only();
+
+ extern int _getopt_internal();
+#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
-
-#endif /* getopt.h */
+#endif /* getopt.h */