From: Eric S. Raymond Date: Sat, 24 Aug 2013 20:32:20 +0000 (-0400) Subject: Second stage or varargs fixups. Messages to all three info lines tested. X-Git-Tag: 1.11~30 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=40f09ce3a4e83bb0944e2352e9c0019892d0b164;p=vms-empire.git Second stage or varargs fixups. Messages to all three info lines tested. --- diff --git a/extern.h b/extern.h index 81cea50..92e1611 100644 --- a/extern.h +++ b/extern.h @@ -226,8 +226,8 @@ void extra (char *buf, int a, int b, int c, int d, int e, int f, int g, int h); void huh (void); void help (char **text, int nlines); void set_need_delay (void); -void ksend (char *buf, int a, int b, int c, int d, int e, int f, int g, int h); -void ksend1 (char *buf, char *a, int b, int c, int d, int e, int f, int g, int h); +void ksend (char *buf, ...); +void ksend1 (char *buf, ...); /* utility routines */ void ttinit (void); diff --git a/term.c b/term.c index 654c5a7..b4b3004 100644 --- a/term.c +++ b/term.c @@ -210,34 +210,41 @@ comment1(char *buf, char *a, } /* kermyt begin */ + void -ksend(char *buf, - int a, int b, int c, int d, int e, int f, int g, int h) +vksend(const char *fmt, va_list varglist) { if(!(my_stream=fopen("info_list.txt","a"))) { - error("Cannot open info_list.txt",0,0,0,0,0,0,0,0); + error("Cannot open info_list.txt",0,0,0,0,0,0,0,0); return; } - fprintf(my_stream, buf, a, b, c, d, e, f, g, h); + vfprintf(my_stream, fmt, varglist); fclose(my_stream); return; } void -ksend1(char *buf, char *a, - int b, int c, int d, int e, int f, int g, int h) +ksend(char *fmt, ...) { - if(!(my_stream=fopen("info_list.txt","a"))) - { - error("Cannot open info_list.txt",0,0,0,0,0,0,0,0); - return; - } - fprintf(my_stream, buf, a, b, c, d, e, f, g, h); - fclose(my_stream); - return; + va_list ap; + + va_start(ap, fmt); + vksend(fmt, ap); + va_end(ap); +} + +void +ksend1(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vksend(fmt, ap); + va_end(ap); } /* kermyt end */ + /* Get a string from the user, echoing characters all the while. */