home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / unlink.c < prev    next >
C/C++ Source or Header  |  1992-09-05  |  628b  |  40 lines

  1. /* unlink.c: by ERS. This routine is in the public domain */
  2.  
  3. #include <unistd.h>
  4. #include <limits.h>
  5. #include <stdlib.h>
  6. #include <errno.h>
  7. #include <osbind.h>
  8. #include <fcntl.h>
  9. #include "lib.h"
  10.  
  11. /* remove provided for ansi compatibility */
  12. #ifndef __GNUC__
  13. int remove(filename)
  14.     const char *filename;
  15. {
  16.     return unlink(filename);
  17. }
  18. #endif
  19.  
  20. #ifdef __GNUC__
  21. asm(".text; .even; .globl _remove; _remove:"); /* dept of dirty tricks */
  22. #endif
  23. int
  24. unlink(filename)
  25.     const char * filename;
  26. {
  27.     char name[PATH_MAX];
  28.     int r;
  29.  
  30.     _unx2dos(filename, name);
  31.  
  32.     r = (int)Fdelete(name);
  33.  
  34.     if (r < 0) {
  35.         errno = -r;
  36.         return -1;
  37.     }
  38.     return 0;
  39. }
  40.