Re: cal's -y flag usage

Jeremie Courreges-Anglas <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
On Thu, Jun 25, 2026 at 09:13:44AM +0000, Johannes Thyssen Tishman wrote:
> While playing with cal I noticed that using the -y flag along with a
> single non-numerical argument or with two arguments would essentially
> cause the option to be ignored:
> 
> $ cal -y jun
> $ cal -y jun 2026
> $ cal -y 06 2026
> 
> All three commands output the calendar for June 2026 instead of the
> entire year. Before I try to patch this, is this the desired/intended
> behaviour?

IMO -y should be ignored when a year is later specified on the command
line (current behavior), and should conflict with specifying a month.

> In case a change is desired, would it make sense to split the SYNOPSIS
> in the man page into two lines? E.g.:
> 
> cal [-jmw] [month] [year]
> cal [-jmwy] [year]

It doesn't really make sense to specify [year] when you specify -y.
I'm not sure the synopsis needs to be amended.

-- 
jca
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.