1 | n/a | #include <windows.h> |
---|
2 | n/a | #include <fcntl.h> |
---|
3 | n/a | #include <io.h> |
---|
4 | n/a | #include <stdio.h> |
---|
5 | n/a | #include <errno.h> |
---|
6 | n/a | |
---|
7 | n/a | /* Extract the mapping of Win32 error codes to errno */ |
---|
8 | n/a | |
---|
9 | n/a | int main() |
---|
10 | n/a | { |
---|
11 | n/a | int i; |
---|
12 | n/a | _setmode(fileno(stdout), O_BINARY); |
---|
13 | n/a | printf("/* Generated file. Do not edit. */\n"); |
---|
14 | n/a | printf("int winerror_to_errno(int winerror)\n"); |
---|
15 | n/a | printf("{\n switch(winerror) {\n"); |
---|
16 | n/a | for(i=1; i < 65000; i++) { |
---|
17 | n/a | _dosmaperr(i); |
---|
18 | n/a | if (errno == EINVAL) { |
---|
19 | n/a | /* Issue #12802 */ |
---|
20 | n/a | if (i == ERROR_DIRECTORY) |
---|
21 | n/a | errno = ENOTDIR; |
---|
22 | n/a | /* Issue #13063 */ |
---|
23 | n/a | else if (i == ERROR_NO_DATA) |
---|
24 | n/a | errno = EPIPE; |
---|
25 | n/a | else |
---|
26 | n/a | continue; |
---|
27 | n/a | } |
---|
28 | n/a | printf(" case %d: return %d;\n", i, errno); |
---|
29 | n/a | } |
---|
30 | n/a | printf(" default: return EINVAL;\n"); |
---|
31 | n/a | printf(" }\n}\n"); |
---|
32 | n/a | } |
---|