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 { "not implemented", ENOSYS},
25 { "input/output", EIO },
26 { "timeout", ETIMEDOUT },
27 { "timed out", ETIMEDOUT },
29 { "too long", E2BIG },
30 { "interrupt", EINTR },
31 { "no such", ENODEV },
32 { "bad file", EBADF },
34 { "temporar", EAGAIN },
36 { "is a directory", EISDIR },
37 { "directory", ENOTDIR },
38 { "argument", EINVAL },
42 { "illegal", EINVAL },
43 { "invalid", EINVAL },
44 { "read-only", EROFS },
45 { "read only", EROFS },
64 if(errortab[0].len == 0)
65 for(i=0; i<nelem(errortab); i++)
66 errortab[i].len = strlen(errortab[i].text);
70 for(i=0; i<nelem(errortab); i++)
71 if(errortab[i].len <= len && cistrstr(e, errortab[i].text))
72 return errortab[i].err;
73 return ERANGE; /* who knows - be blatantly wrong */