projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add cast to exception_none
[deliverable/binutils-gdb.git]
/
libiberty
/
getopt.c
diff --git
a/libiberty/getopt.c
b/libiberty/getopt.c
index c41531e667d8abfb07c8336506ed70c17ac6fd84..d9c3532ce1136b41ff027439ce7ee6067a7c8673 100644
(file)
--- a/
libiberty/getopt.c
+++ b/
libiberty/getopt.c
@@
-3,11
+3,11
@@
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
"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, 98
-
Free Software Foundation, Inc.
+ Copyright (C) 1987,
1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
+
1996, 1997, 1998, 2005
Free Software Foundation, Inc.
- NOTE: Th
e canonical source of this file is maintained with the GNU C Library.
-
Bugs can be reported to bug-glibc@gnu.org
.
+ NOTE: Th
is source is derived from an old version taken from the GNU C
+
Library (glibc)
.
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
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
@@
-21,7
+21,7
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
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., 5
9 Temple Place - Suite 330, Boston, MA 02111-1307
,
+ Foundation, Inc., 5
1 Franklin Street - Fifth Floor, Boston, MA 02110-1301
,
USA. */
\f
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
USA. */
\f
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
@@
-42,6
+42,7
@@
# endif
#endif
# endif
#endif
+#include "ansidecl.h"
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
@@
-82,7
+83,7
@@
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
-# if
def HAVE_LIBINTL_H
+# if
(HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
# include <libintl.h>
# define _(msgid) gettext (msgid)
# else
# include <libintl.h>
# define _(msgid) gettext (msgid)
# else
@@
-212,14
+213,20
@@
static char *posixly_correct;
/* Avoid depending on library functions or files
whose names are inconsistent. */
/* Avoid depending on library functions or files
whose names are inconsistent. */
-#ifndef getenv
-extern char *getenv ();
+#if HAVE_STDLIB_H && HAVE_DECL_GETENV
+# include <stdlib.h>
+#elif !defined(getenv)
+# ifdef __cplusplus
+extern "C" {
+# endif /* __cplusplus */
+extern char *getenv (const char *);
+# ifdef __cplusplus
+}
+# endif /* __cplusplus */
#endif
static char *
#endif
static char *
-my_index (str, chr)
- const char *str;
- int chr;
+my_index (const char *str, int chr)
{
while (*str)
{
{
while (*str)
{
@@
-307,8
+314,7
@@
static void exchange (char **);
#endif
static void
#endif
static void
-exchange (argv)
- char **argv;
+exchange (char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
{
int bottom = first_nonopt;
int middle = last_nonopt;
@@
-328,13
+334,13
@@
exchange (argv)
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
{
/* We must extend the array. The user plays games with us and
presents new arguments. */
- char *new_str = malloc (top + 1);
+ char *new_str =
(char *)
malloc (top + 1);
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
if (new_str == NULL)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
- memset (
__
mempcpy (new_str, __getopt_nonoption_flags,
-
nonoption_flags_max_len),
+ memset (mempcpy (new_str, __getopt_nonoption_flags,
+ nonoption_flags_max_len),
'\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
'\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
@@
-392,10
+398,9
@@
exchange (argv)
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
-_getopt_initialize (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
+_getopt_initialize (int argc ATTRIBUTE_UNUSED,
+ char *const *argv ATTRIBUTE_UNUSED,
+ const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
@@
-444,7
+449,7
@@
_getopt_initialize (argc, argv, optstring)
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
- memset (
__
mempcpy (__getopt_nonoption_flags, orig_str, len),
+ memset (mempcpy (__getopt_nonoption_flags, orig_str, len),
'\0', nonoption_flags_max_len - len);
}
}
'\0', nonoption_flags_max_len - len);
}
}
@@
-514,13
+519,9
@@
_getopt_initialize (argc, argv, optstring)
long-named options. */
int
long-named options. */
int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
+_getopt_internal (int argc, char *const *argv, const char *optstring,
+ const struct option *longopts,
+ int *longind, int long_only)
{
optarg = NULL;
{
optarg = NULL;
@@
-970,10
+971,7
@@
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
int
}
int
-getopt (argc, argv, optstring)
- int argc;
- char *const *argv;
- const char *optstring;
+getopt (int argc, char *const *argv, const char *optstring)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
@@
-989,9
+987,7
@@
getopt (argc, argv, optstring)
the above definition of `getopt'. */
int
the above definition of `getopt'. */
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int c;
int digit_optind = 0;
{
int c;
int digit_optind = 0;
This page took
0.02611 seconds
and
4
git commands to generate.