blob: e1d4b734b2e483037c30becf22466a314b804502 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "internal.h"
static const struct ErrorMessage {
#define E(n, s) char str##n[sizeof(s)];
#include "errno.inc.h"
#undef E
} errormsg = {
#define E(n, s) s,
#include "errno.inc.h"
#undef E
};
static const ushort errmsgidx[] = {
#define E(n, s) [n] = offsetof(struct ErrorMessage, str##n),
#include "errno.inc.h"
#undef E
};
char *
sysยทerrormsg(int errno)
{
if(errno >= arrlen(errmsgidx))
errno=0;
return (char*)(&errormsg + errmsgidx[errno]);
}
|