2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: report.c,v 1.10 1995/08/17 15:01:56 ceriel Exp $ */
9 extern panic(char *, ...);
20 #define MSGOUT STDERR /* file descr. on which to write the messages */
21 #define ERROUT STDERR /* file descr. on which to write the panics */
29 report(char *fmt, ...)
44 char *fmt = va_arg(ap, char*);
46 register char *f = fmt;
49 /* First see if the first arg is an inpdef with
50 a global file name not ending in .c; if so,
53 if (f[0] == '%' && f[1] == 'L') {
55 register struct inpdef *id =
56 va_arg(ap, struct inpdef *);
57 register char *fn = id->id_file;
61 if ( /* the file name global */
63 && /* it is not a .c file */
64 strcmp(&fn[strlen(fn)-2], ".c") != 0
66 /* we skip this message */
69 /* otherwise, we have used up the argument,
72 fprint(MSGOUT, "\"%s\", line %d",
78 register struct inpdef *id;
81 case 'L': /* a location item */
82 id = va_arg(ap, struct inpdef *);
85 case 's': /* a string item */
86 s = va_arg(ap, char *);
87 fprint(MSGOUT, "%s", s);
89 case 'd': /* an int item */
91 fprint(MSGOUT, "%d", i);
94 panic("internal error: bad format %s",
100 fprint(MSGOUT, "%c", fc);
103 fprint(MSGOUT, "\n");
112 /* a definition can come from a number of places */
114 fprint(MSGOUT, "format");
117 if (is_class(id, CL_LIB)) {
118 fprint(MSGOUT, "library");
121 fprint(MSGOUT, "\"%s\", line %d",
122 id->id_file, id->id_line);
128 panic(char *fmt, ...) /* fmt, args */
134 fprint(ERROUT, "PANIC, lint, pass2: line %d: ", LineNr);
135 doprnt(ERROUT, fmt, ap);
136 fprint(ERROUT, "\n");
144 panic(va_alist) /* fmt, args */
151 char *fmt = va_arg(ap, char *);
153 fprint(ERROUT, "PANIC, lint, pass2: line %d: ", LineNr);
154 doprnt(ERROUT, fmt, ap);
155 fprint(ERROUT, "\n");