X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=gui.c;h=0316e3653eecf8e0507a5615e42124178c2f9b87;hp=578eeed0c96d502767a57b5cb80f0cad2c9cfc07;hb=3e6bba778c867a8977704b5c15e52fa18fb0d900;hpb=c0dca63e02352cae6a8c241dba4bc0d2c7cde050 diff --git a/gui.c b/gui.c index 578eeed0..0316e365 100644 --- a/gui.c +++ b/gui.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998-2011 Andre Noll + * Copyright (C) 1998-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "gui.cmdline.h" @@ -100,7 +99,7 @@ static void com_reread_conf(void); static void com_enlarge_top_win(void); static void com_shrink_top_win(void); static void com_version(void); -static void com_quit(void); +__noreturn static void com_quit(void); static void com_refresh(void); static void com_ll_incr(void); static void com_ll_decr(void); @@ -337,11 +336,14 @@ static int align_str(WINDOW* win, char *str, unsigned int len, __printf_2_3 static void print_in_bar(int color, const char *fmt,...) { char *msg; + va_list ap; if (!curses_active) return; wattron(in.win, COLOR_PAIR(color)); - PARA_VSPRINTF(fmt, msg); + va_start(ap, fmt); + xvasprintf(&msg, fmt, ap); + va_end(ap); wmove(in.win, 0, 0); align_str(in.win, msg, sb.cols, LEFT); free(msg); @@ -472,10 +474,13 @@ static void rb_add_entry(int color, char *msg) __printf_2_3 static void outputf(int color, const char* fmt,...) { char *msg; + va_list ap; if (!curses_active) return; - PARA_VSPRINTF(fmt, msg); + va_start(ap, fmt); + xvasprintf(&msg, fmt, ap); + va_end(ap); rb_add_entry(color, msg); wrefresh(bot.win); } @@ -490,10 +495,11 @@ static int add_output_line(char *line, __a_unused void *data) static int loglevel; -__printf_2_3 void para_log(int ll, const char *fmt,...) +__printf_2_3 void curses_log(int ll, const char *fmt,...) { int color; char *msg; + va_list ap; if (ll < loglevel || !curses_active) return; @@ -506,11 +512,14 @@ __printf_2_3 void para_log(int ll, const char *fmt,...) default: color = COLOR_ERRMSG; } - PARA_VSPRINTF(fmt, msg); + va_start(ap, fmt); + xvasprintf(&msg, fmt, ap); + va_end(ap); chop(msg); rb_add_entry(color, msg); wrefresh(bot.win); } +__printf_2_3 void (*para_log)(int, const char*, ...) = curses_log; static void setup_signal_handling(void) {