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, ...)
93 retval = vprintf(fmt, ap);
100 * err_printf() outputs to error status window (or stderr if not in curses)
102 int err_printf(char *fmt, ...)
108 retval = vfprintf(stderr, fmt, ap);
115 * sln_printf() outputs to error status window (or stderr if not in curses)
117 int sln_printf(char *fmt, ...)
122 retval = vprintf(fmt, ap);
129 * sln_printf_if() outputs to status window, no output if not in curses
131 int sln_printf_if(char *fmt, ...)
133 register int retval = 1;
138 int scr_getc(int delay)
142 if (!read (0, &buf, 1))
148 * scr_putc() outputs a single character
152 if (putc(c, stdout) == EOF)
160 return putc(c, stdout);
164 int sln_putc_if(int c)
171 * scr_color() sets the window color for mainwindow
173 int scr_color(int colornum)
196 static volatile int caught_sigwinch = 0;
199 * this is not supposed to be called from a signal handler.
201 int scr_set_windowsize(CtdlIPC* ipc)
207 * scr_winch() handles window size changes from SIGWINCH
208 * resizes all our windows for us
210 RETSIGTYPE scr_winch(int signum)
212 /* if we receive this signal, we must be running
213 * in a terminal that supports resizing.
218 signal(SIGWINCH, scr_winch);