mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Fix initscr() crash on NetBSD
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.
This commit is contained in:
parent
829bcdd7d4
commit
3ccbaef87b
11
noice.c
11
noice.c
|
@ -257,7 +257,16 @@ entrycmp(const void *va, const void *vb)
|
|||
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();
|
||||
|
|
Loading…
Reference in a new issue