1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Automaetd merge.

This commit is contained in:
Saint Xavier 2008-06-08 13:00:15 +02:00
commit 8fc5241a2d
91 changed files with 22459 additions and 19316 deletions

View File

@ -21,6 +21,7 @@ lib/libgnu.a
lib/unistd.h
lib/stdbool.h
lib/stdint.h
lib/stdio.h
lib/stdlib.h
lib/string.h
lib/wchar.h

View File

@ -1,3 +1,13 @@
2008-05-29 Micah Cowan <micah@cowan.name>
* po/*.po: Updated from TP (the 1.11.3 set).
* po/POTFILES.in: Added some more files from lib/, remove
src/xmalloc.c.
* po/quot.sed, po/boldquot.sed: Automatic handling of quotearg's `
and '.
2008-05-15 Micah Cowan <micah@cowan.name>
* NEWS: Entry for --ask-password.

View File

@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
AUTOMAKE_OPTIONS = 1.5 gnits
@ -86,6 +86,15 @@ EXTRA_libgnu_a_SOURCES += exitfail.c
## end gnulib module exitfail
## begin gnulib module fseeko
EXTRA_DIST += fseeko.c stdio-impl.h
EXTRA_libgnu_a_SOURCES += fseeko.c
## end gnulib module fseeko
## begin gnulib module getdelim
@ -163,6 +172,15 @@ EXTRA_DIST += $(top_srcdir)/./link-warning.h
## end gnulib module link-warning
## begin gnulib module lseek
EXTRA_DIST += lseek.c
EXTRA_libgnu_a_SOURCES += lseek.c
## end gnulib module lseek
## begin gnulib module maintainer-makefile
EXTRA_DIST += $(top_srcdir)/maint.mk

113
lib/fseeko.c Normal file
View File

@ -0,0 +1,113 @@
/* An fseeko() function that, together with fflush(), is POSIX compliant.
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
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <config.h>
/* Specification. */
#include <stdio.h>
/* Get off_t and lseek. */
#include <unistd.h>
#include "stdio-impl.h"
#undef fseeko
#if !HAVE_FSEEKO
# undef fseek
# define fseeko fseek
#endif
int
rpl_fseeko (FILE *fp, off_t offset, int whence)
{
#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_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 || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS 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 _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */
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 & _MWRITE ? fp->_Next == fp->_Buf : fp->_Next == fp->_Rend)
&& fp->_Rback == fp->_Back + sizeof (fp->_Back)
&& fp->_Rsave == NULL)
#else
#error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
#endif
{
off_t pos = lseek (fileno (fp), offset, whence);
if (pos == -1)
{
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
fp_->_flags &= ~__SOFF;
#endif
return -1;
}
else
{
#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;
}
}
else
return fseeko (fp, offset, whence);
}

62
lib/lseek.c Normal file
View File

@ -0,0 +1,62 @@
/* An lseek() function that detects pipes.
Copyright (C) 2007 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <config.h>
/* Specification. */
#include <unistd.h>
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* Windows platforms. */
/* Get GetFileType. */
# include <windows.h>
#else
# include <sys/stat.h>
#endif
#include <errno.h>
#undef lseek
off_t
rpl_lseek (int fd, off_t offset, int whence)
{
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
/* mingw lseek mistakenly succeeds on pipes, sockets, and terminals. */
HANDLE h = (HANDLE) _get_osfhandle (fd);
if (h == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return -1;
}
if (GetFileType (h) != FILE_TYPE_DISK)
{
errno = ESPIPE;
return -1;
}
#else
/* BeOS lseek mistakenly succeeds on pipes... */
struct stat statbuf;
if (fstat (fd, &statbuf) < 0)
return -1;
if (!S_ISREG (statbuf.st_mode))
{
errno = ESPIPE;
return -1;
}
#endif
return lseek (fd, offset, whence);
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
@ -58,7 +58,7 @@
/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
definitions below, but temporarily we have to #undef them. */
#ifdef __BEOS__
#if defined __BEOS__ && !defined __HAIKU__
# include <OS.h> /* defines bool but not _Bool */
# undef false
# undef true
@ -73,7 +73,7 @@
(see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
(see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
enum; this ensures that '_Bool' promotes to 'int'. */
#if defined __cplusplus || defined __BEOS__
#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */

94
lib/stdio-impl.h Normal file
View File

@ -0,0 +1,94 @@
/* Implementation details of FILE streams.
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
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/>. */
/* Many stdio implementations have the same logic and therefore can share
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */
/* BSD stdio derived implementations. */
#if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
# if defined __DragonFly__ /* DragonFly */
/* See <http://www.dragonflybsd.org/cvsweb/src/lib/libc/stdio/priv_stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define fp_ ((struct { struct __FILE_public pub; \
struct { unsigned char *_base; int _size; } _bf; \
void *cookie; \
void *_close; \
void *_read; \
void *_seek; \
void *_write; \
struct { unsigned char *_base; int _size; } _ub; \
int _ur; \
unsigned char _ubuf[3]; \
unsigned cahr _nbuf[1]; \
struct { unsigned char *_base; int _size; } _lb; \
int _blksize; \
fpos_t _offset; \
/* More fields, not relevant here. */ \
} *) fp)
/* See <http://www.dragonflybsd.org/cvsweb/src/include/stdio.h?rev=HEAD&content-type=text/x-cvsweb-markup>. */
# define _p pub._p
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
# else
# define fp_ fp
# endif
# 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> */
struct __sfileext
{
struct __sbuf _ub; /* ungetc buffer */
/* More fields, not relevant here. */
};
# define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub
# else /* FreeBSD, DragonFly, MacOS X, Cygwin */
# define fp_ub fp->_ub
# endif
# define HASUB(fp) (fp_ub._base != NULL)
#endif
/* SystemV derived implementations. */
#if defined _IOERR
# 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)
# else
# define fp_ fp
# endif
# if defined _SCO_DS /* OpenServer */
# define _cnt __cnt
# define _ptr __ptr
# define _base __base
# define _flag __flag
# endif
#endif

View File

@ -1,411 +0,0 @@
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* A GNU-like <stdio.h>.
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 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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#if defined __need_FILE || defined __need___FILE
/* Special invocation convention inside glibc header files. */
#include_next <stdio.h>
#else
/* Normal invocation convention. */
#ifndef _GL_STDIO_H
/* The include_next requires a split double-inclusion guard. */
#include_next <stdio.h>
#ifndef _GL_STDIO_H
#define _GL_STDIO_H
#include <stdarg.h>
#include <stddef.h>
#if (0 && 0) \
|| (0 && 0) \
|| (1 && !1) \
|| (1 && (!1 || 0))
/* Get off_t and ssize_t. */
# include <sys/types.h>
#endif
#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 __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
/* The definition of GL_LINK_WARNING is copied here. */
/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
a linker warning on most glibc systems.
We use a linker warning rather than a preprocessor warning, because
#warning cannot be used inside macros. */
#ifndef GL_LINK_WARNING
/* This works on platforms with GNU ld and ELF object format.
Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
Testing __ELF__ guarantees the ELF object format.
Testing __GNUC__ is necessary for the compound expression syntax. */
# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
# define GL_LINK_WARNING(message) \
GL_LINK_WARNING1 (__FILE__, __LINE__, message)
# define GL_LINK_WARNING1(file, line, message) \
GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
# define GL_LINK_WARNING2(file, line, message) \
GL_LINK_WARNING3 (file ":" #line ": warning: " message)
# define GL_LINK_WARNING3(message) \
({ static const char warning[sizeof (message)] \
__attribute__ ((__unused__, \
__section__ (".gnu.warning"), \
__aligned__ (1))) \
= message "\n"; \
(void)0; \
})
# else
# define GL_LINK_WARNING(message) ((void) 0)
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if 0
# if 0
# define fprintf rpl_fprintf
extern int fprintf (FILE *fp, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef fprintf
# define fprintf \
(GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
"use gnulib module fprintf-posix for portable " \
"POSIX compliance"), \
fprintf)
#endif
#if 0
# if 0
# define vfprintf rpl_vfprintf
extern int vfprintf (FILE *fp, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 2, 0)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vfprintf
# define vfprintf(s,f,a) \
(GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
"use gnulib module vfprintf-posix for portable " \
"POSIX compliance"), \
vfprintf (s, f, a))
#endif
#if 0
# if 0
/* Don't break __attribute__((format(printf,M,N))). */
# define printf __printf__
extern int printf (const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef printf
# define printf \
(GL_LINK_WARNING ("printf is not always POSIX compliant - " \
"use gnulib module printf-posix for portable " \
"POSIX compliance"), \
printf)
/* Don't break __attribute__((format(printf,M,N))). */
# define format(kind,m,n) format (__##kind##__, m, n)
# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
# define ____printf____ __printf__
# define ____scanf____ __scanf__
# define ____strftime____ __strftime__
# define ____strfmon____ __strfmon__
#endif
#if 0
# if 0
# define vprintf rpl_vprintf
extern int vprintf (const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 1, 0)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vprintf
# define vprintf(f,a) \
(GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
"use gnulib module vprintf-posix for portable " \
"POSIX compliance"), \
vprintf (f, a))
#endif
#if 0
# if 0
# define snprintf rpl_snprintf
# endif
# if 0 || !1
extern int snprintf (char *str, size_t size, const char *format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef snprintf
# define snprintf \
(GL_LINK_WARNING ("snprintf is unportable - " \
"use gnulib module snprintf for portability"), \
snprintf)
#endif
#if 0
# if 0
# define vsnprintf rpl_vsnprintf
# endif
# if 0 || !1
extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 3, 0)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsnprintf
# define vsnprintf(b,s,f,a) \
(GL_LINK_WARNING ("vsnprintf is unportable - " \
"use gnulib module vsnprintf for portability"), \
vsnprintf (b, s, f, a))
#endif
#if 0
# if 0
# define sprintf rpl_sprintf
extern int sprintf (char *str, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef sprintf
# define sprintf \
(GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
"use gnulib module sprintf-posix for portable " \
"POSIX compliance"), \
sprintf)
#endif
#if 0
# if 0
# define vsprintf rpl_vsprintf
extern int vsprintf (char *str, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 2, 0)));
# endif
#elif defined GNULIB_POSIXCHECK
# undef vsprintf
# define vsprintf(b,f,a) \
(GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
"use gnulib module vsprintf-posix for portable " \
"POSIX compliance"), \
vsprintf (b, f, a))
#endif
#if 0
# if 0
# define asprintf rpl_asprintf
# define vasprintf rpl_vasprintf
# endif
# if 0 || !1
/* Write formatted output to a string dynamically allocated with malloc().
If the memory allocation succeeds, store the address of the string in
*RESULT and return the number of resulting bytes, excluding the trailing
NUL. Upon memory allocation error, or some other error, return -1. */
extern int asprintf (char **result, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int vasprintf (char **result, const char *format, va_list args)
__attribute__ ((__format__ (__printf__, 2, 0)));
# endif
#endif
#if 0
# if 0
# define fopen rpl_fopen
extern FILE * fopen (const char *filename, const char *mode);
# endif
#elif defined GNULIB_POSIXCHECK
# undef fopen
# define fopen(f,m) \
(GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
"use gnulib module fopen for portability"), \
fopen (f, m))
#endif
#if 0
# if 0
# define freopen rpl_freopen
extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef freopen
# define freopen(f,m,s) \
(GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
"use gnulib module freopen for portability"), \
freopen (f, m, s))
#endif
#if 0
# if 0
/* Provide fseek, fseeko functions that are aware of a preceding
fflush(), and which detect pipes. */
# define fseeko rpl_fseeko
extern int fseeko (FILE *fp, off_t offset, int whence);
# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
# endif
#elif defined GNULIB_POSIXCHECK
# undef fseeko
# define fseeko(f,o,w) \
(GL_LINK_WARNING ("fseeko is unportable - " \
"use gnulib module fseeko for portability"), \
fseeko (f, o, w))
#endif
#if 0 && 0
extern int rpl_fseek (FILE *fp, long offset, int whence);
# undef fseek
# if defined GNULIB_POSIXCHECK
# define fseek(f,o,w) \
(GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
"on 32-bit platforms - " \
"use fseeko function for handling of large files"), \
rpl_fseek (f, o, w))
# else
# define fseek rpl_fseek
# endif
#elif defined GNULIB_POSIXCHECK
# ifndef fseek
# define fseek(f,o,w) \
(GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
"on 32-bit platforms - " \
"use fseeko function for handling of large files"), \
fseek (f, o, w))
# endif
#endif
#if 0
# if 0
# define ftello rpl_ftello
extern off_t ftello (FILE *fp);
# define ftell(fp) ftello (fp)
# endif
#elif defined GNULIB_POSIXCHECK
# undef ftello
# define ftello(f) \
(GL_LINK_WARNING ("ftello is unportable - " \
"use gnulib module ftello for portability"), \
ftello (f))
#endif
#if 0 && 0
extern long rpl_ftell (FILE *fp);
# undef ftell
# if GNULIB_POSIXCHECK
# define ftell(f) \
(GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
"on 32-bit platforms - " \
"use ftello function for handling of large files"), \
rpl_ftell (f))
# else
# define ftell rpl_ftell
# endif
#elif defined GNULIB_POSIXCHECK
# ifndef ftell
# define ftell(f) \
(GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
"on 32-bit platforms - " \
"use ftello function for handling of large files"), \
ftell (f))
# endif
#endif
#if 0
# if 0
# define fflush rpl_fflush
/* Flush all pending data on STREAM according to POSIX rules. Both
output and seekable input streams are supported.
Note! LOSS OF DATA can occur if fflush is applied on an input stream
that is _not_seekable_ or on an update stream that is _not_seekable_
and in which the most recent operation was input. Seekability can
be tested with lseek(fileno(fp),0,SEEK_CUR). */
extern int fflush (FILE *gl_stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef fflush
# define fflush(f) \
(GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
"use gnulib module fflush for portable " \
"POSIX compliance"), \
fflush (f))
#endif
#if 1
# if !1
/* Read input, up to (and including) the next occurrence of DELIMITER, from
STREAM, store it in *LINEPTR (and NUL-terminate it).
*LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
bytes of space. It is realloc'd as necessary.
Return the number of bytes read and stored at *LINEPTR (not including the
NUL terminator), or -1 on error or EOF. */
extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
FILE *stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getdelim
# define getdelim(l, s, d, f) \
(GL_LINK_WARNING ("getdelim is unportable - " \
"use gnulib module getdelim for portability"), \
getdelim (l, s, d, f))
#endif
#if 1
# if 0
# undef getline
# define getline rpl_getline
# endif
# if !1 || 0
/* Read a line, up to (and including) the next newline, from STREAM, store it
in *LINEPTR (and NUL-terminate it).
*LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
bytes of space. It is realloc'd as necessary.
Return the number of bytes read and stored at *LINEPTR (not including the
NUL terminator), or -1 on error or EOF. */
extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getline
# define getline(l, s, f) \
(GL_LINK_WARNING ("getline is unportable - " \
"use gnulib module getline for portability"), \
getline (l, s, f))
#endif
#ifdef __cplusplus
}
#endif
#endif /* _GL_STDIO_H */
#endif /* _GL_STDIO_H */
#endif

View File

@ -1,269 +0,0 @@
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* A GNU-like <stdlib.h>.
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 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/>. */
#if defined __need_malloc_and_calloc
/* Special invocation convention inside glibc header files. */
#include_next <stdlib.h>
#else
/* Normal invocation convention. */
#ifndef _GL_STDLIB_H
/* The include_next requires a split double-inclusion guard. */
#include_next <stdlib.h>
#ifndef _GL_STDLIB_H
#define _GL_STDLIB_H
/* The definition of GL_LINK_WARNING is copied here. */
/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
a linker warning on most glibc systems.
We use a linker warning rather than a preprocessor warning, because
#warning cannot be used inside macros. */
#ifndef GL_LINK_WARNING
/* This works on platforms with GNU ld and ELF object format.
Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
Testing __ELF__ guarantees the ELF object format.
Testing __GNUC__ is necessary for the compound expression syntax. */
# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
# define GL_LINK_WARNING(message) \
GL_LINK_WARNING1 (__FILE__, __LINE__, message)
# define GL_LINK_WARNING1(file, line, message) \
GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
# define GL_LINK_WARNING2(file, line, message) \
GL_LINK_WARNING3 (file ":" #line ": warning: " message)
# define GL_LINK_WARNING3(message) \
({ static const char warning[sizeof (message)] \
__attribute__ ((__unused__, \
__section__ (".gnu.warning"), \
__aligned__ (1))) \
= message "\n"; \
(void)0; \
})
# else
# define GL_LINK_WARNING(message) ((void) 0)
# endif
#endif
/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
with proper operation of xargs. */
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#elif EXIT_FAILURE != 1
# undef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if 0
# if !1
# undef malloc
# define malloc rpl_malloc
extern void * malloc (size_t size);
# endif
#elif defined GNULIB_POSIXCHECK
# undef malloc
# define malloc(s) \
(GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
"use gnulib module malloc-posix for portability"), \
malloc (s))
#endif
#if 1
# if !1
# undef realloc
# define realloc rpl_realloc
extern void * realloc (void *ptr, size_t size);
# endif
#elif defined GNULIB_POSIXCHECK
# undef realloc
# define realloc(p,s) \
(GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
"use gnulib module realloc-posix for portability"), \
realloc (p, s))
#endif
#if 0
# if !1
# undef calloc
# define calloc rpl_calloc
extern void * calloc (size_t nmemb, size_t size);
# endif
#elif defined GNULIB_POSIXCHECK
# undef calloc
# define calloc(n,s) \
(GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
"use gnulib module calloc-posix for portability"), \
calloc (n, s))
#endif
#if 0
/* Assuming *OPTIONP is a comma separated list of elements of the form
"token" or "token=value", getsubopt parses the first of these elements.
If the first element refers to a "token" that is member of the given
NULL-terminated array of tokens:
- It replaces the comma with a NUL byte, updates *OPTIONP to point past
the first option and the comma, sets *VALUEP to the value of the
element (or NULL if it doesn't contain an "=" sign),
- It returns the index of the "token" in the given array of tokens.
Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
For more details see the POSIX:2001 specification.
http://www.opengroup.org/susv3xsh/getsubopt.html */
# if !1
extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
# endif
#elif defined GNULIB_POSIXCHECK
# undef getsubopt
# define getsubopt(o,t,v) \
(GL_LINK_WARNING ("getsubopt is unportable - " \
"use gnulib module getsubopt for portability"), \
getsubopt (o, t, v))
#endif
#if 0
# if !1
/* Create a unique temporary directory from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the directory name unique.
Returns TEMPLATE, or a null pointer if it cannot get a unique name.
The directory is created mode 700. */
extern char * mkdtemp (char * /*template*/);
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkdtemp
# define mkdtemp(t) \
(GL_LINK_WARNING ("mkdtemp is unportable - " \
"use gnulib module mkdtemp for portability"), \
mkdtemp (t))
#endif
#if 0
# if 0
/* Create a unique temporary file from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
The file is then created, ensuring it didn't exist before.
The file is created read-write (mask at least 0600 & ~umask), but it may be
world-readable and world-writable (mask 0666 & ~umask), depending on the
implementation.
Returns the open file descriptor if successful, otherwise -1 and errno
set. */
# define mkstemp rpl_mkstemp
extern int mkstemp (char * /*template*/);
# else
/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
# include <unistd.h>
# endif
#elif defined GNULIB_POSIXCHECK
# undef mkstemp
# define mkstemp(t) \
(GL_LINK_WARNING ("mkstemp is unportable - " \
"use gnulib module mkstemp for portability"), \
mkstemp (t))
#endif
#if 0
# if 0
# undef putenv
# define putenv rpl_putenv
extern int putenv (char *string);
# endif
#endif
#if 0
# if !1
/* 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 0
# if !1
/* 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 0
# if 1
# if 0
/* 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
#if 0
# if 0
# define strtod rpl_strtod
# endif
# if !1 || 0
/* 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
#endif /* _GL_STDLIB_H */
#endif /* _GL_STDLIB_H */
#endif

View File

@ -108,7 +108,7 @@ char *xstrdup (char const *str) ATTRIBUTE_MALLOC;
void *xnmalloc (size_t n, size_t s) ATTRIBUTE_MALLOC;
void *xnrealloc (void *p, size_t n, size_t s);
void *x2nrealloc (void *p, size_t *pn, size_t s);
char *xcharalloc (size_t n) ATTRIBUTE_MALLOC;;
char *xcharalloc (size_t n) ATTRIBUTE_MALLOC;
# endif
# ifdef static_inline

34
m4/fseeko.m4 Normal file
View File

@ -0,0 +1,34 @@
# fseeko.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.
AC_DEFUN([gl_FUNC_FSEEKO],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([gl_STDIN_LARGE_OFFSET])
dnl Persuade glibc <stdio.h> to declare fseeko().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
[
AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
[gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
])
if test $gl_cv_func_fseeko = no; then
HAVE_FSEEKO=0
gl_REPLACE_FSEEKO
elif test $gl_cv_var_stdin_large_offset = no; then
gl_REPLACE_FSEEKO
fi
])
AC_DEFUN([gl_REPLACE_FSEEKO],
[
AC_LIBOBJ([fseeko])
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
REPLACE_FSEEKO=1
])

View File

@ -15,11 +15,11 @@
# Specification in the form of a command-line invocation:
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([alloca c-ctype getopt getpass-gnu maintainer-makefile quote])
gl_MODULES([alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg])
gl_AVOID([])
gl_SOURCE_BASE([lib])
gl_M4_BASE([m4])

View File

@ -26,6 +26,7 @@ AC_DEFUN([gl_EARLY],
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
AC_REQUIRE([AC_PROG_RANLIB])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_FUNC_FSEEKO])
])
# This macro should be invoked from ./configure.ac, in the section
@ -50,6 +51,8 @@ AC_DEFUN([gl_INIT],
[AM_XGETTEXT_OPTION([--flag=error:3:c-format])
AM_XGETTEXT_OPTION([--flag=error_at_line:5:c-format])])
gl_EXITFAIL
gl_FUNC_FSEEKO
gl_STDIO_MODULE_INDICATOR([fseeko])
gl_FUNC_GETDELIM
gl_STDIO_MODULE_INDICATOR([getdelim])
gl_FUNC_GETLINE
@ -69,6 +72,8 @@ AC_DEFUN([gl_INIT],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
gl_INLINE
gl_FUNC_LSEEK
gl_UNISTD_MODULE_INDICATOR([lseek])
gl_QUOTE
gl_QUOTEARG
gl_FUNC_REALLOC_POSIX
@ -224,6 +229,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/error.h
lib/exitfail.c
lib/exitfail.h
lib/fseeko.c
lib/getdelim.c
lib/getline.c
lib/getopt.c
@ -234,12 +240,14 @@ AC_DEFUN([gl_FILE_LIST], [
lib/getpass.h
lib/gettext.h
lib/intprops.h
lib/lseek.c
lib/quote.c
lib/quote.h
lib/quotearg.c
lib/quotearg.h
lib/realloc.c
lib/stdbool.in.h
lib/stdio-impl.h
lib/stdio.in.h
lib/stdlib.in.h
lib/strerror.c
@ -255,6 +263,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/error.m4
m4/exitfail.m4
m4/extensions.m4
m4/fseeko.m4
m4/getdelim.m4
m4/getline.m4
m4/getopt.m4
@ -262,6 +271,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/gnulib-common.m4
m4/include_next.m4
m4/inline.m4
m4/lseek.m4
m4/malloc.m4
m4/mbrtowc.m4
m4/mbstate_t.m4

50
m4/lseek.m4 Normal file
View File

@ -0,0 +1,50 @@
# lseek.m4 serial 4
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,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_LSEEK],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe],
[if test $cross_compiling = no; then
AC_LINK_IFELSE([
#include <sys/types.h> /* for off_t */
#include <stdio.h> /* for SEEK_CUR */
#include <unistd.h>
int main ()
{
/* Exit with success only if stdin is seekable. */
return lseek (0, (off_t)0, SEEK_CUR) < 0;
}],
[if test -s conftest$ac_exeext \
&& ./conftest$ac_exeext < conftest.$ac_ext \
&& { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
gl_cv_func_lseek_pipe=yes
else
gl_cv_func_lseek_pipe=no
fi],
[gl_cv_func_lseek_pipe=no])
else
AC_COMPILE_IFELSE([
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) || defined __BEOS__
/* mingw and BeOS mistakenly return 0 when trying to seek on pipes. */
Choke me.
#endif],
[gl_cv_func_lseek_pipe=yes], [gl_cv_func_lseek_pipe=no])
fi])
if test $gl_cv_func_lseek_pipe = no; then
gl_REPLACE_LSEEK
fi
])
AC_DEFUN([gl_REPLACE_LSEEK],
[
AC_LIBOBJ([lseek])
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
REPLACE_LSEEK=1
AC_DEFINE([LSEEK_PIPE_BROKEN], [1],
[Define to 1 if lseek does not detect pipes.])
])

View File

@ -1,523 +0,0 @@
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/*
* ISO C 99 <stdint.h> for platforms that lack it.
* <http://www.opengroup.org/susv3xbd/stdint.h.html>
*/
#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
signed char int8_t;" that will get messed up by our macro. Our
macros should all be consistent with the system versions, except
for the "fast" types and macros, which we recommend against using
in public interfaces due to compiler differences. */
#if 1
# if defined __sgi && ! defined __c99
/* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
with "This header file is to be used only for c99 mode compilations"
diagnostics. */
# define __STDINT_H__
# endif
/* Other systems may have an incomplete or buggy <stdint.h>.
Include it before <inttypes.h>, since any "#include <stdint.h>"
in <inttypes.h> would reinclude us, skipping our contents because
_GL_STDINT_H is defined.
The include_next requires a split double-inclusion guard. */
# include_next <stdint.h>
#endif
#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
#define _GL_STDINT_H
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after <stdint.h>. */
#if 1 && ! defined _AIX
# include <sys/types.h>
#endif
/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
#include <limits.h>
#if 1
/* 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. */
# include <inttypes.h>
#elif 0
/* 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. */
# include <sys/inttypes.h>
#endif
#if 1 && ! defined __BIT_TYPES_DEFINED__
/* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is
included by <sys/types.h>. */
# include <sys/bitypes.h>
#endif
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* Get WCHAR_MIN, WCHAR_MAX. */
# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
# include <wchar.h>
# endif
#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. */
#define _STDINT_MIN(signed, bits, zero) \
((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
#define _STDINT_MAX(signed, bits, zero) \
((signed) \
? ~ _STDINT_MIN (signed, bits, zero) \
: /* The expression for the unsigned case. The subtraction of (signed) \
is a nop in the unsigned case and avoids "signed integer overflow" \
warnings in the signed case. */ \
((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
/* 7.18.1.1. Exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#undef int8_t
#undef uint8_t
#define int8_t signed char
#define uint8_t unsigned char
#undef int16_t
#undef uint16_t
#define int16_t short int
#define uint16_t unsigned short int
#undef int32_t
#undef uint32_t
#define int32_t int
#define uint32_t unsigned int
/* Do not undefine int64_t if gnulib is not being used with 64-bit
types, since otherwise it breaks platforms like Tandem/NSK. */
#if LONG_MAX >> 31 >> 31 == 1
# undef int64_t
# define int64_t long int
# define GL_INT64_T
#elif defined _MSC_VER
# undef int64_t
# define int64_t __int64
# define GL_INT64_T
#elif 1
# undef int64_t
# define int64_t long long int
# define GL_INT64_T
#endif
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
# undef uint64_t
# define uint64_t unsigned long int
# define GL_UINT64_T
#elif defined _MSC_VER
# undef uint64_t
# define uint64_t unsigned __int64
# define GL_UINT64_T
#elif 1
# undef uint64_t
# define uint64_t unsigned long long int
# define GL_UINT64_T
#endif
/* Avoid collision with Solaris 2.5.1 <pthread.h> etc. */
#define _UINT8_T
#define _UINT32_T
#define _UINT64_T
/* 7.18.1.2. Minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#undef int_least8_t
#undef uint_least8_t
#undef int_least16_t
#undef uint_least16_t
#undef int_least32_t
#undef uint_least32_t
#undef int_least64_t
#undef uint_least64_t
#define int_least8_t int8_t
#define uint_least8_t uint8_t
#define int_least16_t int16_t
#define uint_least16_t uint16_t
#define int_least32_t int32_t
#define uint_least32_t uint32_t
#ifdef GL_INT64_T
# define int_least64_t int64_t
#endif
#ifdef GL_UINT64_T
# define uint_least64_t uint64_t
#endif
/* 7.18.1.3. Fastest minimum-width integer types */
/* Note: Other <stdint.h> substitutes may define these types differently.
It is not recommended to use these types in public header files. */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. Assume that 'long int'
is fast enough for all narrower integers. */
#undef int_fast8_t
#undef uint_fast8_t
#undef int_fast16_t
#undef uint_fast16_t
#undef int_fast32_t
#undef uint_fast32_t
#undef int_fast64_t
#undef uint_fast64_t
#define int_fast8_t long int
#define uint_fast8_t unsigned int_fast8_t
#define int_fast16_t long int
#define uint_fast16_t unsigned int_fast16_t
#define int_fast32_t long int
#define uint_fast32_t unsigned int_fast32_t
#ifdef GL_INT64_T
# define int_fast64_t int64_t
#endif
#ifdef GL_UINT64_T
# define uint_fast64_t uint64_t
#endif
/* 7.18.1.4. Integer types capable of holding object pointers */
#undef intptr_t
#undef uintptr_t
#define intptr_t long int
#define uintptr_t unsigned long int
/* 7.18.1.5. Greatest-width integer types */
/* Note: These types are compiler dependent. It may be unwise to use them in
public header files. */
#undef intmax_t
#if 1 && LONG_MAX >> 30 == 1
# define intmax_t long long int
#elif defined GL_INT64_T
# define intmax_t int64_t
#else
# define intmax_t long int
#endif
#undef uintmax_t
#if 1 && ULONG_MAX >> 31 == 1
# define uintmax_t unsigned long long int
#elif defined GL_UINT64_T
# define uintmax_t uint64_t
#else
# define uintmax_t unsigned long int
#endif
/* Verify that intmax_t and uintmax_t have the same size. Too much code
breaks if this is not the case. If this check fails, the reason is likely
to be found in the autoconf macros. */
typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
/* 7.18.2. Limits of specified-width integer types */
#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
/* 7.18.2.1. Limits of exact-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. */
#undef INT8_MIN
#undef INT8_MAX
#undef UINT8_MAX
#define INT8_MIN (~ INT8_MAX)
#define INT8_MAX 127
#define UINT8_MAX 255
#undef INT16_MIN
#undef INT16_MAX
#undef UINT16_MAX
#define INT16_MIN (~ INT16_MAX)
#define INT16_MAX 32767
#define UINT16_MAX 65535
#undef INT32_MIN
#undef INT32_MAX
#undef UINT32_MAX
#define INT32_MIN (~ INT32_MAX)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
#undef INT64_MIN
#undef INT64_MAX
#ifdef GL_INT64_T
/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
evaluates the latter incorrectly in preprocessor expressions. */
# define INT64_MIN (- INTMAX_C (1) << 63)
# define INT64_MAX INTMAX_C (9223372036854775807)
#endif
#undef UINT64_MAX
#ifdef GL_UINT64_T
# define UINT64_MAX UINTMAX_C (18446744073709551615)
#endif
/* 7.18.2.2. Limits of minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
are the same as the corresponding N_t types. */
#undef INT_LEAST8_MIN
#undef INT_LEAST8_MAX
#undef UINT_LEAST8_MAX
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#undef INT_LEAST16_MIN
#undef INT_LEAST16_MAX
#undef UINT_LEAST16_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#undef INT_LEAST32_MIN
#undef INT_LEAST32_MAX
#undef UINT_LEAST32_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#undef INT_LEAST64_MIN
#undef INT_LEAST64_MAX
#ifdef GL_INT64_T
# define INT_LEAST64_MIN INT64_MIN
# define INT_LEAST64_MAX INT64_MAX
#endif
#undef UINT_LEAST64_MAX
#ifdef GL_UINT64_T
# define UINT_LEAST64_MAX UINT64_MAX
#endif
/* 7.18.2.3. Limits of fastest minimum-width integer types */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
are taken from the same list of types. */
#undef INT_FAST8_MIN
#undef INT_FAST8_MAX
#undef UINT_FAST8_MAX
#define INT_FAST8_MIN LONG_MIN
#define INT_FAST8_MAX LONG_MAX
#define UINT_FAST8_MAX ULONG_MAX
#undef INT_FAST16_MIN
#undef INT_FAST16_MAX
#undef UINT_FAST16_MAX
#define INT_FAST16_MIN LONG_MIN
#define INT_FAST16_MAX LONG_MAX
#define UINT_FAST16_MAX ULONG_MAX
#undef INT_FAST32_MIN
#undef INT_FAST32_MAX
#undef UINT_FAST32_MAX
#define INT_FAST32_MIN LONG_MIN
#define INT_FAST32_MAX LONG_MAX
#define UINT_FAST32_MAX ULONG_MAX
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
#ifdef GL_INT64_T
# define INT_FAST64_MIN INT64_MIN
# define INT_FAST64_MAX INT64_MAX
#endif
#undef UINT_FAST64_MAX
#ifdef GL_UINT64_T
# define UINT_FAST64_MAX UINT64_MAX
#endif
/* 7.18.2.4. Limits of integer types capable of holding object pointers */
#undef INTPTR_MIN
#undef INTPTR_MAX
#undef UINTPTR_MAX
#define INTPTR_MIN LONG_MIN
#define INTPTR_MAX LONG_MAX
#define UINTPTR_MAX ULONG_MAX
/* 7.18.2.5. Limits of greatest-width integer types */
#undef INTMAX_MIN
#undef INTMAX_MAX
#ifdef INT64_MAX
# define INTMAX_MIN INT64_MIN
# define INTMAX_MAX INT64_MAX
#else
# define INTMAX_MIN INT32_MIN
# define INTMAX_MAX INT32_MAX
#endif
#undef UINTMAX_MAX
#ifdef UINT64_MAX
# define UINTMAX_MAX UINT64_MAX
#else
# define UINTMAX_MAX UINT32_MAX
#endif
/* 7.18.3. Limits of other integer types */
/* ptrdiff_t limits */
#undef PTRDIFF_MIN
#undef PTRDIFF_MAX
#define PTRDIFF_MIN \
_STDINT_MIN (1, 32, 0)
#define PTRDIFF_MAX \
_STDINT_MAX (1, 32, 0)
/* sig_atomic_t limits */
#undef SIG_ATOMIC_MIN
#undef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MIN \
_STDINT_MIN (1, 32, \
0)
#define SIG_ATOMIC_MAX \
_STDINT_MAX (1, 32, \
0)
/* size_t limit */
#undef SIZE_MAX
#define SIZE_MAX _STDINT_MAX (0, 32, 0u)
/* wchar_t limits */
#undef WCHAR_MIN
#undef WCHAR_MAX
#define WCHAR_MIN \
_STDINT_MIN (1, 32, 0)
#define WCHAR_MAX \
_STDINT_MAX (1, 32, 0)
/* wint_t limits */
#undef WINT_MIN
#undef WINT_MAX
#define WINT_MIN \
_STDINT_MIN (0, 32, 0u)
#define WINT_MAX \
_STDINT_MAX (0, 32, 0u)
#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
/* 7.18.4. Macros for integer constants */
#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
/* 7.18.4.1. Macros for minimum-width integer constants */
/* According to ISO C 99 Technical Corrigendum 1 */
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */
#undef INT8_C
#undef UINT8_C
#define INT8_C(x) x
#define UINT8_C(x) x
#undef INT16_C
#undef UINT16_C
#define INT16_C(x) x
#define UINT16_C(x) x
#undef INT32_C
#undef UINT32_C
#define INT32_C(x) x
#define UINT32_C(x) x ## U
#undef INT64_C
#undef UINT64_C
#if LONG_MAX >> 31 >> 31 == 1
# define INT64_C(x) x##L
#elif defined _MSC_VER
# define INT64_C(x) x##i64
#elif 1
# define INT64_C(x) x##LL
#endif
#if ULONG_MAX >> 31 >> 31 >> 1 == 1
# define UINT64_C(x) x##UL
#elif defined _MSC_VER
# define UINT64_C(x) x##ui64
#elif 1
# define UINT64_C(x) x##ULL
#endif
/* 7.18.4.2. Macros for greatest-width integer constants */
#undef INTMAX_C
#if 1 && LONG_MAX >> 30 == 1
# define INTMAX_C(x) x##LL
#elif defined GL_INT64_T
# define INTMAX_C(x) INT64_C(x)
#else
# define INTMAX_C(x) x##L
#endif
#undef UINTMAX_C
#if 1 && ULONG_MAX >> 31 == 1
# define UINTMAX_C(x) x##ULL
#elif defined GL_UINT64_T
# define UINTMAX_C(x) UINT64_C(x)
#else
# define UINTMAX_C(x) x##UL
#endif
#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
#endif /* _GL_STDINT_H */
#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */

View File

@ -3,7 +3,10 @@
# 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# Package source files
lib/error.c
lib/getopt.c
lib/quotearg.c
lib/xalloc-die.c
src/cmpt.c
src/connect.c
src/convert.c
@ -32,4 +35,3 @@ src/retr.c
src/spider.c
src/url.c
src/utils.c
src/xmalloc.c

1312
po/be.po

File diff suppressed because it is too large Load Diff

848
po/bg.po

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
# For quotearg:
s/^`$//
s/^'$//
s/"\([^"]*\)"/“\1”/g
s/`\([^`']*\)'/\1/g
s/ '\([^`']*\)' / \1 /g

890
po/ca.po

File diff suppressed because it is too large Load Diff

934
po/cs.po

File diff suppressed because it is too large Load Diff

852
po/da.po

File diff suppressed because it is too large Load Diff

948
po/de.po

File diff suppressed because it is too large Load Diff

848
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

889
po/eo.po

File diff suppressed because it is too large Load Diff

853
po/es.po

File diff suppressed because it is too large Load Diff

870
po/et.po

File diff suppressed because it is too large Load Diff

858
po/eu.po

File diff suppressed because it is too large Load Diff

914
po/fi.po

File diff suppressed because it is too large Load Diff

891
po/fr.po

File diff suppressed because it is too large Load Diff

915
po/ga.po

File diff suppressed because it is too large Load Diff

859
po/gl.po

File diff suppressed because it is too large Load Diff

846
po/he.po

File diff suppressed because it is too large Load Diff

867
po/hr.po

File diff suppressed because it is too large Load Diff

1083
po/hu.po

File diff suppressed because it is too large Load Diff

873
po/id.po

File diff suppressed because it is too large Load Diff

918
po/it.po

File diff suppressed because it is too large Load Diff

910
po/ja.po

File diff suppressed because it is too large Load Diff

832
po/nb.po

File diff suppressed because it is too large Load Diff

951
po/nl.po

File diff suppressed because it is too large Load Diff

1945
po/pl.po

File diff suppressed because it is too large Load Diff

920
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
# For quotearg:
s/^`$//
s/^'$//
s/"\([^"]*\)"/“\1”/g
s/`\([^`']*\)'/\1/g
s/ '\([^`']*\)' / \1 /g

858
po/ro.po

File diff suppressed because it is too large Load Diff

912
po/ru.po

File diff suppressed because it is too large Load Diff

915
po/sk.po

File diff suppressed because it is too large Load Diff

1917
po/sl.po

File diff suppressed because it is too large Load Diff

857
po/sr.po

File diff suppressed because it is too large Load Diff

917
po/sv.po

File diff suppressed because it is too large Load Diff

874
po/tr.po

File diff suppressed because it is too large Load Diff

859
po/uk.po

File diff suppressed because it is too large Load Diff

921
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,23 @@
2008-06-01 Micah Cowan <micah@cowan.name>
* main.c [WINDOWS]: Reopen stdout in binary mode, when -O - is
given.
2008-05-31 Micah Cowan <micah@cowan.name>
* html-url.c, http.c: Avoid casts in a couple spots.
2008-05-30 Henri Häkkinen <henux@users.sourceforge.net>
* cookies.c, ftp-basic.c, hash.c, html-url.c, http-ntlm.c, http.c,
init.c, log.c, main.c, progress.c, ptimer.c, spider.c, url.c,
utils.c: Minor changes to silence warnings when using -Wall.
2008-05-26 Steven Schubiger <schubiger@gmail.com>
* ftp.c (getftp): Replace last remaining invocation of escnonprint
with gnulib quote.
2008-05-19 Micah Cowan <micah@cowan.name>
* main.c (main): Password prompt should be done only once (not

View File

@ -587,7 +587,7 @@ check_domain_match (const char *cookie_domain, const char *host)
if (dccount == 2)
{
int i;
size_t i;
int known_toplevel = false;
static const char *known_toplevel_domains[] = {
".com", ".edu", ".net", ".org", ".gov", ".mil", ".int"

View File

@ -189,7 +189,7 @@ ftp_login (int csock, const char *acc, const char *pass)
"331 s/key ",
"331 opiekey "
};
int i;
size_t i;
const char *seed = NULL;
for (i = 0; i < countof (skey_head); i++)
@ -964,7 +964,7 @@ ftp_list (int csock, const char *file)
int nwritten;
uerr_t err;
bool ok = false;
int i = 0;
size_t i = 0;
/* Try `LIST -a' first and revert to `LIST' in case of failure. */
const char *list_commands[] = { "LIST -a",
"LIST" };

View File

@ -808,8 +808,8 @@ Error in server response, closing control connection.\n"));
if (!exists)
{
logputs (LOG_VERBOSE, "\n");
logprintf (LOG_NOTQUIET, _("No such file `%s'.\n"),
escnonprint (u->file));
logprintf (LOG_NOTQUIET, _("No such file %s.\n"),
quote (u->file));
}
}
fd_close (csock);

View File

@ -226,7 +226,7 @@ prime_size (int size, int *prime_offset)
243370577, 316381771, 411296309, 534685237, 695090819, 903618083,
1174703521, 1527114613, 1837299131, 2147483647
};
int i;
size_t i;
for (i = *prime_offset; i < countof (primes); i++)
if (primes[i] >= size)

View File

@ -185,7 +185,7 @@ init_interesting (void)
matches the user's preferences as specified through --ignore-tags
and --follow-tags. */
int i;
size_t i;
interesting_tags = make_nocase_string_hash_table (countof (known_tags));
/* First, add all the tags we know hot to handle, mapped to their
@ -355,7 +355,8 @@ append_url (const char *link_uri,
static void
tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx)
{
int i, attrind;
size_t i;
int attrind;
int first = -1;
for (i = 0; i < countof (tag_url_attributes); i++)
@ -382,7 +383,7 @@ tag_find_urls (int tagid, struct taginfo *tag, struct map_context *ctx)
/* Find whether TAG/ATTRIND is a combination that contains a
URL. */
char *link = tag->attrs[attrind].value;
const int size = countof (tag_url_attributes);
const size_t size = countof (tag_url_attributes);
/* If you're cringing at the inefficiency of the nested loops,
remember that they both iterate over a very small number of

View File

@ -526,7 +526,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
/* Make sure that the user and domain strings fit in the target buffer
before we copy them there. */
if(size + userlen + domlen >= sizeof(ntlmbuf))
if(((size_t) size + userlen + domlen) >= sizeof(ntlmbuf))
return NULL;
memcpy(&ntlmbuf[size], domain, domlen);

View File

@ -2931,7 +2931,7 @@ http_atotm (const char *time_string)
Netscape cookie specification.) */
};
const char *oldlocale;
int i;
size_t i;
time_t ret = (time_t) -1;
/* Solaris strptime fails to recognize English month names in
@ -3042,10 +3042,12 @@ digest_authentication_encode (const char *au, const char *user,
au += 6; /* skip over `Digest' */
while (extract_param (&au, &name, &value, ','))
{
int i;
size_t i;
size_t namelen = name.e - name.b;
for (i = 0; i < countof (options); i++)
if (name.e - name.b == strlen (options[i].name)
&& 0 == strncmp (name.b, options[i].name, name.e - name.b))
if (namelen == strlen (options[i].name)
&& 0 == strncmp (name.b, options[i].name,
namelen))
{
*options[i].variable = strdupdelim (value.b, value.e);
break;
@ -3125,9 +3127,10 @@ username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", response=\"%s\"",
first argument and are followed by whitespace or terminating \0.
The comparison is case-insensitive. */
#define STARTS(literal, b, e) \
((e) - (b) >= STRSIZE (literal) \
((e > b) \
&& ((size_t) ((e) - (b))) >= STRSIZE (literal) \
&& 0 == strncasecmp (b, literal, STRSIZE (literal)) \
&& ((e) - (b) == STRSIZE (literal) \
&& ((size_t) ((e) - (b)) == STRSIZE (literal) \
|| c_isspace (b[STRSIZE (literal)])))
static bool

View File

@ -640,7 +640,7 @@ parse_line (const char *line, char **com, char **val, int *comind)
static bool
setval_internal (int comind, const char *com, const char *val)
{
assert (0 <= comind && comind < countof (commands));
assert (0 <= comind && ((size_t) comind) < countof (commands));
DEBUGP (("Setting %s (%s) to %s\n", com, commands[comind].name, val));
return commands[comind].action (com, val, commands[comind].place);
}

View File

@ -762,7 +762,7 @@ escnonprint_uri (const char *str)
void
log_cleanup (void)
{
int i;
size_t i;
for (i = 0; i < countof (ring); i++)
xfree_null (ring[i].buffer);
}

View File

@ -306,7 +306,7 @@ static void
init_switches (void)
{
char *p = short_options;
int i, o = 0;
size_t i, o = 0;
for (i = 0; i < countof (option_data); i++)
{
struct cmdline_option *opt = &option_data[i];
@ -652,7 +652,7 @@ Recursive accept/reject:\n"),
N_("Mail bug reports and suggestions to <bug-wget@gnu.org>.\n")
};
int i;
size_t i;
printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
version_string);
@ -1021,7 +1021,19 @@ for details.\n\n"));
if (opt.output_document)
{
if (HYPHENP (opt.output_document))
{
#ifdef WINDOWS
FILE *result;
result = freopen (NULL, "wb", stdout);
if (result == NULL)
{
logputs (LOG_NOTQUIET, _("\
WARNING: Can't reopen standard output in binary mode;\n\
downloaded file may contain inappropriate line endings.\n"));
}
#endif
output_stream = stdout;
}
else
{
struct_fstat st;

View File

@ -93,10 +93,10 @@ static int current_impl_locked;
bool
valid_progress_implementation_p (const char *name)
{
int i;
size_t i;
struct progress_implementation *pi = implementations;
char *colon = strchr (name, ':');
int namelen = colon ? colon - name : strlen (name);
size_t namelen = colon ? (size_t) (colon - name) : strlen (name);
for (i = 0; i < countof (implementations); i++, pi++)
if (!strncmp (pi->name, name, namelen))
@ -109,7 +109,7 @@ valid_progress_implementation_p (const char *name)
void
set_progress_implementation (const char *name)
{
int i, namelen;
size_t i, namelen;
struct progress_implementation *pi = implementations;
const char *colon;
@ -117,7 +117,7 @@ set_progress_implementation (const char *name)
name = DEFAULT_PROGRESS_IMPLEMENTATION;
colon = strchr (name, ':');
namelen = colon ? colon - name : strlen (name);
namelen = colon ? (size_t) (colon - name) : strlen (name);
for (i = 0; i < countof (implementations); i++, pi++)
if (!strncmp (pi->name, name, namelen))

View File

@ -133,7 +133,7 @@ posix_init (void)
#endif
{ CLOCK_REALTIME, NO_SYSCONF_CHECK },
};
int i;
size_t i;
/* Determine the clock we can use. For a clock to be usable, it
must be confirmed with sysconf (where applicable) and with

View File

@ -85,7 +85,7 @@ print_broken_links (void)
for (hash_table_iterate (nonexisting_urls_set, &iter);
hash_table_iter_next (&iter); )
{
struct url_list *list;
/* Struct url_list *list; */
const char *url = (const char *) iter.key;
logprintf (LOG_NOTQUIET, _("%s\n"), url);

View File

@ -889,7 +889,7 @@ url_parse (const char *url, int *error)
const char *
url_error (int error_code)
{
assert (error_code >= 0 && error_code < countof (parse_errors));
assert (error_code >= 0 && ((size_t) error_code) < countof (parse_errors));
return _(parse_errors[error_code]);
}

View File

@ -267,7 +267,7 @@ concat_strings (const char *str0, ...)
const char *next_str;
int total_length = 0;
int argcount;
size_t argcount;
/* Calculate the length of and allocate the resulting string. */
@ -1386,7 +1386,7 @@ human_readable (HR_NUMTYPE n)
'E', /* exabyte, 2^60 bytes */
};
static char buf[8];
int i;
size_t i;
/* If the quantity is smaller than 1K, just print it. */
if (n < 1024)

View File

@ -1,3 +1,33 @@
2008-05-31 Micah Cowan <micah@cowan.name>
* Test-N-current.px: Ensure we catch failures.
* Test-N-old.px: Make it test only the timestamp, and not the
content length in addition.
* Test-N-smaller.px, Test-N-no-info.px: added.
* Test-c-partial.px: Improve checking that the file was
partially retrieved, rather than overwritten.
* run-px: Added Test-N-smaller.px, Test-N-no-info.px.
* HTTPServer.pm: Return 416 for fully-retrieved content, rather
than 206 with a zero content-length.
2008-05-23 Micah Cowan <micah@cowan.name>
* Test--spider.px: Make test expect 0 return code.
2008-05-22 Micah Cowan <micah@cowan.name>
* Makefile.am (run-px-tests): Replaced ugly list of tests with
run-px Perl script to manage running them.
* run-px: Added.
* FTPServer.pm (run): Avoid re-forking. Fixes bug #20458.
2008-04-26 Micah Cowan <micah@cowan.name>
* Makefile.am, Test-proxied-https-auth.px: Added a test for

View File

@ -833,14 +833,14 @@ sub run
print STDERR "got a connection from: $client_ipnum\n" if $log;
# fork off a process to handle this connection.
my $pid = fork();
unless (defined $pid) {
warn "fork: $!";
sleep 5; # Back off in case system is overloaded.
next;
}
# my $pid = fork();
# unless (defined $pid) {
# warn "fork: $!";
# sleep 5; # Back off in case system is overloaded.
# next;
# }
if ($pid == 0) { # Child process.
if (1) { # Child process.
# install signals
$SIG{URG} = sub {

View File

@ -98,15 +98,25 @@ sub send_response {
my $start = $1 ? $1 : 0;
my $end = $2 ? $2 : ($content_len - 1);
my $len = $2 ? ($2 - $start) : ($content_len - $start);
if ($len) {
$resp->header("Accept-Ranges" => "bytes");
$resp->header("Content-Length" => $len);
$resp->header("Content-Range" => "bytes $start-$end/$content_len");
$resp->header("Content-Range"
=> "bytes $start-$end/$content_len");
$resp->header("Keep-Alive" => "timeout=15, max=100");
$resp->header("Connection" => "Keep-Alive");
$con->send_basic_header(206, "Partial Content", $resp->protocol);
$con->send_basic_header(206,
"Partial Content", $resp->protocol);
print $con $resp->headers_as_string($CRLF);
print $con $CRLF;
print $con substr($content, $start, $len);
} else {
$con->send_basic_header(416, "Range Not Satisfiable",
$resp->protocol);
$resp->header("Keep-Alive" => "timeout=15, max=100");
$resp->header("Connection" => "Keep-Alive");
print $con $CRLF;
}
next;
}
# fill in content

View File

@ -46,46 +46,7 @@ run-unit-tests: unit-tests$(EXEEXT)
./unit-tests$(EXEEXT)
run-px-tests: WgetTest.pm
$(PERLRUN) $(srcdir)/Test-proxied-https-auth.px && echo && echo
$(PERLRUN) $(srcdir)/Test-proxy-auth-basic.px && echo && echo
$(PERLRUN) $(srcdir)/Test-auth-basic.px && echo && echo
$(PERLRUN) $(srcdir)/Test-c-full.px && echo && echo
$(PERLRUN) $(srcdir)/Test-c-partial.px && echo && echo
$(PERLRUN) $(srcdir)/Test-c.px && echo && echo
$(PERLRUN) $(srcdir)/Test-E-k-K.px && echo && echo
$(PERLRUN) $(srcdir)/Test-E-k.px && echo && echo
$(PERLRUN) $(srcdir)/Test-ftp.px && echo && echo
$(PERLRUN) $(srcdir)/Test-HTTP-Content-Disposition-1.px && echo && echo
$(PERLRUN) $(srcdir)/Test-HTTP-Content-Disposition-2.px && echo && echo
$(PERLRUN) $(srcdir)/Test-HTTP-Content-Disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N-current-HTTP-CD.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N-current.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N-HTTP-Content-Disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N--no-content-disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N--no-content-disposition-trivial.px && echo && echo
$(PERLRUN) $(srcdir)/Test--no-content-disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test--no-content-disposition-trivial.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N-old.px && echo && echo
$(PERLRUN) $(srcdir)/Test-nonexisting-quiet.px && echo && echo
$(PERLRUN) $(srcdir)/Test-noop.px && echo && echo
$(PERLRUN) $(srcdir)/Test-np.px && echo && echo
$(PERLRUN) $(srcdir)/Test-N.px && echo && echo
$(PERLRUN) $(srcdir)/Test-O-HTTP-Content-Disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test-O--no-content-disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test-O--no-content-disposition-trivial.px && echo && echo
$(PERLRUN) $(srcdir)/Test-O-nonexisting.px && echo && echo
$(PERLRUN) $(srcdir)/Test-O.px && echo && echo
$(PERLRUN) $(srcdir)/Test-Restrict-Lowercase.px && echo && echo
$(PERLRUN) $(srcdir)/Test-Restrict-Uppercase.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-fail.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-HTTP-Content-Disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider--no-content-disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider--no-content-disposition-trivial.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-r-HTTP-Content-Disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-r--no-content-disposition.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-r--no-content-disposition-trivial.px && echo && echo
$(PERLRUN) $(srcdir)/Test--spider-r.px && echo && echo
./run-px $(top_srcdir)
EXTRA_DIST = FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm \
Test-auth-basic.px Test-c-full.px Test-c-partial.px \

View File

@ -1,52 +0,0 @@
#!/usr/bin/perl -w
use strict;
use HTTPTest;
###############################################################################
my $mainpage = <<EOF;
<html>
<head>
<title>Main Page</title>
</head>
<body>
<p>
Some text.
</p>
</body>
</html>
EOF
# code, msg, headers, content
my %urls = (
'/index.html' => {
code => "200",
msg => "Dontcare",
headers => {
"Content-type" => "text/html",
},
content => $mainpage,
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider --no-content-disposition http://localhost:8080/index.html";
my $expected_error_code = 256;
my %expected_downloaded_files = (
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test--spider--no-content-disposition-trivial",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -1,53 +0,0 @@
#!/usr/bin/perl -w
use strict;
use HTTPTest;
###############################################################################
my $mainpage = <<EOF;
<html>
<head>
<title>Main Page</title>
</head>
<body>
<p>
Some text.
</p>
</body>
</html>
EOF
# code, msg, headers, content
my %urls = (
'/index.html' => {
code => "200",
msg => "Dontcare",
headers => {
"Content-type" => "text/html",
"Content-Disposition" => "attachment; filename=\"filename.html\"",
},
content => $mainpage,
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider --no-content-disposition http://localhost:8080/index.html";
my $expected_error_code = 256;
my %expected_downloaded_files = (
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test--spider--no-content-disposition",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -1,53 +0,0 @@
#!/usr/bin/perl -w
use strict;
use HTTPTest;
###############################################################################
my $mainpage = <<EOF;
<html>
<head>
<title>Main Page</title>
</head>
<body>
<p>
Some text.
</p>
</body>
</html>
EOF
# code, msg, headers, content
my %urls = (
'/index.html' => {
code => "200",
msg => "Dontcare",
headers => {
"Content-type" => "text/html",
"Content-Disposition" => "attachment; filename=\"filename.html\"",
},
content => $mainpage,
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:8080/index.html";
my $expected_error_code = 256;
my %expected_downloaded_files = (
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test--spider-HTTP-Content-Disposition",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -34,7 +34,7 @@ my %urls = (
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:8080/index.html";
my $expected_error_code = 256;
my $expected_error_code = 0;
my %expected_downloaded_files = (
);

View File

@ -25,7 +25,8 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -N --content-disposition "
. "http://localhost:8080/dummy.txt";
my $expected_error_code = 0;

View File

@ -15,6 +15,11 @@ my $currentversion = <<EOF;
55555555555555555555555555555555555555555555555555
EOF
# The server should serve a slightly different content, but with the
# same length, so we can test which version was downloaded.
my $modifiedversion = $currentversion;
$modifiedversion =~ s/^(.{20}).(.*)$/$1x$2/s;
# code, msg, headers, content
my %urls = (
'/somefile.txt' => {
@ -24,7 +29,7 @@ my %urls = (
"Content-type" => "text/plain",
"Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
},
content => $currentversion,
content => $modifiedversion,
},
);

63
tests/Test-N-no-info.px Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/perl -w
use strict;
use HTTPTest;
###############################################################################
my $currentversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
3333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444
55555555555555555555555555555555555555555555555555
EOF
my $newversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
EOF
# code, msg, headers, content
my %urls = (
'/somefile.txt' => {
code => "200",
msg => "Dontcare",
headers => {
"Content-type" => "text/plain",
},
content => $newversion,
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $expected_error_code = 0;
my %existing_files = (
'somefile.txt' => {
content => $currentversion,
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
},
);
my %expected_downloaded_files = (
'somefile.txt' => {
content => $newversion,
},
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test-N-current",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
existing => \%existing_files,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -10,16 +10,14 @@ use HTTPTest;
my $oldversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
EOF
my $newversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
3333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444
55555555555555555555555555555555555555555555555555
EOF
my $newversion = $oldversion;
$newversion =~ s/^(.{20}).(.*)$/$1x$2/s;
# code, msg, headers, content
my %urls = (
'/somefile.txt' => {

66
tests/Test-N-smaller.px Executable file
View File

@ -0,0 +1,66 @@
#!/usr/bin/perl -w
use strict;
use HTTPTest;
###############################################################################
my $currentversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
3333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444
55555555555555555555555555555555555555555555555555
EOF
my $newversion = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
EOF
# code, msg, headers, content
my %urls = (
'/somefile.txt' => {
code => "200",
msg => "Dontcare",
headers => {
"Content-type" => "text/plain",
"Content-Length" => length $newversion,
"Last-Modified" => "Sat, 09 Oct 2004 08:30:00 GMT",
},
content => $newversion,
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $expected_error_code = 0;
my %existing_files = (
'somefile.txt' => {
content => $currentversion,
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
},
);
my %expected_downloaded_files = (
'somefile.txt' => {
content => $newversion,
timestamp => 1097310600, # "Sat, 09 Oct 2004 08:30:00 GMT"
},
);
###############################################################################
my $the_test = HTTPTest->new (name => "Test-N-current",
input => \%urls,
cmdline => $cmdline,
errcode => $expected_error_code,
existing => \%existing_files,
output => \%expected_downloaded_files);
exit $the_test->run();
# vim: et ts=4 sw=4

View File

@ -9,17 +9,22 @@ use HTTPTest;
my $partiallydownloaded = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
22222222x222222222222222222222222222222222222222222222222222
EOF
my $wholefile = <<EOF;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
my $rest = <<EOF;
3333333333333333333333333333333333333333333333333333333333333333333333
444444444444444444444444444444444444444444444444444444444444
55555555555555555555555555555555555555555555555555
EOF
my $wholefile = <<EOF . $rest;
11111111111111111111111111111111111111111111111111
222222222222222222222222222222222222222222222222222222222222
EOF
my $downloadedfile = $partiallydownloaded . $rest;
# code, msg, headers, content
my %urls = (
'/somefile.txt' => {
@ -44,7 +49,7 @@ my %existing_files = (
my %expected_downloaded_files = (
'somefile.txt' => {
content => $wholefile,
content => $downloadedfile,
},
);

63
tests/run-px Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env perl
use warnings;
die "Please specify the top source directory.\n" if (!@ARGV);
my $top_srcdir = shift @ARGV;
my @tests = (
'Test-auth-basic.px',
'Test-proxy-auth-basic.px',
'Test-proxied-https-auth.px',
'Test-N-HTTP-Content-Disposition.px',
'Test--spider.px',
'Test-c-full.px',
'Test-c-partial.px',
'Test-c.px',
'Test-E-k-K.px',
'Test-E-k.px',
'Test-ftp.px',
'Test-HTTP-Content-Disposition-1.px',
'Test-HTTP-Content-Disposition-2.px',
'Test-HTTP-Content-Disposition.px',
'Test-N-current.px',
'Test-N-smaller.px',
'Test-N-no-info.px',
'Test-N--no-content-disposition.px',
'Test-N--no-content-disposition-trivial.px',
'Test--no-content-disposition.px',
'Test--no-content-disposition-trivial.px',
'Test-N-old.px',
'Test-nonexisting-quiet.px',
'Test-noop.px',
'Test-np.px',
'Test-N.px',
'Test-O-HTTP-Content-Disposition.px',
'Test-O--no-content-disposition.px',
'Test-O--no-content-disposition-trivial.px',
'Test-O-nonexisting.px',
'Test-O.px',
'Test-Restrict-Lowercase.px',
'Test-Restrict-Uppercase.px',
'Test--spider-fail.px',
'Test--spider-r-HTTP-Content-Disposition.px',
'Test--spider-r--no-content-disposition.px',
'Test--spider-r--no-content-disposition-trivial.px',
'Test--spider-r.px',
);
my @results;
for my $test (@tests) {
print "Running $test\n\n";
system("$top_srcdir/tests/$test");
push @results, $?;
}
for (my $i=0; $i != @tests; ++$i) {
if ($results[$i] == 0) {
print "pass: ";
} else {
print "FAIL: ";
}
print "$tests[$i]\n";
}