diff options
Diffstat (limited to 'lib/getopt.h')
-rw-r--r-- | lib/getopt.h | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/lib/getopt.h b/lib/getopt.h index b359a47b..c2eb9ed3 100644 --- a/lib/getopt.h +++ b/lib/getopt.h @@ -1,5 +1,6 @@ /* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, + 2002 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -16,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_H @@ -34,7 +35,7 @@ * to use the system version. */ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -75,9 +76,9 @@ extern int optopt; zero. The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -92,11 +93,7 @@ extern int optopt; struct option { -#if defined (__STDC__) && __STDC__ const char *name; -#else - 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; @@ -106,53 +103,38 @@ struct option /* Names for the values of the `has_arg' field of `struct option'. */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -#if defined (__STDC__) && __STDC__ +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 -#if REALLY_NEED_PLAIN_GETOPT +#if REALLY_NEED_PLAIN_GETOPT /*------------------------------------*/ -/* - * getopt is defined in POSIX.2. Assume that if the system defines +/* getopt is defined in POSIX.2. Assume that if the system defines * getopt that it complies with POSIX.2. If not, an autoconf test * should be written to define NONPOSIX_GETOPT_DEFINITION. */ -#ifndef NONPOSIX_GETOPT_DEFINITION + +# ifndef NONPOSIX_GETOPT_DEFINITION extern int getopt (int argc, char *const *argv, const char *shortopts); -#else /* NONPOSIX_GETOPT_DEFINITION */ +# else /* NONPOSIX_GETOPT_DEFINITION */ extern int getopt (void); -#endif /* NONPOSIX_GETOPT_DEFINITION */ - -#endif +# endif /* NONPOSIX_GETOPT_DEFINITION */ +#endif /* REALLY_NEED_PLAIN_GETOPT ------------------------------------*/ extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); + 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); + 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__ */ - -#ifdef REALLY_NEED_PLAIN_GETOPT -extern int getopt (); -#endif /* REALLY_NEED_PLAIN_GETOPT */ - -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); - -#endif /* __STDC__ */ + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); -#ifdef __cplusplus +#ifdef __cplusplus } #endif |