X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=platform%2Fwin32%2Ffunctions%2F_PDCLIB%2F_PDCLIB_w32errno.c;h=4842d7ff9da415549f73c2a656bf85be821063d4;hp=3e0ebdbe5da2d7c3880653d98b8fd8a24e8df7ab;hb=c42d6c99b024d1a93994d734d9739a3db44c9d67;hpb=e1c526e9bad3f6e69391e94059096145390508d3 diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c b/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c index 3e0ebdb..4842d7f 100644 --- a/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c +++ b/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c @@ -1,57 +1,54 @@ -/* _PDCLIB_allocpages( int const ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -/* This is a stub implementation of _PDCLIB_allocpages -*/ - -#ifndef REGTEST -#include -#include // Watcom bug: winnt.h assumes string.h defines wchar_t -#include - -void _PDCLIB_w32errno(void); - -void _PDCLIB_w32errno(void) -{ - // Not exhaustive - switch(GetLastError()) { - case ERROR_SUCCESS: - return; - case ERROR_FILE_NOT_FOUND: - case ERROR_PATH_NOT_FOUND: - case ERROR_INVALID_DRIVE: - errno = ENOENT; break; - case ERROR_TOO_MANY_OPEN_FILES: - errno = EMFILE; break; - case ERROR_ACCESS_DENIED: - case ERROR_WRITE_PROTECT: - errno = EPERM; break; - case ERROR_INVALID_HANDLE: - errno = EBADF; break; - case ERROR_NOT_ENOUGH_MEMORY: - case ERROR_OUTOFMEMORY: - errno = ENOMEM; break; - case ERROR_NOT_READY: - errno = EAGAIN; break; - case ERROR_BAD_LENGTH: - errno = EINVAL; break; - default: - // TODO: reconsider what to use here? - errno = ENOSYS; break; - } -} - -#endif - -#ifdef TEST -#include <_PDCLIB_test.h> - -int main( void ) -{ - return TEST_RESULTS; -} - -#endif +/* _PDCLIB_w32errno( void ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#ifndef REGTEST +#include +#include // Watcom bug: winnt.h assumes string.h defines wchar_t +#include + +void _PDCLIB_w32errno(void); + +void _PDCLIB_w32errno(void) +{ + // Not exhaustive + switch(GetLastError()) { + case ERROR_SUCCESS: + return; + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + case ERROR_INVALID_DRIVE: + errno = ENOENT; break; + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; break; + case ERROR_ACCESS_DENIED: + case ERROR_WRITE_PROTECT: + errno = EPERM; break; + case ERROR_INVALID_HANDLE: + errno = EBADF; break; + case ERROR_NOT_ENOUGH_MEMORY: + case ERROR_OUTOFMEMORY: + errno = ENOMEM; break; + case ERROR_NOT_READY: + errno = EAGAIN; break; + case ERROR_BAD_LENGTH: + errno = EINVAL; break; + default: + // TODO: reconsider what to use here? + errno = ENOSYS; break; + } +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif