X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=platform%2Fexample%2Ffunctions%2F_PDCLIB%2Fopen.c;h=fc82485aec2d730b3505ee6e3e655e1c83faa11b;hb=9507e63e4b8558c8a3337521853f80f72f83a689;hp=5feec6e828a89a3c8ccb0e2ff8c14492b2cdf22f;hpb=67cb1ca6543f8c00240597d140675bd1a66df90f;p=pdclib.old diff --git a/platform/example/functions/_PDCLIB/open.c b/platform/example/functions/_PDCLIB/open.c index 5feec6e..fc82485 100644 --- a/platform/example/functions/_PDCLIB/open.c +++ b/platform/example/functions/_PDCLIB/open.c @@ -20,14 +20,12 @@ #include #include -_PDCLIB_fd_t _PDCLIB_open( char const * const filename, unsigned int mode ) +int _PDCLIB_open( char const * const filename, unsigned int mode ) { - /* FIXME: THIS IS NOT TO BE USED OUT-OF-THE-BOX. - It is a proof-of-concept implementation. E.g. a stream may only be fully - buffered IF IT CAN BE DETERMINED NOT TO REFER TO AN INTERACTIVE DEVICE. - This logic is not represented here, as this is the EXAMPLE platform, and - actual platform overlays may differ widely. Another point is the value - for permissions being hardcoded to 0664 for file creations. + /* This is an example implementation of _PDCLIB_open() fit for use with + POSIX kernels. + FIXME: The permissions of newly created files should not be hardcoded + here. */ int osmode; switch ( mode & ~_PDCLIB_FBIN ) @@ -78,7 +76,7 @@ int main( void ) /* This testdriver assumes POSIX, i.e. _PDCLIB_fd_t being int and being incremented by one on each successful open. */ - _PDCLIB_fd_t fh; + int fh; char buffer[ 10 ]; /* Trying to read non-existent file. */ TESTCASE( _PDCLIB_open( "testfile", _PDCLIB_FREAD ) == _PDCLIB_NOHANDLE ); @@ -133,3 +131,4 @@ int main( void ) } #endif +