X-Git-Url: http://pileus.org/git/?p=lackey;a=blobdiff_plain;f=src%2Futil.c;h=1ebecfc02dae764fead047a08765eecbc4c0e3ca;hp=37b004d94896899b95312fdc3abc387fe5d725b6;hb=569a0db79c00169e15d5abed2a82f28d1b2391c4;hpb=f45d7e37ac9dd4e70a89671edf862a868f8ab343 diff --git a/src/util.c b/src/util.c index 37b004d..1ebecfc 100644 --- a/src/util.c +++ b/src/util.c @@ -20,20 +20,22 @@ #include #include +#include #include -#include #include "date.h" #include "cal.h" #include "view.h" #include "util.h" -/* For testing */ -#pragma weak COMPACT +#pragma weak view_debug /* Static data */ static FILE *debug_fd = NULL; +/* View debugging */ +extern void view_debug(const char *fmt, va_list ap); + /* Helper functions */ static void message(FILE *output_fd, const char *prefix, const char *fmt, va_list ap) { @@ -58,17 +60,9 @@ static void message(FILE *output_fd, const char *prefix, const char *fmt, va_lis } /* Log to status bar */ - if (&COMPACT && stdscr) { - int rev = COMPACT ? A_BOLD : 0; + if (&view_debug) { va_copy(tmp, ap); - if (!COMPACT) - mvhline(LINES-2, 0, ACS_HLINE, COLS); - move(LINES-1, 0); - attron(COLOR_PAIR(COLOR_ERROR) | rev); - vwprintw(stdscr, fmt, tmp); - attroff(COLOR_PAIR(COLOR_ERROR) | rev); - if (!COMPACT) - clrtoeol(); + view_debug(fmt, tmp); } } @@ -161,9 +155,6 @@ void error(char *fmt, ...) fflush(stderr); message(stderr, "error", fmt, ap); va_end(ap); - if (stdscr) { - getch(); - endwin(); - } + view_exit(); exit(-1); }