Jim Meyering [Wed, 7 Aug 2002 22:02:23 +0000 (22:02 +0000)]
Fix some minor time-related bugs with POSIX time arguments.
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).
Jim Meyering [Fri, 2 Aug 2002 14:42:37 +0000 (14:42 +0000)]
Include hard-locale.h, xmemcoll.h.
(hard_LC_COLLATE): New var.
(different): Args are now char *, not const char *.
Use xmemcoll instead of memcmp to compare lines, so that
LC_COLLATE has effect. However, use memcmp if it is an
easy locale.
(check_file): Do not include newline in comparison, so that
xmemcoll has a byte to stomp on temporarily.
(main): Set hard_LC_COLLATE.
Jim Meyering [Thu, 1 Aug 2002 08:47:33 +0000 (08:47 +0000)]
Change behavior to conform to POSIX 1003.1-2001:
- Do not adjust scheduling priority.
- Redirects stderr to stdout, if stderr is not a terminal.
- Exit status is now 126 if command was found but not invoked,
127 if nohup failed or if command was not found.
Fix bug: command was run if nohup.out wasn't writeable.
Jim Meyering [Mon, 29 Jul 2002 12:17:42 +0000 (12:17 +0000)]
Change behavior to conform to POSIX 1003.1-2001:
- Do not adjust scheduling priority.
- Redirects stderr to stdout, if stderr is not a terminal.
- Exit status is now 126 if command was found but not invoked,
127 if nohup failed or if command was not found.
Jim Meyering [Sat, 27 Jul 2002 21:39:00 +0000 (21:39 +0000)]
(jm_PREREQ_READUTMP): Don't check just
`struct utmpx.ut_exit' and `struct utmp.ut_exit'. Instead, check
all combinations of utmp/utmpx and ut_termination/e_termination
and ut_exit/e_exit.
Jim Meyering [Sat, 27 Jul 2002 21:35:39 +0000 (21:35 +0000)]
If we have both utmpx.h and utmp.h, and there exists
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.
Jim Meyering [Sat, 27 Jul 2002 08:45:49 +0000 (08:45 +0000)]
Port to POSIX 1003.1-2001 "nice", which
requires the option "-n 5" rather than "-5". This matters
with GNU "nice" if the user has set the _POSIX2_VERSION
environment variable.