From 7b207deeb7e3ba7b1ad89ac3f6c549433b2338c3 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 17 Aug 1995 16:43:36 +0000 Subject: [PATCH] use stdarg when compiling with ANSI C compiler --- lang/cem/cpp.ansi/error.c | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/lang/cem/cpp.ansi/error.c b/lang/cem/cpp.ansi/error.c index 63c44e977..a567b3d4a 100644 --- a/lang/cem/cpp.ansi/error.c +++ b/lang/cem/cpp.ansi/error.c @@ -6,7 +6,11 @@ /* E R R O R A N D D I A G N O S T I C R O U T I N E S */ #include +#if __STDC__ +#include +#else #include +#endif #include "arith.h" #include "errout.h" @@ -28,6 +32,70 @@ err_hdr(s) else fprint(ERROUT, s); } +#if __STDC__ +/*VARARGS*/ +error(char *fmt, ...) +{ + va_list ap; + + err_occurred = 1; + err_hdr(""); + va_start(ap, fmt); + doprnt(ERROUT, fmt, ap); + fprint(ERROUT, "\n"); + va_end(ap); +} + +/*VARARGS*/ +warning(char *fmt, ...) +{ + va_list ap; + + err_hdr("(warning) "); + va_start(ap, fmt); + doprnt(ERROUT, fmt, ap); + fprint(ERROUT, "\n"); + va_end(ap); +} + +/*VARARGS*/ +strict(char *fmt, ...) +{ + va_list ap; + + err_hdr("(strict) "); + va_start(ap, fmt); + doprnt(ERROUT, fmt, ap); + fprint(ERROUT, "\n"); + va_end(ap); +} + +/*VARARGS*/ +crash(char *fmt, ...) +{ + va_list ap; + + err_hdr("CRASH\007 "); + va_start(ap, fmt); + doprnt(ERROUT, fmt, ap); + fprint(ERROUT, "\n"); + va_end(ap); + sys_stop(S_ABORT); +} + +/*VARARGS*/ +fatal(char *fmt, ...) +{ + va_list ap; + + err_hdr("fatal error -- "); + va_start(ap, fmt); + doprnt(ERROUT, fmt, ap); + fprint(ERROUT, "\n"); + va_end(ap); + sys_stop(S_EXIT); +} +#else /*VARARGS*/ error(va_alist) va_dcl @@ -105,3 +173,4 @@ fatal(va_alist) va_end(ap); sys_stop(S_EXIT); } +#endif