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

Use gnulib's getpass-gnu module for password prompting.

This commit is contained in:
Steven Schubiger 2008-05-01 00:28:23 +02:00
parent 202caab4c2
commit ae034d236f
48 changed files with 3417 additions and 97 deletions

View File

@ -1,3 +1,24 @@
2008-04-30 Steven Schubiger <stsc@members.fsf.org>
* lib/getdelim.c, lib/getline.c, lib/getpass.c,
lib/getpass.h, lib/realloc.c, lib/stdio.h,
lib/stdio.in.h, lib/stdlib.h, lib/stdlib.in.h: Imported
from gnulib.
* m4/eoverflow.m4, m4/extensions.m4, m4/getdelim.m4,
m4/getline.m4, m4/getpass.m4, m4/malloc.m4, m4/realloc.m4,
m4/stdio_h.m4, m4/stdlib_h.m4: Imported from gnulib.
* md5/stdint.h: Imported from gnulib.
* GNUmakefile: Updated from gnulib.
* lib/Makefile.am, lib/getopt.c, lib/unistd.in.h: Updated
from gnulib.
* m4/gnulib-cache.m4, m4/gnulib-common.m4, m4/gnulib-comp.m4,
m4/include_next.m4, m4/unistd_h.m4: Updated from gnulib.
* md5/Makefile.am, md5/m4/gnulib-cache.m4, md5/m4/gnulib-common.m4,
md5/m4/gnulib-comp.m4, md5/m4/include_next.m4, md5/m4/md5.m4,
md5/m4/stdint.m4, md5/md5.c, md5/md5.h, md5/stdint.in.h,
md5/wchar.in.h: Updated from gnulib.
2008-03-20 Micah Cowan <micah@cowan.name> 2008-03-20 Micah Cowan <micah@cowan.name>
* ABOUT-NLS: Reinstated, but with a message mentioning that * ABOUT-NLS: Reinstated, but with a message mentioning that

View File

@ -1,21 +1,22 @@
# Having a separate GNUmakefile lets me `include' the dynamically # Having a separate GNUmakefile lets me `include' the dynamically
# generated rules created via Makefile.maint as well as Makefile.maint itself. # generated rules created via cfg.mk (package-local configuration)
# as well as maint.mk (generic maintainer rules).
# This makefile is used only if you run GNU Make. # This makefile is used only if you run GNU Make.
# It is necessary if you want to build targets usually of interest # It is necessary if you want to build targets usually of interest
# only to the maintainer. # only to the maintainer.
# Copyright (C) 2001, 2003, 2006, 2007 Free Software Foundation, Inc. # Copyright (C) 2001, 2003, 2006-2008 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, # the Free Software Foundation, either version 3 of the License, or
# or (at your option) any later version. # (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -29,24 +30,55 @@ else
SHELL = sh SHELL = sh
endif endif
# If the user runs GNU make but has not yet run ./configure,
# give them a diagnostic.
_have-Makefile := $(shell test -f Makefile && echo yes)
ifeq ($(_have-Makefile),yes)
# Make tar archive easier to reproduce. # Make tar archive easier to reproduce.
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
# Ran autoreconf and configure or not?
have-Makefile := $(shell test -f Makefile && echo yes)
ifeq ($(have-Makefile),yes)
include Makefile include Makefile
-include $(srcdir)/maint-cfg.mk
# Some projects override e.g., _autoreconf here.
-include $(srcdir)/cfg.mk
include $(srcdir)/maint.mk include $(srcdir)/maint.mk
# Allow cfg.mk to override these.
_build-aux ?= build-aux
_autoreconf ?= autoreconf
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
_have-git-version-gen := \
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
_is-dist-target = $(filter-out %clean, \
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
ifneq (,$(_is-dist-target))
_curr-ver := $(shell cd $(srcdir) && ./$(_build-aux)/git-version-gen \
$(srcdir)/.tarball-version)
ifneq ($(_curr-ver),$(VERSION))
$(info INFO: running autoreconf for new version string: $(_curr-ver))
_dummy := $(shell cd $(srcdir) && rm -rf autom4te.cache .version \
&& $(_autoreconf))
endif
endif
endif
else else
.DEFAULT_GOAL := abort-due-to-no-makefile .DEFAULT_GOAL := abort-due-to-no-makefile
srcdir = .
-include ./maint-cfg.mk # The package can override .DEFAULT_GOAL to run actions like autoreconf.
-include ./cfg.mk
include ./maint.mk include ./maint.mk
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
$(MAKECMDGOALS): abort-due-to-no-makefile
endif
abort-due-to-no-makefile: abort-due-to-no-makefile:
@echo There seems to be no Makefile in this directory. 1>&2 @echo There seems to be no Makefile in this directory. 1>&2
@echo "You must run ./configure before running \`make'." 1>&2 @echo "You must run ./configure before running \`make'." 1>&2

2
NEWS
View File

@ -8,6 +8,8 @@ Please send GNU Wget bug reports to <bug-wget@gnu.org>.
* Changes in Wget (MAINLINE). * Changes in Wget (MAINLINE).
** Gnulib's getpass-gnu module is used to prompt for passwords.
** Gnulib is now used to provide code for certain portability aspects in ** Gnulib is now used to provide code for certain portability aspects in
GNU Wget. GNU Wget.

View File

@ -1,3 +1,8 @@
2008-04-30 Steven Schubiger <stsc@members.fsf.org>
* wget.texi <Download Options>: Document the --ask-password
option.
2008-04-27 Micah Cowan <micah@cowan.name> 2008-04-27 Micah Cowan <micah@cowan.name>
* wget.texi (Download Options) <-O>: Elaborate on why certain * wget.texi (Download Options) <-O>: Elaborate on why certain

View File

@ -990,6 +990,10 @@ Specify the username @var{user} and password @var{password} for both
using the @samp{--ftp-user} and @samp{--ftp-password} options for using the @samp{--ftp-user} and @samp{--ftp-password} options for
@sc{ftp} connections and the @samp{--http-user} and @samp{--http-password} @sc{ftp} connections and the @samp{--http-user} and @samp{--http-password}
options for @sc{http} connections. options for @sc{http} connections.
@item --ask-password
Prompt for a password for each connection established. Cannot be specified
when @samp{--password} is being used, because they are mutually exclusive.
@end table @end table
@node Directory Options @node Directory Options

View File

@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY! ## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General
@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program. # the same distribution terms as the rest of that program.
# #
# Generated by gnulib-tool. # 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 c-ctype getopt maintainer-makefile # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl c-ctype getopt getpass-gnu maintainer-makefile
AUTOMAKE_OPTIONS = 1.5 gnits AUTOMAKE_OPTIONS = 1.5 gnits
@ -40,6 +40,24 @@ libgnu_a_SOURCES += c-ctype.h c-ctype.c
## end gnulib module c-ctype ## end gnulib module c-ctype
## begin gnulib module getdelim
EXTRA_DIST += getdelim.c
EXTRA_libgnu_a_SOURCES += getdelim.c
## end gnulib module getdelim
## begin gnulib module getline
EXTRA_DIST += getline.c
EXTRA_libgnu_a_SOURCES += getline.c
## end gnulib module getline
## begin gnulib module getopt ## begin gnulib module getopt
BUILT_SOURCES += $(GETOPT_H) BUILT_SOURCES += $(GETOPT_H)
@ -59,12 +77,31 @@ EXTRA_libgnu_a_SOURCES += getopt.c getopt1.c
## end gnulib module getopt ## end gnulib module getopt
## begin gnulib module getpass-gnu
EXTRA_DIST += getpass.c getpass.h
EXTRA_libgnu_a_SOURCES += getpass.c
## end gnulib module getpass-gnu
## begin gnulib module gettext-h ## begin gnulib module gettext-h
libgnu_a_SOURCES += gettext.h libgnu_a_SOURCES += gettext.h
## end gnulib module gettext-h ## end gnulib module gettext-h
## begin gnulib module gnumakefile
distclean-local: clean-GNUmakefile
clean-GNUmakefile:
test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || :
EXTRA_DIST += $(top_srcdir)/GNUmakefile
## end gnulib module gnumakefile
## begin gnulib module link-warning ## begin gnulib module link-warning
LINK_WARNING_H=$(top_srcdir)/./link-warning.h LINK_WARNING_H=$(top_srcdir)/./link-warning.h
@ -75,10 +112,19 @@ EXTRA_DIST += $(top_srcdir)/./link-warning.h
## begin gnulib module maintainer-makefile ## begin gnulib module maintainer-makefile
EXTRA_DIST += $(top_srcdir)/./GNUmakefile $(top_srcdir)/./maint.mk EXTRA_DIST += $(top_srcdir)/maint.mk
## end gnulib module maintainer-makefile ## end gnulib module maintainer-makefile
## begin gnulib module realloc-posix
EXTRA_DIST += realloc.c
EXTRA_libgnu_a_SOURCES += realloc.c
## end gnulib module realloc-posix
## begin gnulib module stdbool ## begin gnulib module stdbool
BUILT_SOURCES += $(STDBOOL_H) BUILT_SOURCES += $(STDBOOL_H)
@ -97,6 +143,110 @@ EXTRA_DIST += stdbool.in.h
## end gnulib module stdbool ## end gnulib module stdbool
## begin gnulib module stdio
BUILT_SOURCES += stdio.h
# We need the following in order to create <stdio.h> when the system
# doesn't have one that works with the given compiler.
stdio.h: stdio.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \
-e 's|@''GNULIB_FPRINTF_POSIX''@|$(GNULIB_FPRINTF_POSIX)|g' \
-e 's|@''GNULIB_PRINTF_POSIX''@|$(GNULIB_PRINTF_POSIX)|g' \
-e 's|@''GNULIB_SNPRINTF''@|$(GNULIB_SNPRINTF)|g' \
-e 's|@''GNULIB_SPRINTF_POSIX''@|$(GNULIB_SPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VFPRINTF_POSIX''@|$(GNULIB_VFPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
-e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
-e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
-e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
-e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
-e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
-e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
-e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \
-e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \
-e 's|@''GNULIB_GETDELIM''@|$(GNULIB_GETDELIM)|g' \
-e 's|@''GNULIB_GETLINE''@|$(GNULIB_GETLINE)|g' \
-e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \
-e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \
-e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \
-e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
-e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \
-e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
-e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
-e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
-e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \
-e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
-e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
-e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
-e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
-e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
-e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
-e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
-e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
-e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \
-e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
-e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
-e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdio.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdio.h stdio.h-t
EXTRA_DIST += stdio.in.h
## end gnulib module stdio
## begin gnulib module stdlib
BUILT_SOURCES += stdlib.h
# We need the following in order to create <stdlib.h> when the system
# doesn't have one that works with the given compiler.
stdlib.h: stdlib.in.h
rm -f $@-t $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
-e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
-e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
-e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
-e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
-e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
-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_STRTOD''@|$(GNULIB_STRTOD)|g' \
-e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
-e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
-e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
-e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
-e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
-e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
-e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
-e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/stdlib.in.h; \
} > $@-t
mv $@-t $@
MOSTLYCLEANFILES += stdlib.h stdlib.h-t
EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
## begin gnulib module unistd ## begin gnulib module unistd
BUILT_SOURCES += unistd.h BUILT_SOURCES += unistd.h
@ -111,6 +261,7 @@ unistd.h: unistd.in.h
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
-e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \ -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
-e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \ -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
-e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
-e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \ -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
-e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \ -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
-e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \ -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
@ -125,12 +276,14 @@ unistd.h: unistd.in.h
-e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
-e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
-e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
-e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
-e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
-e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
-e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
-e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
-e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \ -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|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_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
-e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
< $(srcdir)/unistd.in.h; \ < $(srcdir)/unistd.in.h; \

130
lib/getdelim.c Normal file
View File

@ -0,0 +1,130 @@
/* getdelim.c --- Implementation of replacement getdelim function.
Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, 2008 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or
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. */
/* Ported from glibc by Simon Josefsson. */
#include <config.h>
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <errno.h>
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif
#if !HAVE_FLOCKFILE
# undef flockfile
# define flockfile(x) ((void) 0)
#endif
#if !HAVE_FUNLOCKFILE
# undef funlockfile
# define funlockfile(x) ((void) 0)
#endif
/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
NUL-terminate it). *LINEPTR is a pointer returned from malloc (or
NULL), pointing to *N characters of space. It is realloc'ed as
necessary. Returns the number of characters read (not including
the null terminator), or -1 on error or EOF. */
ssize_t
getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
{
ssize_t result;
size_t cur_len = 0;
if (lineptr == NULL || n == NULL || fp == NULL)
{
errno = EINVAL;
return -1;
}
flockfile (fp);
if (*lineptr == NULL || *n == 0)
{
char *new_lineptr;
*n = 120;
new_lineptr = (char *) realloc (*lineptr, *n);
if (new_lineptr == NULL)
{
result = -1;
goto unlock_return;
}
*lineptr = new_lineptr;
}
for (;;)
{
int i;
i = getc (fp);
if (i == EOF)
{
result = -1;
break;
}
/* Make enough space for len+1 (for final NUL) bytes. */
if (cur_len + 1 >= *n)
{
size_t needed_max =
SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX;
size_t needed = 2 * *n + 1; /* Be generous. */
char *new_lineptr;
if (needed_max < needed)
needed = needed_max;
if (cur_len + 1 >= needed)
{
result = -1;
errno = EOVERFLOW;
goto unlock_return;
}
new_lineptr = (char *) realloc (*lineptr, needed);
if (new_lineptr == NULL)
{
result = -1;
goto unlock_return;
}
*lineptr = new_lineptr;
*n = needed;
}
(*lineptr)[cur_len] = i;
cur_len++;
if (i == delimiter)
break;
}
(*lineptr)[cur_len] = '\0';
result = cur_len ? cur_len : result;
unlock_return:
funlockfile (fp); /* doesn't set errno */
return result;
}

29
lib/getline.c Normal file
View File

@ -0,0 +1,29 @@
/* getline.c --- Implementation of replacement getline function.
Copyright (C) 2005, 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 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. */
/* Written by Simon Josefsson. */
#include <config.h>
#include <stdio.h>
ssize_t
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, n, '\n', stream);
}

View File

@ -2,7 +2,7 @@
NOTE: getopt is now part of the C library, so if you don't know what NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org "Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it! before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006 Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -30,10 +30,6 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#ifdef __VMS
# include <unixlib.h>
#endif
#ifdef _LIBC #ifdef _LIBC
# include <libintl.h> # include <libintl.h>
#else #else

231
lib/getpass.c Normal file
View File

@ -0,0 +1,231 @@
/* Copyright (C) 1992-2001, 2003, 2004, 2005, 2006, 2007 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, 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. */
#ifndef _LIBC
# include <config.h>
#endif
#include "getpass.h"
#include <stdio.h>
#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
#include <stdbool.h>
#if HAVE_DECL___FSETLOCKING && HAVE___FSETLOCKING
# if HAVE_STDIO_EXT_H
# include <stdio_ext.h>
# endif
#else
# define __fsetlocking(stream, type) /* empty */
#endif
#if HAVE_TERMIOS_H
# include <termios.h>
#endif
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#else
# if !HAVE_DECL_FFLUSH_UNLOCKED
# undef fflush_unlocked
# define fflush_unlocked(x) fflush (x)
# endif
# if !HAVE_DECL_FLOCKFILE
# undef flockfile
# define flockfile(x) ((void) 0)
# endif
# if !HAVE_DECL_FUNLOCKFILE
# undef funlockfile
# define funlockfile(x) ((void) 0)
# endif
# if !HAVE_DECL_FPUTS_UNLOCKED
# undef fputs_unlocked
# define fputs_unlocked(str,stream) fputs (str, stream)
# endif
# if !HAVE_DECL_PUTC_UNLOCKED
# undef putc_unlocked
# define putc_unlocked(c,stream) putc (c, stream)
# endif
#endif
/* It is desirable to use this bit on systems that have it.
The only bit of terminal state we want to twiddle is echoing, which is
done in software; there is no need to change the state of the terminal
hardware. */
#ifndef TCSASOFT
# define TCSASOFT 0
#endif
static void
call_fclose (void *arg)
{
if (arg != NULL)
fclose (arg);
}
char *
getpass (const char *prompt)
{
FILE *tty;
FILE *in, *out;
struct termios s, t;
bool tty_changed = false;
static char *buf;
static size_t bufsize;
ssize_t nread;
/* Try to write to and read from the terminal if we can.
If we can't open the terminal, use stderr and stdin. */
tty = fopen ("/dev/tty", "w+");
if (tty == NULL)
{
in = stdin;
out = stderr;
}
else
{
/* We do the locking ourselves. */
__fsetlocking (tty, FSETLOCKING_BYCALLER);
out = in = tty;
}
flockfile (out);
/* Turn echoing off if it is on now. */
#if HAVE_TCGETATTR
if (tcgetattr (fileno (in), &t) == 0)
{
/* Save the old one. */
s = t;
/* Tricky, tricky. */
t.c_lflag &= ~(ECHO | ISIG);
tty_changed = (tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &t) == 0);
}
#endif
/* Write the prompt. */
fputs_unlocked (prompt, out);
fflush_unlocked (out);
/* Read the password. */
nread = getline (&buf, &bufsize, in);
/* According to the C standard, input may not be followed by output
on the same stream without an intervening call to a file
positioning function. Suppose in == out; then without this fseek
call, on Solaris, HP-UX, AIX, OSF/1, the previous input gets
echoed, whereas on IRIX, the following newline is not output as
it should be. POSIX imposes similar restrictions if fileno (in)
== fileno (out). The POSIX restrictions are tricky and change
from POSIX version to POSIX version, so play it safe and invoke
fseek even if in != out. */
fseeko (out, 0, SEEK_CUR);
if (buf != NULL)
{
if (nread < 0)
buf[0] = '\0';
else if (buf[nread - 1] == '\n')
{
/* Remove the newline. */
buf[nread - 1] = '\0';
if (tty_changed)
{
/* Write the newline that was not echoed. */
putc_unlocked ('\n', out);
}
}
}
/* Restore the original setting. */
#if HAVE_TCSETATTR
if (tty_changed)
tcsetattr (fileno (in), TCSAFLUSH | TCSASOFT, &s);
#endif
funlockfile (out);
call_fclose (tty);
return buf;
}
#else /* W32 native */
/* Windows implementation by Martin Lambers <marlam@marlam.de>,
improved by Simon Josefsson. */
/* For PASS_MAX. */
#include <limits.h>
/* For _getch(). */
#include <conio.h>
/* For strdup(). */
#include <string.h>
#ifndef PASS_MAX
# define PASS_MAX 512
#endif
char *
getpass (const char *prompt)
{
char getpassbuf[PASS_MAX + 1];
size_t i = 0;
int c;
if (prompt)
{
fputs (prompt, stderr);
fflush (stderr);
}
for (;;)
{
c = _getch ();
if (c == '\r')
{
getpassbuf[i] = '\0';
break;
}
else if (i < PASS_MAX)
{
getpassbuf[i++] = c;
}
if (i >= PASS_MAX)
{
getpassbuf[i] = '\0';
break;
}
}
if (prompt)
{
fputs ("\r\n", stderr);
fflush (stderr);
}
return strdup (getpassbuf);
}
#endif

31
lib/getpass.h Normal file
View File

@ -0,0 +1,31 @@
/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
Copyright (C) 2004 Free Software Foundation, Inc.
Contributed by Simon Josefsson <jas@extundo.com>, 2004.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU 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. */
#ifndef GETPASS_H
# define GETPASS_H
/* Get getpass declaration, if available. */
# include <unistd.h>
# if defined HAVE_DECL_GETPASS && !HAVE_DECL_GETPASS
/* Read a password of arbitrary length from /dev/tty or stdin. */
char *getpass (const char *prompt);
# endif
#endif /* GETPASS_H */

87
lib/realloc.c Normal file
View File

@ -0,0 +1,87 @@
/* realloc() function that is glibc compatible.
Copyright (C) 1997, 2003, 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 General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */
#include <config.h>
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
#ifdef realloc
# define NEED_REALLOC_GNU 1
#endif
/* Infer the properties of the system's malloc function.
Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
#if GNULIB_MALLOC_GNU && !defined malloc
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
#endif
/* Below we want to call the system's malloc and realloc.
Undefine the symbols here so that including <stdlib.h> provides a
declaration of malloc(), not of rpl_malloc(), and likewise for realloc. */
#undef malloc
#undef realloc
/* Specification. */
#include <stdlib.h>
#include <errno.h>
/* Below we want to call the system's malloc and realloc.
Undefine the symbols, if they were defined by gnulib's <stdlib.h>
replacement. */
#undef malloc
#undef realloc
/* Change the size of an allocated block of memory P to N bytes,
with error checking. If N is zero, change it to 1. If P is NULL,
use malloc. */
void *
rpl_realloc (void *p, size_t n)
{
void *result;
#if NEED_REALLOC_GNU
if (n == 0)
{
n = 1;
/* In theory realloc might fail, so don't rely on it to free. */
free (p);
p = NULL;
}
#endif
if (p == NULL)
{
#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
if (n == 0)
n = 1;
#endif
result = malloc (n);
}
else
result = realloc (p, n);
#if !HAVE_REALLOC_POSIX
if (result == NULL)
errno = ENOMEM;
#endif
return result;
}

411
lib/stdio.h Normal file
View File

@ -0,0 +1,411 @@
/* 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

382
lib/stdio.in.h Normal file
View File

@ -0,0 +1,382 @@
/* 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@ @NEXT_STDIO_H@
#else
/* Normal invocation convention. */
#ifndef _GL_STDIO_H
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
#ifndef _GL_STDIO_H
#define _GL_STDIO_H
#include <stdarg.h>
#include <stddef.h>
#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
|| (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
|| (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
|| (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
/* 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. */
#ifdef __cplusplus
extern "C" {
#endif
#if @GNULIB_FPRINTF_POSIX@
# if @REPLACE_FPRINTF@
# 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 @GNULIB_VFPRINTF_POSIX@
# if @REPLACE_VFPRINTF@
# 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 @GNULIB_PRINTF_POSIX@
# if @REPLACE_PRINTF@
/* 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 @GNULIB_VPRINTF_POSIX@
# if @REPLACE_VPRINTF@
# 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 @GNULIB_SNPRINTF@
# if @REPLACE_SNPRINTF@
# define snprintf rpl_snprintf
# endif
# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
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 @GNULIB_VSNPRINTF@
# if @REPLACE_VSNPRINTF@
# define vsnprintf rpl_vsnprintf
# endif
# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
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 @GNULIB_SPRINTF_POSIX@
# if @REPLACE_SPRINTF@
# 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 @GNULIB_VSPRINTF_POSIX@
# if @REPLACE_VSPRINTF@
# 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 @GNULIB_VASPRINTF@
# if @REPLACE_VASPRINTF@
# define asprintf rpl_asprintf
# define vasprintf rpl_vasprintf
# endif
# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
/* 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 @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
# 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 @GNULIB_FREOPEN@
# if @REPLACE_FREOPEN@
# 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 @GNULIB_FSEEKO@
# if @REPLACE_FSEEKO@
/* 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 @GNULIB_FSEEK@ && @REPLACE_FSEEK@
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 @GNULIB_FTELLO@
# if @REPLACE_FTELLO@
# 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 @GNULIB_FTELL@ && @REPLACE_FTELL@
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 @GNULIB_FFLUSH@
# if @REPLACE_FFLUSH@
# 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 @GNULIB_GETDELIM@
# if !@HAVE_DECL_GETDELIM@
/* 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 @GNULIB_GETLINE@
# if @REPLACE_GETLINE@
# undef getline
# define getline rpl_getline
# endif
# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
/* 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

254
lib/stdlib.h Normal file
View File

@ -0,0 +1,254 @@
/* 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
/* 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

225
lib/stdlib.in.h Normal file
View File

@ -0,0 +1,225 @@
/* 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@ @NEXT_STDLIB_H@
#else
/* Normal invocation convention. */
#ifndef _GL_STDLIB_H
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
#ifndef _GL_STDLIB_H
#define _GL_STDLIB_H
/* The definition of GL_LINK_WARNING is copied here. */
/* 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 @GNULIB_MALLOC_POSIX@
# if !@HAVE_MALLOC_POSIX@
# 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 @GNULIB_REALLOC_POSIX@
# if !@HAVE_REALLOC_POSIX@
# 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 @GNULIB_CALLOC_POSIX@
# if !@HAVE_CALLOC_POSIX@
# 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 @GNULIB_GETSUBOPT@
/* 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 !@HAVE_GETSUBOPT@
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 @GNULIB_MKDTEMP@
# if !@HAVE_MKDTEMP@
/* 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 @GNULIB_MKSTEMP@
# if @REPLACE_MKSTEMP@
/* 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 @GNULIB_PUTENV@
# if @REPLACE_PUTENV@
# undef putenv
# define putenv rpl_putenv
extern int putenv (char *string);
# endif
#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
#if @GNULIB_STRTOD@
# if @REPLACE_STRTOD@
# define strtod rpl_strtod
# endif
# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
/* Parse a double from STRING, updating ENDP if appropriate. */
extern double strtod (const char *str, char **endp);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strtod
# define strtod(s, e) \
(GL_LINK_WARNING ("strtod is unportable - " \
"use gnulib module strtod for portability"), \
strtod (s, e))
#endif
#ifdef __cplusplus
}
#endif
#endif /* _GL_STDLIB_H */
#endif /* _GL_STDLIB_H */
#endif

View File

@ -1,5 +1,5 @@
/* Substitute for and wrapper around <unistd.h>. /* Substitute for and wrapper around <unistd.h>.
Copyright (C) 2004-2007 Free Software Foundation, Inc. Copyright (C) 2004-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -86,6 +86,26 @@ extern int dup2 (int oldfd, int newfd);
#endif #endif
#if @GNULIB_ENVIRON@
# if !@HAVE_DECL_ENVIRON@
/* Set of environment variables and values. An array of strings of the form
"VARIABLE=VALUE", terminated with a NULL. */
# if defined __APPLE__ && defined __MACH__
# include <crt_externs.h>
# define environ (*_NSGetEnviron ())
# else
extern char **environ;
# endif
# endif
#elif defined GNULIB_POSIXCHECK
# undef environ
# define environ \
(GL_LINK_WARNING ("environ is unportable - " \
"use gnulib module environ for portability"), \
environ)
#endif
#if @GNULIB_FCHDIR@ #if @GNULIB_FCHDIR@
# if @REPLACE_FCHDIR@ # if @REPLACE_FCHDIR@
@ -181,7 +201,10 @@ extern int getlogin_r (char *name, size_t size);
#if @GNULIB_GETPAGESIZE@ #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. */ /* This is for POSIX systems. */
# if !defined getpagesize && defined _SC_PAGESIZE # if !defined getpagesize && defined _SC_PAGESIZE
# if ! (defined __VMS && __VMS_VER < 70000000) # if ! (defined __VMS && __VMS_VER < 70000000)

70
m4/eoverflow.m4 Normal file
View File

@ -0,0 +1,70 @@
# eoverflow.m4 serial 2
dnl Copyright (C) 2004, 2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
# POSIX. But some systems (like AIX 3) don't define it, and some systems
# (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
# Define EOVERFLOW as a C macro and as a substituted macro in such a way that
# 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable,
# 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric
# value.
AC_DEFUN([gl_EOVERFLOW],
[
AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [
AC_EGREP_CPP(yes,[
#include <errno.h>
#ifdef EOVERFLOW
yes
#endif
], have_eoverflow=1)
if test -n "$have_eoverflow"; then
dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves.
ac_cv_decl_EOVERFLOW=yes
else
AC_EGREP_CPP(yes,[
#define _XOPEN_SOURCE_EXTENDED 1
#include <errno.h>
#ifdef EOVERFLOW
yes
#endif
], have_eoverflow=1)
if test -n "$have_eoverflow"; then
dnl EOVERFLOW exists but is hidden.
dnl Define it to the same value.
AC_COMPUTE_INT([ac_cv_decl_EOVERFLOW], [EOVERFLOW], [
#define _XOPEN_SOURCE_EXTENDED 1
#include <errno.h>
/* The following two lines are a workaround against an autoconf-2.52 bug. */
#include <stdio.h>
#include <stdlib.h>
])
else
dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but
dnl don't define it as EINVAL, because snprintf() callers want to
dnl distinguish EINVAL and EOVERFLOW.
ac_cv_decl_EOVERFLOW=E2BIG
fi
fi
])
if test "$ac_cv_decl_EOVERFLOW" != yes; then
AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW],
[Define as good substitute value for EOVERFLOW.])
EOVERFLOW="$ac_cv_decl_EOVERFLOW"
AC_SUBST(EOVERFLOW)
fi
])
dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
dnl Remove this when we can assume autoconf >= 2.61.
m4_ifdef([AC_COMPUTE_INT], [], [
AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
])

82
m4/extensions.m4 Normal file
View File

@ -0,0 +1,82 @@
# serial 5 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006, 2007 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.
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
# Autoconf. Perhaps we can remove this once we can assume Autoconf
# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
# enough in this area it's likely we'll need to redefine
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
# AC_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
# Remember that #undef in AH_VERBATIM gets replaced with #define by
# AC_DEFINE. The goal here is to define all known feature-enabling
# macros, then, if reports of conflicts are made, disable macros that
# cause problems on some platforms (such as __EXTENSIONS__).
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
if test "$MINIX" = yes; then
AC_DEFINE([_POSIX_SOURCE], [1],
[Define to 1 if you need to in order for `stat' and other
things to work.])
AC_DEFINE([_POSIX_1_SOURCE], [2],
[Define to 2 if the system does not provide POSIX.1 features
except with this defined.])
AC_DEFINE([_MINIX], [1],
[Define to 1 if on MINIX.])
fi
AH_VERBATIM([__EXTENSIONS__],
[/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
])
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
# define __EXTENSIONS__ 1
AC_INCLUDES_DEFAULT])],
[ac_cv_safe_to_define___extensions__=yes],
[ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_ALL_SOURCE])
AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
])# AC_USE_SYSTEM_EXTENSIONS
# gl_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
[AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])

34
m4/getdelim.m4 Normal file
View File

@ -0,0 +1,34 @@
# getdelim.m4 serial 5
dnl Copyright (C) 2005, 2006, 2007 Free Software dnl Foundation, Inc.
dnl
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_PREREQ([2.59])
AC_DEFUN([gl_FUNC_GETDELIM],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
dnl Persuade glibc <stdio.h> to declare getdelim().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REPLACE_FUNCS([getdelim])
AC_CHECK_DECLS_ONCE([getdelim])
if test $ac_cv_func_getdelim = no; then
gl_PREREQ_GETDELIM
fi
if test $ac_cv_have_decl_getdelim = no; then
HAVE_DECL_GETDELIM=0
fi
])
# Prerequisites of lib/getdelim.c.
AC_DEFUN([gl_PREREQ_GETDELIM],
[
AC_CHECK_FUNCS([flockfile funlockfile])
])

81
m4/getline.m4 Normal file
View File

@ -0,0 +1,81 @@
# getline.m4 serial 18
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007 Free
dnl Software Foundation, Inc.
dnl
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_PREREQ([2.59])
dnl See if there's a working, system-supplied version of the getline function.
dnl We can't just do AC_REPLACE_FUNCS(getline) because some systems
dnl have a function by that name in -linet that doesn't have anything
dnl to do with the function we need.
AC_DEFUN([gl_FUNC_GETLINE],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
dnl Persuade glibc <stdio.h> to declare getline().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_CHECK_DECLS_ONCE([getline])
gl_getline_needs_run_time_check=no
AC_CHECK_FUNC(getline,
dnl Found it in some library. Verify that it works.
gl_getline_needs_run_time_check=yes,
am_cv_func_working_getline=no)
if test $gl_getline_needs_run_time_check = yes; then
AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
[echo fooN |tr -d '\012'|tr N '\012' > conftest.data
AC_TRY_RUN([
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main ()
{ /* Based on a test program from Karl Heuer. */
char *line = NULL;
size_t siz = 0;
int len;
FILE *in = fopen ("./conftest.data", "r");
if (!in)
return 1;
len = getline (&line, &siz, in);
exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
}
], am_cv_func_working_getline=yes dnl The library version works.
, am_cv_func_working_getline=no dnl The library version does NOT work.
, dnl We're cross compiling. Assume it works on glibc2 systems.
[AC_EGREP_CPP([Lucky GNU user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ >= 2)
Lucky GNU user
#endif
#endif
],
[am_cv_func_working_getline=yes],
[am_cv_func_working_getline=no])]
)])
fi
if test $ac_cv_have_decl_getline = no; then
HAVE_DECL_GETLINE=0
fi
if test $am_cv_func_working_getline = no; then
REPLACE_GETLINE=1
AC_LIBOBJ([getline])
gl_PREREQ_GETLINE
fi
])
# Prerequisites of lib/getline.c.
AC_DEFUN([gl_PREREQ_GETLINE],
[
gl_FUNC_GETDELIM
])

47
m4/getpass.m4 Normal file
View File

@ -0,0 +1,47 @@
# getpass.m4 serial 10
dnl Copyright (C) 2002-2003, 2005-2006 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.
# Provide a getpass() function if the system doesn't have it.
AC_DEFUN([gl_FUNC_GETPASS],
[
AC_REPLACE_FUNCS(getpass)
AC_CHECK_DECLS_ONCE(getpass)
if test $ac_cv_func_getpass = no; then
gl_PREREQ_GETPASS
fi
])
# Provide the GNU getpass() implementation. It supports passwords of
# arbitrary length (not just 8 bytes as on HP-UX).
AC_DEFUN([gl_FUNC_GETPASS_GNU],
[
AC_CHECK_DECLS_ONCE(getpass)
dnl TODO: Detect when GNU getpass() is already found in glibc.
AC_LIBOBJ(getpass)
gl_PREREQ_GETPASS
dnl We must choose a different name for our function, since on ELF systems
dnl an unusable getpass() in libc.so would override our getpass() if it is
dnl compiled into a shared library.
AC_DEFINE([getpass], [gnu_getpass],
[Define to a replacement function name for getpass().])
])
# Prerequisites of lib/getpass.c.
AC_DEFUN([gl_PREREQ_GETPASS], [
AC_CHECK_HEADERS_ONCE(stdio_ext.h termios.h)
AC_CHECK_FUNCS_ONCE(__fsetlocking tcgetattr tcsetattr)
AC_CHECK_DECLS([__fsetlocking],,,
[#include <stdio.h>
#if HAVE_STDIO_EXT_H
#include <stdio_ext.h>
#endif])
AC_CHECK_DECLS_ONCE([fflush_unlocked])
AC_CHECK_DECLS_ONCE([flockfile])
AC_CHECK_DECLS_ONCE([fputs_unlocked])
AC_CHECK_DECLS_ONCE([funlockfile])
AC_CHECK_DECLS_ONCE([putc_unlocked])
:
])

View File

@ -1,4 +1,4 @@
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General
@ -15,11 +15,11 @@
# Specification in the form of a command-line invocation: # 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 c-ctype getopt maintainer-makefile # gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --aux-dir=. --no-libtool --macro-prefix=gl c-ctype getopt getpass-gnu maintainer-makefile
# Specification in the form of a few gnulib-tool.m4 macro invocations: # Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([]) gl_LOCAL_DIR([])
gl_MODULES([c-ctype getopt maintainer-makefile]) gl_MODULES([c-ctype getopt getpass-gnu maintainer-makefile])
gl_AVOID([]) gl_AVOID([])
gl_SOURCE_BASE([lib]) gl_SOURCE_BASE([lib])
gl_M4_BASE([m4]) gl_M4_BASE([m4])

View File

@ -1,9 +1,28 @@
# gnulib-common.m4 serial 3 # gnulib-common.m4 serial 4
dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
# gl_COMMON
# is expanded unconditionally through gnulib-tool magic.
AC_DEFUN([gl_COMMON], [
dnl Use AC_REQUIRE here, so that the code is expanded once only.
AC_REQUIRE([gl_COMMON_BODY])
])
AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([isoc99_inline],
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
__APPLE__ && __MACH__ test for MacOS X.
__APPLE_CC__ tests for the Apple compiler and its version.
__STDC_VERSION__ tests for the C99 mode. */
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif])
])
# gl_MODULE_INDICATOR([modulename]) # gl_MODULE_INDICATOR([modulename])
# defines a C macro indicating the presence of the given module. # defines a C macro indicating the presence of the given module.
AC_DEFUN([gl_MODULE_INDICATOR], AC_DEFUN([gl_MODULE_INDICATOR],

View File

@ -1,5 +1,5 @@
# DO NOT EDIT! GENERATED AUTOMATICALLY! # DO NOT EDIT! GENERATED AUTOMATICALLY!
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General
@ -25,29 +25,47 @@ AC_DEFUN([gl_EARLY],
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([AC_PROG_RANLIB])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
]) ])
# This macro should be invoked from ./configure.ac, in the section # This macro should be invoked from ./configure.ac, in the section
# "Check for header files, types and library functions". # "Check for header files, types and library functions".
AC_DEFUN([gl_INIT], AC_DEFUN([gl_INIT],
[ [
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
gl_cond_libtool=false gl_cond_libtool=false
gl_libdeps= gl_libdeps=
gl_ltlibdeps= gl_ltlibdeps=
m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
gl_COMMON
gl_source_base='lib' gl_source_base='lib'
gl_EOVERFLOW
gl_FUNC_GETDELIM
gl_STDIO_MODULE_INDICATOR([getdelim])
gl_FUNC_GETLINE
gl_STDIO_MODULE_INDICATOR([getline])
gl_GETOPT gl_GETOPT
gl_FUNC_GETPASS_GNU
AC_SUBST([LIBINTL]) AC_SUBST([LIBINTL])
AC_SUBST([LTLIBINTL]) AC_SUBST([LTLIBINTL])
# Autoconf 2.61a.99 and earlier don't support linking a file only
# in VPATH builds. But since GNUmakefile is for maintainer use
# only, it does not matter if we skip the link with older autoconf.
# Automake 1.10.1 and earlier try to remove GNUmakefile in non-VPATH
# builds, so use a shell variable to bypass this.
GNUmakefile=GNUmakefile
m4_if(m4_version_compare([2.61a.100],
m4_defn([m4_PACKAGE_VERSION])), [1], [],
[AC_CONFIG_LINKS([$GNUmakefile:$GNUmakefile], [],
[GNUmakefile=$GNUmakefile])])
gl_FUNC_REALLOC_POSIX
gl_STDLIB_MODULE_INDICATOR([realloc-posix])
AM_STDBOOL_H AM_STDBOOL_H
gl_STDIO_H
gl_STDLIB_H
gl_UNISTD_H gl_UNISTD_H
LIBGNU_LIBDEPS="$gl_libdeps"
AC_SUBST([LIBGNU_LIBDEPS])
LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
AC_SUBST([LIBGNU_LTLIBDEPS])
m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBOBJ])
@ -65,6 +83,34 @@ AC_DEFUN([gl_INIT],
AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
]) ])
gltests_libdeps=
gltests_ltlibdeps=
m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
gl_COMMON
gl_source_base='tests'
m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ])
AC_CONFIG_COMMANDS_PRE([
gltests_libobjs=
gltests_ltlibobjs=
if test -n "$gltests_LIBOBJS"; then
# Remove the extension.
sed_drop_objext='s/\.o$//;s/\.obj$//'
for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
gltests_libobjs="$gltests_libobjs $i.$ac_objext"
gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
done
fi
AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
])
LIBGNU_LIBDEPS="$gl_libdeps"
AC_SUBST([LIBGNU_LIBDEPS])
LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
AC_SUBST([LIBGNU_LTLIBDEPS])
]) ])
# Like AC_LIBOBJ, except that the module name goes # Like AC_LIBOBJ, except that the module name goes
@ -74,6 +120,13 @@ AC_DEFUN([gl_LIBOBJ], [
gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" 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 # Like AC_REPLACE_FUNCS, except that the module name goes
# into gl_LIBOBJS instead of into LIBOBJS. # into gl_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([gl_REPLACE_FUNCS], [ AC_DEFUN([gl_REPLACE_FUNCS], [
@ -95,24 +148,75 @@ AC_DEFUN([gl_LIBSOURCES], [
]) ])
]) ])
# Like AC_LIBOBJ, except that the module name goes
# into gltests_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([gltests_LIBOBJ], [
AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
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], [
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
])
# Like AC_LIBSOURCES, except the directory where the source file is
# expected is derived from the gnulib-tool parametrization,
# and alloca is special cased (for the alloca-opt module).
# We could also entirely rely on EXTRA_lib..._SOURCES.
AC_DEFUN([gltests_LIBSOURCES], [
m4_foreach([_gl_NAME], [$1], [
m4_if(_gl_NAME, [alloca.c], [], [
m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl
m4_if(m4_sysval, [0], [],
[AC_FATAL([missing tests/]_gl_NAME)])
])
])
])
# This macro records the list of files which have been installed by # This macro records the list of files which have been installed by
# gnulib-tool and may be removed by future gnulib-tool invocations. # gnulib-tool and may be removed by future gnulib-tool invocations.
AC_DEFUN([gl_FILE_LIST], [ AC_DEFUN([gl_FILE_LIST], [
build-aux/GNUmakefile
build-aux/link-warning.h build-aux/link-warning.h
build-aux/maint.mk
lib/c-ctype.c lib/c-ctype.c
lib/c-ctype.h lib/c-ctype.h
lib/getdelim.c
lib/getline.c
lib/getopt.c lib/getopt.c
lib/getopt.in.h lib/getopt.in.h
lib/getopt1.c lib/getopt1.c
lib/getopt_int.h lib/getopt_int.h
lib/getpass.c
lib/getpass.h
lib/gettext.h lib/gettext.h
lib/realloc.c
lib/stdbool.in.h lib/stdbool.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/unistd.in.h lib/unistd.in.h
m4/eoverflow.m4
m4/extensions.m4
m4/getdelim.m4
m4/getline.m4
m4/getopt.m4 m4/getopt.m4
m4/getpass.m4
m4/gnulib-common.m4 m4/gnulib-common.m4
m4/include_next.m4 m4/include_next.m4
m4/malloc.m4
m4/realloc.m4
m4/stdbool.m4 m4/stdbool.m4
m4/stdio_h.m4
m4/stdlib_h.m4
m4/unistd_h.m4 m4/unistd_h.m4
top/GNUmakefile
top/maint.mk
]) ])

View File

@ -1,5 +1,5 @@
# include_next.m4 serial 4 # include_next.m4 serial 6
dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -63,12 +63,15 @@ EOF
# The three "///" are to pacify Sun C 5.8, which otherwise would say # The three "///" are to pacify Sun C 5.8, which otherwise would say
# "warning: #include of /usr/include/... may be non-portable". # "warning: #include of /usr/include/... may be non-portable".
# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. # Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
# Note: This macro assumes that the header file is not empty after
# preprocessing, i.e. it does not only define preprocessor macros but also
# provides some type/enum definitions or function/variable declarations.
AC_DEFUN([gl_CHECK_NEXT_HEADERS], AC_DEFUN([gl_CHECK_NEXT_HEADERS],
[ [
AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([gl_INCLUDE_NEXT])
AC_CHECK_HEADERS_ONCE([$1]) AC_CHECK_HEADERS_ONCE([$1])
AC_FOREACH([gl_HEADER_NAME], [$1], m4_foreach_w([gl_HEADER_NAME], [$1],
[AS_VAR_PUSHDEF([gl_next_header], [AS_VAR_PUSHDEF([gl_next_header],
[gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
if test $gl_cv_have_include_next = yes; then if test $gl_cv_have_include_next = yes; then

41
m4/malloc.m4 Normal file
View File

@ -0,0 +1,41 @@
# malloc.m4 serial 8
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.
# gl_FUNC_MALLOC_POSIX
# --------------------
# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace malloc if it is not.
AC_DEFUN([gl_FUNC_MALLOC_POSIX],
[
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
HAVE_MALLOC_POSIX=1
AC_DEFINE([HAVE_MALLOC_POSIX], 1,
[Define if the 'malloc' function is POSIX compliant.])
else
AC_LIBOBJ([malloc])
HAVE_MALLOC_POSIX=0
fi
AC_SUBST([HAVE_MALLOC_POSIX])
])
# Test whether malloc, realloc, calloc are POSIX compliant,
# Set gl_cv_func_malloc_posix to yes or no accordingly.
AC_DEFUN([gl_CHECK_MALLOC_POSIX],
[
AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
[gl_cv_func_malloc_posix],
[
dnl It is too dangerous to try to allocate a large amount of memory:
dnl some systems go to their knees when you do that. So assume that
dnl all Unix implementations of the function are POSIX compliant.
AC_TRY_COMPILE([],
[#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
choke me
#endif
], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
])
])

23
m4/realloc.m4 Normal file
View File

@ -0,0 +1,23 @@
# realloc.m4 serial 8
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.
# gl_FUNC_REALLOC_POSIX
# ---------------------
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
# fails), and replace realloc if it is not.
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
[
AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
if test $gl_cv_func_malloc_posix = yes; then
HAVE_REALLOC_POSIX=1
AC_DEFINE([HAVE_REALLOC_POSIX], 1,
[Define if the 'realloc' function is POSIX compliant.])
else
AC_LIBOBJ([realloc])
HAVE_REALLOC_POSIX=0
fi
AC_SUBST([HAVE_REALLOC_POSIX])
])

85
m4/stdio_h.m4 Normal file
View File

@ -0,0 +1,85 @@
# stdio_h.m4 serial 9
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_STDIO_H],
[
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([stdio.h])
])
AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_STDIO_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])
AC_DEFUN([gl_STDIO_H_DEFAULTS],
[
GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
dnl Assume proper GNU behavior unless another module says otherwise.
REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])
HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
])
dnl Code shared by fseeko and ftello. Determine if large files are supported,
dnl but stdin does not start as a large file by default.
AC_DEFUN([gl_STDIN_LARGE_OFFSET],
[
AC_CACHE_CHECK([whether stdin defaults to large file offsets],
[gl_cv_var_stdin_large_offset],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
[#if defined __SL64 && defined __SCLE /* cygwin */
/* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
fseeko/ftello needlessly fail. This bug was fixed in 1.5.25, and
it is easier to do a version check than building a runtime test. */
# include <cygwin/version.h>
# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
choke me
# endif
#endif])],
[gl_cv_var_stdin_large_offset=yes],
[gl_cv_var_stdin_large_offset=no])])
])

45
m4/stdlib_h.m4 Normal file
View File

@ -0,0 +1,45 @@
# stdlib_h.m4 serial 6
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_STDLIB_H],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([stdlib.h])
])
AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
])
AC_DEFUN([gl_STDLIB_H_DEFAULTS],
[
GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
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_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
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_STRTOD=1; AC_SUBST([HAVE_STRTOD])
HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
])

View File

@ -1,5 +1,5 @@
# unistd_h.m4 serial 10 # unistd_h.m4 serial 11
dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -34,6 +34,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
[ [
GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
@ -49,12 +50,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
]) ])

View File

@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY! ## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in. ## Process this file with automake to produce Makefile.in.
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General

View File

@ -1,4 +1,4 @@
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General

View File

@ -1,9 +1,28 @@
# gnulib-common.m4 serial 3 # gnulib-common.m4 serial 4
dnl Copyright (C) 2007 Free Software Foundation, Inc. dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
# gl_COMMON
# is expanded unconditionally through gnulib-tool magic.
AC_DEFUN([gl_COMMON], [
dnl Use AC_REQUIRE here, so that the code is expanded once only.
AC_REQUIRE([gl_COMMON_BODY])
])
AC_DEFUN([gl_COMMON_BODY], [
AH_VERBATIM([isoc99_inline],
[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
__APPLE__ && __MACH__ test for MacOS X.
__APPLE_CC__ tests for the Apple compiler and its version.
__STDC_VERSION__ tests for the C99 mode. */
#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
# define __GNUC_STDC_INLINE__ 1
#endif])
])
# gl_MODULE_INDICATOR([modulename]) # gl_MODULE_INDICATOR([modulename])
# defines a C macro indicating the presence of the given module. # defines a C macro indicating the presence of the given module.
AC_DEFUN([gl_MODULE_INDICATOR], AC_DEFUN([gl_MODULE_INDICATOR],

View File

@ -1,5 +1,5 @@
# DO NOT EDIT! GENERATED AUTOMATICALLY! # DO NOT EDIT! GENERATED AUTOMATICALLY!
# Copyright (C) 2004-2007 Free Software Foundation, Inc. # Copyright (C) 2002-2008 Free Software Foundation, Inc.
# #
# This file is free software, distributed under the terms of the GNU # This file is free software, distributed under the terms of the GNU
# General Public License. As a special exception to the GNU General # General Public License. As a special exception to the GNU General
@ -31,21 +31,18 @@ AC_DEFUN([md5_EARLY],
# "Check for header files, types and library functions". # "Check for header files, types and library functions".
AC_DEFUN([md5_INIT], AC_DEFUN([md5_INIT],
[ [
m4_pushdef([AC_LIBOBJ], m4_defn([md5_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([md5_LIBSOURCES]))
AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) AM_CONDITIONAL([GL_COND_LIBTOOL], [false])
gl_cond_libtool=false gl_cond_libtool=false
gl_libdeps= gl_libdeps=
gl_ltlibdeps= gl_ltlibdeps=
m4_pushdef([AC_LIBOBJ], m4_defn([md5_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([md5_LIBSOURCES]))
gl_COMMON
gl_source_base='md5' gl_source_base='md5'
gl_MD5 gl_MD5
gl_STDINT_H gl_STDINT_H
gl_WCHAR_H gl_WCHAR_H
LIBMD5_LIBDEPS="$gl_libdeps"
AC_SUBST([LIBMD5_LIBDEPS])
LIBMD5_LTLIBDEPS="$gl_ltlibdeps"
AC_SUBST([LIBMD5_LTLIBDEPS])
m4_popdef([AC_LIBSOURCES]) m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS]) m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ]) m4_popdef([AC_LIBOBJ])
@ -63,6 +60,34 @@ AC_DEFUN([md5_INIT],
AC_SUBST([md5_LIBOBJS], [$md5_libobjs]) AC_SUBST([md5_LIBOBJS], [$md5_libobjs])
AC_SUBST([md5_LTLIBOBJS], [$md5_ltlibobjs]) AC_SUBST([md5_LTLIBOBJS], [$md5_ltlibobjs])
]) ])
gltests_libdeps=
gltests_ltlibdeps=
m4_pushdef([AC_LIBOBJ], m4_defn([md5tests_LIBOBJ]))
m4_pushdef([AC_REPLACE_FUNCS], m4_defn([md5tests_REPLACE_FUNCS]))
m4_pushdef([AC_LIBSOURCES], m4_defn([md5tests_LIBSOURCES]))
gl_COMMON
gl_source_base='tests'
m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ])
AC_CONFIG_COMMANDS_PRE([
md5tests_libobjs=
md5tests_ltlibobjs=
if test -n "$md5tests_LIBOBJS"; then
# Remove the extension.
sed_drop_objext='s/\.o$//;s/\.obj$//'
for i in `for i in $md5tests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
md5tests_libobjs="$md5tests_libobjs $i.$ac_objext"
md5tests_ltlibobjs="$md5tests_ltlibobjs $i.lo"
done
fi
AC_SUBST([md5tests_LIBOBJS], [$md5tests_libobjs])
AC_SUBST([md5tests_LTLIBOBJS], [$md5tests_ltlibobjs])
])
LIBMD5_LIBDEPS="$gl_libdeps"
AC_SUBST([LIBMD5_LIBDEPS])
LIBMD5_LTLIBDEPS="$gl_ltlibdeps"
AC_SUBST([LIBMD5_LTLIBDEPS])
]) ])
# Like AC_LIBOBJ, except that the module name goes # Like AC_LIBOBJ, except that the module name goes
@ -72,6 +97,13 @@ AC_DEFUN([md5_LIBOBJ], [
md5_LIBOBJS="$md5_LIBOBJS $1.$ac_objext" md5_LIBOBJS="$md5_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 # Like AC_REPLACE_FUNCS, except that the module name goes
# into md5_LIBOBJS instead of into LIBOBJS. # into md5_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([md5_REPLACE_FUNCS], [ AC_DEFUN([md5_REPLACE_FUNCS], [
@ -93,6 +125,41 @@ AC_DEFUN([md5_LIBSOURCES], [
]) ])
]) ])
# Like AC_LIBOBJ, except that the module name goes
# into md5tests_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([md5tests_LIBOBJ], [
AS_LITERAL_IF([$1], [md5tests_LIBSOURCES([$1.c])])dnl
md5tests_LIBOBJS="$md5tests_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 md5tests_LIBOBJS instead of into LIBOBJS.
AC_DEFUN([md5tests_REPLACE_FUNCS], [
m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
AC_CHECK_FUNCS([$1], , [md5tests_LIBOBJ($ac_func)])
])
# Like AC_LIBSOURCES, except the directory where the source file is
# expected is derived from the gnulib-tool parametrization,
# and alloca is special cased (for the alloca-opt module).
# We could also entirely rely on EXTRA_lib..._SOURCES.
AC_DEFUN([md5tests_LIBSOURCES], [
m4_foreach([_gl_NAME], [$1], [
m4_if(_gl_NAME, [alloca.c], [], [
m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl
m4_if(m4_sysval, [0], [],
[AC_FATAL([missing tests/]_gl_NAME)])
])
])
])
# This macro records the list of files which have been installed by # This macro records the list of files which have been installed by
# gnulib-tool and may be removed by future gnulib-tool invocations. # gnulib-tool and may be removed by future gnulib-tool invocations.
AC_DEFUN([md5_FILE_LIST], [ AC_DEFUN([md5_FILE_LIST], [

View File

@ -1,5 +1,5 @@
# include_next.m4 serial 4 # include_next.m4 serial 6
dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc. dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -63,12 +63,15 @@ EOF
# The three "///" are to pacify Sun C 5.8, which otherwise would say # The three "///" are to pacify Sun C 5.8, which otherwise would say
# "warning: #include of /usr/include/... may be non-portable". # "warning: #include of /usr/include/... may be non-portable".
# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. # Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
# Note: This macro assumes that the header file is not empty after
# preprocessing, i.e. it does not only define preprocessor macros but also
# provides some type/enum definitions or function/variable declarations.
AC_DEFUN([gl_CHECK_NEXT_HEADERS], AC_DEFUN([gl_CHECK_NEXT_HEADERS],
[ [
AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([gl_INCLUDE_NEXT])
AC_CHECK_HEADERS_ONCE([$1]) AC_CHECK_HEADERS_ONCE([$1])
AC_FOREACH([gl_HEADER_NAME], [$1], m4_foreach_w([gl_HEADER_NAME], [$1],
[AS_VAR_PUSHDEF([gl_next_header], [AS_VAR_PUSHDEF([gl_next_header],
[gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME]))) [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
if test $gl_cv_have_include_next = yes; then if test $gl_cv_have_include_next = yes; then

View File

@ -1,5 +1,5 @@
# md5.m4 serial 9 # md5.m4 serial 10
dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -10,5 +10,6 @@ AC_DEFUN([gl_MD5],
dnl Prerequisites of lib/md5.c. dnl Prerequisites of lib/md5.c.
AC_REQUIRE([AC_C_BIGENDIAN]) AC_REQUIRE([AC_C_BIGENDIAN])
AC_REQUIRE([AC_C_INLINE])
: :
]) ])

View File

@ -1,5 +1,5 @@
# stdint.m4 serial 29 # stdint.m4 serial 30
dnl Copyright (C) 2001-2007 Free Software Foundation, Inc. dnl Copyright (C) 2001-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -240,7 +240,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in, dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made. dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [AH_TEMPLATE([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to the number of bits in type ']gltype['.])]) [Define to the number of bits in type ']gltype['.])])
for gltype in $1 ; do for gltype in $1 ; do
@ -265,7 +265,7 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
eval BITSIZEOF_${GLTYPE}=\$result eval BITSIZEOF_${GLTYPE}=\$result
done done
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) [AC_SUBST([BITSIZEOF_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
]) ])
@ -278,7 +278,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in, dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made. dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), [AH_TEMPLATE([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
[Define to 1 if ']gltype[' is a signed integer type.])]) [Define to 1 if ']gltype[' is a signed integer type.])])
for gltype in $1 ; do for gltype in $1 ; do
@ -298,7 +298,7 @@ AC_DEFUN([gl_CHECK_TYPES_SIGNED],
eval HAVE_SIGNED_${GLTYPE}=0 eval HAVE_SIGNED_${GLTYPE}=0
fi fi
done done
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) [AC_SUBST([HAVE_SIGNED_]translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
]) ])
@ -311,7 +311,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
dnl config.h.in, dnl config.h.in,
dnl - extra AC_SUBST calls, so that the right substitutions are made. dnl - extra AC_SUBST calls, so that the right substitutions are made.
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], [AH_TEMPLATE(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
[Define to l, ll, u, ul, ull, etc., as suitable for [Define to l, ll, u, ul, ull, etc., as suitable for
constants of type ']gltype['.])]) constants of type ']gltype['.])])
@ -350,7 +350,7 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
eval ${GLTYPE}_SUFFIX=\$result eval ${GLTYPE}_SUFFIX=\$result
AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result) AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], $result)
done done
AC_FOREACH([gltype], [$1], m4_foreach_w([gltype], [$1],
[AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) [AC_SUBST(translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
]) ])

View File

@ -1,6 +1,6 @@
/* Functions to compute MD5 message digest of files or memory blocks. /* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992. according to the definition of MD5 in RFC 1321 from April 1992.
Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006 Copyright (C) 1995,1996,1997,1999,2000,2001,2005,2006,2008
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -80,27 +80,31 @@ md5_init_ctx (struct md5_ctx *ctx)
ctx->buflen = 0; ctx->buflen = 0;
} }
/* Put result from CTX in first 16 bytes following RESBUF. The result /* Copy the 4 byte value from v into the memory location pointed to by *cp,
must be in little endian byte order. If your architecture allows unaligned access this is equivalent to
* (uint32_t *) cp = v */
static inline void
set_uint32 (char *cp, uint32_t v)
{
memcpy (cp, &v, sizeof v);
}
IMPORTANT: On some systems it is required that RESBUF is correctly /* Put result from CTX in first 16 bytes following RESBUF. The result
aligned for a 32-bit value. */ must be in little endian byte order. */
void * void *
md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{ {
((uint32_t *) resbuf)[0] = SWAP (ctx->A); char *r = resbuf;
((uint32_t *) resbuf)[1] = SWAP (ctx->B); set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A));
((uint32_t *) resbuf)[2] = SWAP (ctx->C); set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B));
((uint32_t *) resbuf)[3] = SWAP (ctx->D); set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C));
set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D));
return resbuf; return resbuf;
} }
/* Process the remaining bytes in the internal buffer and the usual /* Process the remaining bytes in the internal buffer and the usual
prolog according to the standard and write the result to RESBUF. prolog according to the standard and write the result to RESBUF. */
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32-bit value. */
void * void *
md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
{ {

View File

@ -1,6 +1,6 @@
/* Declaration of functions and data types used for MD5 sum computing /* Declaration of functions and data types used for MD5 sum computing
library functions. library functions.
Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006 Copyright (C) 1995-1997,1999,2000,2001,2004,2005,2006,2008
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -93,19 +93,13 @@ extern void __md5_process_bytes (const void *buffer, size_t len,
/* Process the remaining bytes in the buffer and put result from CTX /* Process the remaining bytes in the buffer and put result from CTX
in first 16 bytes following RESBUF. The result is always in little in first 16 bytes following RESBUF. The result is always in little
endian byte order, so that a byte-wise output yields to the wanted endian byte order, so that a byte-wise output yields to the wanted
ASCII representation of the message digest. ASCII representation of the message digest. */
IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
boundary. */
extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
/* Put result from CTX in first 16 bytes following RESBUF. The result is /* Put result from CTX in first 16 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest. to the wanted ASCII representation of the message digest. */
IMPORTANT: On some systems, RESBUF must be aligned to a 32-bit
boundary. */
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;

523
md5/stdint.h Normal file
View File

@ -0,0 +1,523 @@
/* 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

@ -23,6 +23,12 @@
#ifndef _GL_STDINT_H #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 /* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef 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 /* 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__. 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. */ <inttypes.h> also defines intptr_t and uintptr_t. */
# define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
#elif @HAVE_SYS_INTTYPES_H@ #elif @HAVE_SYS_INTTYPES_H@
/* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and /* 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. */ the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */
@ -91,6 +95,8 @@
#endif #endif
#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
/* Minimum and maximum values for a integer type under the usual assumption. /* Minimum and maximum values for a integer type under the usual assumption.
Return an unspecified value if BITS == 0, adding a check to pacify Return an unspecified value if BITS == 0, adding a check to pacify
picky compilers. */ picky compilers. */

View File

@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues. /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
Copyright (C) 2007 Free Software Foundation, Inc. Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -26,6 +26,14 @@
* the declaration of wcwidth(). * the declaration of wcwidth().
*/ */
#ifdef __need_mbstate_t
/* Special invocation convention inside uClibc header files. */
#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
#else
/* Normal invocation convention. */
#ifndef _GL_WCHAR_H #ifndef _GL_WCHAR_H
/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
@ -80,3 +88,4 @@ extern int wcwidth (int /* actually wchar_t */);
#endif /* _GL_WCHAR_H */ #endif /* _GL_WCHAR_H */
#endif /* _GL_WCHAR_H */ #endif /* _GL_WCHAR_H */
#endif

View File

@ -1,3 +1,18 @@
2008-04-30 Steven Schubiger <stsc@members.fsf.org>
* main.c (main): New code that handles prompting for passwords
when specified explicitly via command-line option (using gnulib's
getpass-gnu module).
(main): Include the getpass header.
* init.c: Add "ask-password" to the list of recognized commands.
* options.h: Add an according boolean member to the options
struct.
* sysdep.h: Comment the defines __EXTENSIONS__ and _GNU_SOURCE
out, because they're now defined independently by config.h.
2008-04-27 Rabin Vincent <rabin@rab.in> 2008-04-27 Rabin Vincent <rabin@rab.in>
* http.c (http_loop): Fix return for the case where we don't * http.c (http_loop): Fix return for the case where we don't

View File

@ -113,6 +113,7 @@ static const struct {
{ "accept", &opt.accepts, cmd_vector }, { "accept", &opt.accepts, cmd_vector },
{ "addhostdir", &opt.add_hostdir, cmd_boolean }, { "addhostdir", &opt.add_hostdir, cmd_boolean },
{ "alwaysrest", &opt.always_rest, cmd_boolean }, /* deprecated */ { "alwaysrest", &opt.always_rest, cmd_boolean }, /* deprecated */
{ "askpassword", &opt.ask_passwd, cmd_boolean },
{ "authnochallenge", &opt.auth_without_challenge, { "authnochallenge", &opt.auth_without_challenge,
cmd_boolean }, cmd_boolean },
{ "background", &opt.background, cmd_boolean }, { "background", &opt.background, cmd_boolean },

View File

@ -56,6 +56,7 @@ as that of the covered work. */
#include "http.h" /* for save_cookies */ #include "http.h" /* for save_cookies */
#include <getopt.h> #include <getopt.h>
#include "getpass.h"
#ifndef PATH_SEPARATOR #ifndef PATH_SEPARATOR
# define PATH_SEPARATOR '/' # define PATH_SEPARATOR '/'
@ -130,6 +131,7 @@ static struct cmdline_option option_data[] =
{ {
{ "accept", 'A', OPT_VALUE, "accept", -1 }, { "accept", 'A', OPT_VALUE, "accept", -1 },
{ "append-output", 'a', OPT__APPEND_OUTPUT, NULL, required_argument }, { "append-output", 'a', OPT__APPEND_OUTPUT, NULL, required_argument },
{ "ask-password", 0, OPT_BOOLEAN, "askpassword", -1 },
{ "auth-no-challenge", 0, OPT_BOOLEAN, "authnochallenge", -1 }, { "auth-no-challenge", 0, OPT_BOOLEAN, "authnochallenge", -1 },
{ "background", 'b', OPT_BOOLEAN, "background", -1 }, { "background", 'b', OPT_BOOLEAN, "background", -1 },
{ "backup-converted", 'K', OPT_BOOLEAN, "backupconverted", -1 }, { "backup-converted", 'K', OPT_BOOLEAN, "backupconverted", -1 },
@ -472,6 +474,8 @@ Download:\n"),
--user=USER set both ftp and http user to USER.\n"), --user=USER set both ftp and http user to USER.\n"),
N_("\ N_("\
--password=PASS set both ftp and http password to PASS.\n"), --password=PASS set both ftp and http password to PASS.\n"),
N_("\
--ask-password prompt for passwords.\n"),
"\n", "\n",
N_("\ N_("\
@ -673,6 +677,16 @@ secs_to_human_time (double interval)
return buf; return buf;
} }
static char *
prompt_for_password (void)
{
if (opt.user)
printf (_("Password for user \"%s\": "), opt.user);
else
printf (_("Password: "));
return getpass("");
}
static void static void
print_version (void) print_version (void)
{ {
@ -907,6 +921,13 @@ Cannot specify -N if -O is given. See the manual for details.\n\n"), stdout);
} }
} }
if (opt.ask_passwd && opt.passwd)
{
printf (_("Cannot specify both --ask-password and --password.\n"));
print_usage ();
exit (1);
}
if (!nurl && !opt.input_filename) if (!nurl && !opt.input_filename)
{ {
/* No URL specified. */ /* No URL specified. */
@ -1002,6 +1023,9 @@ Cannot specify -N if -O is given. See the manual for details.\n\n"), stdout);
char *filename = NULL, *redirected_URL = NULL; char *filename = NULL, *redirected_URL = NULL;
int dt; int dt;
if (opt.ask_passwd)
opt.passwd = prompt_for_password ();
if ((opt.recursive || opt.page_requisites) if ((opt.recursive || opt.page_requisites)
&& (url_scheme (*t) != SCHEME_FTP || url_uses_proxy (*t))) && (url_scheme (*t) != SCHEME_FTP || url_uses_proxy (*t)))
{ {

View File

@ -85,6 +85,7 @@ struct options
char *user; /* Generic username */ char *user; /* Generic username */
char *passwd; /* Generic password */ char *passwd; /* Generic password */
bool ask_passwd; /* Ask for password? */
bool always_rest; /* Always use REST. */ bool always_rest; /* Always use REST. */
char *ftp_user; /* FTP username */ char *ftp_user; /* FTP username */

View File

@ -68,7 +68,7 @@ as that of the covered work. */
/* For Solaris: request everything else that is available and doesn't /* For Solaris: request everything else that is available and doesn't
conflict with the above. */ conflict with the above. */
#define __EXTENSIONS__ /* #define __EXTENSIONS__ */ /* XXX clashes with config.h */
/* For Linux: request features of 4.3BSD and SVID (System V Interface /* For Linux: request features of 4.3BSD and SVID (System V Interface
Definition). */ Definition). */
@ -78,7 +78,7 @@ as that of the covered work. */
/* Under glibc-based systems we want all GNU extensions as well. This /* Under glibc-based systems we want all GNU extensions as well. This
declares some unnecessary cruft, but also useful functions such as declares some unnecessary cruft, but also useful functions such as
timegm, FNM_CASEFOLD extension to fnmatch, memrchr, etc. */ timegm, FNM_CASEFOLD extension to fnmatch, memrchr, etc. */
#define _GNU_SOURCE /* #define _GNU_SOURCE */ /* XXX clashes with config.h */
#endif /* NAMESPACE_TWEAKS */ #endif /* NAMESPACE_TWEAKS */