123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- #include "sam.h"
- static char *emsg[]={
- /* error_s */
- "can't open",
- "can't create",
- "not in menu:",
- "changes to",
- "I/O error:",
- "can't write while changing:",
- /* error_c */
- "unknown command",
- "no operand for",
- "bad delimiter",
- /* error */
- "can't fork",
- "interrupt",
- "address",
- "search",
- "pattern",
- "newline expected",
- "blank expected",
- "pattern expected",
- "can't nest X or Y",
- "unmatched `}'",
- "command takes no address",
- "addresses overlap",
- "substitution",
- "& match too long",
- "bad \\ in rhs",
- "address range",
- "changes not in sequence",
- "addresses out of order",
- "no file name",
- "unmatched `('",
- "unmatched `)'",
- "malformed `[]'",
- "malformed regexp",
- "reg. exp. list overflow",
- "plan 9 command",
- "can't pipe",
- "no current file",
- "string too long",
- "changed files",
- "empty string",
- "file search",
- "non-unique match for \"\"",
- "tag match too long",
- "too many subexpressions",
- "temporary file too large",
- "file is append-only",
- "no destination for plumb message",
- "internal read error in buffer load",
- };
- static char *wmsg[]={
- /* warn_s */
- "duplicate file name",
- "no such file",
- "write might change good version of",
- /* warn_S */
- "files might be aliased",
- /* warn */
- "null characters elided",
- "can't run pwd",
- "last char not newline",
- "exit status",
- };
- void
- error(Err s)
- {
- char buf[512];
- sprint(buf, "?%s", emsg[s]);
- hiccough(buf);
- }
- void
- error_s(Err s, char *a)
- {
- char buf[512];
- sprint(buf, "?%s \"%s\"", emsg[s], a);
- hiccough(buf);
- }
- void
- error_r(Err s, char *a)
- {
- char buf[512];
- sprint(buf, "?%s \"%s\": %r", emsg[s], a);
- hiccough(buf);
- }
- void
- error_c(Err s, int c)
- {
- char buf[512];
- sprint(buf, "?%s `%C'", emsg[s], c);
- hiccough(buf);
- }
- void
- warn(Warn s)
- {
- dprint("?warning: %s\n", wmsg[s]);
- }
- void
- warn_S(Warn s, String *a)
- {
- print_s(wmsg[s], a);
- }
- void
- warn_SS(Warn s, String *a, String *b)
- {
- print_ss(wmsg[s], a, b);
- }
- void
- warn_s(Warn s, char *a)
- {
- dprint("?warning: %s `%s'\n", wmsg[s], a);
- }
- void
- termwrite(char *s)
- {
- String *p;
- if(downloaded){
- p = tmpcstr(s);
- if(cmd)
- loginsert(cmd, cmdpt, p->s, p->n);
- else
- Strinsert(&cmdstr, p, cmdstr.n);
- cmdptadv += p->n;
- free(p);
- }else
- Write(2, s, strlen(s));
- }
|