Fix a 64-bitness issue (removed some untyped K&R C code that assumed ints
authorDavid Given <dg@cowlark.com>
Mon, 27 Feb 2012 22:36:36 +0000 (22:36 +0000)
committerNick Downing <nick@ndcode.org>
Wed, 17 Apr 2019 14:20:30 +0000 (00:20 +1000)
and pointers were the same size).

util/ack/util.c

index 96110ef..9fc3632 100644 (file)
@@ -11,6 +11,7 @@
 /*                                                                    */
 /**********************************************************************/
 
+#include <stdarg.h>
 #include "ack.h"
 #include <ctype.h>
 #include <stdio.h>
@@ -84,19 +85,26 @@ char *firstblank(str) char *str ; {
 }
 
 /* VARARGS1 */
-fatal(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
+void fatal(const char* fmt, ...)
+{
        /* Fatal internal error */
+       va_list ap;
+       va_start(ap, fmt);
        fprintf(STDOUT,"%s: fatal internal error, ",progname) ;
-       fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
+       vfprintf(STDOUT, fmt, ap);
        fprintf(STDOUT,"\n") ;
        quit(-2) ;
 }
 
 
 /* VARARGS1 */
-vprint(fmt,p1,p2,p3,p4,p5,p6,p7) char *fmt ; {
+void vprint(const char* fmt, ...)
+{
        /* Diagnostic print, no auto NL */
-       fprintf(STDOUT,fmt,p1,p2,p3,p4,p5,p6,p7);
+       va_list ap;
+       va_start(ap, fmt);
+       vfprintf(STDOUT, fmt, ap);
+       va_end(ap);
 }
 
 #ifdef DEBUG