Most of cal's output has the year in the month header. The exception is when a full year is output, which then has a top header containing the year. There is a bug when using --span with --year, --Year, or with only a year for the date parameter; then months for multiple years are output and only one year is displayed at the top. These are all broken: cal -Sy 2020 cal -SY 2020 cal -S 2020 cal -3 2020 (this is broken in the current release because it too sets --span, but still displays 12 months) The top header typically scrolls off the screen for a full year output anyway. So it is convenient to have the year included in each month. To fix these issues and to make cal's output consistent, always display the year in the month header. Signed-off-by: J William Piggott <elseifthen@xxxxxxx> --- misc-utils/cal.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 562ae2afb..8dea2c459 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -705,17 +705,16 @@ static void cal_output_header(struct cal_month *month, const struct cal_control char out[FMT_ST_CHARS]; struct cal_month *i; - if (ctl->header_hint || ctl->header_year) { + if (ctl->header_hint) { for (i = month; i; i = i->next) { sprintf(out, _("%s"), ctl->full_month[i->month - 1]); center(out, ctl->week_width - 1, i->next == NULL ? 0 : ctl->gutter_width); } - if (!ctl->header_year) { - my_putstring("\n"); - for (i = month; i; i = i->next) { - sprintf(out, _("%04d"), i->year); - center(out, ctl->week_width - 1, i->next == NULL ? 0 : ctl->gutter_width); - } + my_putstring("\n"); + for (i = month; i; i = i->next) { + sprintf(out, _("%04d"), i->year); + center(out, ctl->week_width - 1, + i->next == NULL ? 0 : ctl->gutter_width); } } else { for (i = month; i; i = i->next) { -- 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