1 #define _POSIX_C_SOURCE 1
15 static WINDOW *win = NULL;
16 static FILE *debug_fd = NULL;
18 /* Control-C handler, so we don't hose the therminal */
19 static void on_sigint(int signum)
22 debug("got sigint\n");
27 static void update(void)
29 getmaxyx(win, win_rows, win_cols);
36 static void on_sigwinch(int signum)
43 /* Debugging functions */
44 int debug(char *fmt, ...)
49 vfprintf(debug_fd, "debug: ", ap);
50 rval = vfprintf(debug_fd, fmt, ap);
56 int main(int argc, char **argv)
59 debug_fd = fopen("acal.log", "w+");
61 sigemptyset(&act.sa_mask);
63 act.sa_handler = on_sigint;
64 if (sigaction(SIGINT, &act, NULL) < 0)
65 debug("sigint error\n");
66 act.sa_handler = on_sigwinch;
67 if (sigaction(SIGWINCH, &act, NULL) < 0)
68 debug("sigwinch error\n");
95 /* Cleanup, see also on_sigint */