From 2e2e788390ece70034333a9c46c9b69805954c59 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 24 Aug 2013 21:53:12 -0400 Subject: [PATCH] Varargs cleanup is almost finished. --- extern.h | 2 +- term.c | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/extern.h b/extern.h index 78724ec..70044c1 100644 --- a/extern.h +++ b/extern.h @@ -206,7 +206,7 @@ void scan_sat (view_map_t *vmap, long loc); void set_prod (city_info_t *cityp); /* terminal routines */ -void pdebug (char *s, int a, int b, int c, int d, int e, int f, int g, int h); +void pdebug (char *s, ...); void topini (void); void clreol (int line, int colp); void topmsg (int line, char *fmt, ...); diff --git a/term.c b/term.c index 19e6dcb..42ced47 100644 --- a/term.c +++ b/term.c @@ -40,15 +40,6 @@ to read the lines. The new information is then displayed, and the static bool need_delay; static FILE *my_stream; -void -/* VARARGS1 */ -pdebug(char *s, - int a, int b, int c, int d, int e, int f, int g, int h) -{ - if (!print_debug) return; - comment (s, a, b, c, d, e, f, g, h); -} - /* Here are routines that handle printing to the top few lines of the screen. 'topini' should be called at initialization, and whenever @@ -230,6 +221,22 @@ comment1 (char *fmt, ...) } +void +pdebug(char *fmt, ...) +{ + va_list ap; + + if (!print_debug) return; + + va_start(ap, fmt); + if (need_delay) delay (); + topmsg (1, ""); + topmsg (2, ""); + vtopmsg (3, fmt, ap); + need_delay = (fmt != 0); + va_end(ap); +} + /* kermyt begin */ void -- 2.43.0