File: subs.c

package info (click to toggle)
xmake 1.06-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 124 kB
  • ctags: 120
  • sloc: ansic: 1,372; makefile: 60
file content (41 lines) | stat: -rw-r--r-- 668 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

/*
 * SUBS.C
 *
 */

#include "defs.h"

Prototype void fatal(Node *node, const char *ctl, ...);

void
fatal(Node *node, const char *ctl, ...)
{
    if (node) {
	INode *in;

	if ((in = node->no_INode) != NULL) {
	    fprintf(stderr, "%s:%d\t", in->in_Node.no_Name, node->no_ILine);

	    /*
	     * if the error occured while parsing, dump the parse hierarchy
	     */

	    if (in->in_Fi) {
		while ((in = in->in_Parent) != NULL) {
		    fprintf(stderr, "(from %s:%d)", in->in_Node.no_Name, in->in_Node.no_ILine);
		}
	    }
	}
    }
    {
	va_list va;

	va_start(va, ctl);
	vfprintf(stderr, ctl, va);
	va_end(va);
    }
    exit(FATALEXIT);
    /* not reached */
}