Use varargs.h for routine with variable number of args

This commit is contained in:
ceriel 1988-10-20 12:57:32 +00:00
parent 153a94aad4
commit 497792f739

View file

@ -1,6 +1,7 @@
#include <ctype.h> #include <ctype.h>
#include <system.h> #include <system.h>
#include <stdio.h> #include <stdio.h>
#include <varargs.h>
#include "as.h" #include "as.h"
#include "const.h" #include "const.h"
@ -223,13 +224,18 @@ char *mnem;
/*** Error ****************************************************************/ /*** Error ****************************************************************/
error( fmt, argv) /*VARARGS*/
char *fmt; error(va_alist)
int argv; va_dcl
{ {
char *fmt;
va_list args;
extern int yylineno; extern int yylineno;
fprint( STDERR, "ERROR in line %d : ", yylineno); va_start(args);
doprnt( STDERR, fmt, &argv); fmt = va_arg(args, char *);
fprint( STDERR, "\n"); fprint( STDERR, "ERROR in line %d : ", yylineno);
doprnt( STDERR, fmt, args);
fprint( STDERR, "\n");
va_end(args);
} }