Manual / cal
cal(1)
| CAL(1) | General Commands Manual | CAL(1) |
NAME
cal - display a Gregorian calendar
SYNOPSIS
cal [ [ month ] year ]
DESCRIPTION
With no operands, cal displays a calendar for the current month, read from the machine's own clock (see date(1) for the same clock and its own refusal when none is present).
With one operand, year (1-9999) alone selects that whole year: every month is printed, one per block, separated by a blank line. This is a KNOWN GAP against BSD cal(1), whose three-column full-year layout this build does not reproduce.
With two operands, month (1-12) and year select a single month, rendered to match this project's BSD reference exactly: a centred title line, the Su Mo Tu We Th Fr Sa header, and six weekly rows (a wholly blank row where the month needs fewer), every line padded to 22 columns.
Leap years follow the ordinary Gregorian rule (divisible by 4, not by 100 unless also by 400). The day of the week is found by Sakamoto's algorithm. The 1752 Julian-to-Gregorian transition is a KNOWN GAP: every year is treated as proleptic Gregorian.
FILES
/usr/man/CAL this page
SEE ALSO
DIAGNOSTICS
Exit status is 0; 1 if no operands were given and the machine has no valid clock reading; 2 for a usage error (a non-numeric operand, a month outside 1-12, a year outside 1-9999, or more than two operands).
BUGS
No three-column full-year layout (see above). No support for the pre-1752 Julian calendar.
| September 15, 2026 | maux |