X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fopen.c;h=f661da5bd170ab2be05ec333f1982a25abf3c3e9;hb=2b793d7f6e3a8e37229e761ef4c92961bd0f686a;hp=0230558c9ccc4aea4f907f44b985232cbb4cb18e;hpb=0326491c5ed243ea6efc5e66e3a6ea21427aad92;p=pdclib diff --git a/platform/example/functions/_PDCLIB/open.c b/platform/example/functions/_PDCLIB/open.c index 0230558..f661da5 100644 --- a/platform/example/functions/_PDCLIB/open.c +++ b/platform/example/functions/_PDCLIB/open.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* _PDCLIB_open( char const * const, int ) This file is part of the Public Domain C Library (PDCLib). @@ -64,6 +62,9 @@ int _PDCLIB_open( char const * const filename, unsigned int mode ) { switch ( errno ) { + /* See the comments on implementation-defined errno values in + <_PDCLIB_config.h>. + */ case EACCES: case EFAULT: case EINTR: @@ -80,9 +81,12 @@ int _PDCLIB_open( char const * const filename, unsigned int mode ) case EOVERFLOW: case EROFS: case ETXTBSY: - _PDCLIB_errno = _PDCLIB_EIO; + _PDCLIB_errno = _PDCLIB_ERROR; + break; default: - _PDCLIB_errno = _PDCLIB_EUNKNOWN; + /* This should be something like EUNKNOWN. */ + _PDCLIB_errno = _PDCLIB_ERROR; + break; } } return rc; @@ -98,6 +102,7 @@ int _PDCLIB_open( char const * const filename, unsigned int mode ) int main( void ) { +#ifndef REGTEST /* This testdriver assumes POSIX, i.e. _PDCLIB_fd_t being int and being incremented by one on each successful open. */ @@ -153,6 +158,7 @@ int main( void ) TESTCASE( _PDCLIB_close( fh ) == 0 ); /* Cleaning up. */ TESTCASE( remove( testfile ) == 0 ); +#endif return TEST_RESULTS; }