Re: cal: add option to highlight the current day

Walter Alejandro Iglesias <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
On Sun, Jul 05, 2026 at 11:06:19AM +0000, Johannes Thyssen Tishman wrote:
> 2026-07-05T12:38:13+0200 Walter Alejandro Iglesias <[email protected]>:
> > On Sat, Jul 04, 2026 at 07:25:20AM -0600, Theo de Raadt wrote:
> > > Calling tgetent() late is bizzare, and it made you do this:
> > > 
> > > -       if (pledge("stdio", NULL) == -1)
> > > +       if (pledge("stdio rpath tty", NULL) == -1)
> > >                 err(1, "pledge");
> > > 
> > > In a word: Nope.
> > > 
> > > 
> > 
> > I've had this patch for a while.  I didn't post it here because I
> > thought no one would be interested.  Now I've updated it with the latest
> > sources.
> > 
> > When you pipe the output to a file it does not send the highlight code.
> > 
> > It also corrects separation between rows of months with cal -y.
> 
> Hi Walter, thanks for sharing. I see that you did some things
> differently in your patch. Perhaps you could send these as suggestions
> to the patch I sent if you prefer them? This way we can avoid splitting
> the thread.

Sorry!  You're right, this is your project.  Take what’s useful to you
from it and throw the rest away. :-)

> 
> I've also thought about printing the calendar day by day directly in the
> loop instead filling a buffer first. Perhaps others have an opinion on
> this. However, I think it's better to get the escape sequences with
> tgetstr instead of hardcoding them, as this honors termcap.
> 
> Regarding the separation between rows of months with cal -y, I see your
> point. However, the rows all have a hight of 8 lines. Yes, there's not
> always an empty line between months, but I think I prefer a consistent
> grid. Perhaps this could be discussed in a separate thread.
> 

-- 
Walter
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.