cal: bug on FreeBSD

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

 



Hi,

cal skips the first day of the week if it has 2 digits.

# diff ./cal
 Mo Tu We Th Fr Sa Su
              1  2  3
  4  5  6  7  8  9 10
-11 12 13 14 15 16 17
-18 19 20 21 22 23 24
-25 26 27 28 29 30
+ 12 13 14 15 16 17
+ 19 20 21 22 23 24
+ 26 27 28 29 30

The bug was introduced by my own commit
07ac4aa9  cal: all output must use my_putstring

This is the related code in cal_output_months()

for (d = DAYS_IN_WEEK * week_line;
     d < DAYS_IN_WEEK * week_line + DAYS_IN_WEEK; d++) {
	if (0 < i->days[d]) {
		if (reqday == i->days[d])
			sprintf(out, "%*s%s%*d%s", skip - (ctl->julian ? 3 : 2),
			       "", Senter, (ctl->julian ? 3 : 2),
			       i->days[d], Sexit);
		else
			sprintf(out, "%*d", skip, i->days[d]);
/*                             ^^^^^
 *         if we print this with fputs instead of my_putstring/putp
 *         below than it looks good */
	} else
		sprintf(out, "%*s", skip, "");
	my_putstring(out);
	if (skip < (int)ctl->day_width)
		skip++;
}


Is putp() broken on that machine or could we fix it?

cu,
Rudi
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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