Some valid time stamps were being rejected (notably -1, and
time stamps before 1900 on 64-bit hosts). And some invalid
time stamps were being accepted, e.g. September 31.
* lib/posixtm.h (posixtime): Return bool instead of time_t, so
that we can return (time_t) -1 successfully.
* lib/posixtm.c: Likewise.
[HAVE_STDBOOL_H]: Include <stdbool.h>.
(bool, false, true) [!HAVE_STDBOOL_H]: New type.
(t): Remove static var.
(year, posix_time_parse): Now takes struct tm * arg to modify, instead
of static var. All uses changed.
(year): Do not reject years before 1900; they can occur with
64-bit time_t.
(posix_time_parse): Do not check for out-of-range components;
that is now the caller's responsibility, since our checks were
only approximations.
(posixtime): Use mktime to check for out-of-range components,
since it knows them exactly.
If mktime returns (time_t) -1, check whether an error actually occurred
by invoking localtime on -1.
(main) [TEST_POSIXTIME]: Check for input data errors, and report
posixtime failures better.
Improve the test data (in comments only).
the utmp.ut_exit member, but not the utmpx.ut_exit member, then
undefine HAVE_UTMPX_H. For AIX 4.3.3. Doing all this in cpp is
a big kludge; someday we'll put the brains in an autoconf macro.
(UT_EXIT_E_TERMINATION, UT_EXIT_E_EXIT): Define.
S_IFREG is defined, instead of using a test specific to glibc
2.2. This should be safe, since POSIX requires S_ISREG and
Unix Version 7 had S_IFREG. We don't need to check for
<sys/types.h> since we don't use any symbols that it defines.
use of localtime, and then of gettimeofday would cause trouble:
the localtime call used to initialize rpl_gettimeofday's save
mechanism would clobber ls's current local time information so
that in any long listing the first file would always be listed
with date 1970-01-01. Analysis by Volker Borchert.
(localtime): Undefine.
(rpl_localtime): New function.