summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-03-04 16:07:50 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-03-04 16:07:50 +0100
commit0c68bd518ad9f0fd843522eb2f293907d6f355ce (patch)
tree9d228491b89b855b3e95b9554814f0e877803b72 /gl
parentb7fdedd04274ae444c279a77027fc078cb23b307 (diff)
downloadgnutls-0c68bd518ad9f0fd843522eb2f293907d6f355ce.tar.gz
removed getpass from gl/
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am56
-rw-r--r--gl/fseek.c30
-rw-r--r--gl/fseeko.c159
-rw-r--r--gl/getdelim.c135
-rw-r--r--gl/getline.c27
-rw-r--r--gl/getpass.c229
-rw-r--r--gl/getpass.h30
-rw-r--r--gl/m4/fseek.m415
-rw-r--r--gl/m4/getdelim.m488
-rw-r--r--gl/m4/getline.m496
-rw-r--r--gl/m4/getpass.m458
-rw-r--r--gl/m4/gnulib-cache.m43
-rw-r--r--gl/m4/gnulib-comp.m471
-rw-r--r--gl/m4/strdup.m436
-rw-r--r--gl/strdup.c54
-rw-r--r--gl/tests/Makefile.am34
-rw-r--r--gl/tests/test-fseek.c70
-rwxr-xr-xgl/tests/test-fseek.sh5
-rwxr-xr-xgl/tests/test-fseek2.sh3
-rw-r--r--gl/tests/test-fseeko.c74
-rwxr-xr-xgl/tests/test-fseeko.sh5
-rwxr-xr-xgl/tests/test-fseeko2.sh3
-rw-r--r--gl/tests/test-fseeko3.c51
-rwxr-xr-xgl/tests/test-fseeko3.sh7
-rw-r--r--gl/tests/test-fseeko4.c73
-rwxr-xr-xgl/tests/test-fseeko4.sh5
-rw-r--r--gl/tests/test-getdelim.c94
-rw-r--r--gl/tests/test-getline.c94
28 files changed, 2 insertions, 1603 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index 1019d03a3f..a3d5d25df6 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs getpass gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.9.6 gnits
@@ -216,24 +216,6 @@ EXTRA_libgnu_la_SOURCES += float.c itold.c
## end gnulib module float
-## begin gnulib module fseek
-
-
-EXTRA_DIST += fseek.c
-
-EXTRA_libgnu_la_SOURCES += fseek.c
-
-## end gnulib module fseek
-
-## begin gnulib module fseeko
-
-
-EXTRA_DIST += fseeko.c stdio-impl.h
-
-EXTRA_libgnu_la_SOURCES += fseeko.c
-
-## end gnulib module fseeko
-
## begin gnulib module fstat
@@ -268,33 +250,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh
## end gnulib module gendocs
-## begin gnulib module getdelim
-
-
-EXTRA_DIST += getdelim.c
-
-EXTRA_libgnu_la_SOURCES += getdelim.c
-
-## end gnulib module getdelim
-
-## begin gnulib module getline
-
-
-EXTRA_DIST += getline.c
-
-EXTRA_libgnu_la_SOURCES += getline.c
-
-## end gnulib module getline
-
-## begin gnulib module getpass
-
-
-EXTRA_DIST += getpass.c getpass.h
-
-EXTRA_libgnu_la_SOURCES += getpass.c
-
-## end gnulib module getpass
-
## begin gnulib module gettext
# If your project uses "gettextize --intl" to put a source-code
@@ -974,15 +929,6 @@ EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
## end gnulib module strcase
-## begin gnulib module strdup-posix
-
-
-EXTRA_DIST += strdup.c
-
-EXTRA_libgnu_la_SOURCES += strdup.c
-
-## end gnulib module strdup-posix
-
## begin gnulib module string
BUILT_SOURCES += string.h
diff --git a/gl/fseek.c b/gl/fseek.c
deleted file mode 100644
index 5b69550aec..0000000000
--- a/gl/fseek.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* An fseek() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-/* Get off_t. */
-#include <unistd.h>
-
-int
-fseek (FILE *fp, long offset, int whence)
-{
- /* Use the replacement fseeko function with all its workarounds. */
- return fseeko (fp, (off_t)offset, whence);
-}
diff --git a/gl/fseeko.c b/gl/fseeko.c
deleted file mode 100644
index 472b16fcd2..0000000000
--- a/gl/fseeko.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* An fseeko() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
-
- This program 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <stdio.h>
-
-/* Get off_t, lseek, _POSIX_VERSION. */
-#include <unistd.h>
-
-#include "stdio-impl.h"
-
-int
-fseeko (FILE *fp, off_t offset, int whence)
-#undef fseeko
-#if !HAVE_FSEEKO
-# undef fseek
-# define fseeko fseek
-#endif
-#if _GL_WINDOWS_64_BIT_OFF_T
-# undef fseeko
-# if HAVE__FSEEKI64 /* msvc, mingw64 */
-# define fseeko _fseeki64
-# else /* mingw */
-# define fseeko fseeko64
-# endif
-#endif
-{
-#if LSEEK_PIPE_BROKEN
- /* mingw gives bogus answers rather than failure on non-seekable files. */
- if (lseek (fileno (fp), 0, SEEK_CUR) == -1)
- return EOF;
-#endif
-
- /* These tests are based on fpurge.c. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- if (fp->_IO_read_end == fp->_IO_read_ptr
- && fp->_IO_write_ptr == fp->_IO_write_base
- && fp->_IO_save_base == NULL)
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
-# if defined __SL64 && defined __SCLE /* Cygwin */
- if ((fp->_flags & __SL64) == 0)
- {
- /* Cygwin 1.5.0 through 1.5.24 failed to open stdin in 64-bit
- mode; but has an fseeko that requires 64-bit mode. */
- FILE *tmp = fopen ("/dev/null", "r");
- if (!tmp)
- return -1;
- fp->_flags |= __SL64;
- fp->_seek64 = tmp->_seek64;
- fclose (tmp);
- }
-# endif
- if (fp_->_p == fp_->_bf._base
- && fp_->_r == 0
- && fp_->_w == ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
- ? fp_->_bf._size
- : 0)
- && fp_ub._base == NULL)
-#elif defined __EMX__ /* emx+gcc */
- if (fp->_ptr == fp->_buffer
- && fp->_rcount == 0
- && fp->_wcount == 0
- && fp->_ungetc_count == 0)
-#elif defined __minix /* Minix */
- if (fp_->_ptr == fp_->_buf
- && (fp_->_ptr == NULL || fp_->_count == 0))
-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
- if (fp_->_ptr == fp_->_base
- && (fp_->_ptr == NULL || fp_->_cnt == 0))
-#elif defined __UCLIBC__ /* uClibc */
- if (((fp->__modeflags & __FLAG_WRITING) == 0
- || fp->__bufpos == fp->__bufstart)
- && ((fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) == 0
- || fp->__bufpos == fp->__bufread))
-#elif defined __QNX__ /* QNX */
- if ((fp->_Mode & 0x2000 /* _MWRITE */ ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
- && fp->_Rback == fp->_Back + sizeof (fp->_Back)
- && fp->_Rsave == NULL)
-#elif defined __MINT__ /* Atari FreeMiNT */
- if (fp->__bufp == fp->__buffer
- && fp->__get_limit == fp->__bufp
- && fp->__put_limit == fp->__bufp
- && !fp->__pushed_back)
-#elif defined EPLAN9 /* Plan9 */
- if (fp->rp == fp->buf
- && fp->wp == fp->buf)
-#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
- /* Cross-compiling to some other system advertising conformance to
- POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
- If this assumption is incorrect, please report the bug to
- bug-gnulib. */
- if (0)
-#else
- #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
-#endif
- {
- /* We get here when an fflush() call immediately preceded this one (or
- if ftell() has created buffers but no I/O has occurred on a
- newly-opened stream). We know there are no buffers. */
- off_t pos = lseek (fileno (fp), offset, whence);
- if (pos == -1)
- {
-#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
- fp_->_flags &= ~__SOFF;
-#endif
- return -1;
- }
-
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
- fp->_flags &= ~_IO_EOF_SEEN;
- fp->_offset = pos;
-#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
-# if defined __CYGWIN__
- /* fp_->_offset is typed as an integer. */
- fp_->_offset = pos;
-# else
- /* fp_->_offset is an fpos_t. */
- {
- /* Use a union, since on NetBSD, the compilation flags
- determine whether fpos_t is typedef'd to off_t or a struct
- containing a single off_t member. */
- union
- {
- fpos_t f;
- off_t o;
- } u;
- u.o = pos;
- fp_->_offset = u.f;
- }
-# endif
- fp_->_flags |= __SOFF;
- fp_->_flags &= ~__SEOF;
-#elif defined __EMX__ /* emx+gcc */
- fp->_flags &= ~_IOEOF;
-#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */
- fp->_flag &= ~_IOEOF;
-#elif defined __MINT__ /* Atari FreeMiNT */
- fp->__offset = pos;
- fp->__eof = 0;
-#endif
- return 0;
- }
- return fseeko (fp, offset, whence);
-}
diff --git a/gl/getdelim.c b/gl/getdelim.c
deleted file mode 100644
index 7762e52176..0000000000
--- a/gl/getdelim.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* getdelim.c --- Implementation of replacement getdelim function.
- Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2014 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1, or (at
- your option) any later version.
-
- This program 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Ported from glibc by Simon Josefsson. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#ifndef SSIZE_MAX
-# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
-#endif
-
-#if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-# define getc_maybe_unlocked(fp) getc(fp)
-#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED
-# undef flockfile
-# undef funlockfile
-# define flockfile(x) ((void) 0)
-# define funlockfile(x) ((void) 0)
-# define getc_maybe_unlocked(fp) getc(fp)
-#else
-# define getc_maybe_unlocked(fp) getc_unlocked(fp)
-#endif
-
-/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
- NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
- NULL), pointing to *N characters of space. It is realloc'ed as
- necessary. Returns the number of characters read (not including
- the null terminator), or -1 on error or EOF. */
-
-ssize_t
-getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
-{
- ssize_t result;
- size_t cur_len = 0;
-
- if (lineptr == NULL || n == NULL || fp == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- flockfile (fp);
-
- if (*lineptr == NULL || *n == 0)
- {
- char *new_lineptr;
- *n = 120;
- new_lineptr = (char *) realloc (*lineptr, *n);
- if (new_lineptr == NULL)
- {
- result = -1;
- goto unlock_return;
- }
- *lineptr = new_lineptr;
- }
-
- for (;;)
- {
- int i;
-
- i = getc_maybe_unlocked (fp);
- if (i == EOF)
- {
- result = -1;
- break;
- }
-
- /* Make enough space for len+1 (for final NUL) bytes. */
- if (cur_len + 1 >= *n)
- {
- size_t needed_max =
- SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
- size_t needed = 2 * *n + 1; /* Be generous. */
- char *new_lineptr;
-
- if (needed_max < needed)
- needed = needed_max;
- if (cur_len + 1 >= needed)
- {
- result = -1;
- errno = EOVERFLOW;
- goto unlock_return;
- }
-
- new_lineptr = (char *) realloc (*lineptr, needed);
- if (new_lineptr == NULL)
- {
- result = -1;
- goto unlock_return;
- }
-
- *lineptr = new_lineptr;
- *n = needed;
- }
-
- (*lineptr)[cur_len] = i;
- cur_len++;
-
- if (i == delimiter)
- break;
- }
- (*lineptr)[cur_len] = '\0';
- result = cur_len ? cur_len : result;
-
- unlock_return:
- funlockfile (fp); /* doesn't set errno */
-
- return result;
-}
diff --git a/gl/getline.c b/gl/getline.c
deleted file mode 100644
index c0d652e44b..0000000000
--- a/gl/getline.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* getline.c --- Implementation of replacement getline function.
- Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1, or (at
- your option) any later version.
-
- This program 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Simon Josefsson. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-ssize_t
-getline (char **lineptr, size_t *n, FILE *stream)
-{
- return getdelim (lineptr, n, '\n', stream);
-}
diff --git a/gl/getpass.c b/gl/getpass.c
deleted file mode 100644
index b82d66332f..0000000000
--- a/gl/getpass.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* Copyright (C) 1992-2001, 2003-2007, 2009-2014 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 Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
-
- This program 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-#include "getpass.h"
-
-#include <stdio.h>
-
-#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
-
-# include <stdbool.h>
-
-# if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
-# if HAVE_STDIO_EXT_H
-# include <stdio_ext.h>
-# endif
-# else
-# define __fsetlocking(stream, type) /* empty */
-# endif
-
-# if HAVE_TERMIOS_H
-# include <termios.h>
-# endif
-
-# if USE_UNLOCKED_IO
-# include "unlocked-io.h"
-# else
-# if !HAVE_DECL_FFLUSH_UNLOCKED
-# undef fflush_unlocked
-# define fflush_unlocked(x) fflush (x)
-# endif
-# if !HAVE_DECL_FLOCKFILE
-# undef flockfile
-# define flockfile(x) ((void) 0)
-# endif
-# if !HAVE_DECL_FUNLOCKFILE
-# undef funlockfile
-# define funlockfile(x) ((void) 0)
-# endif
-# if !HAVE_DECL_FPUTS_UNLOCKED
-# undef fputs_unlocked
-# define fputs_unlocked(str,stream) fputs (str, stream)
-# endif
-# if !HAVE_DECL_PUTC_UNLOCKED
-# undef putc_unlocked
-# define putc_unlocked(c,stream) putc (c, stream)
-# endif
-# endif
-
-/* It is desirable to use this bit on systems that have it.
- The only bit of terminal state we want to twiddle is echoing, which is
- done in software; there is no need to change the state of the terminal
- hardware. */
-
-# ifndef TCSASOFT
-# define TCSASOFT 0
-# endif
-
-static void
-call_fclose (void *arg)
-{
- if (arg != NULL)
- fclose (arg);
-}
-
-char *
-getpass (const char *prompt)
-{
- FILE *tty;
- FILE *in, *out;
- struct termios s, t;
- bool tty_changed = false;
- static char *buf;
- static size_t bufsize;
- ssize_t nread;
-
- /* Try to write to and read from the terminal if we can.
- If we can't open the terminal, use stderr and stdin. */
-
- tty = fopen ("/dev/tty", "w+");
- if (tty == NULL)
- {
- in = stdin;
- out = stderr;
- }
- else
- {
- /* We do the locking ourselves. */
- __fsetlocking (tty, FSETLOCKING_BYCALLER);
-
- out = in = tty;
- }
-
- flockfile (out);
-
- /* Turn echoing off if it is on now. */
-# if HAVE_TCGETATTR
- if (tcgetattr (fileno (in), &t) == 0)
- {
- /* Save the old one. */
- s = t;
- /* Tricky, tricky. */
- t.c_lflag &= ~(ECHO | ISIG);
- tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
- }
-# endif
-
- /* Write the prompt. */
- fputs_unlocked (prompt, out);
- fflush_unlocked (out);
-
- /* Read the password. */
- nread = getline (&buf, &bufsize, in);
-
- /* According to the C standard, input may not be followed by output
- on the same stream without an intervening call to a file
- positioning function. Suppose in == out; then without this fseek
- call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets
- echoed, whereas on IRIX, the following newline is not output as
- it should be. POSIX imposes similar restrictions if fileno (in)
- == fileno (out). The POSIX restrictions are tricky and change
- from POSIX version to POSIX version, so play it safe and invoke
- fseek even if in != out. */
- fseeko (out, 0, SEEK_CUR);
-
- if (buf != NULL)
- {
- if (nread < 0)
- buf[0] = '\0';
- else if (buf[nread - 1] == '\n')
- {
- /* Remove the newline. */
- buf[nread - 1] = '\0';
- if (tty_changed)
- {
- /* Write the newline that was not echoed. */
- putc_unlocked ('\n', out);
- }
- }
- }
-
- /* Restore the original setting. */
-# if HAVE_TCSETATTR
- if (tty_changed)
- tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s);
-# endif
-
- funlockfile (out);
-
- call_fclose (tty);
-
- return buf;
-}
-
-#else /* W32 native */
-
-/* Windows implementation by Martin Lambers <marlam@marlam.de>,
- improved by Simon Josefsson. */
-
-/* For PASS_MAX. */
-# include <limits.h>
-/* For _getch(). */
-# include <conio.h>
-/* For strdup(). */
-# include <string.h>
-
-# ifndef PASS_MAX
-# define PASS_MAX 512
-# endif
-
-char *
-getpass (const char *prompt)
-{
- char getpassbuf[PASS_MAX + 1];
- size_t i = 0;
- int c;
-
- if (prompt)
- {
- fputs (prompt, stderr);
- fflush (stderr);
- }
-
- for (;;)
- {
- c = _getch ();
- if (c == '\r')
- {
- getpassbuf[i] = '\0';
- break;
- }
- else if (i < PASS_MAX)
- {
- getpassbuf[i++] = c;
- }
-
- if (i >= PASS_MAX)
- {
- getpassbuf[i] = '\0';
- break;
- }
- }
-
- if (prompt)
- {
- fputs ("\r\n", stderr);
- fflush (stderr);
- }
-
- return strdup (getpassbuf);
-}
-#endif
diff --git a/gl/getpass.h b/gl/getpass.h
deleted file mode 100644
index c579138726..0000000000
--- a/gl/getpass.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
- Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
- Contributed by Simon Josefsson <jas@extundo.com>, 2004.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
-
- This program 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef GETPASS_H
-# define GETPASS_H
-
-/* Get getpass declaration, if available. */
-# include <unistd.h>
-
-# if !HAVE_DECL_GETPASS
-/* Read a password of arbitrary length from /dev/tty or stdin. */
-char *getpass (const char *prompt);
-
-# endif
-
-#endif /* GETPASS_H */
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
deleted file mode 100644
index a5ea41d0b8..0000000000
--- a/gl/m4/fseek.m4
+++ /dev/null
@@ -1,15 +0,0 @@
-# fseek.m4 serial 4
-dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_FSEEK],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
- AC_REQUIRE([gl_FUNC_FSEEKO])
- dnl When fseeko needs fixes, fseek needs them too.
- if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
- REPLACE_FSEEK=1
- fi
-])
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
deleted file mode 100644
index c763994186..0000000000
--- a/gl/m4/getdelim.m4
+++ /dev/null
@@ -1,88 +0,0 @@
-# getdelim.m4 serial 10
-
-dnl Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
-dnl
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_PREREQ([2.59])
-
-AC_DEFUN([gl_FUNC_GETDELIM],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-
- dnl Persuade glibc <stdio.h> to declare getdelim().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getdelim])
-
- AC_CHECK_FUNCS_ONCE([getdelim])
- if test $ac_cv_func_getdelim = yes; then
- HAVE_GETDELIM=1
- dnl Found it in some library. Verify that it works.
- AC_CACHE_CHECK([for working getdelim function], [gl_cv_func_working_getdelim],
- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
- int main ()
- {
- FILE *in = fopen ("./conftest.data", "r");
- if (!in)
- return 1;
- {
- /* Test result for a NULL buffer and a zero size.
- Based on a test program from Karl Heuer. */
- char *line = NULL;
- size_t siz = 0;
- int len = getdelim (&line, &siz, '\n', in);
- if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
- return 2;
- }
- {
- /* Test result for a NULL buffer and a non-zero size.
- This crashes on FreeBSD 8.0. */
- char *line = NULL;
- size_t siz = (size_t)(~0) / 4;
- if (getdelim (&line, &siz, '\n', in) == -1)
- return 3;
- }
- return 0;
- }
- ]])], [gl_cv_func_working_getdelim=yes] dnl The library version works.
- , [gl_cv_func_working_getdelim=no] dnl The library version does NOT work.
- , dnl We're cross compiling. Assume it works on glibc2 systems.
- [AC_EGREP_CPP([Lucky GNU user],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2) && !defined __UCLIBC__
- Lucky GNU user
- #endif
-#endif
- ],
- [gl_cv_func_working_getdelim="guessing yes"],
- [gl_cv_func_working_getdelim="guessing no"])]
- )])
- case "$gl_cv_func_working_getdelim" in
- *no)
- REPLACE_GETDELIM=1
- ;;
- esac
- else
- HAVE_GETDELIM=0
- fi
-
- if test $ac_cv_have_decl_getdelim = no; then
- HAVE_DECL_GETDELIM=0
- fi
-])
-
-# Prerequisites of lib/getdelim.c.
-AC_DEFUN([gl_PREREQ_GETDELIM],
-[
- AC_CHECK_FUNCS([flockfile funlockfile])
- AC_CHECK_DECLS([getc_unlocked])
-])
diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4
deleted file mode 100644
index 0330666bc7..0000000000
--- a/gl/m4/getline.m4
+++ /dev/null
@@ -1,96 +0,0 @@
-# getline.m4 serial 26
-
-dnl Copyright (C) 1998-2003, 2005-2007, 2009-2014 Free Software Foundation,
-dnl Inc.
-dnl
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_PREREQ([2.59])
-
-dnl See if there's a working, system-supplied version of the getline function.
-dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems
-dnl have a function by that name in -linet that doesn't have anything
-dnl to do with the function we need.
-AC_DEFUN([gl_FUNC_GETLINE],
-[
- AC_REQUIRE([gl_STDIO_H_DEFAULTS])
-
- dnl Persuade glibc <stdio.h> to declare getline().
- AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getline])
-
- gl_getline_needs_run_time_check=no
- AC_CHECK_FUNC([getline],
- [dnl Found it in some library. Verify that it works.
- gl_getline_needs_run_time_check=yes],
- [am_cv_func_working_getline=no])
- if test $gl_getline_needs_run_time_check = yes; then
- AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline],
- [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
- int main ()
- {
- FILE *in = fopen ("./conftest.data", "r");
- if (!in)
- return 1;
- {
- /* Test result for a NULL buffer and a zero size.
- Based on a test program from Karl Heuer. */
- char *line = NULL;
- size_t siz = 0;
- int len = getline (&line, &siz, in);
- if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
- return 2;
- }
- {
- /* Test result for a NULL buffer and a non-zero size.
- This crashes on FreeBSD 8.0. */
- char *line = NULL;
- size_t siz = (size_t)(~0) / 4;
- if (getline (&line, &siz, in) == -1)
- return 3;
- }
- return 0;
- }
- ]])], [am_cv_func_working_getline=yes] dnl The library version works.
- , [am_cv_func_working_getline=no] dnl The library version does NOT work.
- , dnl We're cross compiling. Assume it works on glibc2 systems.
- [AC_EGREP_CPP([Lucky GNU user],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ >= 2) && !defined __UCLIBC__
- Lucky GNU user
- #endif
-#endif
- ],
- [am_cv_func_working_getline="guessing yes"],
- [am_cv_func_working_getline="guessing no"])]
- )])
- fi
-
- if test $ac_cv_have_decl_getline = no; then
- HAVE_DECL_GETLINE=0
- fi
-
- case "$am_cv_func_working_getline" in
- *no)
- dnl Set REPLACE_GETLINE always: Even if we have not found the broken
- dnl getline function among $LIBS, it may exist in libinet and the
- dnl executable may be linked with -linet.
- REPLACE_GETLINE=1
- ;;
- esac
-])
-
-# Prerequisites of lib/getline.c.
-AC_DEFUN([gl_PREREQ_GETLINE],
-[
- :
-])
diff --git a/gl/m4/getpass.m4 b/gl/m4/getpass.m4
deleted file mode 100644
index cf545a6dd0..0000000000
--- a/gl/m4/getpass.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-# getpass.m4 serial 14
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation,
-dnl Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-# Provide a getpass() function if the system doesn't have it.
-AC_DEFUN([gl_FUNC_GETPASS],
-[
- dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_FUNCS([getpass])
- AC_CHECK_DECLS_ONCE([getpass])
- if test $ac_cv_func_getpass = yes; then
- HAVE_GETPASS=1
- else
- HAVE_GETPASS=0
- fi
-])
-
-# Provide the GNU getpass() implementation. It supports passwords of
-# arbitrary length (not just 8 bytes as on HP-UX).
-AC_DEFUN([gl_FUNC_GETPASS_GNU],
-[
- dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS_ONCE([getpass])
- dnl TODO: Detect when GNU getpass() is already found in glibc.
- REPLACE_GETPASS=1
-
- if test $REPLACE_GETPASS = 1; then
- dnl We must choose a different name for our function, since on ELF systems
- dnl an unusable getpass() in libc.so would override our getpass() if it is
- dnl compiled into a shared library.
- AC_DEFINE([getpass], [gnu_getpass],
- [Define to a replacement function name for getpass().])
- fi
-])
-
-# Prerequisites of lib/getpass.c.
-AC_DEFUN([gl_PREREQ_GETPASS], [
- AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
- AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
- AC_CHECK_DECLS([__fsetlocking],,,
- [[#include <stdio.h>
- #if HAVE_STDIO_EXT_H
- #include <stdio_ext.h>
- #endif]])
- AC_CHECK_DECLS_ONCE([fflush_unlocked])
- AC_CHECK_DECLS_ONCE([flockfile])
- AC_CHECK_DECLS_ONCE([fputs_unlocked])
- AC_CHECK_DECLS_ONCE([funlockfile])
- AC_CHECK_DECLS_ONCE([putc_unlocked])
- :
-])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index 2ac68e5d1f..f3791069b4 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs getpass gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
@@ -41,7 +41,6 @@ gl_MODULES([
extensions
func
gendocs
- getpass
gettext
gettimeofday
hash-pjw-bare
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index 8c7dbab045..a75a55b6d2 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -74,11 +74,6 @@ AC_DEFUN([gl_EARLY],
# Code from module fpucw:
# Code from module fputc-tests:
# Code from module fread-tests:
- # Code from module fseek:
- # Code from module fseek-tests:
- # Code from module fseeko:
- AC_REQUIRE([AC_FUNC_FSEEKO])
- # Code from module fseeko-tests:
# Code from module fstat:
# Code from module fstat-tests:
# Code from module ftell:
@@ -90,12 +85,7 @@ AC_DEFUN([gl_EARLY],
# Code from module func-tests:
# Code from module fwrite-tests:
# Code from module gendocs:
- # Code from module getdelim:
- # Code from module getdelim-tests:
- # Code from module getline:
- # Code from module getline-tests:
# Code from module getpagesize:
- # Code from module getpass:
# Code from module gettext:
# Code from module gettext-h:
# Code from module gettimeofday:
@@ -161,7 +151,6 @@ AC_DEFUN([gl_EARLY],
# Code from module stdlib:
# Code from module stdlib-tests:
# Code from module strcase:
- # Code from module strdup-posix:
# Code from module string:
# Code from module string-tests:
# Code from module strings:
@@ -249,17 +238,6 @@ AC_SUBST([LTALLOCA])
if test $REPLACE_ITOLD = 1; then
AC_LIBOBJ([itold])
fi
- gl_FUNC_FSEEK
- if test $REPLACE_FSEEK = 1; then
- AC_LIBOBJ([fseek])
- fi
- gl_STDIO_MODULE_INDICATOR([fseek])
- gl_FUNC_FSEEKO
- if test $HAVE_FSEEKO = 0 || test $REPLACE_FSEEKO = 1; then
- AC_LIBOBJ([fseeko])
- gl_PREREQ_FSEEKO
- fi
- gl_STDIO_MODULE_INDICATOR([fseeko])
gl_FUNC_FSTAT
if test $REPLACE_FSTAT = 1; then
AC_LIBOBJ([fstat])
@@ -278,23 +256,6 @@ AC_SUBST([LTALLOCA])
fi
gl_STDIO_MODULE_INDICATOR([ftello])
gl_FUNC
- gl_FUNC_GETDELIM
- if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then
- AC_LIBOBJ([getdelim])
- gl_PREREQ_GETDELIM
- fi
- gl_STDIO_MODULE_INDICATOR([getdelim])
- gl_FUNC_GETLINE
- if test $REPLACE_GETLINE = 1; then
- AC_LIBOBJ([getline])
- gl_PREREQ_GETLINE
- fi
- gl_STDIO_MODULE_INDICATOR([getline])
- gl_FUNC_GETPASS
- if test $HAVE_GETPASS = 0; then
- AC_LIBOBJ([getpass])
- gl_PREREQ_GETPASS
- fi
dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac.
AM_GNU_GETTEXT_VERSION([0.18.1])
AC_SUBST([LIBINTL])
@@ -387,12 +348,6 @@ AC_SUBST([LTALLOCA])
AC_LIBOBJ([strncasecmp])
gl_PREREQ_STRNCASECMP
fi
- gl_FUNC_STRDUP_POSIX
- if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
- AC_LIBOBJ([strdup])
- gl_PREREQ_STRDUP
- fi
- gl_STRING_MODULE_INDICATOR([strdup])
gl_HEADER_STRING_H
gl_HEADER_STRINGS_H
gl_FUNC_STRNDUP
@@ -504,8 +459,6 @@ changequote([, ])dnl
gl_STDIO_MODULE_INDICATOR([fdopen])
gl_FUNC_UNGETC_WORKS
gl_FUNC_UNGETC_WORKS
- gl_FUNC_UNGETC_WORKS
- gl_FUNC_UNGETC_WORKS
gl_FUNC_GETPAGESIZE
if test $REPLACE_GETPAGESIZE = 1; then
AC_LIBOBJ([getpagesize])
@@ -653,15 +606,9 @@ AC_DEFUN([gl_FILE_LIST], [
lib/float+.h
lib/float.c
lib/float.in.h
- lib/fseek.c
- lib/fseeko.c
lib/fstat.c
lib/ftell.c
lib/ftello.c
- lib/getdelim.c
- lib/getline.c
- lib/getpass.c
- lib/getpass.h
lib/gettext.h
lib/gettimeofday.c
lib/hash-pjw-bare.c
@@ -698,7 +645,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdlib.in.h
lib/str-two-way.h
lib/strcasecmp.c
- lib/strdup.c
lib/string.in.h
lib/strings.in.h
lib/strncasecmp.c
@@ -743,16 +689,12 @@ AC_DEFUN([gl_FILE_LIST], [
m4/fdopen.m4
m4/float_h.m4
m4/fpieee.m4
- m4/fseek.m4
m4/fseeko.m4
m4/fstat.m4
m4/ftell.m4
m4/ftello.m4
m4/func.m4
- m4/getdelim.m4
- m4/getline.m4
m4/getpagesize.m4
- m4/getpass.m4
m4/gettext.m4
m4/gettimeofday.m4
m4/glibc2.m4
@@ -815,7 +757,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stdio_h.m4
m4/stdlib_h.m4
m4/strcase.m4
- m4/strdup.m4
m4/string_h.m4
m4/strings_h.m4
m4/strndup.m4
@@ -863,16 +804,6 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-float.c
tests/test-fputc.c
tests/test-fread.c
- tests/test-fseek.c
- tests/test-fseek.sh
- tests/test-fseek2.sh
- tests/test-fseeko.c
- tests/test-fseeko.sh
- tests/test-fseeko2.sh
- tests/test-fseeko3.c
- tests/test-fseeko3.sh
- tests/test-fseeko4.c
- tests/test-fseeko4.sh
tests/test-fstat.c
tests/test-ftell.c
tests/test-ftell.sh
@@ -886,8 +817,6 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-ftello4.sh
tests/test-func.c
tests/test-fwrite.c
- tests/test-getdelim.c
- tests/test-getline.c
tests/test-gettimeofday.c
tests/test-iconv.c
tests/test-inet_pton.c
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4
deleted file mode 100644
index 1681a30eba..0000000000
--- a/gl/m4/strdup.m4
+++ /dev/null
@@ -1,36 +0,0 @@
-# strdup.m4 serial 13
-
-dnl Copyright (C) 2002-2014 Free Software Foundation, Inc.
-
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_STRDUP],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS_ONCE([strdup])
- AC_CHECK_DECLS_ONCE([strdup])
- if test $ac_cv_have_decl_strdup = no; then
- HAVE_DECL_STRDUP=0
- fi
-])
-
-AC_DEFUN([gl_FUNC_STRDUP_POSIX],
-[
- AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
- AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
- AC_CHECK_FUNCS_ONCE([strdup])
- if test $ac_cv_func_strdup = yes; then
- if test $gl_cv_func_malloc_posix != yes; then
- REPLACE_STRDUP=1
- fi
- fi
- AC_CHECK_DECLS_ONCE([strdup])
- if test $ac_cv_have_decl_strdup = no; then
- HAVE_DECL_STRDUP=0
- fi
-])
-
-# Prerequisites of lib/strdup.c.
-AC_DEFUN([gl_PREREQ_STRDUP], [:])
diff --git a/gl/strdup.c b/gl/strdup.c
deleted file mode 100644
index c882215fc4..0000000000
--- a/gl/strdup.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2014 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 Lesser General Public License as published by
- the Free Software Foundation; either version 2.1, or (at your option)
- any later version.
-
- This program 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 Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <config.h>
-#endif
-
-/* Get specification. */
-#include <string.h>
-
-#include <stdlib.h>
-
-#undef __strdup
-#ifdef _LIBC
-# undef strdup
-#endif
-
-#ifndef weak_alias
-# define __strdup strdup
-#endif
-
-/* Duplicate S, returning an identical malloc'd string. */
-char *
-__strdup (const char *s)
-{
- size_t len = strlen (s) + 1;
- void *new = malloc (len);
-
- if (new == NULL)
- return NULL;
-
- return (char *) memcpy (new, s, len);
-}
-#ifdef libc_hidden_def
-libc_hidden_def (__strdup)
-#endif
-#ifdef weak_alias
-weak_alias (__strdup, strdup)
-#endif
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index 617c63c031..cfe3486819 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -285,22 +285,6 @@ EXTRA_DIST += test-fread.c signature.h macros.h
## end gnulib module fread-tests
-## begin gnulib module fseek-tests
-
-TESTS += test-fseek.sh test-fseek2.sh
-check_PROGRAMS += test-fseek
-EXTRA_DIST += test-fseek.c test-fseek.sh test-fseek2.sh signature.h macros.h
-
-## end gnulib module fseek-tests
-
-## begin gnulib module fseeko-tests
-
-TESTS += test-fseeko.sh test-fseeko2.sh test-fseeko3.sh test-fseeko4.sh
-check_PROGRAMS += test-fseeko test-fseeko3 test-fseeko4
-EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh test-fseeko3.c test-fseeko3.sh test-fseeko4.c test-fseeko4.sh signature.h macros.h
-
-## end gnulib module fseeko-tests
-
## begin gnulib module fstat-tests
TESTS += test-fstat
@@ -343,24 +327,6 @@ EXTRA_DIST += test-fwrite.c signature.h macros.h
## end gnulib module fwrite-tests
-## begin gnulib module getdelim-tests
-
-TESTS += test-getdelim
-check_PROGRAMS += test-getdelim
-MOSTLYCLEANFILES += test-getdelim.txt
-EXTRA_DIST += test-getdelim.c signature.h macros.h
-
-## end gnulib module getdelim-tests
-
-## begin gnulib module getline-tests
-
-TESTS += test-getline
-check_PROGRAMS += test-getline
-MOSTLYCLEANFILES += test-getline.txt
-EXTRA_DIST += test-getline.c signature.h macros.h
-
-## end gnulib module getline-tests
-
## begin gnulib module getpagesize
diff --git a/gl/tests/test-fseek.c b/gl/tests/test-fseek.c
deleted file mode 100644
index 81ebb1cc46..0000000000
--- a/gl/tests/test-fseek.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Test of fseek() function.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
- 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.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-/* None of the files accessed by this test are large, so disable the
- fseek link warning if the user requested GNULIB_POSIXCHECK. */
-#define _GL_NO_LARGE_FILES
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (fseek, int, (FILE *, long, int));
-
-#include "macros.h"
-
-#ifndef FUNC_UNGETC_BROKEN
-# define FUNC_UNGETC_BROKEN 0
-#endif
-
-int
-main (int argc, char **argv)
-{
- /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
- iff argc > 1. */
- int expected = argc > 1 ? 0 : -1;
- ASSERT (fseek (stdin, 0, SEEK_CUR) == expected);
- if (argc > 1)
- {
- /* Test that fseek discards previously read ungetc data. */
- int ch = fgetc (stdin);
- ASSERT (ch == '#');
- ASSERT (ungetc (ch, stdin) == ch);
- ASSERT (fseek (stdin, 2, SEEK_SET) == 0);
- ch = fgetc (stdin);
- ASSERT (ch == '/');
- if (2 < argc)
- {
- if (FUNC_UNGETC_BROKEN)
- {
- fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
- stderr);
- return 77;
- }
- /* Test that fseek discards random ungetc data. */
- ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff));
- }
- ASSERT (fseek (stdin, 0, SEEK_END) == 0);
- ASSERT (fgetc (stdin) == EOF);
- /* Test that fseek resets end-of-file marker. */
- ASSERT (feof (stdin));
- ASSERT (fseek (stdin, 0, SEEK_END) == 0);
- ASSERT (!feof (stdin));
- }
- return 0;
-}
diff --git a/gl/tests/test-fseek.sh b/gl/tests/test-fseek.sh
deleted file mode 100755
index bad6c08dda..0000000000
--- a/gl/tests/test-fseek.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-./test-fseek${EXEEXT} 1 < "$srcdir/test-fseek.sh" || exit 1
-echo hi | ./test-fseek${EXEEXT} || exit 1
-exit 0
diff --git a/gl/tests/test-fseek2.sh b/gl/tests/test-fseek2.sh
deleted file mode 100755
index a4c9cb7f5c..0000000000
--- a/gl/tests/test-fseek2.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec ./test-fseek${EXEEXT} 1 2 < "$srcdir/test-fseek2.sh"
diff --git a/gl/tests/test-fseeko.c b/gl/tests/test-fseeko.c
deleted file mode 100644
index ae9ccef51d..0000000000
--- a/gl/tests/test-fseeko.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Test of fseeko() function.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
- 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.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-/* None of the files accessed by this test are large, so disable the
- fseek link warning if we are not using the gnulib fseek module. */
-#define _GL_NO_LARGE_FILES
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int));
-
-
-#include "macros.h"
-
-#ifndef FUNC_UNGETC_BROKEN
-# define FUNC_UNGETC_BROKEN 0
-#endif
-
-int
-main (int argc, char **argv _GL_UNUSED)
-{
- /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh'
- iff argc > 1. */
- int expected = argc > 1 ? 0 : -1;
- /* Exit with success only if fseek/fseeko agree. */
- int r1 = fseeko (stdin, 0, SEEK_CUR);
- int r2 = fseek (stdin, 0, SEEK_CUR);
- ASSERT (r1 == r2 && r1 == expected);
- if (argc > 1)
- {
- /* Test that fseek discards previously read ungetc data. */
- int ch = fgetc (stdin);
- ASSERT (ch == '#');
- ASSERT (ungetc (ch, stdin) == ch);
- ASSERT (fseeko (stdin, 2, SEEK_SET) == 0);
- ch = fgetc (stdin);
- ASSERT (ch == '/');
- if (2 < argc)
- {
- if (FUNC_UNGETC_BROKEN)
- {
- fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
- stderr);
- return 77;
- }
- /* Test that fseek discards random ungetc data. */
- ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff));
- }
- ASSERT (fseeko (stdin, 0, SEEK_END) == 0);
- ASSERT (fgetc (stdin) == EOF);
- /* Test that fseek resets end-of-file marker. */
- ASSERT (feof (stdin));
- ASSERT (fseeko (stdin, 0, SEEK_END) == 0);
- ASSERT (!feof (stdin));
- }
- return 0;
-}
diff --git a/gl/tests/test-fseeko.sh b/gl/tests/test-fseeko.sh
deleted file mode 100755
index 5c558272cb..0000000000
--- a/gl/tests/test-fseeko.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-./test-fseeko${EXEEXT} 1 < "$srcdir/test-fseeko.sh" || exit 1
-echo hi | ./test-fseeko${EXEEXT} || exit 1
-exit 0
diff --git a/gl/tests/test-fseeko2.sh b/gl/tests/test-fseeko2.sh
deleted file mode 100755
index 6e1130cf58..0000000000
--- a/gl/tests/test-fseeko2.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec ./test-fseeko${EXEEXT} 1 2 < "$srcdir/test-fseeko2.sh"
diff --git a/gl/tests/test-fseeko3.c b/gl/tests/test-fseeko3.c
deleted file mode 100644
index e92c9a12bc..0000000000
--- a/gl/tests/test-fseeko3.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Test of fseeko() function.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
- 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.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <eblake@redhat.com>, 2011. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <stdlib.h>
-
-#include "macros.h"
-
-int
-main (int argc, char **argv)
-{
- int do_initial_ftell = atoi (argv[1]);
- const char *filename = argv[2];
- FILE *fp = fopen (filename, "r");
- ASSERT (fp != NULL);
-
- if (do_initial_ftell)
- {
- off_t pos = ftell (fp);
- ASSERT (pos == 0);
- }
-
- ASSERT (fseeko (fp, 0, SEEK_END) == 0);
-
- {
- off_t pos = ftell (fp);
- ASSERT (pos > 0);
- }
-
- ASSERT (fclose (fp) == 0);
-
- return 0;
-}
diff --git a/gl/tests/test-fseeko3.sh b/gl/tests/test-fseeko3.sh
deleted file mode 100755
index c50b4a2258..0000000000
--- a/gl/tests/test-fseeko3.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-./test-fseeko3${EXEEXT} 0 "$srcdir/test-fseeko3.sh" || exit 1
-
-./test-fseeko3${EXEEXT} 1 "$srcdir/test-fseeko3.sh" || exit 1
-
-exit 0
diff --git a/gl/tests/test-fseeko4.c b/gl/tests/test-fseeko4.c
deleted file mode 100644
index 6559ad963e..0000000000
--- a/gl/tests/test-fseeko4.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Test of fseeko() function.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
- 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.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#include "macros.h"
-
-int
-main (int argc, char **argv)
-{
- const char *filename = argv[1];
-
- /* Test that fseeko() sets errno if someone else closes the stream
- fd behind the back of stdio. */
- {
- FILE *fp = fopen (filename, "r");
- ASSERT (fp != NULL);
- setvbuf (fp, NULL, _IONBF, 0);
- ASSERT (ftell (fp) == 0);
- ASSERT (fseeko (fp, 0, SEEK_END) == 0);
- ASSERT (ftell (fp) > 0);
- ASSERT (close (fileno (fp)) == 0);
- errno = 0;
- ASSERT (fseeko (fp, 0, SEEK_SET) == -1);
- ASSERT (errno == EBADF);
- fclose (fp);
- }
-
- /* Test that fseeko() sets errno if the stream was constructed with
- an invalid file descriptor. */
- {
- FILE *fp = fdopen (-1, "w");
- if (fp != NULL)
- {
- errno = 0;
- ASSERT (fseeko (fp, 0, SEEK_END) == -1);
- ASSERT (errno == EBADF);
- fclose (fp);
- }
- }
- {
- FILE *fp;
- close (99);
- fp = fdopen (99, "w");
- if (fp != NULL)
- {
- errno = 0;
- ASSERT (fseeko (fp, 0, SEEK_END) == -1);
- ASSERT (errno == EBADF);
- fclose (fp);
- }
- }
-
- return 0;
-}
diff --git a/gl/tests/test-fseeko4.sh b/gl/tests/test-fseeko4.sh
deleted file mode 100755
index e6464ae44a..0000000000
--- a/gl/tests/test-fseeko4.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-./test-fseeko4${EXEEXT} "$srcdir/test-fseeko4.sh" || exit 1
-
-exit 0
diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c
deleted file mode 100644
index 76aba827db..0000000000
--- a/gl/tests/test-getdelim.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Test of getdelim() function.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
- 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, or (at your option)
- any later version.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2007. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *));
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
- FILE *f;
- char *line;
- size_t len;
- ssize_t result;
-
- /* Create test file. */
- f = fopen ("test-getdelim.txt", "wb");
- if (!f || fwrite ("anAnbcnd\0f", 1, 10, f) != 10 || fclose (f) != 0)
- {
- fputs ("Failed to create sample file.\n", stderr);
- remove ("test-getdelim.txt");
- return 1;
- }
- f = fopen ("test-getdelim.txt", "rb");
- if (!f)
- {
- fputs ("Failed to reopen sample file.\n", stderr);
- remove ("test-getdelim.txt");
- return 1;
- }
-
- /* Test initial allocation, which must include trailing NUL. */
- line = NULL;
- len = 0;
- result = getdelim (&line, &len, 'n', f);
- ASSERT (result == 2);
- ASSERT (strcmp (line, "an") == 0);
- ASSERT (2 < len);
- free (line);
-
- /* Test initial allocation again, with line = NULL and len != 0. */
- line = NULL;
- len = (size_t)(~0) / 4;
- result = getdelim (&line, &len, 'n', f);
- ASSERT (result == 2);
- ASSERT (strcmp (line, "An") == 0);
- ASSERT (2 < len);
- free (line);
-
- /* Test growth of buffer. */
- line = malloc (1);
- len = 1;
- result = getdelim (&line, &len, 'n', f);
- ASSERT (result == 3);
- ASSERT (strcmp (line, "bcn") == 0);
- ASSERT (3 < len);
-
- /* Test embedded NULs and EOF behavior. */
- result = getdelim (&line, &len, 'n', f);
- ASSERT (result == 3);
- ASSERT (memcmp (line, "d\0f", 4) == 0);
- ASSERT (3 < len);
-
- result = getdelim (&line, &len, 'n', f);
- ASSERT (result == -1);
-
- free (line);
- fclose (f);
- remove ("test-getdelim.txt");
- return 0;
-}
diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c
deleted file mode 100644
index 4dbc485e87..0000000000
--- a/gl/tests/test-getline.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Test of getline() function.
- Copyright (C) 2007-2014 Free Software Foundation, Inc.
-
- 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, or (at your option)
- any later version.
-
- This program 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2007. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *));
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
- FILE *f;
- char *line;
- size_t len;
- ssize_t result;
-
- /* Create test file. */
- f = fopen ("test-getline.txt", "wb");
- if (!f || fwrite ("a\nA\nbc\nd\0f", 1, 10, f) != 10 || fclose (f) != 0)
- {
- fputs ("Failed to create sample file.\n", stderr);
- remove ("test-getline.txt");
- return 1;
- }
- f = fopen ("test-getline.txt", "rb");
- if (!f)
- {
- fputs ("Failed to reopen sample file.\n", stderr);
- remove ("test-getline.txt");
- return 1;
- }
-
- /* Test initial allocation, which must include trailing NUL. */
- line = NULL;
- len = 0;
- result = getline (&line, &len, f);
- ASSERT (result == 2);
- ASSERT (strcmp (line, "a\n") == 0);
- ASSERT (2 < len);
- free (line);
-
- /* Test initial allocation again, with line = NULL and len != 0. */
- line = NULL;
- len = (size_t)(~0) / 4;
- result = getline (&line, &len, f);
- ASSERT (result == 2);
- ASSERT (strcmp (line, "A\n") == 0);
- ASSERT (2 < len);
- free (line);
-
- /* Test growth of buffer, must not leak. */
- line = malloc (1);
- len = 0;
- result = getline (&line, &len, f);
- ASSERT (result == 3);
- ASSERT (strcmp (line, "bc\n") == 0);
- ASSERT (3 < len);
-
- /* Test embedded NULs and EOF behavior. */
- result = getline (&line, &len, f);
- ASSERT (result == 3);
- ASSERT (memcmp (line, "d\0f", 4) == 0);
- ASSERT (3 < len);
-
- result = getline (&line, &len, f);
- ASSERT (result == -1);
-
- free (line);
- fclose (f);
- remove ("test-getline.txt");
- return 0;
-}