X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrftime.c;h=569a3d448e504bca02e6b5db42721eaf747bb82b;hb=2e296bb50d37439d208c507bc8409336822a0c28;hp=cc4953e68aaf9bc2cabdc9521ae2d99c220374bf;hpb=43e78b970f396160a887c9da94531569faeda8a0;p=gnulib.git diff --git a/lib/strftime.c b/lib/strftime.c index cc4953e68..569a3d448 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -73,6 +73,17 @@ David MacKenzie */ +#ifdef HAVE_CONFIG_H +#if defined (CONFIG_BROKETS) +/* We use instead of "config.h" so that a compilation + using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h + (which it would do because it found this file in $srcdir). */ +#include +#else +#include "config.h" +#endif +#endif + #include #if defined(TM_IN_SYS_TIME) || (!defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)) #include @@ -84,22 +95,18 @@ extern char *tzname[2]; #endif -#if !__STDC__ -#define const -#endif - /* Types of padding for numbers in date and time. */ enum padding { none, blank, zero }; -static char *days[] = +static char const* const days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; -static char *months[] = +static char const * const months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" @@ -108,7 +115,13 @@ static char *months[] = /* Add character C to STRING and increment LENGTH, unless LENGTH would exceed MAX. */ -#define add_char(c) (length + 1 <= max) && (string[length++] = (c)) +#define add_char(c) \ + do \ + { \ + if (length + 1 <= max) \ + string[length++] = (c); \ + } \ + while (0) /* Add a 2 digit number to STRING, padding if specified. Return the number of characters added, up to MAX. */