2 * Screen output handling
11 #include <sys/types.h>
16 #include <libcitadel.h>
18 #include "citadel_ipc.h"
19 #include "citadel_decls.h"
25 extern int screenheight;
26 extern int screenwidth;
27 extern int rc_ansi_color;
28 extern void check_screen_dims(void);
30 void do_keepalive(void);
34 * Initialize the screen
46 * Kill the screen completely (used at exit). It is safe to call this
47 * function more than once.
49 void screen_delete(void)
59 void ctdl_beep(void) {
66 * Set screen/IO parameters, e.g. at start of program or return from external
76 * Reset screen/IO parameters, e.g. at exit or fork of external program.
78 int screen_reset(void)
85 * scr_printf() outputs to the terminal
87 int scr_printf(char *fmt, ...)
89 static char outbuf[4096]; /* static for performance -- not re-entrant -- change if needed */
95 retval = vsnprintf(outbuf, sizeof outbuf, fmt, ap);
99 for (i=0; i<len; ++i) {
107 * Read one character from the terminal
109 int scr_getc(int delay)
116 if (!read (0, &buf, 1))
122 * Output one character to the terminal
126 if (putc(c, stdout) == EOF) {
139 static volatile int caught_sigwinch = 0;
142 * this is not supposed to be called from a signal handler.
144 int scr_set_windowsize(CtdlIPC* ipc)
150 * scr_winch() handles window size changes from SIGWINCH
151 * resizes all our windows for us
153 RETSIGTYPE scr_winch(int signum)
155 /* if we receive this signal, we must be running
156 * in a terminal that supports resizing.
161 signal(SIGWINCH, scr_winch);