#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
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
+#if !defined (_LIBC) && defined (GLIBC) && GLIBC >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
/* This needs to come after some library #include
- to get __GNU_LIBRARY__ defined. */
-#ifdef __GNU_LIBRARY__
+ to get GNU_LIBRARY defined. */
+#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>
#endif
#endif
-#if defined (WIN32) && !defined (__CYGWIN32__)
+#if defined (WIN32) && !defined (CYGWIN32)
/* It's not Unix, really. See? Capital letters. */
#include <windows.h>
#define getpid() GetCurrentProcessId()
causes problems with re-calling getopt as programs generally don't
know that. */
-int __getopt_initialized = 0;
+int getopt_initialized = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
\f
-#ifdef __GNU_LIBRARY__
+#ifdef GNU_LIBRARY
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
/* If using GCC, we can safely declare strlen this way.
If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
+#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
/* 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 /* __GNUC__ */
+#endif /* not STDC */
+#endif /* GNUC */
-#endif /* not __GNU_LIBRARY__ */
+#endif /* not GNU_LIBRARY */
\f
/* Handle permutation of arguments. */
indicating ARGV elements that should not be considered arguments. */
/* Defined in getopt_init.c */
-extern char *__getopt_nonoption_flags;
+extern char *getopt_nonoption_flags;
static int nonoption_flags_max_len;
static int nonoption_flags_len;
static int original_argc;
static char *const *original_argv;
-extern pid_t __libc_pid;
+extern pid_t libc_pid;
/* Make sure the environment variable bash 2.0 puts in the environment
is valid for the getopt call we must make sure that the ARGV passed
original_argc = argc;
original_argv = argv;
}
-text_set_element (__libc_subinit, store_args_and_env);
+text_set_element (libc_subinit, store_args_and_env);
# define SWAP_FLAGS(ch1, ch2) \
if (nonoption_flags_len > 0) \
{ \
- char __tmp = __getopt_nonoption_flags[ch1]; \
- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
- __getopt_nonoption_flags[ch2] = __tmp; \
+ char tmp = getopt_nonoption_flags[ch1]; \
+ getopt_nonoption_flags[ch1] = getopt_nonoption_flags[ch2]; \
+ getopt_nonoption_flags[ch2] = tmp; \
}
#else /* !_LIBC */
# define SWAP_FLAGS(ch1, ch2)
`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
but it consists of two parts that need to be swapped next. */
#ifdef _LIBC
- /* First make sure the handling of the `__getopt_nonoption_flags'
+ /* First make sure the handling of the `getopt_nonoption_flags'
string can work normally. Our top argument must be in the range
of the string. */
if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
- memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
+ memcpy (new_str, getopt_nonoption_flags, nonoption_flags_max_len);
memset (&new_str[nonoption_flags_max_len], '\0',
top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
- __getopt_nonoption_flags = new_str;
+ getopt_nonoption_flags = new_str;
}
}
#endif
/* 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 *
{
if (nonoption_flags_max_len == 0)
{
- if (__getopt_nonoption_flags == NULL
- || __getopt_nonoption_flags[0] == '\0')
+ if (getopt_nonoption_flags == NULL
+ || getopt_nonoption_flags[0] == '\0')
nonoption_flags_max_len = -1;
else
{
- const char *orig_str = __getopt_nonoption_flags;
+ const char *orig_str = getopt_nonoption_flags;
int len = nonoption_flags_max_len = strlen (orig_str);
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
- __getopt_nonoption_flags =
+ getopt_nonoption_flags =
(char *) malloc (nonoption_flags_max_len);
- if (__getopt_nonoption_flags == NULL)
+ if (getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
{
- memcpy (__getopt_nonoption_flags, orig_str, len);
- memset (&__getopt_nonoption_flags[len], '\0',
+ memcpy (getopt_nonoption_flags, orig_str, len);
+ memset (&getopt_nonoption_flags[len], '\0',
nonoption_flags_max_len - len);
}
}
{
optarg = NULL;
- if (optind == 0 || !__getopt_initialized)
+ if (optind == 0 || !getopt_initialized)
{
if (optind == 0)
optind = 1; /* Don't scan ARGV[0], the program name. */
optstring = _getopt_initialize (argc, argv, optstring);
- __getopt_initialized = 1;
+ getopt_initialized = 1;
}
/* Test whether ARGV[optind] points to a non-option argument.
#ifdef _LIBC
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
+ && getopt_nonoption_flags[optind] == '1'))
#else
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif