Staging
v0.8.1
v0.8.1
Revision 7574a1a8916639075dce3534aae8a54e977e06e9 authored by Zachary Ware on 11 February 2018, 19:56:57 UTC, committed by GitHub on 11 February 2018, 19:56:57 UTC
(cherry picked from commit 28607e0dd9417ce44a109980ffd60697c1afdea0)
1 parent 9d8c24b
generrmap.c
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <errno.h>
/* Extract the mapping of Win32 error codes to errno */
int main()
{
int i;
_setmode(fileno(stdout), O_BINARY);
printf("/* Generated file. Do not edit. */\n");
printf("int winerror_to_errno(int winerror)\n");
printf("{\n switch(winerror) {\n");
for(i=1; i < 65000; i++) {
_dosmaperr(i);
if (errno == EINVAL) {
/* Issue #12802 */
if (i == ERROR_DIRECTORY)
errno = ENOTDIR;
/* Issue #13063 */
else if (i == ERROR_NO_DATA)
errno = EPIPE;
else
continue;
}
printf(" case %d: return %d;\n", i, errno);
}
printf(" default: return EINVAL;\n");
printf(" }\n}\n");
}
Computing file changes ...