1985-01-10 13:17:22 +00:00
|
|
|
#ifndef lint
|
|
|
|
static char rcsid[] = "$Header$";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
1986-10-20 10:17:57 +00:00
|
|
|
#include <out.h>
|
1985-01-10 13:17:22 +00:00
|
|
|
#include "const.h"
|
|
|
|
|
|
|
|
static short nerrors = 0;
|
1985-06-10 10:48:49 +00:00
|
|
|
static diag();
|
1985-01-10 13:17:22 +00:00
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
|
|
|
extern char *outputname;
|
1986-10-20 10:17:57 +00:00
|
|
|
extern int exitstatus;
|
1985-01-10 13:17:22 +00:00
|
|
|
|
1986-10-20 10:17:57 +00:00
|
|
|
if (nerrors) {
|
1985-01-10 13:17:22 +00:00
|
|
|
unlink(outputname);
|
1986-10-20 10:17:57 +00:00
|
|
|
exit(nerrors);
|
|
|
|
}
|
1985-01-10 13:17:22 +00:00
|
|
|
|
1986-10-20 10:17:57 +00:00
|
|
|
exit(exitstatus);
|
1985-01-10 13:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VARARGS1 */
|
|
|
|
fatal(format, a1, a2, a3, a4)
|
|
|
|
char *format;
|
|
|
|
{
|
|
|
|
nerrors++;
|
|
|
|
diag("fatal", format, a1, a2, a3, a4);
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* VARARGS1 */
|
|
|
|
warning(format, a1, a2, a3, a4)
|
|
|
|
char *format;
|
|
|
|
{
|
|
|
|
diag("warning", format, a1, a2, a3, a4);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* VARARGS1 */
|
|
|
|
error(format, a1, a2, a3, a4)
|
|
|
|
char *format;
|
|
|
|
{
|
|
|
|
nerrors++;
|
|
|
|
diag("error", format, a1, a2, a3, a4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
diag(tail, format, a1, a2, a3, a4)
|
|
|
|
char *tail;
|
|
|
|
char *format;
|
|
|
|
{
|
|
|
|
extern char *progname, *archname, *modulname;
|
|
|
|
|
|
|
|
fprintf(stderr, "%s: ", progname);
|
|
|
|
if (archname)
|
|
|
|
fprintf(stderr, "%s: ", archname);
|
|
|
|
if (modulname)
|
|
|
|
fprintf(stderr, "%s: ", modulname);
|
|
|
|
fprintf(stderr, format, a1, a2, a3, a4);
|
|
|
|
fprintf(stderr, " (%s)\n", tail);
|
|
|
|
}
|