]> pd.if.org Git - pdclib.old/blobdiff - platform/example/functions/_PDCLIB/open.c
Enable per-thread locale support to be compiled out
[pdclib.old] / platform / example / functions / _PDCLIB / open.c
index e1fcc9d6cd01826f82e8c4bb24ccc0fcc073b304..1d292f6e3c15892fa8e46eee4fc599994569ae8e 100644 (file)
@@ -6,29 +6,19 @@
    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 <stdio.h>
+#include <errno.h>
 
 #ifndef REGTEST
 #include <_PDCLIB_glue.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-_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
@@ -36,10 +26,13 @@ _PDCLIB_fd_t _PDCLIB_open( char const * const filename, int mode )
 #ifdef TEST
 #include <_PDCLIB_test.h>
 
+#include <stdlib.h>
+#include <string.h>
+
 int main( void )
 {
-    TESTCASE( NO_TESTDRIVER );
     return TEST_RESULTS;
 }
 
 #endif
+