From 2aef9e31154b5939fa687b14ab21a2669819a7a9 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 24 Aug 2013 17:18:23 -0400 Subject: [PATCH] More varargs fixups. --- extern.h | 4 ++-- term.c | 37 ++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/extern.h b/extern.h index 557ce17..d574ba5 100644 --- a/extern.h +++ b/extern.h @@ -220,8 +220,8 @@ void prompt1 (char *fmt, ...); void prompt2 (char *fmt, ...); void error (char *fmt, ...); void info (char *a, char *b, char *c); -void comment (char *fmt, int a, int b, int c, int d, int e, int f, int g, int h); -void comment1 (char *fmt,char *a, int b, int c, int d, int e, int f, int g, int h); +void comment (char *fmt, ...); +void comment1 (char *fmt, ...); void extra (char *fmt, ...); void huh (void); void help (char **text, int nlines); diff --git a/term.c b/term.c index 71c46f5..19e6dcb 100644 --- a/term.c +++ b/term.c @@ -190,9 +190,9 @@ void info(char *a, char *b, char *c) { if (need_delay) delay (); - topmsg (1, a,0,0,0,0,0,0,0,0); - topmsg (2, b,0,0,0,0,0,0,0,0); - topmsg (3, c,0,0,0,0,0,0,0,0); + topmsg (1, a); + topmsg (2, b); + topmsg (3, c); need_delay = (a || b || c); } @@ -202,27 +202,34 @@ set_need_delay(void) { } void -comment (char *buf, - int a, int b, int c, int d, int e, int f, int g, int h) +comment (char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); if (need_delay) delay (); - topmsg (1, 0,0,0,0,0,0,0,0,0); - topmsg (2, 0,0,0,0,0,0,0,0,0); - topmsg (3, buf, a, b, c, d, e, f, g, h); - need_delay = (buf != 0); + topmsg (1, ""); + topmsg (2, ""); + vtopmsg (3, fmt, ap); + need_delay = (fmt != 0); + va_end(ap); } void -comment1(char *buf, char *a, - int b, int c, int d, int e, int f, int g, int h) +comment1 (char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); if (need_delay) delay (); - topmsg1 (1, 0,0,0,0,0,0,0,0,0); - topmsg1 (2, 0,0,0,0,0,0,0,0,0); - topmsg1 (3, buf, a, b, c, d, e, f, g, h); - need_delay = (buf != 0); + topmsg (1, ""); + topmsg (2, ""); + vtopmsg (3, fmt, ap); + need_delay = (fmt != 0); + va_end(ap); } + /* kermyt begin */ void -- 2.43.0