diff options
| author | Ulrich Drepper | 1998-04-27 23:48:59 +0000 |
|---|---|---|
| committer | Ulrich Drepper | 1998-04-27 23:48:59 +0000 |
| commit | 1823194b952fe26a5609422179eaebfe52fa1d64 (patch) | |
| tree | 3549d64e83a4cb5c03374890d57a009bcad456cf /lib-src/getopt.c | |
| parent | 57ff063d0b21457e9087aa91a5e152dc1bcf6002 (diff) | |
| download | emacs-1823194b952fe26a5609422179eaebfe52fa1d64.tar.gz emacs-1823194b952fe26a5609422179eaebfe52fa1d64.zip | |
automatically generated from GPLed version
Diffstat (limited to 'lib-src/getopt.c')
| -rw-r--r-- | lib-src/getopt.c | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/lib-src/getopt.c b/lib-src/getopt.c index df61ee5cf7e..395d597bbc0 100644 --- a/lib-src/getopt.c +++ b/lib-src/getopt.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
| 8 | 8 | ||
| 9 | NOTE: The canonical source of this file is maintained with the GNU C Library. | 9 | NOTE: The canonical source of this file is maintained with the GNU C Library. |
| 10 | Bugs can be reported to bug-glibc@prep.ai.mit.edu. | 10 | Bugs can be reported to bug-glibc@gnu.org. |
| 11 | 11 | ||
| 12 | This program is free software; you can redistribute it and/or modify it | 12 | This program is free software; you can redistribute it and/or modify it |
| 13 | under the terms of the GNU General Public License as published by the | 13 | under the terms of the GNU General Public License as published by the |
| @@ -27,19 +27,19 @@ | |||
| 27 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. | 27 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. |
| 28 | Ditto for AIX 3.2 and <stdlib.h>. */ | 28 | Ditto for AIX 3.2 and <stdlib.h>. */ |
| 29 | #ifndef _NO_PROTO | 29 | #ifndef _NO_PROTO |
| 30 | #define _NO_PROTO | 30 | # define _NO_PROTO |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef HAVE_CONFIG_H | 33 | #ifdef HAVE_CONFIG_H |
| 34 | #include <config.h> | 34 | # include <config.h> |
| 35 | #endif | 35 | #endif |
| 36 | 36 | ||
| 37 | #if !defined __STDC__ || !__STDC__ | 37 | #if !defined __STDC__ || !__STDC__ |
| 38 | /* This is a separate conditional since some stdc systems | 38 | /* This is a separate conditional since some stdc systems |
| 39 | reject `defined (const)'. */ | 39 | reject `defined (const)'. */ |
| 40 | #ifndef const | 40 | # ifndef const |
| 41 | #define const | 41 | # define const |
| 42 | #endif | 42 | # endif |
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #include <stdio.h> | 45 | #include <stdio.h> |
| @@ -54,10 +54,10 @@ | |||
| 54 | 54 | ||
| 55 | #define GETOPT_INTERFACE_VERSION 2 | 55 | #define GETOPT_INTERFACE_VERSION 2 |
| 56 | #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 | 56 | #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 |
| 57 | #include <gnu-versions.h> | 57 | # include <gnu-versions.h> |
| 58 | #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION | 58 | # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION |
| 59 | #define ELIDE_CODE | 59 | # define ELIDE_CODE |
| 60 | #endif | 60 | # endif |
| 61 | #endif | 61 | #endif |
| 62 | 62 | ||
| 63 | #ifndef ELIDE_CODE | 63 | #ifndef ELIDE_CODE |
| @@ -68,26 +68,26 @@ | |||
| 68 | #ifdef __GNU_LIBRARY__ | 68 | #ifdef __GNU_LIBRARY__ |
| 69 | /* Don't include stdlib.h for non-GNU C libraries because some of them | 69 | /* Don't include stdlib.h for non-GNU C libraries because some of them |
| 70 | contain conflicting prototypes for getopt. */ | 70 | contain conflicting prototypes for getopt. */ |
| 71 | #include <stdlib.h> | 71 | # include <stdlib.h> |
| 72 | #include <unistd.h> | 72 | # include <unistd.h> |
| 73 | #endif /* GNU C library. */ | 73 | #endif /* GNU C library. */ |
| 74 | 74 | ||
| 75 | #ifdef VMS | 75 | #ifdef VMS |
| 76 | #include <unixlib.h> | 76 | # include <unixlib.h> |
| 77 | #if HAVE_STRING_H - 0 | 77 | # if HAVE_STRING_H - 0 |
| 78 | #include <string.h> | 78 | # include <string.h> |
| 79 | #endif | 79 | # endif |
| 80 | #endif | 80 | #endif |
| 81 | 81 | ||
| 82 | #ifndef _ | 82 | #ifndef _ |
| 83 | /* This is for other GNU distributions with internationalized messages. | 83 | /* This is for other GNU distributions with internationalized messages. |
| 84 | When compiling libc, the _ macro is predefined. */ | 84 | When compiling libc, the _ macro is predefined. */ |
| 85 | #ifdef HAVE_LIBINTL_H | 85 | # ifdef HAVE_LIBINTL_H |
| 86 | # include <libintl.h> | 86 | # include <libintl.h> |
| 87 | # define _(msgid) gettext (msgid) | 87 | # define _(msgid) gettext (msgid) |
| 88 | #else | 88 | # else |
| 89 | # define _(msgid) (msgid) | 89 | # define _(msgid) (msgid) |
| 90 | #endif | 90 | # endif |
| 91 | #endif | 91 | #endif |
| 92 | 92 | ||
| 93 | /* This version of `getopt' appears to the caller like standard Unix `getopt' | 93 | /* This version of `getopt' appears to the caller like standard Unix `getopt' |
| @@ -197,14 +197,19 @@ static char *posixly_correct; | |||
| 197 | because there are many ways it can cause trouble. | 197 | because there are many ways it can cause trouble. |
| 198 | On some systems, it contains special magic macros that don't work | 198 | On some systems, it contains special magic macros that don't work |
| 199 | in GCC. */ | 199 | in GCC. */ |
| 200 | #include <string.h> | 200 | # include <string.h> |
| 201 | #define my_index strchr | 201 | # define my_index strchr |
| 202 | #else | 202 | #else |
| 203 | 203 | ||
| 204 | /* Avoid depending on library functions or files | 204 | /* Avoid depending on library functions or files |
| 205 | whose names are inconsistent. */ | 205 | whose names are inconsistent. */ |
| 206 | 206 | ||
| 207 | char *getenv (); | 207 | #ifndef getenv |
| 208 | extern char *getenv (); | ||
| 209 | #endif | ||
| 210 | #ifndef strncmp | ||
| 211 | extern int strncmp (); | ||
| 212 | #endif | ||
| 208 | 213 | ||
| 209 | static char * | 214 | static char * |
| 210 | my_index (str, chr) | 215 | my_index (str, chr) |
| @@ -225,11 +230,11 @@ my_index (str, chr) | |||
| 225 | #ifdef __GNUC__ | 230 | #ifdef __GNUC__ |
| 226 | /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. | 231 | /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. |
| 227 | That was relevant to code that was here before. */ | 232 | That was relevant to code that was here before. */ |
| 228 | #if !defined __STDC__ || !__STDC__ | 233 | # if (!defined __STDC__ || !__STDC__) && !defined strlen |
| 229 | /* gcc with -traditional declares the built-in strlen to return int, | 234 | /* gcc with -traditional declares the built-in strlen to return int, |
| 230 | and has done so at least since version 2.4.5. -- rms. */ | 235 | and has done so at least since version 2.4.5. -- rms. */ |
| 231 | extern int strlen (const char *); | 236 | extern int strlen (const char *); |
| 232 | #endif /* not __STDC__ */ | 237 | # endif /* not __STDC__ */ |
| 233 | #endif /* __GNUC__ */ | 238 | #endif /* __GNUC__ */ |
| 234 | 239 | ||
| 235 | #endif /* not __GNU_LIBRARY__ */ | 240 | #endif /* not __GNU_LIBRARY__ */ |
| @@ -527,11 +532,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) | |||
| 527 | from the shell indicating it is not an option. The later information | 532 | from the shell indicating it is not an option. The later information |
| 528 | is only used when the used in the GNU libc. */ | 533 | is only used when the used in the GNU libc. */ |
| 529 | #ifdef _LIBC | 534 | #ifdef _LIBC |
| 530 | #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ | 535 | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ |
| 531 | || (optind < nonoption_flags_len \ | 536 | || (optind < nonoption_flags_len \ |
| 532 | && __getopt_nonoption_flags[optind] == '1')) | 537 | && __getopt_nonoption_flags[optind] == '1')) |
| 533 | #else | 538 | #else |
| 534 | #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') | 539 | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') |
| 535 | #endif | 540 | #endif |
| 536 | 541 | ||
| 537 | if (nextchar == NULL || *nextchar == '\0') | 542 | if (nextchar == NULL || *nextchar == '\0') |