From 520ea9b87fce103f9a5217d6b3b8cf32f2ad07c5 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sat, 13 Mar 1999 22:59:18 +0000 Subject: [PATCH] Parameters in front of va_alist are unportable; use va_arg instead. --- contrib/whois++/output.c | 17 +++++++++++------ libraries/liblutil/setproctitle.c | 6 ++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/contrib/whois++/output.c b/contrib/whois++/output.c index b793971e62..d1589d48b1 100644 --- a/contrib/whois++/output.c +++ b/contrib/whois++/output.c @@ -303,27 +303,32 @@ LDAPMessage *entry; ldap_value_free( val ); } -printFormatted( lineLength, systemMessage, output, format, va_alist ) -int lineLength, systemMessage; -FILE *output; -char *format; +printFormatted( va_alist ) va_dcl - { + int lineLength, systemMessage; + FILE *output; + char *format; va_list ap; + char buffer[BUFSIZ]; char *head, *p, *q; char *tag; int count; + va_start( ap ); + lineLength = va_arg( ap, int ); + systemMessage = va_arg( ap, int ); + output = va_arg( ap, FILE * ); + format = va_arg( ap, char * ); if ( systemMessage ) { lineLength--; tag = "% "; } else tag = ""; - va_start( ap ); vsprintf( buffer, format, ap ); va_end( ap ); + if ( strlen( buffer ) < lineLength ) fprintf( output, "%s%s\r\n", tag, buffer ); else { diff --git a/libraries/liblutil/setproctitle.c b/libraries/liblutil/setproctitle.c index 534a69bfe6..4c13eb95d1 100644 --- a/libraries/liblutil/setproctitle.c +++ b/libraries/liblutil/setproctitle.c @@ -34,8 +34,7 @@ void setproctitle #if defined( HAVE_STDARG ) ( const char *fmt, ... ) #else - ( fmt, va_alist ) -const char *fmt; + ( va_alist ) va_dcl #endif { @@ -48,7 +47,10 @@ va_dcl #if defined( HAVE_STDARG ) va_start(ap, fmt); #else + const char *fmt; + va_start(ap); + fmt = va_arg(ap, const char *); #endif #ifdef HAVE_VSNPRINTF -- 2.39.5