diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-05-05 23:18:02 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-05-05 23:18:02 +0000 |
commit | c5aa1e92211d8e1c3768a94c7a1fcf7e72e8cf80 (patch) | |
tree | 017db6c8be411c52ab98093e94dcce3c7ca3f029 /gcc/getopt.c | |
parent | 870d7a364fabca1efd21f7b8a996934ab7f91805 (diff) | |
download | ppe42-gcc-c5aa1e92211d8e1c3768a94c7a1fcf7e72e8cf80.tar.gz ppe42-gcc-c5aa1e92211d8e1c3768a94c7a1fcf7e72e8cf80.zip |
* Check in merge from gcc2. See ChangeLog.12 for details.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19553 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/getopt.c')
-rw-r--r-- | gcc/getopt.c | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/gcc/getopt.c b/gcc/getopt.c index f6f505caae2..a9a101f3c1b 100644 --- a/gcc/getopt.c +++ b/gcc/getopt.c @@ -1,13 +1,13 @@ /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 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@prep.ai.mit.edu. + Bugs can be reported to bug-glibc@gnu.org. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -27,19 +27,19 @@ /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */ #ifndef _NO_PROTO -#define _NO_PROTO +# define _NO_PROTO #endif #ifdef HAVE_CONFIG_H -#include <config.h> +# include <config.h> #endif -#if !defined (__STDC__) || !__STDC__ +#if !defined __STDC__ || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ -#ifndef const -#define const -#endif +# ifndef const +# define const +# endif #endif #include <stdio.h> @@ -53,11 +53,11 @@ it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 -#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 -#include <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif +#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 +# include <gnu-versions.h> +# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +# define ELIDE_CODE +# endif #endif #ifndef ELIDE_CODE @@ -68,26 +68,26 @@ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ -#include <stdlib.h> -#include <unistd.h> +# include <stdlib.h> +# include <unistd.h> #endif /* GNU C library. */ #ifdef VMS -#include <unixlib.h> -#if HAVE_STRING_H - 0 -#include <string.h> -#endif +# include <unixlib.h> +# if HAVE_STRING_H - 0 +# include <string.h> +# endif #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include <libintl.h> -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif +# ifdef HAVE_LIBINTL_H +# include <libintl.h> +# define _(msgid) gettext (msgid) +# else +# define _(msgid) (msgid) +# endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' @@ -197,14 +197,19 @@ static char *posixly_correct; because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ -#include <string.h> -#define my_index strchr +# include <string.h> +# define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ -char *getenv (); +#ifndef getenv +extern char *getenv (); +#endif +#ifndef strncmp +extern int strncmp (); +#endif static char * my_index (str, chr) @@ -225,11 +230,11 @@ my_index (str, chr) #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ -#if !defined (__STDC__) || !__STDC__ +# if (!defined __STDC__ || !__STDC__) && !defined strlen /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); -#endif /* not __STDC__ */ +# endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ @@ -292,7 +297,7 @@ text_set_element (__libc_subinit, store_args_and_env); `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ -#if defined (__STDC__) && __STDC__ +#if defined __STDC__ && __STDC__ static void exchange (char **); #endif @@ -378,7 +383,7 @@ exchange (argv) /* Initialize the internal data when the first call is made. */ -#if defined (__STDC__) && __STDC__ +#if defined __STDC__ && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * @@ -527,11 +532,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) #else -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') |