An ncurses virgin installs it and tries it out

//rubenerd.com/files/uploads/screenie.ncurses.png

Having dabbled in a ton of different languages lately, I felt the overwhelming urge this week just to get back to some good ol' C, and what better and more productive way to do so that to mess around with ncurses!

I have to come clean and admit this, but I've never really used ncurses for anything other than some rudimentary crap, and what little I did I've completely forgotten in a vast ocean of nested Java System.in streamreaders. I've written a ton of scripts and basic applications to run in the shell (mostly for server admin tasks) but I've never used ncurses to make more sophisticated shell interfaces, so I thought I'd finally give it a shot.

Getting ncurses in the first place

The first thing that always trips me up is I forget having the ncurses binaries (which most free and open source OSs do) is different from having the development versions you can include in C code. Fortunately it's really simple to install on at least the systems I maintain.

Here's a quiz: which is for FreeBSD and which is for Fedora? :)

# pkg_add -rv ncurses-devel
or
# cd /usr/ports/devel/ncurses-devel
# make install clean
# yum install ncurses-devel

In either case, it works! Hallelujah! I can never spell that word.

#include <stdarg.h>
#include <ncurses.h>

int main(void) {
    initscr();
    printw("Grilled cheese sandwiches!");
    refresh();
    getch();
    endwin();

    return 0; /* Is all gooooood! */
}

The iPad has just come out!? Why ncurses?

Two reasons. First, I have a whole bunch of machines that just exist to run Folding@Home that don't have X on them at all, and I would love to create pretty little interfaces I could use with them.

Secondly, and you'll probably think it's silly, but our first family computer was a DOS machine and I've always wanted to write my own *nix versions of some of my favourite old DOS applications that I can run in FreeBSD or on my Mac Terminal. For example, my favourite editor of all time is still the IBM E Editor, and having a version of that with syntax highlighting would make me ditch Vim, nano and TextMate for good! I know, I know, it's sad and silly, but it'd be so much fun! Do any open source implementations of REXX exist? That was a fun language :).

My studies start again in two weeks, wonder how much of this I can do before then? At the very least I'd like to have that old DOS menu system ported. Sounds like an alcoholic beverage.