projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Resolve clash between stdint.m4 and uintmax_t.m4.
[gnulib.git]
/
lib
/
getopt.c
diff --git
a/lib/getopt.c
b/lib/getopt.c
index
ef790b7
..
83bd6db
100644
(file)
--- a/
lib/getopt.c
+++ b/
lib/getopt.c
@@
-2,7
+2,7
@@
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 drepper@gnu.org
before changing it!
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 drepper@gnu.org
before changing it!
- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
+ Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@
-18,30
+18,18
@@
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
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
, USA. */
+ Inc., 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301
, USA. */
\f
\f
-/* 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
-#endif
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#include <stdio.h>
-
-/* This needs to come after some library #include
- 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>
-# include <unistd.h>
-#endif /* GNU C library. */
+#include "getopt.h"
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <string.h>
+#include <unistd.h>
#ifdef VMS
# include <unixlib.h>
#ifdef VMS
# include <unixlib.h>
@@
-76,7
+64,6
@@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
-#include "getopt.h"
#include "getopt_int.h"
/* For communication from `getopt' to the caller.
#include "getopt_int.h"
/* For communication from `getopt' to the caller.
@@
-118,16
+105,9
@@
int optopt = '?';
static struct _getopt_data getopt_data;
\f
static struct _getopt_data getopt_data;
\f
-#ifndef __GNU_LIBRARY__
-
-/* Avoid depending on library functions or files
- whose names are inconsistent. */
-
-#ifndef getenv
+#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
extern char *getenv ();
#endif
extern char *getenv ();
#endif
-
-#endif /* not __GNU_LIBRARY__ */
\f
#ifdef _LIBC
/* Stored original parameters.
\f
#ifdef _LIBC
/* Stored original parameters.
@@
-556,10
+536,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-634,10
+611,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-674,10
+648,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-751,10
+722,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-817,10
+785,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-868,10
+833,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-940,10
+902,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-985,10
+944,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-1027,10
+983,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
((_IO_FILE *) stderr)->_flags2
|= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
@@
-1101,10
+1054,7
@@
_getopt_internal_r (int argc, char **argv, const char *optstring,
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
+ __fxprintf (NULL, "%s", buf);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);
((_IO_FILE *) stderr)->_flags2 = old_flags2;
_IO_funlockfile (stderr);