3 /* remove( const char * )
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 remove() fit for use with POSIX kernels.
18 #include "/usr/include/errno.h"
20 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
22 extern int unlink( const char * pathname );
24 int remove( const char * pathname )
27 struct _PDCLIB_file_t * current = _PDCLIB_filelist;
28 while ( current != NULL )
30 if ( ( current->filename != NULL ) && ( strcmp( current->filename, pathname ) == 0 ) )
34 current = current->next;
36 if ( ( rc = unlink( pathname ) ) == -1 )
40 /* These are the values possible on a Linux machine. Adapt the
41 values and their mapping to PDCLib errno values at will. (This
42 is an example implementation, so we keep it very simple.)
55 _PDCLIB_errno = _PDCLIB_EIO;
58 _PDCLIB_errno = _PDCLIB_EUNKNOWN;
68 #include <_PDCLIB_test.h>
72 /* Testing covered by ftell.c (and several others) */