|
|
1.1 root 1: #include "sam.h"
2:
3: static char *emsg[]={
4: /* error_s */
5: "can't open",
6: "can't create",
7: "not in menu:",
8: "changes to",
9: "I/O error:",
10: /* error_c */
11: "unknown command",
12: "no operand for",
13: "bad delimiter",
14: /* error */
15: "can't fork",
16: "out of memory",
17: "interrupt",
18: "address",
19: "search",
20: "pattern",
21: "newline expected",
22: "blank expected",
23: "pattern expected",
24: "can't nest X or Y",
25: "unmatched `}'",
26: "command takes no address",
27: "addresses overlap",
28: "substitution",
29: "substitution too long",
30: "& match too long",
31: "bad \\ in rhs",
32: "address range",
33: "changes not in sequence",
34: "file name too long",
35: "addresses out of order",
36: "no file name",
37: "unmatched `('",
38: "unmatched `)'",
39: "too many char classes",
40: "malformed `[]'",
41: "reg. exp. list overflow",
42: "unix command",
43: "can't pipe",
44: "no current file",
45: "string too long",
46: "changed files",
47: "empty string",
48: "file search",
49: "non-unique match for \"\"",
50: };
51: static char *wmsg[]={
52: /* warn_s */
53: "duplicate file name",
54: "no such file",
55: "write might change good version of",
56: /* warn */
57: "non-ascii chars elided",
58: "can't run pwd",
59: "last char not newline",
60: "exit status not 0",
61: };
62: error(s)
63: Error s;
64: {
65: char buf[512];
66: sprint(buf, "?%s", emsg[s]);
67: hiccough(buf);
68: }
69: error_s(s, a)
70: Error s;
71: char *a;
72: {
73: char buf[512];
74: sprint(buf, "?%s \"%s\"", emsg[s], a);
75: hiccough(buf);
76: }
77: error_c(s, c)
78: Error s;
79: {
80: char buf[512];
81: sprint(buf, "?%s `%c'", emsg[s], c);
82: hiccough(buf);
83: }
84: warn(s)
85: Warning s;
86: {
87: dprint("?warning: %s\n", wmsg[s]);
88: }
89: warn_s(s, a)
90: Warning s;
91: char *a;
92: {
93: dprint("?warning: %s `%s'\n", wmsg[s], a);
94: }
95: dprint(z, a, b, c, d, e)
96: char *z;
97: {
98: uchar buf[BLOCKSIZE];
99: sprint((char *)buf, z, a, b, c, d, e);
100: termwrite(buf, strlen(buf));
101: }
102: termwrite(s, n)
103: uchar *s;
104: {
105: static String p; /* avoid tempstr: we might be using it now */
106: if(downloaded){
107: p.n=p.size=n;
108: p.s=s;
109: if(cmd)
110: Finsert(cmd, &p, cmdpt);
111: else
112: strinsert(&cmdstr, &p, (long)cmdstr.n);
113: cmdptadv+=n;
114: }else
115: Write(2, s, n);
116: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.