home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / libnix-0.8-src.lha / libnix-0.8 / sources / nix / stdio / rename.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  563 b   |  36 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <dos/dos.h>
  4. #ifdef __GNUC__
  5. #include <inline/dos.h>
  6. #endif
  7.  
  8. extern void __seterrno(void);
  9. extern char *__amigapath(const char *path);
  10.  
  11. int rename(const char *old,const char *new)
  12. { int ret=-1;
  13.  
  14. #ifdef IXPATHS
  15.   if((old=__amigapath(old))!=NULL)
  16.   { 
  17.     if((old=strdup(old))!=NULL)
  18.     { 
  19.       if((new=__amigapath(new))!=NULL)
  20.       {
  21. #endif
  22.         if(Rename((char *)old,(char *)new))
  23.           ret=0;
  24.         else
  25.           __seterrno();
  26.  
  27. #ifdef IXPATHS
  28.       }
  29.       free(old);
  30.     }
  31.   }
  32. #endif
  33.  
  34.   return ret;
  35. }
  36.