forked from totalspectrum/spin2cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrerror.c
More file actions
45 lines (41 loc) · 960 Bytes
/
Copy pathstrerror.c
File metadata and controls
45 lines (41 loc) · 960 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <errno.h>
#include <string.h>
static char *_sys_errlist[] = {
"OK",
"Numerical argument out of domain",
"Result not representable",
"Illegal multibyte sequence",
"No such file or directory",
"Bad file number",
"Permission denied",
"Not enough memory",
"Temporary failure",
"File exists",
"Invalid argument",
"Too many open files",
"I/O error",
"Not a directory",
"Is a directory",
"Read only file system",
"Function not implemented",
"Directory not empty",
"Name too long",
"Device not seekable",
"Bad address",
"Broken connection",
"Device or resource busy",
"Cross device link",
"No space on device",
"Unknown error",
};
#define ENUMERRORS (sizeof(_sys_errlist)/sizeof(_sys_errlist[0]))
char *_strerror(int errnum)
{
if (errnum < 0 || errnum >= (int)ENUMERRORS)
errnum = ENUMERRORS-1;
return _sys_errlist[errnum];
}
char *strerror(int errnum)
{
return _strerror(errnum);
}