提交 130426c6 编写于 作者: J Jim Meyering

update from gnulib

* gnulib/lib/inet_ntop.h: Remove file.
* gnulib/m4/onceonly_2_57.m4: Remove file.
* build-aux/useless-if-before-free: Update.
* build-aux/vc-list-files: Update.
* gnulib/lib/.cvsignore: Update.
* gnulib/lib/Makefile.am: Update.
* gnulib/lib/fseeko.c: Update.
* gnulib/lib/getaddrinfo.c: Update.
* gnulib/lib/getdelim.c: Update.
* gnulib/lib/inet_ntop.c: Update.
* gnulib/lib/inet_ntop.h: Update.
* gnulib/lib/poll.c: Update.
* gnulib/lib/snprintf.c: Update.
* gnulib/lib/stdlib.in.h: Update.
* gnulib/lib/string.in.h: Update.
* gnulib/lib/sys_socket.in.h: Update.
* gnulib/lib/sys_stat.in.h: Update.
* gnulib/lib/vasnprintf.c: Update.
* gnulib/lib/vasprintf.c: Update.
* gnulib/lib/wchar.in.h: Update.
* gnulib/m4/arpa_inet_h.m4: Update.
* gnulib/m4/extensions.m4: Update.
* gnulib/m4/gnulib-common.m4: Update.
* gnulib/m4/gnulib-comp.m4: Update.
* gnulib/m4/include_next.m4: Update.
* gnulib/m4/inet_ntop.m4: Update.
* gnulib/m4/netinet_in_h.m4: Update.
* gnulib/m4/onceonly_2_57.m4: Update.
* gnulib/m4/physmem.m4: Update.
* gnulib/m4/snprintf.m4: Update.
* gnulib/m4/stdint.m4: Update.
* gnulib/m4/stdio_h.m4: Update.
* gnulib/m4/stdlib_h.m4: Update.
* gnulib/m4/string_h.m4: Update.
* gnulib/m4/strndup.m4: Update.
* gnulib/m4/sys_select_h.m4: Update.
* gnulib/m4/sys_socket_h.m4: Update.
* gnulib/m4/sys_stat_h.m4: Update.
* gnulib/m4/vasnprintf.m4: Update.
* gnulib/tests/Makefile.am: Update.
* gnulib/tests/test-fseeko.c: Update.
* gnulib/tests/test-getaddrinfo.c: Update.
* gnulib/tests/test-getdelim.c: Update.
* gnulib/tests/test-getline.c: Update.
* gnulib/tests/test-lseek.c: Update.
* gnulib/tests/test-snprintf.c: Update.
* gnulib/tests/test-sys_stat.c: Update.
* gnulib/tests/test-vasnprintf.c: Update.
* gnulib/tests/test-vasprintf.c: Update.
上级 0c37f598
Tue Apr 29 21:43:28 CEST 2008 Jim Meyering <meyering@redhat.com>
update from gnulib
* gnulib/lib/inet_ntop.h: Remove file.
* gnulib/m4/onceonly_2_57.m4: Remove file.
* build-aux/useless-if-before-free: Update.
* build-aux/vc-list-files: Update.
* gnulib/lib/.cvsignore: Update.
* gnulib/lib/Makefile.am: Update.
* gnulib/lib/fseeko.c: Update.
* gnulib/lib/getaddrinfo.c: Update.
* gnulib/lib/getdelim.c: Update.
* gnulib/lib/inet_ntop.c: Update.
* gnulib/lib/inet_ntop.h: Update.
* gnulib/lib/poll.c: Update.
* gnulib/lib/snprintf.c: Update.
* gnulib/lib/stdlib.in.h: Update.
* gnulib/lib/string.in.h: Update.
* gnulib/lib/sys_socket.in.h: Update.
* gnulib/lib/sys_stat.in.h: Update.
* gnulib/lib/vasnprintf.c: Update.
* gnulib/lib/vasprintf.c: Update.
* gnulib/lib/wchar.in.h: Update.
* gnulib/m4/arpa_inet_h.m4: Update.
* gnulib/m4/extensions.m4: Update.
* gnulib/m4/gnulib-common.m4: Update.
* gnulib/m4/gnulib-comp.m4: Update.
* gnulib/m4/include_next.m4: Update.
* gnulib/m4/inet_ntop.m4: Update.
* gnulib/m4/netinet_in_h.m4: Update.
* gnulib/m4/onceonly_2_57.m4: Update.
* gnulib/m4/physmem.m4: Update.
* gnulib/m4/snprintf.m4: Update.
* gnulib/m4/stdint.m4: Update.
* gnulib/m4/stdio_h.m4: Update.
* gnulib/m4/stdlib_h.m4: Update.
* gnulib/m4/string_h.m4: Update.
* gnulib/m4/strndup.m4: Update.
* gnulib/m4/sys_select_h.m4: Update.
* gnulib/m4/sys_socket_h.m4: Update.
* gnulib/m4/sys_stat_h.m4: Update.
* gnulib/m4/vasnprintf.m4: Update.
* gnulib/tests/Makefile.am: Update.
* gnulib/tests/test-fseeko.c: Update.
* gnulib/tests/test-getaddrinfo.c: Update.
* gnulib/tests/test-getdelim.c: Update.
* gnulib/tests/test-getline.c: Update.
* gnulib/tests/test-lseek.c: Update.
* gnulib/tests/test-snprintf.c: Update.
* gnulib/tests/test-sys_stat.c: Update.
* gnulib/tests/test-vasnprintf.c: Update.
* gnulib/tests/test-vasprintf.c: Update.
remove useless tests before xmlFree
* src/qemu_conf.c (qemudParseDiskXML, qemudParseInterfaceXML):
(qemudParseInputXML, qemudParseDhcpRangesXML):
......
......@@ -2,7 +2,7 @@
# Detect instances of "if (p) free (p);".
# Likewise for "if (p != NULL) free (p);". And with braces.
my $VERSION = '2008-03-12 13:06'; # UTC
my $VERSION = '2008-04-29 17:55'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
......@@ -123,8 +123,8 @@ EOF
{
if ($line =~
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
(?: \s*$regexp\s*\((?:\s*\([^)]+\))\s*\2\s*\)|
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))\s*\2\s*\)\s*;\s*\}))/sx)
(?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)|
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*\2\s*\)\s*;\s*\}))/sx)
{
$found_match = 1;
$list
......
#!/bin/sh
# List version-controlled file names.
# Print a version string.
scriptversion=2008-04-03.17
# Copyright (C) 2006-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
......@@ -20,38 +23,80 @@
# List the specified version-controlled files.
# With no argument, list them all. With a single DIRECTORY argument,
# list the version-controlled files in that directory.
# This script must be run solely from the top of a $srcdir build directory.
# If there's an argument, it must be a single, "."-relative directory name.
# cvsu is part of the cvsutils package: http://www.red-bean.com/cvsutils/
postprocess=
case $1 in
--help) cat <<EOF
Usage: $0 [-C SRCDIR] [DIR]
Output a list of version-controlled files in DIR (default .), relative to
SRCDIR (default .). SRCDIR must be the top directory of a checkout.
Options:
--help print this help, then exit
--version print version number, then exit
-C SRCDIR change directory to SRCDIR before generating list
Report bugs and patches to <bug-gnulib@gnu.org>.
EOF
exit ;;
--version)
year=`echo "$scriptversion" | sed 's/[^0-9].*//'`
cat <<EOF
vc-list-files $scriptversion
Copyright (C) $year Free Software Foundation, Inc,
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
exit ;;
-C)
test "$2" = . || postprocess="| sed 's|^|$2/|'"
cd "$2" || exit 1
shift; shift ;;
esac
dir=
case $# in
0) ;;
1) dir=$1 ;;
*) echo "$0: too many arguments" 1>&2
echo "Usage: $0 [DIR]" 1>&2; exit 1;;
echo "Usage: $0 [-C srcdir] [DIR]" 1>&2; exit 1;;
esac
test "x$dir" = x && dir=.
if test -d .git; then
exec git ls-files "$dir"
eval exec git ls-files '"$dir"' $postprocess
elif test -d .hg; then
exec hg locate "$dir/*"
eval exec hg locate '"$dir/*"' $postprocess
elif test -d CVS; then
if test -x build-aux/cvsu; then
build-aux/cvsu --find --types=AFGM "$dir"
eval build-aux/cvsu --find --types=AFGM '"$dir"' $postprocess
elif (cvsu --help) >/dev/null 2>&1; then
eval cvsu --find --types=AFGM '"$dir"' $postprocess
else
awk -F/ '{ \
eval awk -F/ \''{ \
if (!$1 && $3 !~ /^-/) { \
f=FILENAME; \
sub(/CVS\/Entries/, "", f); \
print f $2; \
}}' \
$(find ${*-*} -name Entries -print) /dev/null;
}}'\'' \
$(find ${*-*} -name Entries -print) /dev/null' $postprocess
fi
else
echo "$0: Failed to determine type of version control used in "`pwd` 1>&2
echo "$0: Failed to determine type of version control used in `pwd`" 1>&2
exit 1
fi
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:
......@@ -5,6 +5,7 @@
Makefile
Makefile.in
alloca.h
arpa_inet.h
float.h
netinet_in.h
poll.h
......
......@@ -62,12 +62,21 @@ arpa/inet.h:
@MKDIR_P@ arpa
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
echo '#include <sys/socket.h>'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
-e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
-e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \
-e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
-e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
-e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
< $(srcdir)/arpa_inet.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
MOSTLYCLEANDIRS += arpa
EXTRA_DIST += arpa_inet.in.h
## end gnulib module arpa_inet
## begin gnulib module float
......@@ -93,7 +102,7 @@ EXTRA_DIST += float.in.h
## begin gnulib module fseeko
EXTRA_DIST += fseeko.c
EXTRA_DIST += fseeko.c stdio-impl.h
EXTRA_libgnu_la_SOURCES += fseeko.c
......@@ -167,7 +176,7 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
## begin gnulib module inet_ntop
EXTRA_DIST += inet_ntop.c inet_ntop.h
EXTRA_DIST += inet_ntop.c
EXTRA_libgnu_la_SOURCES += inet_ntop.c
......@@ -433,17 +442,22 @@ stdlib.h: stdlib.in.h
-e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
-e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
-e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
-e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
-e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
-e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
-e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdlib.in.h; \
......@@ -492,6 +506,7 @@ string.h: string.in.h
-e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
-e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
-e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
-e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \
-e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
-e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
-e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
......@@ -508,6 +523,7 @@ string.h: string.in.h
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
-e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
-e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
-e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
-e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
......@@ -631,9 +647,8 @@ sys/stat.h: sys_stat.in.h
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
-e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
-e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
-e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
-e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
< $(srcdir)/sys_stat.in.h; \
} > $@-t
mv $@-t $@
......
/* An fseeko() function that, together with fflush(), is POSIX compliant.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -23,6 +23,8 @@
/* Get off_t and lseek. */
#include <unistd.h>
#include "stdio-impl.h"
#undef fseeko
#if !HAVE_FSEEKO
# undef fseek
......@@ -39,18 +41,11 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
#endif
/* These tests are based on fpurge.c. */
#if defined _IO_ferror_unlocked /* GNU libc, BeOS */
#if defined _IO_ferror_unlocked || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, 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 /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
# if defined __NetBSD__ || defined __OpenBSD__ /* NetBSD, OpenBSD */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
# define fp_ub ((struct { struct __sbuf _ub; } *) fp->_ext._base)->_ub
# else /* FreeBSD, MacOS X, Cygwin */
# define fp_ub fp->_ub
# endif
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __SL64 && defined __SCLE /* Cygwin */
if ((fp->_flags & __SL64) == 0)
{
......@@ -64,27 +59,20 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
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)
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 _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
# if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */
# define fp_ ((struct { unsigned char *_ptr; \
unsigned char *_base; \
unsigned char *_end; \
long _cnt; \
int _file; \
unsigned int _flag; \
} *) fp)
#elif defined __EMX__ /* emx+gcc */
if (fp->_ptr == fp->_buffer
&& fp->_rcount == 0
&& fp->_wcount == 0
&& fp->_ungetc_count == 0)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
if (fp_->_ptr == fp_->_base
&& (fp_->_ptr == NULL || fp_->_cnt == 0))
# else
if (fp->_ptr == fp->_base
&& (fp->_ptr == NULL || fp->_cnt == 0))
# endif
#elif defined __UCLIBC__ /* uClibc */
if (((fp->__modeflags & __FLAG_WRITING) == 0
|| fp->__bufpos == fp->__bufstart)
......@@ -101,18 +89,20 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
off_t pos = lseek (fileno (fp), offset, whence);
if (pos == -1)
{
#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
fp->_flags &= ~__SOFF;
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_flags &= ~__SOFF;
#endif
return -1;
}
else
{
#if defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
fp->_offset = pos;
fp->_flags |= __SOFF;
fp->_flags &= ~__SEOF;
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_offset = pos;
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 */
fp->_flag &= ~_IOEOF;
#endif
return 0;
......
/* Get address information (partial implementation).
Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007, 2008 Free Software
Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
......@@ -25,6 +25,9 @@
# include <netinet/in.h>
#endif
/* Get inet_ntop. */
#include <arpa/inet.h>
/* Get calloc. */
#include <stdlib.h>
......@@ -40,8 +43,6 @@
#define _(String) gettext (String)
#define N_(String) String
#include "inet_ntop.h"
/* BeOS has AF_INET, but not PF_INET. */
#ifndef PF_INET
# define PF_INET AF_INET
......
/* getdelim.c --- Implementation of replacement getdelim function.
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007 Free
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or
......@@ -42,11 +42,6 @@
# define funlockfile(x) ((void) 0)
#endif
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#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
......
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 2005, 2006, 2008 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
......@@ -36,7 +36,7 @@
#include <config.h>
/* Specification. */
#include "inet_ntop.h"
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
......
/* Convert internet address from internal to printable, presentable format.
Copyright (C) 2005, 2006 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/* Converts an internet address from internal format to a printable,
presentable format.
AF is an internet address family, such as AF_INET or AF_INET6.
SRC points to a 'struct in_addr' (for AF_INET) or 'struct in6_addr'
(for AF_INET6).
DST points to a buffer having room for CNT bytes.
The printable representation of the address (in numeric form, not
surrounded by [...], no reverse DNS is done) is placed in DST, and
DST is returned. If an error occurs, the return value is NULL and
errno is set. If CNT bytes are not sufficient to hold the result,
the return value is NULL and errno is set to ENOSPC. A good value
for CNT is 46.
For more details, see the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/inet_ntop.html>. */
#if !HAVE_DECL_INET_NTOP
extern const char *inet_ntop (int af, const void *restrict src,
char *restrict dst, socklen_t cnt);
#endif
......@@ -43,10 +43,6 @@
#define INFTIM (-1)
#endif
#ifndef EOVERFLOW
#define EOVERFLOW EINVAL
#endif
/* BeOS does not have MSG_PEEK. */
#ifndef MSG_PEEK
#define MSG_PEEK 0
......
/* Formatted output to strings.
Copyright (C) 2004, 2006-2007 Free Software Foundation, Inc.
Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
......@@ -29,11 +29,6 @@
#include "vasnprintf.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
/* Print formatted output to string STR. Similar to sprintf, but
additional length SIZE limit how much is written into STR. Returns
string length of formatted string (which may be larger than SIZE).
......
/* A GNU-like <stdlib.h>.
Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc.
Copyright (C) 1995, 2001-2004, 2006-2008 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
......@@ -176,6 +176,21 @@ extern int putenv (char *string);
#endif
#if @GNULIB_RPMATCH@
# if !@HAVE_RPMATCH@
/* Test a user response to a question.
Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
extern int rpmatch (const char *response);
# endif
#elif defined GNULIB_POSIXCHECK
# undef rpmatch
# define rpmatch(r) \
(GL_LINK_WARNING ("rpmatch is unportable - " \
"use gnulib module rpmatch for portability"), \
rpmatch (r))
#endif
#if @GNULIB_SETENV@
# if !@HAVE_SETENV@
/* Set NAME to VALUE in the environment.
......@@ -199,6 +214,23 @@ extern int unsetenv (const char *name);
#endif
#if @GNULIB_STRTOD@
# if @REPLACE_STRTOD@
# define strtod rpl_strtod
# endif
# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
/* Parse a double from STRING, updating ENDP if appropriate. */
extern double strtod (const char *str, char **endp);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtod
# define strtod(s, e) \
(GL_LINK_WARNING ("strtod is unportable - " \
"use gnulib module strtod for portability"), \
strtod (s, e))
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -93,6 +93,22 @@ extern void *memrchr (void const *, int, size_t)
memrchr (a, b, c))
#endif
/* Find the first occurrence of C in S. More efficient than
memchr(S,C,N), at the expense of undefined behavior if C does not
occur within N bytes. */
#if @GNULIB_RAWMEMCHR@
# if ! @HAVE_RAWMEMCHR@
extern void *rawmemchr (void const *__s, int __c_in)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
# undef rawmemchr
# define rawmemchr(a,b) \
(GL_LINK_WARNING ("rawmemchr is unportable - " \
"use gnulib module rawmemchr for portability"), \
rawmemchr (a, b))
#endif
/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
#if @GNULIB_STPCPY@
# if ! @HAVE_STPCPY@
......
/* Provide a sys/socket header file for systems lacking it (read: MinGW).
Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
/* Provide a sys/socket header file for systems lacking it (read: MinGW)
and for systems where it is incomplete.
Copyright (C) 2005-2008 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
......@@ -16,8 +17,9 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file is supposed to be used on platforms that lack <sys/socket.h>
and on platforms where <sys/socket.h> cannot be included standalone.
/* This file is supposed to be used on platforms that lack <sys/socket.h>,
on platforms where <sys/socket.h> cannot be included standalone, and on
platforms where <sys/socket.h> does not provide all necessary definitions.
It is intended to provide definitions and prototypes needed by an
application. */
......@@ -37,7 +39,22 @@
#ifndef _GL_SYS_SOCKET_H
#define _GL_SYS_SOCKET_H
#if !@HAVE_SYS_SOCKET_H@
#if @HAVE_SYS_SOCKET_H@
/* A platform that has <sys/socket.h>. */
/* For shutdown(). */
# if !defined SHUT_RD
# define SHUT_RD 0
# endif
# if !defined SHUT_WR
# define SHUT_WR 1
# endif
# if !defined SHUT_RDWR
# define SHUT_RDWR 2
# endif
#else
/* A platform that lacks <sys/socket.h>.
......@@ -85,6 +102,16 @@
# define ESHUTDOWN WSAESHUTDOWN
# endif
# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
# define setsockopt(a,b,c,d,e) rpl_setsockopt(a,b,c,d,e)
static inline int
rpl_setsockopt(int socket, int level, int optname, const void *optval,
socklen_t optlen)
{
return (setsockopt)(socket, level, optname, optval, optlen);
}
# endif
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
......
/* Provide a more complete sys/stat header file.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2006-2008 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
......@@ -29,6 +29,12 @@
#ifndef _GL_SYS_STAT_H
#define _GL_SYS_STAT_H
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
headers that may declare mkdir(). */
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# include <io.h>
#endif
#ifndef S_IFMT
# define S_IFMT 0170000
#endif
......@@ -261,11 +267,15 @@
# define lstat stat
#endif
#if @REPLACE_MKDIR@
# undef mkdir
# define mkdir rpl_mkdir
extern int mkdir (char const *name, mode_t mode);
#else
/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
Additionally, it declares _mkdir (and depending on compile flags, an
alias mkdir), only in the nonstandard io.h. */
#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
# include <io.h>
alias mkdir), only in the nonstandard <io.h>, which is included above. */
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
static inline int
rpl_mkdir (char const *name, mode_t mode)
......@@ -273,7 +283,8 @@ rpl_mkdir (char const *name, mode_t mode)
return _mkdir (name);
}
# define mkdir rpl_mkdir
# define mkdir rpl_mkdir
# endif
#endif
#endif /* _GL_SYS_STAT_H */
......
......@@ -117,11 +117,6 @@
# include "fpucw.h"
#endif
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
#if HAVE_WCHAR_T
# if HAVE_WCSLEN
# define local_wcslen wcslen
......@@ -182,10 +177,12 @@ local_wcslen (const wchar_t *s)
# endif
#else
/* TCHAR_T is char. */
# /* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
/* Use snprintf if it exists under the name 'snprintf' or '_snprintf'.
But don't use it on BeOS, since BeOS snprintf produces no output if the
size argument is >= 0x3000000. */
# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__
size argument is >= 0x3000000.
Also don't use it on Linux libc5, since there snprintf with size = 1
writes any output without bounds, like sprintf. */
# if (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF) && !defined __BEOS__ && !(__GNU_LIBRARY__ == 1)
# define USE_SNPRINTF 1
# else
# define USE_SNPRINTF 0
......@@ -1306,9 +1303,9 @@ floorlog10l (long double x)
}
/* Now 0.95 <= z <= 1.01. */
z = 1 - z;
/* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ...
/* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
Four terms are enough to get an approximation with error < 10^-7. */
l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
/* Finally multiply with log(2)/log(10), yields an approximation for
log10(x). */
l *= 0.30102999566398119523;
......@@ -1397,9 +1394,9 @@ floorlog10 (double x)
}
/* Now 0.95 <= z <= 1.01. */
z = 1 - z;
/* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ...
/* log2(1-z) = 1/log(2) * (- z - z^2/2 - z^3/3 - z^4/4 - ...)
Four terms are enough to get an approximation with error < 10^-7. */
l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
l -= 1.4426950408889634074 * z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
/* Finally multiply with log(2)/log(10), yields an approximation for
log10(x). */
l *= 0.30102999566398119523;
......@@ -1409,6 +1406,20 @@ floorlog10 (double x)
# endif
/* Tests whether a string of digits consists of exactly PRECISION zeroes and
a single '1' digit. */
static int
is_borderline (const char *digits, size_t precision)
{
for (; precision > 0; precision--, digits++)
if (*digits != '0')
return 0;
if (*digits != '1')
return 0;
digits++;
return *digits == '\0';
}
#endif
DCHAR_T *
......@@ -2858,8 +2869,32 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
exponent += 1;
adjusted = 1;
}
/* Here ndigits = precision+1. */
if (is_borderline (digits, precision))
{
/* Maybe the exponent guess was too high
and a smaller exponent can be reached
by turning a 10...0 into 9...9x. */
char *digits2 =
scale10_round_decimal_long_double (arg,
(int)precision - exponent + 1);
if (digits2 == NULL)
{
free (digits);
END_LONG_DOUBLE_ROUNDING ();
goto out_of_memory;
}
if (strlen (digits2) == precision + 1)
{
free (digits);
digits = digits2;
exponent -= 1;
}
else
free (digits2);
}
/* Here ndigits = precision+1. */
*p++ = digits[--ndigits];
if ((flags & FLAG_ALT) || precision > 0)
{
......@@ -2971,6 +3006,30 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
adjusted = 1;
}
/* Here ndigits = precision. */
if (is_borderline (digits, precision - 1))
{
/* Maybe the exponent guess was too high
and a smaller exponent can be reached
by turning a 10...0 into 9...9x. */
char *digits2 =
scale10_round_decimal_long_double (arg,
(int)(precision - 1) - exponent + 1);
if (digits2 == NULL)
{
free (digits);
END_LONG_DOUBLE_ROUNDING ();
goto out_of_memory;
}
if (strlen (digits2) == precision)
{
free (digits);
digits = digits2;
exponent -= 1;
}
else
free (digits2);
}
/* Here ndigits = precision. */
/* Determine the number of trailing zeroes
that have to be dropped. */
......@@ -3211,8 +3270,31 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
exponent += 1;
adjusted = 1;
}
/* Here ndigits = precision+1. */
if (is_borderline (digits, precision))
{
/* Maybe the exponent guess was too high
and a smaller exponent can be reached
by turning a 10...0 into 9...9x. */
char *digits2 =
scale10_round_decimal_double (arg,
(int)precision - exponent + 1);
if (digits2 == NULL)
{
free (digits);
goto out_of_memory;
}
if (strlen (digits2) == precision + 1)
{
free (digits);
digits = digits2;
exponent -= 1;
}
else
free (digits2);
}
/* Here ndigits = precision+1. */
*p++ = digits[--ndigits];
if ((flags & FLAG_ALT) || precision > 0)
{
......@@ -3337,6 +3419,29 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
adjusted = 1;
}
/* Here ndigits = precision. */
if (is_borderline (digits, precision - 1))
{
/* Maybe the exponent guess was too high
and a smaller exponent can be reached
by turning a 10...0 into 9...9x. */
char *digits2 =
scale10_round_decimal_double (arg,
(int)(precision - 1) - exponent + 1);
if (digits2 == NULL)
{
free (digits);
goto out_of_memory;
}
if (strlen (digits2) == precision)
{
free (digits);
digits = digits2;
exponent -= 1;
}
else
free (digits2);
}
/* Here ndigits = precision. */
/* Determine the number of trailing zeroes
that have to be dropped. */
......@@ -3661,6 +3766,44 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
/* Decide whether to handle the precision ourselves. */
#if NEED_PRINTF_UNBOUNDED_PRECISION
switch (dp->conversion)
{
case 'd': case 'i': case 'u':
case 'o':
case 'x': case 'X': case 'p':
prec_ourselves = has_precision && (precision > 0);
break;
default:
prec_ourselves = 0;
break;
}
#endif
/* Decide whether to perform the padding ourselves. */
#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
switch (dp->conversion)
{
# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
/* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
to perform the padding after this conversion. Functions
with unistdio extensions perform the padding based on
character count rather than element count. */
case 'c': case 's':
# endif
# if NEED_PRINTF_FLAG_ZERO
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
# endif
pad_ourselves = 1;
break;
default:
pad_ourselves = prec_ourselves;
break;
}
#endif
#if !USE_SNPRINTF
/* Allocate a temporary buffer of sufficient size for calling
sprintf. */
......@@ -3837,18 +3980,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
abort ();
}
if (!pad_ourselves)
{
# if ENABLE_UNISTDIO
/* Padding considers the number of characters, therefore the
number of elements after padding may be
> max (tmp_length, width)
but is certainly
<= tmp_length + width. */
tmp_length = xsum (tmp_length, width);
/* Padding considers the number of characters, therefore
the number of elements after padding may be
> max (tmp_length, width)
but is certainly
<= tmp_length + width. */
tmp_length = xsum (tmp_length, width);
# else
/* Padding considers the number of elements, says POSIX. */
if (tmp_length < width)
tmp_length = width;
/* Padding considers the number of elements,
says POSIX. */
if (tmp_length < width)
tmp_length = width;
# endif
}
tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */
}
......@@ -3869,44 +4016,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
/* Decide whether to handle the precision ourselves. */
#if NEED_PRINTF_UNBOUNDED_PRECISION
switch (dp->conversion)
{
case 'd': case 'i': case 'u':
case 'o':
case 'x': case 'X': case 'p':
prec_ourselves = has_precision && (precision > 0);
break;
default:
prec_ourselves = 0;
break;
}
#endif
/* Decide whether to perform the padding ourselves. */
#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
switch (dp->conversion)
{
# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
/* If we need conversion from TCHAR_T[] to DCHAR_T[], we need
to perform the padding after this conversion. Functions
with unistdio extensions perform the padding based on
character count rather than element count. */
case 'c': case 's':
# endif
# if NEED_PRINTF_FLAG_ZERO
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
# endif
pad_ourselves = 1;
break;
default:
pad_ourselves = prec_ourselves;
break;
}
#endif
/* Construct the format string for calling snprintf or
sprintf. */
fbp = buf;
......@@ -4403,14 +4512,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
#if !DCHAR_IS_TCHAR
# if !USE_SNPRINTF
#if !USE_SNPRINTF
if (count >= tmp_length)
/* tmp_length was incorrectly calculated - fix the
code above! */
abort ();
# endif
#endif
#if !DCHAR_IS_TCHAR
/* Convert from TCHAR_T[] to DCHAR_T[]. */
if (dp->conversion == 'c' || dp->conversion == 's')
{
......@@ -4528,7 +4637,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (w < width)
{
size_t pad = width - w;
# if USE_SNPRINTF
/* Make room for the result. */
if (xsum (count, pad) > allocated - length)
{
......@@ -4538,12 +4647,16 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
xmax (xsum3 (length, count, pad),
xtimes (allocated, 2));
# if USE_SNPRINTF
length += count;
ENSURE_ALLOCATION (n);
length -= count;
# else
ENSURE_ALLOCATION (n);
# endif
}
/* Here count + pad <= allocated - length. */
# endif
{
# if !DCHAR_IS_TCHAR || USE_SNPRINTF
DCHAR_T * const rp = result + length;
......@@ -4553,7 +4666,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
DCHAR_T *p = rp + count;
DCHAR_T *end = p + pad;
DCHAR_T *pad_ptr;
# if !DCHAR_IS_TCHAR
# if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
if (dp->conversion == 'c'
|| dp->conversion == 's')
/* No zero-padding for string directives. */
......@@ -4604,13 +4717,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
}
#endif
#if DCHAR_IS_TCHAR && !USE_SNPRINTF
if (count >= tmp_length)
/* tmp_length was incorrectly calculated - fix the
code above! */
abort ();
#endif
/* Here still count <= allocated - length. */
#if !DCHAR_IS_TCHAR || USE_SNPRINTF
......
/* Formatted output to strings.
Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
Copyright (C) 1999, 2002, 2006-2008 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
......@@ -30,11 +30,6 @@
#include "vasnprintf.h"
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
int
vasprintf (char **resultp, const char *format, va_list args)
{
......
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -26,6 +26,14 @@
* the declaration of wcwidth().
*/
#ifdef __need_mbstate_t
/* Special invocation convention inside uClibc header files. */
#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
#else
/* Normal invocation convention. */
#ifndef _GL_WCHAR_H
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
......@@ -80,3 +88,4 @@ extern int wcwidth (int /* actually wchar_t */);
#endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */
#endif
# arpa_inet_h.m4 serial 1
dnl Copyright (C) 2006 Free Software Foundation, Inc.
# arpa_inet_h.m4 serial 4
dnl Copyright (C) 2006, 2008 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.
dnl Written by Simon Josefsson
dnl Written by Simon Josefsson and Bruno Haible
AC_DEFUN([gl_HEADER_ARPA_INET],
[
dnl Use AC_REQUIRE here, so that the default behavior below is expanded
dnl once only, before all statements that occur in other macros.
AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
AC_CHECK_HEADERS_ONCE([arpa/inet.h])
if test $ac_cv_header_arpa_inet_h = yes; then
ARPA_INET_H=''
HAVE_ARPA_INET_H=1
else
ARPA_INET_H='arpa/inet.h'
HAVE_ARPA_INET_H=0
fi
AC_SUBST(ARPA_INET_H)
AC_SUBST([HAVE_ARPA_INET_H])
dnl Execute this unconditionally, because ARPA_INET_H may be set by other
dnl modules, after this code is executed.
gl_CHECK_NEXT_HEADERS([arpa/inet.h])
])
AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])
AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
[
GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP])
GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
ARPA_INET_H=''; AC_SUBST([ARPA_INET_H])
])
# serial 5 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
......@@ -61,9 +61,9 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
[AC_LANG_PROGRAM([[
# define __EXTENSIONS__ 1
AC_INCLUDES_DEFAULT])],
]AC_INCLUDES_DEFAULT])],
[ac_cv_safe_to_define___extensions__=yes],
[ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
......
# gnulib-common.m4 serial 3
dnl Copyright (C) 2007 Free Software Foundation, Inc.
# gnulib-common.m4 serial 4
dnl Copyright (C) 2007-2008 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.
# gl_COMMON
# is expanded unconditionally through gnulib-tool magic.
AC_DEFUN([gl_COMMON], [
dnl Use AC_REQUIRE here, so that the code is expanded once only.
AC_REQUIRE([gl_COMMON_BODY])
])
AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([isoc99_inline],
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
__APPLE__ && __MACH__ test for MacOS X.
__APPLE_CC__ tests for the Apple compiler and its version.
__STDC_VERSION__ tests for the C99 mode. */
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif])
])
# gl_MODULE_INDICATOR([modulename])
# defines a C macro indicating the presence of the given module.
AC_DEFUN([gl_MODULE_INDICATOR],
......
......@@ -39,7 +39,9 @@ AC_DEFUN([gl_INIT],
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
gl_COMMON
gl_source_base='gnulib/lib'
gl_EOVERFLOW
gl_FUNC_ALLOCA
gl_HEADER_ARPA_INET
AC_PROG_MKDIR_P
......@@ -57,6 +59,7 @@ AC_DEFUN([gl_INIT],
AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL])
gl_INET_NTOP
gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
gl_FUNC_LSEEK
gl_UNISTD_MODULE_INDICATOR([lseek])
gl_FUNC_MALLOC_POSIX
......@@ -126,6 +129,7 @@ AC_DEFUN([gl_INIT],
m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
gl_COMMON
gl_source_base='gnulib/tests'
gt_TYPE_WCHAR_T
gt_TYPE_WINT_T
......@@ -230,6 +234,7 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/useless-if-before-free
build-aux/vc-list-files
lib/alloca.in.h
lib/arpa_inet.in.h
lib/asnprintf.c
lib/asprintf.c
lib/dummy.c
......@@ -245,7 +250,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/getpass.h
lib/gettext.h
lib/inet_ntop.c
lib/inet_ntop.h
lib/lseek.c
lib/malloc.c
lib/netinet_in.in.h
......@@ -262,6 +266,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/snprintf.c
lib/stdbool.in.h
lib/stdint.in.h
lib/stdio-impl.h
lib/stdio.in.h
lib/stdlib.in.h
lib/strdup.c
......@@ -316,12 +321,13 @@ AC_DEFUN([gl_FILE_LIST], [
m4/malloc.m4
m4/netinet_in_h.m4
m4/nls.m4
m4/onceonly_2_57.m4
m4/onceonly.m4
m4/physmem.m4
m4/po.m4
m4/poll.m4
m4/posix-shell.m4
m4/printf-posix.m4
m4/printf.m4
m4/progtest.m4
m4/realloc.m4
m4/size_max.m4
......@@ -352,6 +358,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/wchar_t.m4
m4/wint_t.m4
m4/xsize.m4
tests/test-EOVERFLOW.c
tests/test-alloca-opt.c
tests/test-arpa_inet.c
tests/test-fseeko.c
......
# include_next.m4 serial 5
# include_next.m4 serial 6
dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -71,7 +71,7 @@ AC_DEFUN([gl_CHECK_NEXT_HEADERS],
AC_REQUIRE([gl_INCLUDE_NEXT])
AC_CHECK_HEADERS_ONCE([$1])
AC_FOREACH([gl_HEADER_NAME], [$1],
m4_foreach_w([gl_HEADER_NAME], [$1],
[AS_VAR_PUSHDEF([gl_next_header],
[gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
if test $gl_cv_have_include_next = yes; then
......
# inet_ntop.m4 serial 3
dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc.
# inet_ntop.m4 serial 5
dnl Copyright (C) 2005, 2006, 2008 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_INET_NTOP],
[
AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
ARPA_INET_H='arpa/inet.h'
AC_REPLACE_FUNCS(inet_ntop)
gl_PREREQ_INET_NTOP
])
# Prerequisites of lib/inet_ntop.h and lib/inet_ntop.c.
# Prerequisites of lib/inet_ntop.c.
AC_DEFUN([gl_PREREQ_INET_NTOP], [
AC_CHECK_HEADERS_ONCE([netinet/in.h arpa/inet.h])
AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
AC_REQUIRE([gl_SOCKET_FAMILIES])
AC_REQUIRE([AC_C_RESTRICT])
......
# netinet_in_h.m4 serial 3
dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
# netinet_in_h.m4 serial 4
dnl Copyright (C) 2006-2008 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.
......@@ -9,7 +9,7 @@ AC_DEFUN([gl_HEADER_NETINET_IN],
AC_CACHE_CHECK([whether <netinet/in.h> is self-contained],
[gl_cv_header_netinet_in_h_selfcontained],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <netinet/in.h>], [])],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])],
[gl_cv_header_netinet_in_h_selfcontained=yes],
[gl_cv_header_netinet_in_h_selfcontained=no])
])
......
# onceonly_2_57.m4 serial 4
dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl This file defines some "once only" variants of standard autoconf macros.
dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
dnl The advantage is that the check for each of the headers/functions/decls
dnl will be put only once into the 'configure' file. It keeps the size of
dnl the 'configure' file down, and avoids redundant output when 'configure'
dnl is run.
dnl The drawback is that the checks cannot be conditionalized. If you write
dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
dnl empty, and the check will be inserted before the body of the AC_DEFUNed
dnl function.
dnl This is like onceonly.m4, except that it uses diversions to named sections
dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once,
dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The
dnl size reduction is ca. 9%.
dnl Autoconf version 2.57 or newer is recommended.
AC_PREREQ(2.57)
# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
:
AC_FOREACH([gl_HEADER_NAME], [$1], [
AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
[./-], [___])), [
m4_divert_text([INIT_PREPARE],
[gl_header_list="$gl_header_list gl_HEADER_NAME"])
gl_HEADERS_EXPANSION
AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
[Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
])
AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
[./-], [___])))
])
])
m4_define([gl_HEADERS_EXPANSION], [
m4_divert_text([DEFAULTS], [gl_header_list=])
AC_CHECK_HEADERS([$gl_header_list])
m4_define([gl_HEADERS_EXPANSION], [])
])
# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
:
AC_FOREACH([gl_FUNC_NAME], [$1], [
AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
m4_divert_text([INIT_PREPARE],
[gl_func_list="$gl_func_list gl_FUNC_NAME"])
gl_FUNCS_EXPANSION
AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
[Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
])
AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
])
])
m4_define([gl_FUNCS_EXPANSION], [
m4_divert_text([DEFAULTS], [gl_func_list=])
AC_CHECK_FUNCS([$gl_func_list])
m4_define([gl_FUNCS_EXPANSION], [])
])
# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
# AC_CHECK_DECLS(DECL1, DECL2, ...).
AC_DEFUN([AC_CHECK_DECLS_ONCE], [
:
AC_FOREACH([gl_DECL_NAME], [$1], [
AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
])
AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
])
])
# physmem.m4 serial 7
dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
# physmem.m4 serial 8
dnl Copyright (C) 2002-2003, 2005-2006, 2008 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.
......@@ -12,8 +12,8 @@ AC_DEFUN([gl_SYS__SYSTEM_CONFIGURATION],
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/systemcfg.h>
]],
[double x = _system_configuration.physmem;
if (x > 0.0) return 0;])],
[[double x = _system_configuration.physmem;
if (x > 0.0) return 0;]])],
[gl_cv_var__system_configuration=yes],
[gl_cv_var__system_configuration=no])])
......
# snprintf.m4 serial 4
dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
# snprintf.m4 serial 5
dnl Copyright (C) 2002-2004, 2007-2008 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.
......@@ -7,8 +7,17 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SNPRINTF],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_cv_func_snprintf_usable=no
AC_CHECK_FUNCS([snprintf])
if test $ac_cv_func_snprintf = no; then
if test $ac_cv_func_snprintf = yes; then
gl_SNPRINTF_SIZE1
case "$gl_cv_func_snprintf_size1" in
*yes)
gl_cv_func_snprintf_usable=yes
;;
esac
fi
if test $gl_cv_func_snprintf_usable = no; then
gl_REPLACE_SNPRINTF
fi
AC_CHECK_DECLS_ONCE([snprintf])
......
# stdint.m4 serial 29
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
# stdint.m4 serial 31
dnl Copyright (C) 2001-2008 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.
......@@ -240,7 +240,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to the number of bits in type ']gltype['.])])
for gltype in $1 ; do
......@@ -265,7 +265,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
eval BITSIZEOF_${GLTYPE}=\$result
done
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
])
......@@ -278,7 +278,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to 1 if ']gltype[' is a signed integer type.])])
for gltype in $1 ; do
......@@ -298,7 +298,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
eval HAVE_SIGNED_${GLTYPE}=0
fi
done
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
])
......@@ -311,7 +311,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
[Define to l, ll, u, ul, ull, etc., as suitable for
constants of type ']gltype['.])])
......@@ -337,9 +337,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
ui64)gltype1='unsigned __int64';;
esac
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([$2
[AC_LANG_PROGRAM([$2[
extern $gltype foo;
extern $gltype1 foo;])],
extern $gltype1 foo;]])],
[eval gl_cv_type_${gltype}_suffix=\$glsuf])
eval result=\$gl_cv_type_${gltype}_suffix
test "$result" != no && break
......@@ -350,7 +350,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
eval ${GLTYPE}_SUFFIX=\$result
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
done
AC_FOREACH([gltype], [$1],
m4_foreach_w([gltype], [$1],
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
])
......
# stdio_h.m4 serial 9
dnl Copyright (C) 2007 Free Software Foundation, Inc.
# stdio_h.m4 serial 10
dnl Copyright (C) 2007-2008 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.
......@@ -70,8 +70,8 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
[
AC_CACHE_CHECK([whether stdin defaults to large file offsets],
[gl_cv_var_stdin_large_offset],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
[#if defined __SL64 && defined __SCLE /* cygwin */
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]],
[[#if defined __SL64 && defined __SCLE /* cygwin */
/* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
it is easier to do a version check than building a runtime test. */
......@@ -79,7 +79,7 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
choke me
# endif
#endif])],
#endif]])],
[gl_cv_var_stdin_large_offset=yes],
[gl_cv_var_stdin_large_offset=no])])
])
# stdlib_h.m4 serial 5
dnl Copyright (C) 2007 Free Software Foundation, Inc.
# stdlib_h.m4 serial 7
dnl Copyright (C) 2007, 2008 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.
......@@ -26,7 +26,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
......@@ -34,9 +36,12 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
])
......@@ -35,6 +35,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
......@@ -66,6 +67,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
......
# strndup.m4 serial 14
dnl Copyright (C) 2002-2003, 2005-2007 Free Software Foundation, Inc.
# strndup.m4 serial 15
dnl Copyright (C) 2002-2003, 2005-2008 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.
......@@ -18,8 +18,8 @@ AC_DEFUN([gl_FUNC_STRNDUP],
# AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'.
AC_CACHE_CHECK([for working strndup], gl_cv_func_strndup,
[AC_RUN_IFELSE([
AC_LANG_PROGRAM([#include <string.h>
#include <stdlib.h>], [[
AC_LANG_PROGRAM([[#include <string.h>
#include <stdlib.h>]], [[
#ifndef HAVE_DECL_STRNDUP
extern char *strndup (const char *, size_t);
#endif
......
# sys_select_h.m4 serial 3
dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
# sys_select_h.m4 serial 4
dnl Copyright (C) 2006-2008 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.
......@@ -9,7 +9,7 @@ AC_DEFUN([gl_HEADER_SYS_SELECT],
AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
[gl_cv_header_sys_select_h_selfcontained],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/select.h>], [])],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], [[]])],
[gl_cv_header_sys_select_h_selfcontained=yes],
[gl_cv_header_sys_select_h_selfcontained=no])
])
......
# sys_socket_h.m4 serial 4
dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
# sys_socket_h.m4 serial 6
dnl Copyright (C) 2005-2008 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.
......@@ -8,18 +8,39 @@ dnl From Simon Josefsson.
AC_DEFUN([gl_HEADER_SYS_SOCKET],
[
AC_REQUIRE([AC_C_INLINE])
AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
[gl_cv_header_sys_socket_h_selfcontained],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>], [])],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
[gl_cv_header_sys_socket_h_selfcontained=yes],
[gl_cv_header_sys_socket_h_selfcontained=no])
])
if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
SYS_SOCKET_H=''
dnl If the shutdown function exists, <sys/socket.h> should define
dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
AC_CHECK_FUNCS([shutdown])
if test $ac_cv_func_shutdown = yes; then
AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
[gl_cv_header_sys_socket_h_shut],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sys/socket.h>]],
[[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
[gl_cv_header_sys_socket_h_shut=yes],
[gl_cv_header_sys_socket_h_shut=no])
])
if test $gl_cv_header_sys_socket_h_shut = no; then
SYS_SOCKET_H='sys/socket.h'
fi
fi
else
SYS_SOCKET_H='sys/socket.h'
fi
if test -n "$SYS_SOCKET_H"; then
dnl Check prerequisites of the <sys/socket.h> replacement.
gl_CHECK_NEXT_HEADERS([sys/socket.h])
if test $ac_cv_header_sys_socket_h = yes; then
HAVE_SYS_SOCKET_H=1
......
# sys_stat_h.m4 serial 6 -*- Autoconf -*-
dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
# sys_stat_h.m4 serial 8 -*- Autoconf -*-
dnl Copyright (C) 2006-2008 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.
......@@ -9,6 +9,8 @@ dnl Test whether <sys/stat.h> contains lstat and mkdir or must be substituted.
AC_DEFUN([gl_HEADER_SYS_STAT_H],
[
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so
dnl stat is a good replacement.
AC_CHECK_FUNCS_ONCE([lstat])
......@@ -19,24 +21,7 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
fi
AC_SUBST([HAVE_LSTAT])
dnl Check for mkdir. Mingw has _mkdir(name) in the nonstandard <io.h>
dnl instead.
AC_CHECK_DECLS([mkdir],
[],
[AC_CHECK_HEADERS([io.h])],
[#include <sys/stat.h>])
if test $ac_cv_have_decl_mkdir = yes; then
HAVE_DECL_MKDIR=1
else
HAVE_DECL_MKDIR=0
fi
AC_SUBST([HAVE_DECL_MKDIR])
if test "$ac_cv_header_io_h" = yes; then
HAVE_IO_H=1
else
HAVE_IO_H=0
fi
AC_SUBST([HAVE_IO_H])
dnl For the mkdir substitute.
AC_REQUIRE([AC_C_INLINE])
dnl Check for broken stat macros.
......@@ -45,4 +30,26 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
gl_CHECK_NEXT_HEADERS([sys/stat.h])
SYS_STAT_H='sys/stat.h'
AC_SUBST([SYS_STAT_H])
dnl Define types that are supposed to be defined in <sys/types.h> or
dnl <sys/stat.h>.
AC_CHECK_TYPE([nlink_t], [],
[AC_DEFINE([nlink_t], [int],
[Define to the type of st_nlink in struct stat, or a supertype.])],
[#include <sys/types.h>
#include <sys/stat.h>])
]) # gl_HEADER_SYS_STAT_H
AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])
AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
[
dnl Assume proper GNU behavior unless another module says otherwise.
REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
])
# vasnprintf.m4 serial 24
# vasnprintf.m4 serial 25
dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_VASNPRINTF],
[
AC_REQUIRE([gl_EOVERFLOW])
AC_CHECK_FUNCS_ONCE([vasnprintf])
if test $ac_cv_func_vasnprintf = no; then
gl_REPLACE_VASNPRINTF
......
......@@ -42,6 +42,14 @@ libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
EXTRA_libtests_a_SOURCES =
AM_LIBTOOLFLAGS = --preserve-dup-deps
## begin gnulib module EOVERFLOW-tests
TESTS += test-EOVERFLOW
check_PROGRAMS += test-EOVERFLOW
EXTRA_DIST += test-EOVERFLOW.c
## end gnulib module EOVERFLOW-tests
## begin gnulib module alloca-opt-tests
TESTS += test-alloca-opt
......@@ -73,6 +81,7 @@ EXTRA_DIST += test-fseeko.c test-fseeko.sh
TESTS += test-getaddrinfo
check_PROGRAMS += test-getaddrinfo
test_getaddrinfo_LDADD = $(LDADD) @LIBINTL@
EXTRA_DIST += test-getaddrinfo.c
......
/* Test of fseeko() function.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007, 2008 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
......@@ -19,39 +19,47 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
/* Get off_t. */
#include <sys/types.h>
#define ASSERT(expr) \
do \
{ \
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
while (0)
int
main (int argc, char **argv)
{
/* Assume stdin is non-empty and seekable iff argc > 1. */
/* 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, (off_t)0, SEEK_CUR);
int r2 = fseek (stdin, (long)0, SEEK_CUR);
if (r1 != r2 || r1 != expected)
return 1;
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 ungetc data. */
/* Test that fseek discards previously read ungetc data. */
int ch = fgetc (stdin);
if (ch == EOF)
return 1;
if (ungetc (ch ^ 0xff, stdin) != (ch ^ 0xff))
return 1;
if (fseeko (stdin, (off_t) 0, SEEK_END))
return 1;
if (fgetc (stdin) != EOF)
return 1;
ASSERT (ch == '#');
ASSERT (ungetc (ch, stdin) == ch);
ASSERT (fseeko (stdin, 2, SEEK_SET) == 0);
/* Test that fseek discards random ungetc data. */
ch = fgetc (stdin);
ASSERT (ch == '/');
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. */
if (!feof (stdin))
return 1;
if (fseeko (stdin, (off_t) 0, SEEK_END))
return 1;
if (feof (stdin))
return 1;
ASSERT (feof (stdin));
ASSERT (fseeko (stdin, 0, SEEK_END) == 0);
ASSERT (!feof (stdin));
}
return 0;
}
......@@ -19,7 +19,7 @@
#include <config.h>
#include "getaddrinfo.h"
#include "inet_ntop.h"
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
......@@ -54,10 +54,18 @@ int simple (char *host, char *service)
if (res != 0)
{
/* IRIX reports EAI_NONAME for "https". Don't fail the test
merely because of this. */
if (res == EAI_NONAME)
return 0;
/* Solaris reports EAI_SERVICE for "http" and "https". Don't
fail the test merely because of this. */
if (res == EAI_SERVICE)
return 0;
/* AIX reports EAI_NODATA for "https". Don't fail the test
merely because of this. */
if (res == EAI_NODATA)
return 0;
return 1;
}
......
/* Test of getdelim() function.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -29,6 +29,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
/* Test of getline() function.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -29,6 +29,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
/* Test of lseek() function.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -28,6 +28,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
/* Test of snprintf() function.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -29,6 +29,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
/* Test of <sys/stat.h> substitute.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -253,6 +253,9 @@ verify (!S_ISWHT (S_IFLNK));
verify (!S_ISWHT (S_IFSOCK));
#endif
/* Check the existence of some types. */
nlink_t t1;
int
main ()
{
......
/* Test of vasnprintf() and asnprintf() functions.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -31,6 +31,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
/* Test of vasprintf() and asprintf() functions.
Copyright (C) 2007 Free Software Foundation, Inc.
Copyright (C) 2007-2008 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
......@@ -30,6 +30,7 @@
if (!(expr)) \
{ \
fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
fflush (stderr); \
abort (); \
} \
} \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册