X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrftime.c;h=897aab71e5dd4063b05d955ed5b270077f9add91;hb=cb9819cbb9261bd50c3466cf0a4cd873f0d7ebd7;hp=86cd1cf7e7082ef78d6dcd070c8f3719e52cb145;hpb=0632e115747ff96e93330c88f536d7354a7ce507;p=gnulib.git diff --git a/lib/strftime.c b/lib/strftime.c index 86cd1cf7e..897aab71e 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -1,22 +1,21 @@ -/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software +/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. - 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 - the Free Software Foundation; either version 2, or (at your option) - any later version. + 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifdef _LIBC # define HAVE_MBLEN 1 @@ -30,22 +29,15 @@ # include "../locale/localeinfo.h" #else # include +# if FPRINTFTIME +# include "fprintftime.h" +# endif #endif #include -#include /* Some systems define `time_t' here. */ +#include -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif -#if HAVE_TZNAME && ! defined tzname +#if HAVE_TZNAME && !HAVE_DECL_TZNAME extern char *tzname[]; #endif @@ -55,7 +47,7 @@ extern char *tzname[]; conversion specifications. The GNU C Library uses UTF8 multibyte encoding, which is safe for formats, but strftime.c can be used with other C libraries that use unsafe encodings. */ -#define DO_MULTIBYTE (HAVE_MBLEN && HAVE_WCHAR_H && ! MULTIBYTE_IS_FORMAT_SAFE) +#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE) #if DO_MULTIBYTE # if HAVE_MBRLEN @@ -141,11 +133,10 @@ extern char *tzname[]; #endif #if !HAVE_TM_GMTOFF -/* Portable standalone applications should supply a "time_r.h" that +/* Portable standalone applications should supply a "time.h" that declares a POSIX-compliant localtime_r, for the benefit of older implementations that lack localtime_r or have a nonstandard one. See the gnulib time_r module for one way to implement this. */ -# include "time_r.h" # undef __gmtime_r # undef __localtime_r # define __gmtime_r gmtime_r @@ -178,6 +169,12 @@ extern char *tzname[]; # define memset_zero(P, Len) (memset (P, '0', Len), (P) += (Len)) #endif +#if FPRINTFTIME +# define advance(P, N) +#else +# define advance(P, N) ((P) += (N)) +#endif + #define add(n, f) \ do \ { \ @@ -196,7 +193,7 @@ extern char *tzname[]; memset_space (p, _delta); \ } \ f; \ - p += FPRINTFTIME ? 0 : _n; \ + advance (p, _n); \ } \ i += _incr; \ } while (0)