ยปCore Development>Code coverage>PC/generrmap.c

Python code coverage for PC/generrmap.c

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