Update from gnulib.

This commit is contained in:
Jim Meyering 2008-01-14 14:07:25 +00:00
parent 2edab512a0
commit 32d4aeb162
19 changed files with 230 additions and 38 deletions

View File

@ -1,5 +1,25 @@
2008-01-14 Jim Meyering <meyering@redhat.com>
Update files from gnulib.
* gnulib/lib/Makefile.am: Update.
* gnulib/lib/float.in.h: Likewise.
* gnulib/lib/fseeko.c: Likewise.
* gnulib/lib/printf-parse.c: Likewise.
* gnulib/lib/stdint.in.h: Likewise.
* gnulib/lib/stdio.in.h: Likewise.
* gnulib/lib/stdlib.in.h: Likewise.
* gnulib/lib/string.in.h: Likewise.
* gnulib/lib/unistd.in.h: Likewise.
* gnulib/lib/vasnprintf.h: Likewise.
* gnulib/m4/alloca.m4: Likewise.
* gnulib/m4/float_h.m4: Likewise.
* gnulib/m4/gnulib-comp.m4: Likewise.
* gnulib/m4/stdlib_h.m4: Likewise.
* gnulib/m4/string_h.m4: Likewise.
* gnulib/m4/unistd_h.m4: Likewise.
* gnulib/tests/Makefile.am: Likewise.
* gnulib/tests/test-fseeko.c: Likewise.
Clean up the global name space.
* src/qemu_conf.c: Add "static" and "const" attributes to some globals.
* src/qemu_conf.h: Update a declaration.
@ -77,7 +97,7 @@ Thu Jan 10 13:51:00 GMT 2008 Mark McLoughlin <markmc@redhat.com>
Thu Jan 10 13:50:11 GMT 2008 Mark McLoughlin <markmc@redhat.com>
* src/iptables.c: Re-name the "flipflop" variable to "command_idx"
Thu Jan 10 13:49:01 GMT 2008 Mark McLoughlin <markmc@redhat.com>
* src/iptables.c: make use of virFileMakePath(),

View File

@ -420,13 +420,18 @@ 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_SETENV''@|$(GNULIB_SETENV)|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_SETENV''@|$(HAVE_SETENV)|g' \
-e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdlib.in.h; \
} > $@-t
@ -482,9 +487,11 @@ string.h: string.in.h
-e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
-e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
-e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
-e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
-e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
-e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
-e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
-e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
-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' \
@ -500,6 +507,9 @@ string.h: string.in.h
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
-e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
-e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
-e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/string.in.h; \
@ -677,6 +687,7 @@ unistd.h: unistd.in.h
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
-e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
< $(srcdir)/unistd.in.h; \

View File

@ -24,7 +24,7 @@
#define _GL_FLOAT_H
/* 'long double' properties. */
#if defined __i386__ && defined __BEOS__
#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
/* Number of mantissa units, in base FLT_RADIX. */
# undef LDBL_MANT_DIG
# define LDBL_MANT_DIG 64

View File

@ -111,6 +111,9 @@ rpl_fseeko (FILE *fp, off_t offset, int whence)
#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 */
fp->_flag &= ~_IOEOF;
#endif
return 0;
}

View File

@ -1,5 +1,5 @@
/* Formatted output to strings.
Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
Copyright (C) 1999-2000, 2002-2003, 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
@ -392,6 +392,44 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
}
cp++;
}
#if defined __APPLE__ && defined __MACH__
/* On MacOS X 10.3, PRIdMAX is defined as "qd".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'q')
{
if (64 / 8 > sizeof (long))
{
/* int64_t = long long */
flags += 16;
}
else
{
/* int64_t = long */
flags += 8;
}
cp++;
}
#endif
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* On native Win32, PRIdMAX is defined as "I64d".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
{
if (64 / 8 > sizeof (long))
{
/* __int64 = long long */
flags += 16;
}
else
{
/* __int64 = long */
flags += 8;
}
cp += 3;
}
#endif
else
break;
}

View File

@ -23,6 +23,12 @@
#ifndef _GL_STDINT_H
/* When including a system file that in turn includes <inttypes.h>,
use the system <inttypes.h>, not our substitute. This avoids
problems with (for example) VMS, whose <sys/bitypes.h> includes
<inttypes.h>. */
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
@ -66,9 +72,7 @@
/* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
<inttypes.h> also defines intptr_t and uintptr_t. */
# define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
# include <inttypes.h>
# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
#elif @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
@ -91,6 +95,8 @@
#endif
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Minimum and maximum values for a integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */

View File

@ -1,6 +1,6 @@
/* A GNU-like <stdio.h>.
Copyright (C) 2004, 2007 Free Software Foundation, Inc.
Copyright (C) 2004, 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
@ -45,7 +45,7 @@
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes

View File

@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
Copyright (C) 1995, 2001-2002, 2006-2007 Free Software Foundation, Inc.
Copyright (C) 1995, 2001-2004, 2006-2007 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,29 @@ extern int putenv (char *string);
#endif
#if @GNULIB_SETENV@
# if !@HAVE_SETENV@
/* Set NAME to VALUE in the environment.
If REPLACE is nonzero, overwrite an existing value. */
extern int setenv (const char *name, const char *value, int replace);
# endif
#endif
#if @GNULIB_UNSETENV@
# if @HAVE_UNSETENV@
# if @VOID_UNSETENV@
/* On some systems, unsetenv() returns void.
This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
# define unsetenv(name) ((unsetenv)(name), 0)
# endif
# else
/* Remove the variable NAME from the environment. */
extern int unsetenv (const char *name);
# endif
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,6 @@
/* A GNU-like <string.h>.
Copyright (C) 1995-1996, 2001-2007 Free Software Foundation, Inc.
Copyright (C) 1995-1996, 2001-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
@ -25,6 +25,18 @@
#define _GL_STRING_H
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
/* The attribute __pure__ was added in gcc 2.96. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
# define __pure__ /* empty */
# endif
#endif
/* The definition of GL_LINK_WARNING is copied here. */
@ -35,15 +47,20 @@ extern "C" {
/* Return the first occurrence of NEEDLE in HAYSTACK. */
#if @GNULIB_MEMMEM@
# if ! @HAVE_DECL_MEMMEM@
# if @REPLACE_MEMMEM@
# define memmem rpl_memmem
# endif
# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
extern void *memmem (void const *__haystack, size_t __haystack_len,
void const *__needle, size_t __needle_len);
void const *__needle, size_t __needle_len)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
# undef memmem
# define memmem(a,al,b,bl) \
(GL_LINK_WARNING ("memmem is unportable - " \
"use gnulib module memmem for portability"), \
(GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
"use gnulib module memmem-simple for portability, " \
"and module memmem for speed" ), \
memmem (a, al, b, bl))
#endif
@ -65,7 +82,8 @@ extern void *mempcpy (void *restrict __dest, void const *restrict __src,
/* Search backwards through a block for a byte (specified as an int). */
#if @GNULIB_MEMRCHR@
# if ! @HAVE_DECL_MEMRCHR@
extern void *memrchr (void const *, int, size_t);
extern void *memrchr (void const *, int, size_t)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
# undef memrchr
@ -118,7 +136,8 @@ extern char *stpncpy (char *restrict __dst, char const *restrict __src,
/* Find the first occurrence of C in S or the final NUL byte. */
#if @GNULIB_STRCHRNUL@
# if ! @HAVE_STRCHRNUL@
extern char *strchrnul (char const *__s, int __c_in);
extern char *strchrnul (char const *__s, int __c_in)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strchrnul
@ -163,7 +182,8 @@ extern char *strndup (char const *__string, size_t __n);
return MAXLEN. */
#if @GNULIB_STRNLEN@
# if ! @HAVE_DECL_STRNLEN@
extern size_t strnlen (char const *__string, size_t __maxlen);
extern size_t strnlen (char const *__string, size_t __maxlen)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
# undef strnlen
@ -189,7 +209,8 @@ extern size_t strnlen (char const *__string, size_t __maxlen);
/* Find the first occurrence in S of any character in ACCEPT. */
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
extern char *strpbrk (char const *__s, char const *__accept);
extern char *strpbrk (char const *__s, char const *__accept)
__attribute__ ((__pure__));
# endif
# if defined GNULIB_POSIXCHECK
/* strpbrk() assumes the second argument is a list of single-byte characters.
@ -269,23 +290,32 @@ extern char *strsep (char **restrict __stringp, char const *restrict __delim);
strsep (s, d))
#endif
#if defined GNULIB_POSIXCHECK
#if @GNULIB_STRSTR@
# if @REPLACE_STRSTR@
# define strstr rpl_strstr
char *strstr (const char *haystack, const char *needle)
__attribute__ ((__pure__));
# endif
#elif defined GNULIB_POSIXCHECK
/* strstr() does not work with multibyte strings if the locale encoding is
different from UTF-8:
POSIX says that it operates on "strings", and "string" in POSIX is defined
as a sequence of bytes, not of characters. */
# undef strstr
# define strstr(a,b) \
(GL_LINK_WARNING ("strstr cannot work correctly on character strings " \
"in most multibyte locales - " \
"use mbsstr if you care about internationalization"), \
(GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
"work correctly on character strings in most " \
"multibyte locales - " \
"use mbsstr if you care about internationalization, " \
"or use strstr if you care about speed"), \
strstr (a, b))
#endif
/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
comparison. */
#if ! @HAVE_STRCASESTR@
extern char *strcasestr (const char *haystack, const char *needle);
extern char *strcasestr (const char *haystack, const char *needle)
__attribute__ ((__pure__));
#endif
#if defined GNULIB_POSIXCHECK
/* strcasestr() does not work with multibyte strings:
@ -511,6 +541,18 @@ extern char *strerror (int);
strerror (e))
#endif
#if @GNULIB_STRSIGNAL@
# if ! @HAVE_DECL_STRSIGNAL@
extern char *strsignal (int __sig);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strsignal
# define strsignal(a) \
(GL_LINK_WARNING ("strsignal is unportable - " \
"use gnulib module strsignal for portability"), \
strsignal (a))
#endif
#ifdef __cplusplus
}

View File

@ -181,7 +181,10 @@ extern int getlogin_r (char *name, size_t size);
#if @GNULIB_GETPAGESIZE@
# if !@HAVE_GETPAGESIZE@
# if @REPLACE_GETPAGESIZE@
# define getpagesize rpl_getpagesize
extern int getpagesize (void);
# elif !@HAVE_GETPAGESIZE@
/* This is for POSIX systems. */
# if !defined getpagesize && defined _SC_PAGESIZE
# if ! (defined __VMS && __VMS_VER < 70000000)

View File

@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc.
Copyright (C) 2002-2004, 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,7 +26,7 @@
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes

View File

@ -1,5 +1,5 @@
# alloca.m4 serial 7
dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
# alloca.m4 serial 8
dnl Copyright (C) 2002-2004, 2006, 2007 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.
@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA],
ALLOCA_H=alloca.h
fi
AC_SUBST([ALLOCA_H])
AC_DEFINE(HAVE_ALLOCA_H, 1,
[Define HAVE_ALLOCA_H for backward compatibility with older code
that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
])
# Prerequisites of lib/alloca.c.

View File

@ -1,4 +1,4 @@
# float_h.m4 serial 2
# float_h.m4 serial 3
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H],
AC_REQUIRE([AC_CANONICAL_HOST])
FLOAT_H=
case "$host_os" in
beos*)
beos* | openbsd*)
FLOAT_H=float.h
gl_CHECK_NEXT_HEADERS([float.h])
;;

View File

@ -157,6 +157,13 @@ AC_DEFUN([gl_LIBOBJ], [
gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
])
# m4_foreach_w is provided by autoconf-2.59c and later.
# This definition is to accommodate developers using versions
# of autoconf older than that.
m4_ifndef([m4_foreach_w],
[m4_define([m4_foreach_w],
[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
# Like AC_REPLACE_FUNCS, except that the module name goes
# into gl_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([gl_REPLACE_FUNCS], [
@ -185,6 +192,13 @@ AC_DEFUN([gltests_LIBOBJ], [
gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
])
# m4_foreach_w is provided by autoconf-2.59c and later.
# This definition is to accommodate developers using versions
# of autoconf older than that.
m4_ifndef([m4_foreach_w],
[m4_define([m4_foreach_w],
[m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
# Like AC_REPLACE_FUNCS, except that the module name goes
# into gltests_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([gltests_REPLACE_FUNCS], [

View File

@ -1,4 +1,4 @@
# stdlib_h.m4 serial 4
# stdlib_h.m4 serial 5
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -26,12 +26,17 @@ 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_SETENV=0; AC_SUBST([GNULIB_SETENV])
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])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
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_SETENV=1; AC_SUBST([HAVE_SETENV])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
])

View File

@ -1,10 +1,12 @@
# Configure a GNU-like replacement for <string.h>.
# Copyright (C) 2007 Free Software Foundation, Inc.
# Copyright (C) 2007, 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.
# serial 3
# Written by Paul Eggert.
AC_DEFUN([gl_HEADER_STRING_H],
@ -41,6 +43,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
@ -58,6 +61,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
@ -74,5 +78,8 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
])

View File

@ -55,6 +55,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
])

View File

@ -34,12 +34,13 @@ AM_CPPFLAGS = \
-I../.. -I$(srcdir)/../.. \
-I../../gnulib/lib -I$(srcdir)/../../gnulib/lib
LDADD = libtests.a $(LIBTESTS_LIBDEPS) ../../gnulib/lib/libgnu.la
LDADD = libtests.a ../../gnulib/lib/libgnu.la libtests.a $(LIBTESTS_LIBDEPS)
libtests_a_SOURCES =
libtests_a_LIBADD = $(gltests_LIBOBJS)
libtests_a_DEPENDENCIES = $(gltests_LIBOBJS)
EXTRA_libtests_a_SOURCES =
AM_LIBTOOLFLAGS = --preserve-dup-deps
## begin gnulib module alloca-opt-tests

View File

@ -26,10 +26,32 @@
int
main (int argc, char **argv)
{
/* Assume stdin is seekable iff argc > 1. */
/* Assume stdin is non-empty and seekable 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);
return ! (r1 == r2 && r1 == expected);
if (r1 != r2 || r1 != expected)
return 1;
if (argc > 1)
{
/* Test that fseek discards 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;
/* 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;
}
return 0;
}