Index: tool/lemon.c ================================================================== --- tool/lemon.c +++ tool/lemon.c @@ -5,11 +5,11 @@ ** and Makefile of another program. ** ** The author of this program disclaims copyright. */ #include -#include +#include #include #include extern void qsort(); extern double strtod(); @@ -68,11 +68,11 @@ struct config *Configlist_basis(/* void */); void Configlist_eat(/* struct config * */); void Configlist_reset(/* void */); /********* From the file "error.h" ***************************************/ -void ErrorMsg( /* char *, int, char *, ... */ ); +void ErrorMsg(const char *, int,const char *, ...); /****** From the file "option.h" ******************************************/ struct s_options { enum { OPT_FLAG=1, OPT_INT, OPT_DBL, OPT_STR, OPT_FFLAG, OPT_FINT, OPT_FDBL, OPT_FSTR} type; @@ -1100,28 +1100,20 @@ ** of the line. */ #define ERRMSGSIZE 10000 /* Hope this is big enough. No way to error check */ #define LINEWIDTH 79 /* Max width of any output line */ #define PREFIXLIMIT 30 /* Max width of the prefix on each line */ -void ErrorMsg(va_alist) -va_dcl -{ - char *filename; - int lineno; - char *format; +void ErrorMsg(const char *filename, int lineno, const char *format, ...){ char errmsg[ERRMSGSIZE]; char prefix[PREFIXLIMIT+10]; int errmsgsize; int prefixsize; int availablewidth; va_list ap; int end, restart, base; - va_start(ap); - filename = va_arg(ap,char*); - lineno = va_arg(ap,int); - format = va_arg(ap,char*); + va_start(ap, format); /* Prepare a prefix to be prepended to every output line */ if( lineno>0 ){ sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); }else{ sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename);