]> pd.if.org Git - pdclib/blobdiff - platform/example/functions/_PDCLIB/open.c
Whitespace cleanups.
[pdclib] / platform / example / functions / _PDCLIB / open.c
index 0230558c9ccc4aea4f907f44b985232cbb4cb18e..0f9d08cc25e92bdff52927f16f00b0be5745004f 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /* _PDCLIB_open( char const * const, int )
 
    This file is part of the Public Domain C Library (PDCLib).
@@ -13,7 +11,8 @@
 #include <stdio.h>
 
 #ifndef REGTEST
-#include <_PDCLIB_glue.h>
+
+#include "_PDCLIB_glue.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -64,6 +63,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 +82,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;
@@ -91,13 +96,15 @@ int _PDCLIB_open( char const * const filename, unsigned int mode )
 #endif
 
 #ifdef TEST
-#include <_PDCLIB_test.h>
+
+#include "_PDCLIB_test.h"
 
 #include <stdlib.h>
 #include <string.h>
 
 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,8 +160,8 @@ int main( void )
     TESTCASE( _PDCLIB_close( fh ) == 0 );
     /* Cleaning up. */
     TESTCASE( remove( testfile ) == 0 );
+#endif
     return TEST_RESULTS;
 }
 
 #endif
-