]> err.no Git - util-linux/commit
cal: fix first day of the week calculation on BE systems
authorKarel Zak <kzak@redhat.com>
Thu, 11 Feb 2010 15:29:05 +0000 (16:29 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 16 Feb 2010 08:58:57 +0000 (09:58 +0100)
commitc3e3134eb7a252706f1efe53f6f8b5e4309a79e2
tree7960f81393c21bed366450f999ebc9935cee946f
parentad83f970362c96cdcaa237780212480e6925f919
cal: fix first day of the week calculation on BE systems

This reverts commit dcb54fafb128ab41772ae217afc6a7612e2cc446,
"cal: remove gcc-ism from nl_langinfo() call".

The code:

int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY);

does not work on big-endian machines. The original solution based on
union is better.

Note that the "type punning" is not gcc-ism any more, it's allowed
by C99 (6.5.2.3).

Reported-by: Joseph Jezak <josejx@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/cal.c