lib/strftime.c


Log

Author Commit Date CI Message
Paul Eggert a4d796fb 2012-02-05T13:42:03 maint: spelling fixes
Paul Eggert 51e801f2 2012-01-05T23:53:49 In commentary, do not use ` to quote.
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Jim Meyering 4cae3d45 2011-03-21T15:32:54 strftime: fix a bug in yesterday's change * lib/strftime.c (add): Accommodate width's initial value of -1. Otherwise, nstrftime would copy uninitialized data into the result buffer.
Paul Eggert 0ed06c55 2011-03-20T23:59:29 strftime: don't assume a byte count fits in 'int' * lib/strftime.c (add): Don't assume first arg fits in 'int'. I found this problem by static analysis, using gcc -Wstrict-overflow (GCC 4.5.2, x86-64). This reported an optimization that depended on an integer overflow having undefined behavior, but it turns out that the argument is a size, which might not fit in 'int' anyway, 2011-03-20 Paul Eggert <eggert@cs.ucla.edu>
Paul Eggert 1c4cf205 2011-01-18T09:40:16 strftime: remove dependencies on multibyte modules strftime depended on mbrlen, mbsinit, and wchar, but these modules are needed only if ! MULTIBYTE_IS_FORMAT_SAFE, and that is true only if __osf__ is defined, and I suspect OSF doesn't need these other modules. If my guess is wrong, we'll need to come up with a variant of strftime that doesn't need the multibyte modules. I discovered this problem when attempting modify Emacs to use the strftime module. With the previous gnulib, this caused Emacs to need 31 new files, ranging from lib/config.charset to m4/wint_t.m4. This was overkill and I expect would be offputting to the Emacs maintainers. After this change, only 6 new files are needed, namely strftime.[ch], srtftime.m4, stdbool.in.h, stdbool.m4, and tm_gmtoff.m4. * lib/strftime.c (MULTIBYTE_IS_FORMAT_SAFE): Define to 1 always. Suggested by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00238.html>. * m4/strftime.m4 (gl_FUNC_STRFTIME): Do not require AC_TYPE_MBSTATE_T, and do not check for wchar.h. * modules/strftime (Files): Remove m4/mbstate_t.m4. (Depends-on): Remove mbrlen, mbsinit, wchar.
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Jim Meyering 3030c5b5 2009-12-28T10:50:36 update nearly all FSF copyright year lists to include 2009 The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
James Youngman 6553be82 2009-11-09T11:41:29 strftime.c: include ignore-value.h only when FPRINTFTIME is defined * lib/strftime.c: Correct placement of #include "ignore-value.h".
Jim Meyering 739294f4 2009-10-28T11:25:29 fprintftime: wrap macro code argument in "do {...} while(0)" * lib/strftime.c (cpy) [FPRINTFTIME]: The second argument to the cpy macro must be a statement that can be followed by a semicolon. Now that the else clause contains a comment and is hence longer than one line, I require curly braces. That in turn requires that we wrap this code block in the standard do...while(0).
Jim Meyering 8348e9cb 2009-10-28T11:07:31 fprintftime: remove stray semicolon from previous change * lib/strftime.c (cpy) [FPRINTFTIME]: Remove trailing semicolon.
Jim Meyering 119ae551 2009-10-28T10:24:09 fprintftime: avoid a warning about ignored fwrite return value * lib/strftime.c [FPRINTFTIME]: Include "ignore-value.h". (cpy) [FPRINTFTIME]: Ignore fwrite failure, even though technically, that is unsafe. * modules/fprintftime (Depends-on): Add ignore-value.
Jim Meyering e97e3a48 2008-11-30T17:10:29 avoid misc. warnings * lib/fsusage.c (UNUSED_PARAM): Define. (get_fs_usage): Mark parameter "disk" as unused. * lib/getugroups.c (getgrent): Use "void" in prototype. * lib/mountlist.c: Mark unused parameters. (read_file_system_list): Declare a local with "const". * lib/nanosleep.c (getnow): Declare static. * lib/strftime.c: Include strftime.h, for declaration of nstrftime.
Bruno Haible bb850628 2009-01-18T23:48:59 Revisit the condition when to use multibyte parsing in strftime.
Bruno Haible 2c15946a 2009-01-18T21:46:46 Remove unused code for mempcpy.
Jim Meyering 50ad4233 2009-01-02T09:58:09 strftime: avoid compilation failure on Solaris 2.6 * modules/strftime (Depends-on): Add mbrlen and mbsinit. * lib/strftime.c [DO_MULTIBYTE]: Include <wchar.h> unconditionally. Don't #define mbrlen or mbsinit, since now they're guaranteed to be available. Reported by Tom G. Christensen. Details in <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/16180>.
Paul Eggert 2f2f93bf 2008-01-15T16:32:59 Fix problem with getdate on mingw32 reported by Simon Josefsson in <http://lists.gnu.org/archive/html/bug-gnulib/2008-01/msg00192.html>. * lib/getdate.y (get_date): Check "HAVE_DECL_TZNAME", not "defined tzname", when deciding whether to declare tzname. * lib/strftime.c (tzname): Likewise.
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Paul Eggert 3ac95524 2007-02-12T18:49:19 New module 'time', so that apps can include <time.h> as per POSIX and GNU instead of separate include files like time_r.h and timegm.h. This implementation tries out a simpler approach for replacing decls in standard include files (as compared to the string module), somewhat as an experiment. * config/srclist.txt: Comment out mktime.c for now. * doc/gnulib-tool.texi (Initial import): Don't use time_r as an example since it doesn't apply any more. Use generic wording instead. * MODULES.html.sh (Support for systems lacking POSIX:2001): New module 'time'. * lib/time_.h, m4/time_h.m4, modules/time: New files. * lib/strptime.h, lib/time_r.h, lib/timegm.h: Remove. * lib/mktime.c: Include config.h depending on _LIBC, not HAVE_CONFIG_H. Don't include <sys/types.h>; no longer needed since we assume C89. * lib/mktime.c: Don't include "time_r.h"; no longer needed. * lib/strftime.c: Likewise. * lib/time_r.c: Likewise. * lib/nanosleep.c (nanosleep): #undef after include files, not before. * lib/nanosleep.c: Include <time.h> first, to check interface. * lib/strptime.c: Likewise. * lib/time_r.c: Likewise. * lib/timegm.c: Likewise. * lib/strptime.c: Don't include strptime.h or time_r.h; no longer needed. * lib/timegm.c: Don't include timegm.h; no longer needed. * lib/timespec.h: Don't include <sys/time.h> before <time.h>; time.h now handles any problems in that area. (struct timespec, nanosleep): Remove; time.h now arranges for these. * lib/xnanosleep.c: Don't include timespec.h; no longer needed now that time.h defines struct timespec. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Check that nanosleep is declared. Set REPLACE_NANOSLEEP. Don't AC_DEFINE nanosleep; the time module now handles that. * m4/strptime.m4 (gl_FUNC_STPRTIME): Set REPLACE_STRPTIME. * m4/time_r.m4 (gl_TIME_R): Don't define HAVE_TIME_R_POSIX; no longer needed. Set REPLACE_LOCALTIME. * m4/timegm.m4 (gl_FUNC_TIMEGM): Set REPLACE_TIMEGM. * m4/timespec.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC): Move to time_h.m4. (gl_TIMESPEC): Don't check for sys/time.h or struct timespec or nanosleep; time_h.m4 now does that. Don't require gl_USE_SYSTEM_EXTENSIONS; no longer needed directly, and the time module handles this now. * modules/getdate (Depends-on): Remove timespec. Add time. * modules/nanosleep (Depends-on): Likewise. * modules/stat-time (Depends-on): Likewise. * modules/nanosleep (Include): Include time.h, not timespec.h. * modules/strptime (Files): Remove lib/strptime.h. (Depends-on): Add extensions, time. (Include): Include time.h, not strptime.h. * modules/time_r (Files): Remove lib/time_r.h. (Depends-on): Add time. (Include): Include time.h, not time_r.h. * modules/timegm: Likewise. * modules/timespec (Description): Now does timespec-related decls of our own, instead of struct timespec itself. (Depends-on): Add time; remove extensions. (Maintainer): Add self. * modules/utimecmp (Depends-on): Add time; remove timespec. * modules/utimens (Depends-on): Likewise. * modules/xnanosleep (Depends-on): Likewise.
Paul Eggert 5661ab9d 2007-01-18T08:33:34 * MODULES.html.sh (Support for systems lacking POSIX:2001): New module sys_time. * lib/gethrxtime.c: Include <sys/time.h>, since we can no longer assume timespec.h defines struct timeval. * lib/settime.c: Likewise. * lib/utimens.c: Likewise. * lib/gettime.c (gettime): Remove test against HAVE_GETTIMEOFDAY, since we now assume the gettimeofday module. * lib/tempname.c (__gen_tempname): Likewise. * lib/gettimeofday.h: Remove. * lib/gettimeofday.c: Include <sys/time.h> instead of "gettimeofday.h". Don't include <sys/types.h> and <stdlib.h>; shouldn't be needed. Include <time.h>, for 'time()'. (localtime_buffer_addr): Also use this workaround if TZSET_CLOBBERS_LOCALTIME. Set to a dummy static variable by default, to simplify the uses. All uses changed. (localtime, gmtime, tzset, gettimeofday): Reformat slightly so that #undef is inside {}, and 'const' follows type name consistently. (tzset): Define replacement only if TZSET_CLOBBERS_LOCALTIME. (gettimeofday): Do not use the maximum possible value for tv->tv_usec, since that might break usages other than ls.c. Instead, we'll leave ls.c alone. This undoes today's patch by Bruno. Add a compile-time warning for 1s-clock resolution; we've never observed the problem but might as well keep the canary. * lib/nanosleep.c: Include timespec.h first, for interface check. * lib/nanosleep.c: Include <sys/time.h> unconditionally, since we now assume the sys_time module. * lib/tempname.c: Likewise. * lib/timespec.h: Likewise. * lib/nanosleep.c: Don't worry about TIME_WITH_SYS_TIME; no longer needed. * lib/strftime.c: Likewise. * lib/timespec.h: Likewise. * lib/posixtm.c: Include posixtm.h first, for interface check. Don't worry about TM_IN_SYS_TIME; that's wayyy obsolete. * lib/posixtm.h: Include stdbool.h and time.h, for proper interface. * lib/strftime.c: Don't include <sys/types.h>; shouldn't be needed. * lib/sys_time_.h: New file. * lib/timespec.h (struct timespec): Use long int, not long. * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): (gl_FUNC_GETTIMEOFDAY_CLOBBER, gl_PREREQ_GETTIMEOFDAY): Remove obsolescent call to AC_HEADER_TIME. * m4/mktime.m4 (AC_FUNC_MKTIME): Likewise. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise. * m4/strftime.m4 (gl_FUNC_STRFTIME): Likewise. * m4/timespec.m4 (gl_TIMESPEC, gl_CHECK_TYPE_STRUCT_TIMESPEC): Likewise. * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Likewise. * m4/utimbuf.m4 (gl_CHECK_TYPE_STRUCT_UTIMBUF): Likewise. * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Move sys/time.h tests into the sys_time module. Check for gettimeofday just once. Prefix our variables with gl_, not with ac_ or jm_. Tighten test for gettimeofday signature to just check the signature. Merely compile it, since linking doesn't test signature. Improve test for whether gettimeofday.o is actually needed. (gl_FUNC_GETTIMEOFDAY_CLOBBER): Renamed from AC_FUNC_GETTIMEOFDAY_CLOBBER. All uses changed. Use AC_RUN_IFELSE rather than AC_TRY_RUN. If clobbering, set and define GETTIMEOFDAY_CLOBBERS_LOCALTIME. (gl_GETTIMEOFDAY_REPLACE_LOCALTIME): Don't define GETTIMEOFDAY_CLOBBERS_LOCALTIME; that's gl_FUNC_GETTIMEOFDAY_CLOBBER's job. Don't define tzset; that's gl_FUNC_TZSET_CLOBBER's job. * m4/mktime.m4 (AC_FUNC_MKTIME): Just include <time.h> rather than worrying about sys/time.h. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't bother worrying about TIME_WITH_SYS_TIME. * m4/stat-time.m4 (gl_STAT_TIME): Likewise. * m4/posixtm.m4 (gl_POSIXTM): Remove obsolescent call to AC_STRUCT_TM. * m4/sys_time_h.m4: New file. * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Require gl_HEADER_SYS_TIME_H. Don't include sys/time.h. Return from main rather than exiting. Define TZSET_CLOBBERS_LOCALTIME, for consistency with other names; all uses changed. * modules/gethrxtime (Depends-on): Add sys_time. * modules/gettime (Depends-on): Likewise. * modules/gettimeofday (Depends-on): Likewise. * modules/nanosleep (Depends-on): Likewise. * modules/settime (Depends-on): Likewise. * modules/tempname (Depends-on): Likewise. * modules/utimens (Depends-on): Likewise. * modules/gettimeofday (Files): Remove lib/gettimeofday.h. (Include:) Change back to <sys/time.h>. (Maintainer:) Add self. * modules/sys_time: New file. * modules/tempname (Depends-on): Add gettimeofday. * tests/test-gettimeofday.c: Include <sys/time.h> rather than gettimeofday.h.
Eric Blake 96f7b7d9 2007-01-16T16:31:23 * modules/fnmatch (Depends-on): Depend on wchar. * lib/fnmatch.c (WIDE_CHAR_SUPPORT): Assume <wchar.h>. * m4/fnmatch.m4: Likewise. * modules/mbchar (Makefile.am): Assume <wchar.h>. * m4/mbchar.m4: Likewise. * modules/mbswidth (Depends-on): Depend on wchar. * lib/mbswidth.c: Assume <wchar.h>. * m4/mbswidth.m4: Likewise. * modules/quotearg (Depends-on): Depend on wchar. * lib/quotearg.c: Assume <wchar.h>. * m4/quotearg.m4: Likewise. * modules/regex (Depends-on): Depend on wchar. * lib/regex_internal.h: Assume <wchar.h>. * m4/regex.m4: Likewise. * modules/stdint (Depends-on): Depend on wchar. * lib/stdint_.h [!defined WCHAR_MIN]: Assume <wchar.h>. * m4/stdint.m4: Likewise. * tests/test-stdint.c [HAVE_WINT_T]: Likewise. * modules/strftime (Depends-on): Depend on wchar. * lib/strftime.c (DO_MULTIBYTE): Assume <wchar.h>. * modules/strtol (Depends-on): Depend on wchar. * lib/strtol.c: Assume <wchar.h>. * modules/wcwidth (Depends-on): Depend on wchar. * lib/wcwidth.h: Assume <wchar.h>. * m4/wcwidth.m4: Likewise.
Paul Eggert b8120186 2006-10-19T07:32:18 * lib/strftime.c (advance): New macro. (add): Use it to avoid adding 0 to a FILE *. FILE can be an incomplete type, so you can't add 0 to it. Problem reported by Eelco Dolstra for dietlibc.
Paul Eggert 74fcb057 2006-10-08T07:24:56 Don't include <config.h> twice; this doesn't work in some cases, e.g., when config.h has "#define intmax_t long long int" and we include <config.h>, <inttypes.h>, <config.h> in that order. * fprintftime.c: Don't include config.h or fprintftime.h. * fts-cycle.c: Don't include config.h. * strftime.c: Include fprintftime.h if FPRINTFTIME is defined. * xstrtoimax.c: Remove copyright notice since it's short tnow. Don't include config.h or xstrtol.h. Define STRTOL_T_MINIMUM and STRTOL_T_MAXIMUM unconditionally, since we now assume gnulib inttypes.h. * xstrtoumax.c: Likewise. * xstrtol.c: Include config.h and xstrtol.h after defining __strtol and the like, so that this module is more like its siblings. (STRTOL_T_MINIMUM, STRTOL_T_MAXIMUM) [! defined STRTOL_T_MINIMUM]: Remove; no longer needed now that we assume gnulib inttypes.h. 2006-10-07 Bruno Haible <bruno@clisp.org>
Paul Eggert 0632e115 2006-09-13T22:38:14 * _fpending.c: Include <config.h> unconditionally, since we no longer worry about uses that don't define HAVE_CONFIG_H. * acl.c, alloca.c, argmatch.c, atexit.c, backupfile.c: * basename.c, c-stack.c, c-strtod.c, calloc.c, canon-host.c: * canonicalize.c, chdir-long.c, chdir-safer.c, chown.c: * cloexec.c, close-stream.c, closeout.c, creat-safer.c: * cycle-check.c, diacrit.c, dirchownmod.c, dirfd.c, dirname.c: * dup-safer.c, dup2.c, error.c, euidaccess.c, exclude.c: * exitfail.c, fchmodat.c, fchown-stub.c, fd-safer.c: * file-type.c, fileblocks.c, filemode.c, filenamecat.c: * fnmatch.c, fopen-safer.c, fprintftime.c, free.c, fsusage.c: * ftruncate.c, fts-cycle.c, fts.c, full-write.c, gai_strerror.c: * getcwd.c, getdate.y, getdomainname.c, getgroups.c: * gethostname.c, gethrxtime.c, getloadavg.c, getlogin_r.c: * getndelim2.c, getnline.c, getopt.c, getopt1.c, getpass.c: * gettime.c, gettimeofday.c, getugroups.c, getusershell.c: * glob.c, group-member.c, hard-locale.c, hash-pjw.c, hash.c: * human.c, idcache.c, inet_ntop.c, inet_pton.c, inttostr.c: * isdir.c, lchown.c, linebuffer.c, long-options.c, lstat.c: * malloc.c, md5.c, memcasecmp.c, memchr.c, memcmp.c, memcoll.c: * memcpy.c, memmove.c, memrchr.c, mkancesdirs.c, mkdir-p.c: * mkdir.c, mkdirat.c, mkstemp-safer.c, mkstemp.c, modechange.c: * mountlist.c, nanosleep.c, obstack.c, open-safer.c: * openat-die.c, openat.c, pagealign_alloc.c, physmem.c: * pipe-safer.c, posixtm.c, posixver.c, putenv.c, quote.c: * quotearg.c, raise.c, readtokens.c, readtokens0.c, readutmp.c: * realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c, safe-read.c: * same.c, save-cwd.c, savedir.c, setenv.c, settime.c, sha1.c: * sig2str.c, snprintf.c, strdup.c, strerror.c, strftime.c: * stripslash.c, strndup.c, strnlen.c, strpbrk.c, strtod.c: * strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c: * timegm.c, tmpfile-safer.c, unlinkdir.c, userspec.c, utime.c: * utimecmp.c, utimens.c, version-etc-fsf.c, version-etc.c: * xalloc-die.c, xgetcwd.c, xgethostname.c, xmalloc.c: * xmemcoll.c, xnanosleep.c, xreadlink.c, xstrtod.c: * xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c: Likewise.
Paul Eggert a8f0811e 2006-07-06T21:51:28 * lib/.cppi-disable: Add wcwidth. * lib/fnmatch.c (ISBLANK): Remove. All uses changed to isblank. (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. (ISGRAPH): Remove. All uses changed to isgraph. (FOLD) [!defined _LIBC]: Remove special case. * lib/getdate.y (lookup_word): Remove no-longer-needed call to islower. * lib/regext_internal.h (isblank): Depend on HAVE_DECL_ISBLANK, not HAVE_ISBLANK. * lib/strftime.c (TOLOWER, TOUPPER) [!defined _LIBC]: Remove special case. * m4/fnmatch.m4 (_AC_LIBOBJ_FNMATCH): Don't check for getenv decl; no longer needed. Check for isblank decl. * m4/mkstemp.m4 (gl_PREREQ_TEMPNAME): Don't check for getenv decl. * m4/regex.m4 (gl_PREREQ_REGEX): Dheck for isblank decl instead of existence.
Jim Meyering f1c279d9 2006-06-29T21:11:49 From Derek R. Price: * lib/strftime.c: Assume strftime() exists. * m4/strftime.m4: Don't call AC_FUNC_STRFTIME.
Paul Eggert b83182a4 2006-01-04T18:55:42 * strftime.c (tzname): Don't declare if it is already #defined. Problem reported for Mingw by Mark Junker.
Paul Eggert c0e63657 2005-09-22T23:37:18 * strftime.c (my_strftime): Rewrite the previous change slightly, to make it a bit faster and (I hope) clearer. * strftime.c (my_strftime): Add support for %:z, %::z, %:::z. Fix bug in formats like %2N. * strftime.c [FPRINTFTIME] (fprintftime): Provide a new interface: size_t fprintftime (FILE *fp, char const *fmt, struct tm const *tm, int utc, int nanoseconds); Background: date should not have to allocate a megabyte of virtual memory to handle a format argument like +%1048575T. When implemented with strftime, it must allocate such a buffer, use strftime to fill it in, print it, then free it. With fprintftime, it simply prints everything and exits. With no need for memory allocation, that's one fewer way to fail. * strftime.c (my_strftime): Parse the colons of %:::z *after* the optional field width, not before, so we accept %9:z, not %:9z. (my_strftime): Be sure to use L_('x') for literals.
Jim Meyering 995cff88 2005-08-19T09:21:57 Make the %s format (seconds since the epoch) work for a negative number and when used with a zero-padded field width, e.g. %015s. (my_strftime): Move the `do_number_sign_and_padding' label so that it precedes the code to set `digits'. Otherwise, %0Ns wouldn't work. Before this change, `date -d @-22 +%05s' would print `00-22'. Now, it prints `-0022', as it should.
Paul Eggert f9914d0b 2005-07-04T04:40:46 Remove the dependency of the strftime module on the tzset module. * modules/strftime (Depends-on): Remove dependency on tzset. * lib/strftime.c (my_strftime) [! defined _LIBC && ! HAVE_RUN_TZSET_TEST]: Copy the input structure, to work around some of the bug with Solaris 2.5.1 and Solaris 2.6. If you still care about these old Solaris releases, you should also use the tzset module, but we won't require it as a dependency any more since we don't want LGPLed code to depend on GPLed code. * m4/strftime.m4 (gl_FUNC_STRFTIME): Don't require gl_FUNC_TZSET_CLOBBER.
Paul Eggert 267a39ba 2005-05-14T06:03:57 *** empty log message ***
Paul Eggert 8d007e5a 2005-03-26T18:08:56 Propagate intprops.h comment fixes to mktime.c and strftime.c.
Paul Eggert 077c39d9 2005-03-19T05:34:28 (my_strftime): If the underlying strftime returns 0 (which shouldn't happen), generate nothing instead of returning 0 immediately, so that nstrftime (NULL, ...) doesn't return 0.
Paul Eggert ef38266d 2005-03-16T01:02:49 (my_strftime): Prepend space to format so that we can reliably distinguish strftime failure from empty output on POSIX hosts.
Paul Eggert 3a363a3b 2005-03-14T23:23:43 * strftime.c (my_strftime) [HAVE_STRFTIME && ! (_NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)]: Initialize the first byte of ubuf[].
Paul Eggert eef56b54 2005-03-09T19:11:23 Factor int-properties macros into a single file, except for glibc-related files. * lib/intprops.h: New file. * lib/getloadavg.c: Include it instead of limits.h. (INT_STRLEN_BOUND): Remove. * lib/human.c: Include intprops.h. (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself. * lib/human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000. * lib/inttostr.h: Include intprops.h instead of limits.h. (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove. * lib/mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros, for consistency with intprops.h. (time_t_is_integer, twos_complement_arithmetic): Use them. * lib/sig2str.h: Include <signal.h>, intprops.h. (INT_STRLEN_BOUND): Remove. * lib/strftime.c (TYPE_SIGNED): Remove. (INT_STRLEN_BOUND): Switch to same implementation as intprops.h. * lib/strtol.c: Adjust comments to match intprops.h. * lib/userspec.c: Include intprops.h. (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. * lib/utimecmp.c, lib/xnanosleep.c, lib/xstrtol.c: Likewise. * lib/utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT instead of rolling our own expressions. * lib/xstrtol.c: Include xstrtol.h first, to test interface. * modules/getloadavg (Files): Add lib/intprops.h. * modules/human (Files): Likewise. * modules/inttostr (Files): Likewise. * modules/sig2str (Files): Likewise. * modules/userspec (Files): Likewise. * modules/utimecmp (Files): Likewise. * modules/xnanosleep (Files): Likewise. * modules/xstrtol (Files): Likewise.
Paul Eggert 4f5d6947 2005-03-09T18:39:39 Include <stdbool.h>. Use bool where appropriate, instead of int. (my_strftime): Do not mishandle years close to INT_MAX, by doing the right thing even if adding 1900 would overflow. Similarly for tm_mon + 1 and tm_yday + 1. Make %Y always equivalent to %C%y, and similarly for %G and %g. (DO_NUMBER, DO_NUMBER_SPACEPAD): Set digits to d, not a conditional. (DO_SIGNED_NUMBER): New macro. (my_strftime) [HAVE_TZNAME]: Don't dump core if tp->tm_dst > 1.
Paul Eggert aa33a4be 2004-11-11T05:57:27 (SHR): New macro, which is a portable substitute for >> that should work even on Crays. (tm_diff): Use it.
Paul Eggert fdc514fe 2004-11-09T20:55:12 (DO_MULTIBYTE): Check for wchar.h, too.
Paul Eggert a802e7b9 2003-09-30T06:11:03 * strftime.c (tm_diff) [! HAVE_TM_GMTOFF]: Fix arg typo in previous patch.
Paul Eggert addf390d 2003-09-12T19:22:07 Remove K&R cruft.
Paul Eggert 7b224479 2003-09-06T21:34:07 Add time_r module. Change timegm, mktime, and strftime to use localtime_r and gmtime_r, now supplied by the time_r module. This fixes some timegm bugs and cleans up mktime and strftime a bit.
Paul Eggert 29ad412d 2003-08-16T05:38:25 Merge from coreutils.
Paul Eggert 4589d52c 2003-07-09T22:48:52 Switch from LGPL to GPL.
Jim Meyering 0112e5e2 2003-05-12T08:20:29 (my_strftime): Let the `-' (no-pad) flag affect the space-padded-by-default conversion specifiers, %e, %k, %l.
Jim Meyering 0fb89595 2003-04-11T15:00:23 (widen): Cast alloca return value to proper type.
Jim Meyering 45b705d0 2003-04-11T14:59:01 From GNU libc. (my_strftime): Handle very large width specifications for numeric values correctly. Improve checks for overflow.
Jim Meyering 7535c942 2003-04-11T14:57:16 (widen) [COMPILE_WIDE]: Merge nearly-identical definitions. (nl_get_alt_digit) [! defined my_strftime]: Define. (my_strftime) [_NL_CURRENT]: Merge nearly-identical uses of _nl_get_alt_digit and _nl_get_walt_digit.
Jim Meyering c6e790b6 2003-04-11T14:36:24 (my_strftime): Merge in locale-related changes from libc. These changes have no effect outside of _LIBC.
Jim Meyering d763b0b6 2001-12-09T21:02:43 (my_strftime_localtime_r): Include this function definition in the `#if ! HAVE_TM_GMTOFF' block.
Jim Meyering 71ad25e2 2001-05-20T20:41:20 (my_strftime): Define to nstrftime if emacs, but only if my_strftime is not defined. (extra_args, extra_args_spec, extra_args_spec_iso): Rename from ut_argument, ut_argument_spec, ut_argument_spec_iso, respectively. Add one more extra argument: a nanoseconds value. All uses changed. (ns): New macro. (my_strftime function): Add %N format. (emacs_strftimeu): Renamed from emacs_strftime, with extra ut argument.
Jim Meyering 0d99837f 2001-02-17T16:50:27 update comments from libc
Jim Meyering 0ea8ff5b 2001-01-04T10:19:43 Sync with glibc time/strftime.c 1.81.
Jim Meyering a1afa17b 2000-11-23T07:24:51 (my_strftime): Do not invoke mbrlen with a size of (size_t) -1; it's not portable.
Jim Meyering c3f1de2d 2000-10-26T08:08:06 Update from libc.
Jim Meyering d286a6b3 2000-08-30T07:58:01 Merge in changes from GNU libc.
Jim Meyering dcbcec14 2000-04-17T11:39:26 (my_strftime) [strftime]: Declare strftime here, since the definition of it to rpl_strftime also defined-away the system's declaration.
Jim Meyering 4c81c55a 2000-04-03T07:09:38 (my_strftime): Make sure we call the system strftime, not ourselves, when invoking the underlying strftime.
Jim Meyering cd89762c 2000-01-06T21:31:48 Sync with the GNU C Library.
Jim Meyering c730015f 2000-01-02T07:09:54 (my_strftime): Some old compilers object to '\a', so don't bother optimizing for it.
Jim Meyering 20b83f8e 1999-09-19T08:09:50 Remove useless parens in #if directive
Jim Meyering 6dca64d7 1999-04-06T14:22:06 Update from master source in libc, removing %f.
Jim Meyering cf42d3e5 1998-12-07T03:12:10 ansideclify
Jim Meyering 26119e04 1998-10-18T14:09:48 Don't invoke localtime_r or gmtime_r unless it's the GNU C library's localtime_r and gmtime_r; there are too many buggy implementations of localtime_r and gmtime_r out there, and it's not worth keeping track of all the different bugs. * strftime.c (__EXTENSIONS__): Remove. (my_strftime_gmtime_r): Renamed from gmtime_r; all uses changed. (my_strftime_localtime_r): Renamed from localtime_r; all uses changed. Base them on localtime/gmtime if not _LIBC.
Jim Meyering 6579bcf6 1998-10-18T01:10:21 Declare localtime_r if necessary.
Jim Meyering 184e8608 1998-10-17T12:39:30 Some systems require <unistd.h> to be included before <time.h> for localtime_r to be declared properly.
Jim Meyering 732c30c0 1998-09-27T12:45:33 (my_strftime): Update from FSF.
Jim Meyering 140b7a20 1998-04-28T12:19:53 tweak from FSF
Jim Meyering fd396561 1997-11-18T03:32:00 (_REENTRANT): #define, as some hosts need this to declare localtime_r properly. From Paul Eggert.
Jim Meyering 1873f591 1997-11-13T13:22:54 Update from FSF.
Jim Meyering 2670a464 1997-10-22T14:06:16 update from FSF
Jim Meyering b0c278e7 1997-05-28T12:19:28 correct/normalize indentation in cpp directives
Jim Meyering 819c5a82 1997-05-28T12:01:33 update from FSF
Jim Meyering 1f662bb3 1997-01-23T02:23:44 revert last change
Jim Meyering a77b1b10 1997-01-22T23:23:04 [strftime]: Add parameters to macro definition. From Drepper.
Jim Meyering cd9581e9 1997-01-22T22:43:15 (_strftime_copytm): New function, to work around Solaris 2.5 tzset bug. From Paul Eggert.
Jim Meyering 5760692e 1996-12-21T13:51:26 update from GNU libc
Jim Meyering 3494f0f1 1996-12-21T01:40:43 Update from GNU libc.
Jim Meyering 4b249620 1996-12-18T16:56:46 run cpp-indent
Jim Meyering 7182a44e 1996-12-18T16:54:48 another new version ...
Jim Meyering 478d5850 1996-12-18T00:21:38 Update from GNU libc.
Jim Meyering e34035c2 1996-12-10T03:17:01 add a space
Jim Meyering e0dd89ba 1996-12-10T03:16:36 revert last change.
Jim Meyering 3a944dc2 1996-12-10T02:46:42 [HAVE_TZNAME || defined __LIBC]: Declare tzname.
Jim Meyering db112fc7 1996-12-09T13:02:21 [HAVE_TZNAME]: Declare tzname. Patch from Karl Heuer.
Jim Meyering 2b7805a3 1996-12-07T18:52:54 (strftime): Remove " %Z" part of format for %c. Suggestion from Paul Eggert.
Jim Meyering 3b3231a0 1996-12-01T04:08:17 Update from GNU libc.
Jim Meyering 1631b5c0 1996-11-05T04:22:40 Fix copyright.
Jim Meyering 7eed8715 1996-10-10T02:56:10 (strftime): Accommodate the broken C compiler that comes with SunOS -- don't initialize aggregates in decls of automatic variables. Reported by Kaveh Ghazi.
Jim Meyering afabd949 1996-09-17T04:13:22 (strftime): New version, from GNU libc.
Jim Meyering a269665d 1996-09-06T03:18:46 revert last change
Jim Meyering 14bfc49e 1996-09-06T03:12:04 New version from glibc.
Jim Meyering 2d46f4b5 1996-08-17T05:15:44 Update from GNU libc -- this adds back %z and %s formats and reverts to old behavior where unrecognized format like %E is treated as eqivalent to `E'.
Jim Meyering 7e6585ee 1996-07-30T05:33:30 Update from GNU libc master.
Jim Meyering 81f8f912 1996-07-17T05:29:47 Use `;' instead of (void)0.
Jim Meyering 5f3cca13 1996-07-16T05:08:29 Use `(void)0' as second arg to add macro. Omitting that second arg made some HPUX C compiler report an error. From Kaveh R. Ghazi.
Jim Meyering 6ff53d6b 1996-07-16T04:58:04 Update from FSF.
Jim Meyering 783c1624 1996-07-15T03:56:06 indent cpp-directives