]> pd.if.org Git - pdclib.old/blobdiff - platform/posix/functions/stdio/remove.c
* platform/example is now a "stub" platform - it should compile anywhere, but
[pdclib.old] / platform / posix / functions / stdio / remove.c
similarity index 79%
rename from platform/example_cygwin/functions/stdio/remove.c
rename to platform/posix/functions/stdio/remove.c
index e27dd56efe2cfcfc83167a9cfb87753ea5797c13..389df301be224d6945d6b8a250f7e31a82ca7543 100644 (file)
 
 #ifndef REGTEST
 
+#include <string.h>
+
 #include "/usr/include/errno.h"
 
+extern struct _PDCLIB_file_t * _PDCLIB_filelist;
+
 extern int unlink( const char * pathname );
 
 int remove( const char * pathname )
 {
     int rc;
+    struct _PDCLIB_file_t * current = _PDCLIB_filelist;
+    while ( current != NULL )
+    {
+        if ( ( current->filename != NULL ) && ( strcmp( current->filename, pathname ) == 0 ) )
+        {
+            return EOF;
+        }
+        current = current->next;
+    }
     if ( ( rc = unlink( pathname ) ) == -1 )
     {
         switch ( errno )