error() now calls more()
[unix-history] / usr / src / usr.bin / window / error.c
CommitLineData
46285cba 1#ifndef lint
70c33e26 2static char *sccsid = "@(#)error.c 3.5 84/01/12";
46285cba
EW
3#endif
4
5#include "defs.h"
1c0ca238
EW
6#include "value.h"
7#include "context.h"
46285cba 8
bb94cfe3 9#define ERRLINES 10 /* number of lines for errwin */
46285cba
EW
10
11/*VARARGS1*/
12error(fmt, a, b, c, d, e, f, g, h)
13char *fmt;
14{
3b06703c
EW
15 register struct ww *w;
16
1c0ca238 17 if (cx.x_type != X_FILE) {
46285cba 18 if (terse)
bb94cfe3 19 wwbell();
46285cba 20 else {
bb94cfe3
EW
21 (void) wwprintf(cmdwin, fmt, a, b, c, d, e, f, g, h);
22 (void) wwputs(" ", cmdwin);
46285cba
EW
23 }
24 return;
25 }
3b06703c 26 if (cx.x_noerrwin)
46285cba 27 return;
3b06703c 28 if ((w = cx.x_errwin) == 0) {
46285cba
EW
29 char buf[512];
30
1c0ca238 31 (void) sprintf(buf, "Errors from %s", cx.x_filename);
3b06703c
EW
32 if ((w = cx.x_errwin = openiwin(ERRLINES, buf)) == 0) {
33 (void) wwputs("Can't open error window. ", cmdwin);
34 cx.x_noerrwin = 1;
46285cba
EW
35 return;
36 }
46285cba 37 }
70c33e26 38 more(w);
3b06703c
EW
39 (void) wwprintf(w, "line %d: ", cx.x_lineno);
40 (void) wwprintf(w, fmt, a, b, c, d, e, f, g, h);
41 (void) wwputc('\n', w);
46285cba
EW
42}
43
1c0ca238 44err_end()
46285cba 45{
1c0ca238
EW
46 if (cx.x_errwin != 0) {
47 waitnl(cx.x_errwin);
48 closeiwin(cx.x_errwin);
49 cx.x_errwin = 0;
46285cba 50 }
46285cba 51}