X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fopen.c;h=1d292f6e3c15892fa8e46eee4fc599994569ae8e;hb=a18343e497615802f47e0f6876b5bed73af674e0;hp=d3aafb2c23b7b73932e37aee48fa761c6db783f9;hpb=d02f38605b53cdff5460cc6b9e1b2a80c3a2ba4c;p=pdclib diff --git a/platform/example/functions/_PDCLIB/open.c b/platform/example/functions/_PDCLIB/open.c index d3aafb2..1d292f6 100644 --- a/platform/example/functions/_PDCLIB/open.c +++ b/platform/example/functions/_PDCLIB/open.c @@ -1,36 +1,24 @@ /* $Id$ */ -/* Release $Name$ */ - /* _PDCLIB_open( char const * const, int ) This file is part of the Public Domain C Library (PDCLib). Permission is granted to use, modify, and / or redistribute at will. */ -/* This is an example implementation of _PDCLIB_open() fit for use with POSIX - kernels. +/* This is a stub implementation of open. */ #include +#include #ifndef REGTEST #include <_PDCLIB_glue.h> -#include -#include -#include -#include - -_PDCLIB_fd_t _PDCLIB_open( char const * const filename, int mode ) +int _PDCLIB_open( char const * const filename, unsigned int mode ) { - int osmode = 0; - if ( mode & _PDCLIB_FRW ) osmode |= O_RDWR; - if ( mode & ( _PDCLIB_FWRITE | _PDCLIB_FAPPEND ) ) osmode |= O_CREAT; - if ( mode & _PDCLIB_FWRITE ) osmode |= O_TRUNC; - if ( mode & _PDCLIB_FAPPEND ) osmode |= O_APPEND; - if ( ( mode & _PDCLIB_FREAD ) && ! ( mode & _PDCLIB_FRW ) ) osmode |= O_RDONLY; - return open( filename, osmode ); + errno = ENOTSUP; + return 1; } #endif @@ -38,10 +26,13 @@ _PDCLIB_fd_t _PDCLIB_open( char const * const filename, int mode ) #ifdef TEST #include <_PDCLIB_test.h> +#include +#include + int main( void ) { - TESTCASE( NO_TESTDRIVER ); return TEST_RESULTS; } #endif +