]> 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>
Thu, 11 Feb 2010 15:29:05 +0000 (16:29 +0100)
commitaebb9522b78ded9cc00475b2dfc98813a0cbf202
tree94b89e67e56eb9981abe392d8cf3a1a3b9997225
parentf4bf2458f608b639cfa5ff6f0bfe836bcdf81a9c
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