]> pd.if.org Git - pdclib/blob - platform/win32/functions/stdio/remove.c
Enable building PDCLib with Watcom. This was surprisingly painless: their C99 mode...
[pdclib] / platform / win32 / functions / stdio / remove.c
1 /* $Id$ */
2
3 /* remove( const char * )
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 /* This is an example implementation of remove() fit for use with POSIX kernels.
10 */
11
12 #include <stdio.h>
13
14 #ifndef REGTEST
15
16 #include <string.h>
17 #include <errno.h>
18 #include <wchar.h> // Watcom bug: winnt.h assumes string.h defines wchar_t
19 #include <windows.h>
20
21 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
22
23 extern void _PDCLIB_w32errno( void );
24 int remove( const char * pathname )
25 {
26     BOOL ok = DeleteFileA( pathname );
27     if(!ok) {
28         _PDCLIB_w32errno();
29         return -1;
30     } else return 0;
31 }
32
33 #endif
34
35 #ifdef TEST
36 #include <_PDCLIB_test.h>
37
38 int main( void )
39 {
40     /* Testing covered by ftell.c (and several others) */
41     return TEST_RESULTS;
42 }
43
44 #endif
45