3 /* _PDCLIB_open( char const * const, int )
5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
9 /* This is an example implementation of _PDCLIB_open() fit for use with POSIX
16 #include <_PDCLIB_glue.h>
18 #include <sys/types.h>
23 _PDCLIB_fd_t _PDCLIB_open( char const * const filename, unsigned int mode )
26 if ( mode & _PDCLIB_FRW ) osmode |= O_RDWR;
27 if ( mode & ( _PDCLIB_FWRITE | _PDCLIB_FAPPEND ) ) osmode |= O_CREAT;
28 if ( mode & _PDCLIB_FWRITE ) osmode |= O_TRUNC;
29 if ( mode & _PDCLIB_FAPPEND ) osmode |= O_APPEND;
30 if ( ( mode & _PDCLIB_FREAD ) && ! ( mode & _PDCLIB_FRW ) ) osmode |= O_RDONLY;
31 return open( filename, osmode );
37 #include <_PDCLIB_test.h>
41 TESTCASE( NO_TESTDRIVER );