summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-03-23 08:51:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-03-23 08:53:21 -0700
commite6d3eaa69871d800eb078580b64f2bc5806a0fcc (patch)
tree8bfe6653b6be56f06adee8e0cfbf2b366b8ac8a6 /lib
parente1392faae5c5cc7805b52efacbb25a71213afdeb (diff)
downloademacs-e6d3eaa69871d800eb078580b64f2bc5806a0fcc.tar.gz
Merge from gnulib
This incorporates: 2017-03-22 getopt: merge from glibc * build-aux/config.sub, lib/getopt.c, lib/getopt.in.h: * lib/getopt1.c, lib/getopt_int.h: Copy from gnulib. * lib/gnulib.mk.in: Regenerate.
Diffstat (limited to 'lib')
-rw-r--r--lib/getopt.c70
-rw-r--r--lib/getopt.in.h41
-rw-r--r--lib/getopt1.c22
-rw-r--r--lib/getopt_int.h22
-rw-r--r--lib/gnulib.mk.in1
5 files changed, 87 insertions, 69 deletions
diff --git a/lib/getopt.c b/lib/getopt.c
index e40ea8d5eaa..7afd0dcabe8 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -2,22 +2,22 @@
NOTE: getopt is 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-1996, 1998-2004, 2006, 2008-2017 Free Software
- Foundation, Inc.
+ Copyright (C) 1987-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
@@ -27,8 +27,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <unistd.h>
+#include <string.h>
#ifdef _LIBC
# include <libintl.h>
@@ -37,7 +37,7 @@
# define _(msgid) gettext (msgid)
#endif
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
# include <wchar.h>
#endif
@@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d)
{
/* Bottom segment is the short one. */
int len = middle - bottom;
- register int i;
+ int i;
/* Swap it with the top part of the top segment. */
for (i = 0; i < len; i++)
@@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d)
{
/* Top segment is the short one. */
int len = top - middle;
- register int i;
+ int i;
/* Swap it with the bottom part of the bottom segment. */
for (i = 0; i < len; i++)
@@ -564,11 +564,11 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
first.next = ambig_list;
ambig_list = &first;
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf = NULL;
size_t buflen = 0;
- FILE *fp = open_memstream (&buf, &buflen);
+ FILE *fp = __open_memstream (&buf, &buflen);
if (fp != NULL)
{
fprintf (fp,
@@ -584,7 +584,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
fputc_unlocked ('\n', fp);
- if (__builtin_expect (fclose (fp) != EOF, 1))
+ if (__glibc_likely (fclose (fp) != EOF))
{
_IO_flockfile (stderr);
@@ -642,7 +642,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
int n;
#endif
@@ -650,7 +650,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
if (argv[d->optind - 1][1] == '-')
{
/* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
n = __asprintf (&buf, _("\
%s: option '--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
@@ -663,7 +663,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
else
{
/* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
n = __asprintf (&buf, _("\
%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[d->optind - 1][0],
@@ -676,7 +676,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
#endif
}
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
if (n >= 0)
{
_IO_flockfile (stderr);
@@ -709,7 +709,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf, _("\
@@ -760,7 +760,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
int n;
#endif
@@ -768,7 +768,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
if (argv[d->optind][1] == '-')
{
/* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"),
argv[0], d->__nextchar);
#else
@@ -779,7 +779,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
else
{
/* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"),
argv[0], argv[d->optind][0], d->__nextchar);
#else
@@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
#endif
}
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
if (n >= 0)
{
_IO_flockfile (stderr);
@@ -826,19 +826,19 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
int n;
#endif
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"),
argv[0], c);
#else
fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
#endif
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
if (n >= 0)
{
_IO_flockfile (stderr);
@@ -884,7 +884,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf,
@@ -958,7 +958,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
@@ -998,7 +998,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf, _("\
@@ -1037,7 +1037,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf, _("\
@@ -1112,7 +1112,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
{
if (print_errors)
{
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
char *buf;
if (__asprintf (&buf, _("\
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 6cbad8e0339..3f57c68a25e 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,20 +1,20 @@
/* Declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free Software
- Foundation, Inc.
+ Copyright (C) 1989-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_GETOPT_H
@@ -238,6 +238,25 @@ struct option
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW _GL_ARG_NONNULL ((2, 3));
+#ifndef __GETOPT_PREFIX
+# if defined __need_getopt && defined __USE_POSIX2 \
+ && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU
+/* The GNU getopt has more functionality than the standard version. The
+ additional functionality can be disable at runtime. This redirection
+ helps to also do this at runtime. */
+# ifdef __REDIRECT
+ extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv,
+ const char *__shortopts),
+ __posix_getopt);
+# else
+extern int __posix_getopt (int ___argc, char *const *___argv,
+ const char *__shortopts)
+ __THROW _GL_ARG_NONNULL ((2, 3));
+# define getopt __posix_getopt
+# endif
+# endif
+#endif
+
#ifndef __need_getopt
extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
const char *__shortopts,
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 4d2e8cbac33..166b1295333 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,20 +1,20 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2017 Free Software
- Foundation, Inc.
+ Copyright (C) 1987-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifdef _LIBC
# include <getopt.h>
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index a7ce0e9cc14..c614fcb65be 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,20 +1,20 @@
/* Internal declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2017 Free Software
- Foundation, Inc.
+ Copyright (C) 1989-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 2c0b689e710..ca95ed7e825 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -558,7 +558,6 @@ LIBS_GNUSTEP = @LIBS_GNUSTEP@
LIBS_MAIL = @LIBS_MAIL@
LIBS_SYSTEM = @LIBS_SYSTEM@
LIBS_TERMCAP = @LIBS_TERMCAP@
-LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@
LIBTIFF = @LIBTIFF@
LIBXMENU = @LIBXMENU@
LIBXML2_CFLAGS = @LIBXML2_CFLAGS@