home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
emacs-19.28-src.tgz
/
tar.out
/
fsf
/
emacs
/
unixlib
/
src
/
rename.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
461b
|
25 lines
#include "amiga.h"
int rename(const char *from, const char *to)
{
long err;
chkabort();
if (Rename(from, to)) return 0;
err = IoErr();
if (err == ERROR_OBJECT_EXISTS)
{
if (DeleteFile(to) && Rename(from, to)) return 0;
err = IoErr();
if (err == ERROR_DELETE_PROTECTED)
{
if (SetProtection(to, 0) && DeleteFile(to) && Rename(from, to))
return 0;
err = IoErr();
}
}
errno = convert_oserr(err);
return -1;
}