home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GERLIB_USR08B.LHA / gerlib / support / lib / libgpp.a / rename.c < prev   
Encoding:
C/C++ Source or Header  |  1993-10-16  |  586 b   |  37 lines

  1. #ifdef amiga
  2.  
  3. #include <exec/types.h>
  4. #include <exec/ports.h>
  5. #include <exec/memory.h>
  6. #include <exec/execbase.h>
  7. #include <dos/dos.h>
  8. #include <dos/dosextens.h>
  9. #include <dos/exall.h>
  10. #include <inline/stubs.h>
  11. #ifdef __OPTIMIZE__
  12. #include <inline/dos.h>
  13. #else
  14. #include <clib/dos_protos.h>
  15. #endif
  16.  
  17. #endif
  18.  
  19. #include <stdioprivate.h>
  20.  
  21. int rename (const char *_old, const char *_new)
  22. {
  23. #ifdef amiga
  24.     if(Rename(STRPTR) _old, (STRPTR) _new) == 0)
  25.         return -1;
  26.     else return 0;
  27. #else
  28.   if (link (_old, _new) == -1)
  29.    return -1;
  30.  
  31.   if (unlink (_old) == -1)
  32.    return -1;
  33.  
  34.   return 0;
  35. #endif
  36. }
  37.