]> git.ipfire.org Git - thirdparty/util-linux.git/commit
cal: honor num_months when only a year argument
authorJ William Piggott <elseifthen@gmx.com>
Mon, 22 Jan 2018 20:05:08 +0000 (15:05 -0500)
committerKarel Zak <kzak@redhat.com>
Wed, 24 Jan 2018 12:24:33 +0000 (13:24 +0100)
commit2bcf8f7934649a5ee7925cdfdb12ca5abbf59b38
treeb6ef28531fbeb8403de521e8b97be35a39e81b20
parent0aade1d3196524b7f36137191cba9be5e007028f
cal: honor num_months when only a year argument

I don't know if this was an oversight or an overzealous
interpretation of POSIX. Just in case, I'll address the
POSIX possibility. POSIX description for cal(1) says:

  If only the year operand is given, cal shall produce a
  calendar for all twelve months in the given calendar year.

It also says that cal(1) has no options, so in that context
if an option is given then it should be expected to override
POSIX behavior.

Before patched all of these command displayed a full year:
cal -1 2020
cal -3 2020
cal -n6 2020

Patched the number of months options are honored.

This patch also fixes the -1 option which was a no-op.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
misc-utils/cal.c