Re: cal: First day of the week

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 04, 2009 at 08:37:03PM +0000, Pádraig Brady wrote:
> +	int wfd = (int) nl_langinfo(_NL_TIME_WEEK_1STDAY);

 So dirty, so undocumented... the nl_langinfo() is really tricky.

 cal.c: In function ‘main’:
 cal.c:314: warning: cast from pointer to integer of different size

 You need to use union:

		int wfd;
		union { unsigned int word; char *string; } val;
		val.string = nl_langinfo(_NL_TIME_WEEK_1STDAY);

		wfd = val.word;

> +	wfd = day_in_week(wfd%100, (wfd/100)%100, wfd/(100*100));
> +	weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7;
>  #endif

 Fixed. Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux