2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 C99 function rename() with optional Amiga<>Posix file name conversion.
15 #include <aros/debug.h>
17 /*****************************************************************************
29 Renames a file or directory.
32 oldpath - Complete path to existing file or directory.
33 newpath - Complete path to the new file or directory.
36 0 on success and -1 on error. In case of an error, errno is set.
47 Uses stdcio.library rename() function after path name conversion
49 ******************************************************************************/
50 int __posixc_rename (const char * oldpath
, const char * newpath
)
52 STRPTR aoldpath
= (STRPTR
)strdup((const char*)__path_u2a(oldpath
));
53 CONST_STRPTR anewpath
= __path_u2a(newpath
);
56 /* __path_u2a has resolved paths like /toto/../a */
57 if (anewpath
[0] == '.')
59 if (anewpath
[1] == '\0' || (anewpath
[1] == '.' && anewpath
[2] == '\0'))
67 ret
= rename(aoldpath
, anewpath
);