static void on_sigint(int signum)
{
endwin();
- debug("got sigint\n");
exit(0);
}
{
endwin();
refresh();
+ screen_resize();
screen_draw();
}
int rval;
va_list ap;
+ /* Open log file */
+ if (!debug_fd)
+ debug_fd = fopen("acal.log", "w+");
+
/* Log to debug file */
va_start(ap, fmt);
vfprintf(debug_fd, "debug: ", ap);
int main(int argc, char **argv)
{
/* Misc setup */
- debug_fd = fopen("acal.log", "w+");
struct sigaction act;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = on_sigint;
- if (sigaction(SIGINT, &act, NULL) < 0)
- debug("sigint error\n");
+ sigaction(SIGINT, &act, NULL);
act.sa_handler = on_sigwinch;
- if (sigaction(SIGWINCH, &act, NULL) < 0)
- debug("sigwinch error\n");
+ sigaction(SIGWINCH, &act, NULL);
/* Curses setup */
initscr();
init_pair(COLOR_TITLE, COLOR_GREEN, COLOR_BLACK);
init_pair(COLOR_ERROR, COLOR_RED, COLOR_BLACK);
screen_init();
+ screen_draw();
/* Run */
while (1) {
/* Cleanup, see also on_sigint */
endwin();
- debug("cleanup");
return 0;
}