|
|
1.1 root 1: #ifndef lint
2: static char sccsid[] = "@(#)error.c 3.12 4/24/85";
3: #endif
4:
5: /*
6: * Copyright (c) 1983 Regents of the University of California,
7: * All rights reserved. Redistribution permitted subject to
8: * the terms of the Berkeley Software License Agreement.
9: */
10:
11: #include "defs.h"
12: #include "value.h"
13: #include "context.h"
14: #include "char.h"
15:
16: #define ERRLINES 10 /* number of lines for errwin */
17:
18: /*VARARGS1*/
19: error(fmt, a, b, c, d, e, f, g, h)
20: char *fmt;
21: {
22: register struct context *x;
23: register struct ww *w;
24:
25: for (x = &cx; x != 0 && x->x_type != X_FILE; x = x->x_link)
26: ;
27: if (x == 0) {
28: if (terse)
29: wwbell();
30: else {
31: wwprintf(cmdwin, fmt, a, b, c, d, e, f, g, h);
32: wwputs(" ", cmdwin);
33: }
34: return;
35: }
36: if (x->x_noerr)
37: return;
38: if ((w = x->x_errwin) == 0) {
39: char buf[512];
40:
41: (void) sprintf(buf, "Errors from %s", x->x_filename);
42: if ((w = x->x_errwin = openiwin(ERRLINES, buf)) == 0) {
43: wwputs("Can't open error window. ", cmdwin);
44: x->x_noerr = 1;
45: return;
46: }
47: }
48: if (more(w, 0) == 2) {
49: x->x_noerr = 1;
50: return;
51: }
52: wwprintf(w, "line %d: ", x->x_lineno);
53: wwprintf(w, fmt, a, b, c, d, e, f, g, h);
54: wwputc('\n', w);
55: }
56:
57: err_end()
58: {
59: if (cx.x_type == X_FILE && cx.x_errwin != 0) {
60: if (!cx.x_noerr)
61: waitnl(cx.x_errwin);
62: closeiwin(cx.x_errwin);
63: cx.x_errwin = 0;
64: }
65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.