From 5a5367474b6808f488d4b0e74ba30bebfdc882f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 3 Nov 2004 07:44:15 +0000 Subject: [PATCH] Sync from gnulib. --- config/ChangeLog | 4 ++++ config/texinfo.tex | 20 +++++++++----------- lib/ChangeLog | 4 ++++ lib/getdate.y | 7 +++---- lib/getpass.c | 30 ++++++++++++++++++++---------- lib/setenv.h | 12 ++++++++++-- lib/xreadlink.c | 18 ++++++++++++------ m4/ChangeLog | 4 ++++ m4/getpass.m4 | 1 + 9 files changed, 67 insertions(+), 33 deletions(-) diff --git a/config/ChangeLog b/config/ChangeLog index 3118d61..9518083 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2004-11-02 Paul Eggert + + * texinfo.tex: Sync from gnulib. + 2004-10-29 Paul Eggert * config.guess, install-sh, texinfo.tex: Sync from gnulib. diff --git a/config/texinfo.tex b/config/texinfo.tex index b4b9016..4737221 100644 --- a/config/texinfo.tex +++ b/config/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2004-09-06.16} +\def\texinfoversion{2004-10-31.06} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software @@ -2732,19 +2732,17 @@ where each line of input produces a line of output.} \global\setpercentfalse } -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. \ifdim\multitablelinespace=0pt \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip \global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi +\fi %% Test to see if parskip is larger than space between lines of %% table. If not, do nothing. %% If so, set to same dimension as multitablelinespace. diff --git a/lib/ChangeLog b/lib/ChangeLog index c54f4b9..5f64004 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2004-11-02 Paul Eggert + + * getdate.y, getpass.c, setenv.h: Sync from gnulib. + 2004-10-29 Paul Eggert * getdate.y, getpagesize.h, mktime.c: Sync from gnulib. diff --git a/lib/getdate.y b/lib/getdate.y index ec8c192..d203c09 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -1307,8 +1308,8 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) int month = tm.tm_mon + pc.rel_month; int day = tm.tm_mday + pc.rel_day; if (((year < tm.tm_year) ^ (pc.rel_year < 0)) - | (month < tm.tm_mon) ^ (pc.rel_month < 0) - | (day < tm.tm_mday) ^ (pc.rel_day < 0)) + | ((month < tm.tm_mon) ^ (pc.rel_month < 0)) + | ((day < tm.tm_mday) ^ (pc.rel_day < 0))) goto fail; tm.tm_year = year; tm.tm_mon = month; @@ -1365,8 +1366,6 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) #if TEST -#include - int main (int ac, char **av) { diff --git a/lib/getpass.c b/lib/getpass.c index 78f21e0..4f520ae 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -58,16 +58,26 @@ #elif USE_UNLOCKED_IO # include "unlocked-io.h" #else -# undef fflush_unlocked -# define fflush_unlocked(x) fflush (x) -# undef flockfile -# define flockfile(x) ((void) 0) -# undef funlockfile -# define funlockfile(x) ((void) 0) -# undef fputs_unlocked -# define fputs_unlocked(str,stream) fputs (str, stream) -# undef putc_unlocked -# define putc_unlocked(c,stream) putc (c, stream) +# 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 #if _LIBC diff --git a/lib/setenv.h b/lib/setenv.h index 1c69ac3..7ac5ae6 100644 --- a/lib/setenv.h +++ b/lib/setenv.h @@ -1,5 +1,5 @@ /* Setting environment variables. - Copyright (C) 2001-2003 Free Software Foundation, Inc. + Copyright (C) 2001-2004 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 @@ -34,7 +34,15 @@ extern int setenv (const char *name, const char *value, int replace); #endif -#if !HAVE_UNSETENV +#if HAVE_UNSETENV + +# if VOID_UNSETENV +/* On some systems, unsetenv() returns void. + This is the case for 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); diff --git a/lib/xreadlink.c b/lib/xreadlink.c index 2e66c07..c38e2d3 100644 --- a/lib/xreadlink.c +++ b/lib/xreadlink.c @@ -41,6 +41,8 @@ # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) #endif +#define MAXSIZE (SIZE_MAX < SSIZE_MAX ? SIZE_MAX : SSIZE_MAX) + #include "xalloc.h" /* Call readlink to get the symbolic link value of FILENAME. @@ -56,14 +58,15 @@ xreadlink (char const *filename, size_t size) { /* The initial buffer size for the link value. A power of 2 detects arithmetic overflow earlier, but is not required. */ - size_t buf_size = size + 1; + size_t buf_size = size < MAXSIZE ? size + 1 : MAXSIZE; while (1) { char *buffer = xmalloc (buf_size); - ssize_t link_length = readlink (filename, buffer, buf_size); + ssize_t r = readlink (filename, buffer, buf_size); + size_t link_length = r; - if (link_length < 0) + if (r < 0) { int saved_errno = errno; free (buffer); @@ -71,15 +74,18 @@ xreadlink (char const *filename, size_t size) return NULL; } - if ((size_t) link_length < buf_size) + if (link_length < buf_size) { buffer[link_length] = 0; return buffer; } free (buffer); - buf_size *= 2; - if (! (0 < buf_size && buf_size <= SSIZE_MAX)) + if (buf_size <= MAXSIZE / 2) + buf_size *= 2; + else if (buf_size < MAXSIZE) + buf_size = MAXSIZE; + else xalloc_die (); } } diff --git a/m4/ChangeLog b/m4/ChangeLog index fcc56bf..432e7b4 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2004-11-02 Paul Eggert + + * getpass.m4: Sync from gnulib. + 2004-10-29 Paul Eggert * getpagesize.m4: Sync from gnulib. diff --git a/m4/getpass.m4 b/m4/getpass.m4 index 0c4d805..8d68224 100644 --- a/m4/getpass.m4 +++ b/m4/getpass.m4 @@ -34,5 +34,6 @@ AC_DEFUN([gl_FUNC_GETPASS_GNU], # Prerequisites of lib/getpass.c. AC_DEFUN([gl_PREREQ_GETPASS], [ AC_CHECK_HEADERS_ONCE(stdio_ext.h) + AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile putc_unlocked]) : ]) -- 2.7.4