summaryrefslogtreecommitdiffstats
path: root/misc-utils/cal.c
diff options
context:
space:
mode:
authorSami Kerola2015-05-17 19:27:42 +0200
committerKarel Zak2015-05-18 11:41:48 +0200
commitc5ad7b59acc8b12fa2c10624bbf12dc20910f88d (patch)
treecedfeb4a5dcd7ebaf7e243200647b9ab5021fecb /misc-utils/cal.c
parentzramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns (diff)
downloadkernel-qcow2-util-linux-c5ad7b59acc8b12fa2c10624bbf12dc20910f88d.tar.gz
kernel-qcow2-util-linux-c5ad7b59acc8b12fa2c10624bbf12dc20910f88d.tar.xz
kernel-qcow2-util-linux-c5ad7b59acc8b12fa2c10624bbf12dc20910f88d.zip
cal: fix January 1753 week number printout
Earlier output was clearly broken. $ cal -w 1 1753 January 1753 Su Mo Tu We Th Fr Sa 51 1 2 3 4 5 6 52 7 8 9 10 11 12 13 52 14 15 16 17 18 19 20 52 21 22 23 24 25 26 27 52 28 29 30 31 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r--misc-utils/cal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index f1df759f1..548e56712 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -609,7 +609,7 @@ static void cal_fill_month(struct cal_month *month, const struct cal_control *ct
else
month->weeks[i] = SPACE;
weeklines--;
- if (52 < weeknum && i == 0)
+ if (i == 0 && (52 < weeknum || (month->year == 1753 && 51 < weeknum)))
weeknum = week_number(month->days[DAYS_IN_WEEK * (i + 1)], 1, month->year, ctl);
else if (52 < weeknum)
weeknum = week_number(31, 12, month->year, ctl);