Changeset 794
- Timestamp:
- Oct 2, 2003, 3:39:36 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/sys/remove.c
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r793 r794 1 1 /* sys/remove.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */ 2 -- Copyright (c) 2003 by Knut St. Osmundsen */ 2 3 3 4 #include "libc-alias.h" 4 5 #define INCL_FSMACROS 6 #define INCL_DOSMISC 5 7 #include <os2emx.h> 6 8 #include <emx/syscalls.h> 7 9 #include "syscalls.h" 8 10 9 int _STD(remove) 11 int _STD(remove)(const char *name) 10 12 { 11 ULONG rc; 12 FS_VAR(); 13 static int fUseForce; /* state: 0 - uninit, 1 - DosForceDelete, -1 - DosDelete */ 14 ULONG rc; 15 FS_VAR(); 13 16 14 FS_SAVE_LOAD(); 15 rc = DosDelete (name); 16 FS_RESTORE(); 17 if (rc == 0) 17 FS_SAVE_LOAD(); 18 /* 19 * DosDelete is kind of slow as it always scans the environment (in a R0 20 * accessing R3 data safe manner to make matters worse even) for DELDIR. 21 * Since only a limited number of programs actually changes this 22 * environment block, we assume that it's ok to check the first time if 23 * DELDIR processing is enabled or not. If it isn't there, we can use 24 * DosForceDelete and save quite a bit of time if we're called some 25 * times. 26 */ 27 if (fUseForce == 0) 28 { 29 PSZ psz = NULL; 30 if (DosScanEnv("DELDIR", &psz) || !psz) 31 fUseForce = 1; 32 else 33 fUseForce = -1; 34 } 35 36 /* 37 * Do the delete. 38 */ 39 if (fUseForce == 1) 40 rc = DosForceDelete(name); 41 else 42 rc = DosDelete(name); 43 FS_RESTORE(); 44 if (rc) 45 { 46 _sys_set_errno(rc); 47 return -1; 48 } 18 49 return 0; 19 else20 {21 _sys_set_errno (rc);22 return -1;23 }24 50 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.