Check return values of newwin/newpad

master
C. McEnroe 2020-02-08 02:13:02 -05:00
parent 5c10fe0d41
commit 55e721da42
1 changed files with 7 additions and 1 deletions

8
ui.c
View File

@ -109,6 +109,7 @@ static struct Window *windowFor(size_t id) {
window->id = id; window->id = id;
window->pad = newpad(BufferCap, COLS); window->pad = newpad(BufferCap, COLS);
if (!window->pad) err(EX_OSERR, "newpad");
scrollok(window->pad, true); scrollok(window->pad, true);
wmove(window->pad, BufferCap - 1, 0); wmove(window->pad, BufferCap - 1, 0);
window->scroll = BufferCap; window->scroll = BufferCap;
@ -211,20 +212,25 @@ void uiInit(void) {
disableFlowControl(); disableFlowControl();
def_prog_mode(); def_prog_mode();
atexit(errExit); atexit(errExit);
colorInit();
if (!to_status_line && !strncmp(termname(), "xterm", 5)) { if (!to_status_line && !strncmp(termname(), "xterm", 5)) {
to_status_line = "\33]2;"; to_status_line = "\33]2;";
from_status_line = "\7"; from_status_line = "\7";
} }
#define X(id, seq) define_key(seq, id); #define X(id, seq) define_key(seq, id);
ENUM_KEY ENUM_KEY
#undef X #undef X
colorInit();
status = newwin(1, COLS, 0, 0); status = newwin(1, COLS, 0, 0);
if (!status) err(EX_OSERR, "newwin");
input = newpad(1, 512); input = newpad(1, 512);
if (!input) err(EX_OSERR, "newpad");
keypad(input, true); keypad(input, true);
nodelay(input, true); nodelay(input, true);
windows.active = windowFor(Network); windows.active = windowFor(Network);
uiShow(); uiShow();
} }