Roy's Blog

A Hacker's musings on Code | Tech | Life

After starting the year with curses work, I decided to do some more!

Currently we lack Soft Label Key functions as specified by POSIX. What are these? Glad you asked! Soft Label Keys ripoff a line from the bottom of the screen and allow for up to 8 keys to be displayed there. You can define labels for them, colours, etc.

"BIG WHOOP!" I hear you say. "My app already does this, why should I care?"

Because SLK also works with the terminfo database to work out if the terminal natively supports labels (via plab_norm, label_on, etc)! This means a line doesn't have to be ripped off from the screen so no real-estate is lost. Sadly, no terminal actually seems to support these markings. But if one is ever made, it should work fine.

Now, not many curses apps actually use the SLK functions, probably for this very reason. But some do, and it is a standard so I've coded NetBSD to support this natively.

Sadly, this has uncovered a bug in the NetBSD curses library where cursor movement in a one line window at the bottom of the screen appears to push the window up. This is very visible with SLK and will have to be fixed for any apps that actually use it, but the SLK implementation itself is sound as resizing the terminal forces a redraw and it looks fine.

Discuss this Post

So over the holidays, I managed to get in some good quality family time and find some time to work on some Open Source stuff. I meant to work mainly on dhcpcd, but it turned out I spent most of my time working on NetBSD curses library so that Python Curses now works with it. Now, most people reading this blog may not care much for NetBSD or for curses, but it's important because ncurses is used pretty much everywhere by default ..... aside from NetBSD. And most readers should know, I go out of my way to promote interoperable software even when it's at a detriment to my own projects. That's just how I roll.

There is a apparently a thing called PD Curses but I don't know anywhere that actually uses it by default. If you know, please email me @ or . I do know that the pkgsrc curses framework supports it.

And this is the thing I'm currently doing. As NetBSD curses supports more POSIX functions (and a few ncurses extensions, sadly) more and more packages now work alongside NetBSD curses, so I'm plowing through pkgsrc again moving things to the curses framework. This is important, because there is logic in devel/ncurses to use NetBSD curses when passing certain criteria, but sadly this always brings ncurses as a possibility to be linked or it's header used, both of which are quite bad for NetBSD curses so there is a method to my madness.

One interesting thing though is that since I started comitting my curses patches, it turns out that Sabotage Linux is using NetBSD curses and made it portable. I'm chatting with one of their devs and we're starting to merge of a few of their patches back into NetBSD.

Discuss this Post

My prior terminfo work has been completed and merged with curses. Userland applications have been re-worked where needed and everything is working just fine!

So NetBSD finally has an up to date replacement for the legacy termcap it currently uses. Well, it will have when merged - I've only just asked for testing so it might take some time before it hits -current.

Discuss this Post