5 /* _PDCLIB_remove( const char * )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
11 /* This is an example implementation of _PDCLIB_remove() (declared in
12 _PDCLIB_glue.h), fit for use in POSIX kernels.
13 NOTE: Linux is *not* POSIX-compliant in this, as it sets EISDIR instead of
14 EPERM if you try to unlink a directory. Check the manpage for unlink(2).
18 #include <_PDCLIB_glue.h>
22 int _PDCLIB_remove( const char * filename )
24 int prev_errno = errno;
27 if ( ( ( rc = unlink( filename ) ) != 0 ) && ( errno == EPERM ) )
29 rc = rmdir( filename );
38 #include <_PDCLIB_test.h>
42 TESTCASE( NO_TESTDRIVER );