baf5b74da2
of a segment. It also uses the "object" library to read and write ACK- object files and libraries.
75 lines
1.2 KiB
C
75 lines
1.2 KiB
C
#ifndef lint
|
|
static char rcsid[] = "$Header$";
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include <out.h>
|
|
#include "const.h"
|
|
|
|
static short nerrors = 0;
|
|
static diag();
|
|
|
|
stop()
|
|
{
|
|
extern char *outputname;
|
|
extern int exitstatus;
|
|
|
|
if (nerrors) {
|
|
unlink(outputname);
|
|
exit(nerrors);
|
|
}
|
|
|
|
exit(exitstatus);
|
|
}
|
|
|
|
trap_signals()
|
|
{
|
|
static int trap_them[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM, 0 };
|
|
register int *ip;
|
|
|
|
for (ip = trap_them; *ip; ip++)
|
|
if (signal(*ip, stop) == SIG_IGN)
|
|
signal(*ip, SIG_IGN); /* Oops, reset. */
|
|
}
|
|
|
|
/* 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);
|
|
}
|