14 static int linecount; /* for paging */
15 static int screenheight = 24, screenwidth = 80;
16 static int curses = FALSE;
18 static void outro(int sig) {
19 /* wrap up, either normally or due to signal */
29 static void fastexit(int sig) {
35 void iostart(int usecurses) {
36 (void) signal(SIGINT, fastexit);
37 (void) signal(SIGINT, fastexit);
39 (void) signal(SIGIOT,fastexit); /* for assert(3) */
41 if(signal(SIGQUIT,SIG_IGN) != SIG_IGN)
42 (void)signal(SIGQUIT,fastexit);
44 if (curses = usecurses) {
53 scrollok(stdscr, TRUE);
54 getmaxyx(stdscr, screenheight, screenwidth);
56 char *LINES = getenv("LINES");
58 screenheight = atoi(LINES);
66 void clearscreen(void) {
67 /* Somehow we need to clear the screen */
69 extern void clrscr(void);
76 // proutn("\033[2J"); /* Hope for an ANSI display */
77 /* much more in that old-TTY spirit to just throw linefeeds */
79 for (i = 0; i < screenheight; i++)
86 char buf[BUFSIZ], *prompt;
89 prompt = "[ANOUNCEMENT ARRIVING...]";
91 prompt = "[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]";
95 prompt = "[CONTINUE?]";
97 prompt = "[PRESS ENTER TO CONTINUE]";
101 waddch(stdscr, '\n');
102 waddstr(stdscr, prompt);
103 wgetnstr(stdscr, buf, sizeof(buf));
109 fgets(buf, sizeof(buf), stdin);
123 if (y == screenheight-1)
126 waddch(stdscr, '\n');
129 if (linecount >= screenheight)
137 void proutn(char *fmt, ...) {
141 vw_printw(stdscr, fmt, ap);
148 void prout(char *fmt, ...) {
152 vw_printw(stdscr, fmt, ap);
160 void proutc(char *line) {
161 line[strlen(line)-1] = '\0';
163 waddstr(stdscr, line);
169 void prouts(char *fmt, ...) {
171 char *s, buf[BUFSIZ];
175 vsprintf(buf, fmt, ap);
178 for (s = buf; *s; s++) {
179 endTime = clock() + CLOCKS_PER_SEC*0.05;
180 while (clock() < endTime) continue;
192 void getline(char *line, int max) {
194 wgetnstr(stdscr, line, max);
197 fgets(line, max, stdin);
198 line[strlen(line)-1] = '\0';
202 void commandhook(char *cmd, int before) {