diff --git a/util/ncgg/emlookup.c b/util/ncgg/emlookup.c index 6d0d9a3f1..6927f9259 100644 --- a/util/ncgg/emlookup.c +++ b/util/ncgg/emlookup.c @@ -10,6 +10,7 @@ static char rcsid[]= "$Id$"; #include #include "param.h" #include "expr.h" +#include "extern.h" #include #include diff --git a/util/ncgg/error.c b/util/ncgg/error.c index 48cac2c00..5d083d577 100644 --- a/util/ncgg/error.c +++ b/util/ncgg/error.c @@ -8,6 +8,8 @@ static char rcsid[]= "$Id$"; #include #include +#include +#include "extern.h" int nerrors=0; @@ -24,24 +26,38 @@ goodbye() { #endif } -/*VARARGS1*/ -fatal(s,a,b,c,d) char *s; { +void errorv(const char* s, va_list ap) +{ + extern int lineno; + extern char *filename; + + fprintf(stderr, "\"%s\", line %d:", filename, lineno); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + nerrors++; +} + +void fatal(const char* s, ...) +{ + + va_list ap; + + va_start(ap, s); + errorv(s, ap); + va_end(ap); - error(s,a,b,c,d); errorexit(); goodbye(); exit(-1); } -/*VARARGS1*/ -error(s,a,b,c,d) char *s; { - extern int lineno; - extern char *filename; +void error(const char* s, ...) +{ + va_list ap; - fprintf(stderr,"\"%s\", line %d:",filename,lineno); - fprintf(stderr,s,a,b,c,d); - fprintf(stderr,"\n"); - nerrors++; + va_start(ap, s); + errorv(s, ap); + va_end(ap); } #ifndef NDEBUG diff --git a/util/ncgg/extern.h b/util/ncgg/extern.h index ff5260704..561591627 100644 --- a/util/ncgg/extern.h +++ b/util/ncgg/extern.h @@ -40,3 +40,7 @@ extern int use_tes; extern char *mystrcpy(); extern char *myalloc(); + +extern void error(const char* s, ...); +extern void fatal(const char* s, ...); + diff --git a/util/ncgg/hall.c b/util/ncgg/hall.c index b22f03210..f8a5364c7 100644 --- a/util/ncgg/hall.c +++ b/util/ncgg/hall.c @@ -9,6 +9,7 @@ static char rcsid[]= "$Id$"; #include "assert.h" #include "param.h" #include "set.h" +#include "extern.h" #include /* diff --git a/util/ncgg/lookup.c b/util/ncgg/lookup.c index c59610fdd..ab31baebc 100644 --- a/util/ncgg/lookup.c +++ b/util/ncgg/lookup.c @@ -9,6 +9,7 @@ static char rcsid[]= "$Id$"; #include "assert.h" #include "param.h" #include "lookup.h" +#include "extern.h" char *myalloc(); char *mystrcpy(); diff --git a/util/ncgg/main.c b/util/ncgg/main.c index 2c805e7a8..330e08c98 100644 --- a/util/ncgg/main.c +++ b/util/ncgg/main.c @@ -8,6 +8,7 @@ static char rcsid[]= "$Id$"; #include #include +#include "extern.h" char *filename; char *beg_sbrk; diff --git a/util/ncgg/strlookup.c b/util/ncgg/strlookup.c index 5d5877abc..d473341aa 100644 --- a/util/ncgg/strlookup.c +++ b/util/ncgg/strlookup.c @@ -7,6 +7,7 @@ static char rcsid[]= "$Id$"; #endif #include "param.h" +#include "extern.h" int nstrings=0; char *l_strings[MAXSTRINGS]; diff --git a/util/ncgg/var.c b/util/ncgg/var.c index 792b78923..72a3f825d 100644 --- a/util/ncgg/var.c +++ b/util/ncgg/var.c @@ -13,6 +13,7 @@ static char rcsid[]= "$Id$"; #include "set.h" #include "instruct.h" #include "lookup.h" +#include "extern.h" #include int wordsize;