X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fextras%2Fgetopt.h;h=c05d74fbd0322df9f0c7c053196bf86ed7c730bc;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=2fa12f7baf5c68b6057e2ac0d85f3cb1a8302cbb;hpb=3305b049e7f587b23359a1c9047fb5763d19c1dc;p=vlc diff --git a/src/extras/getopt.h b/src/extras/getopt.h index 2fa12f7baf..c05d74fbd0 100644 --- a/src/extras/getopt.h +++ b/src/extras/getopt.h @@ -22,7 +22,7 @@ #ifndef _GETOPT_H #define _GETOPT_H 1 -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -33,7 +33,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 @@ -47,16 +47,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 @@ -79,56 +79,56 @@ 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'. */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 #if defined (__STDC__) && __STDC__ #ifdef __GNU_LIBRARY__ /* 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(); -#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(int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ + extern int getopt(); +#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__ */ - -#ifdef __cplusplus + 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 */