NetBSD has its own curses implementation and initscr() does not
terminate with an error if TERM is not set properly.
Instead check the return value and exit if an initialization
error occurs.
void
initcurses(void)
{
- initscr();
+ char *term;
+
+ if (initscr() == NULL) {
+ term = getenv("TERM");
+ if (term != NULL)
+ fprintf(stderr, "error opening terminal: %s\n", term);
+ else
+ fprintf(stderr, "failed to initialize curses\n");
+ exit(1);
+ }
cbreak();
noecho();
nonl();