#include // setlocale() #include // exit() #include #ifndef NCURSES_VERSION #error this is not ncurses #endif #ifndef NCURSES_OPAQUE #error this ncurses is not opaque #endif int main(void) { setlocale(LC_ALL, ""); initscr(); cbreak(); echo(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); scrollok(stdscr, TRUE); bkgd('+' | A_STANDOUT); clear(); move((LINES - 1), 0); addstr("This is the bottom line."); move(0, 0); addstr("Press Enter, ^J, and/or ^M."); refresh(); int ch; int status = 0; while (TRUE) { ch = getch(); if (ERR == ch) { status = 1; break; } if (scroll(stdscr) == ERR) { status = 2; break; } if (addstr("X") == ERR) { status = 3; break; } if (refresh() == ERR) { status = 4; break; } } endwin(); exit(status); }