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)
58 void ctdl_beep(void) {
65 * Set screen/IO parameters, e.g. at start of program or return from external
75 * Reset screen/IO parameters, e.g. at exit or fork of external program.
77 int screen_reset(void)
84 * scr_printf() outputs to the terminal
86 int scr_printf(char *fmt, ...)
92 retval = vprintf(fmt, ap);
99 * err_printf() outputs to error status window (or stderr if not in curses)
101 int err_printf(char *fmt, ...)
107 retval = vfprintf(stderr, fmt, ap);
114 * sln_printf() outputs to error status window (or stderr if not in curses)
116 int sln_printf(char *fmt, ...)
121 retval = vprintf(fmt, ap);
128 * sln_printf_if() outputs to status window, no output if not in curses
130 int sln_printf_if(char *fmt, ...)
132 register int retval = 1;
137 int scr_getc(int delay)
141 if (!read (0, &buf, 1))
147 * scr_putc() outputs a single character
151 if (putc(c, stdout) == EOF)
159 return putc(c, stdout);
163 int sln_putc_if(int c)
170 * scr_color() sets the window color for mainwindow
172 int scr_color(int colornum)
195 static volatile int caught_sigwinch = 0;
198 * this is not supposed to be called from a signal handler.
200 int scr_set_windowsize(CtdlIPC* ipc)
206 * scr_winch() handles window size changes from SIGWINCH
207 * resizes all our windows for us
209 RETSIGTYPE scr_winch(int signum)
211 /* if we receive this signal, we must be running
212 * in a terminal that supports resizing.
217 signal(SIGWINCH, scr_winch);
222 * Initialize the window(s) we will be using.
224 void windows_new(void)
230 * Deinitialize the window(s) we were using (at exit).
232 void windows_delete(void)