5 EPLAN9 = 0x19283745 /* see /usr/local/plan9/src/lib9/errstr.c */
8 typedef struct Error Error;
16 static Error errortab[] = {
17 { "permitted", EPERM },
18 { "permission", EACCES },
22 { "no such", ENOENT },
23 { "not found", ENOENT },
24 { "input/output", EIO },
25 { "timeout", ETIMEDOUT },
26 { "timed out", ETIMEDOUT },
28 { "too long", E2BIG },
29 { "interrupt", EINTR },
30 { "no such", ENODEV },
31 { "bad file", EBADF },
33 { "temporar", EAGAIN },
35 { "is a directory", EISDIR },
36 { "directory", ENOTDIR },
37 { "argument", EINVAL },
41 { "illegal", EINVAL },
42 { "read-only", EROFS },
43 { "read only", EROFS },
61 if(errortab[0].len == 0)
62 for(i=0; i<nelem(errortab); i++)
63 errortab[i].len = strlen(errortab[i].text);
67 for(i=0; i<nelem(errortab); i++)
68 if(errortab[i].len <= len && cistrstr(e, errortab[i].text))
69 return errortab[i].err;
70 return ERANGE; /* who knows - be blatantly wrong */