[TUHS] History of cal(1)?
Dan Cross via TUHS
tuhs at tuhs.org
Tue Sep 23 00:51:43 AEST 2025
On Sat, Sep 20, 2025 at 4:35 PM John Levine <johnl at taugh.com> wrote:
> It appears that Dan Cross via TUHS <crossd at gmail.com> said:
> >My suspicion is that it was not, and this is a case of parallel
> >invention: after all, a program that prints out a calendar is
> >obviously useful. ...
>
> It is, but a program that has all the logic to adjust for 16th century
> calendar changes, not so much. (Try "cal 9 1752")
The amount of logic required to handle that in the 5th Ed version of
`cal` is surprisingly small, consisting of only three places and
perhaps a total of 8 or 9 lines of code, depending on how one wants to
count.
> My impression is that the Unix cal program was always this overimplemented
> so perhaps we can see whether other earlier programs did that too.
I edited a copy to get it to compile with a recent compiler. The
changes were mainly to modernize the C dialect `=+` vs `+=` and that
kind of thing; I added prototypes in a handful of places, and used ISO
function definitions and a couple of `#include`'s. The result is 214
lines of code, including whitespace. Forgive me, but I'd hardly call
that "over-implemented."
THVV's Multics calendar program is actually meant to produce printable
calendars to hang on a wall, with enough space that one could write
birthdays and so forth onto them, as one might on a hanging calendar
bought in a store. That program is over a thousand lines of code PL/1
code (including significant comments and whitespace):
https://github.com/dancrossnyc/multics/blob/main/library_dir_dir/system_library_standard/source/bound_printing_cmds_.s.archive/calendar.pl1
Multics calendar does not appear to handle the Sep 1752 switch, however.
- Dan C.
More information about the TUHS
mailing list