2023-11-16 18:46:16 -08:00
|
|
|
#include <rp6502.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2023-11-17 11:08:51 -08:00
|
|
|
unsigned char __fastcall__ _sysrename (const char* oldpath, const char* newpath)
|
2023-11-16 18:46:16 -08:00
|
|
|
{
|
|
|
|
size_t oldpathlen, newpathlen;
|
2023-11-17 11:08:51 -08:00
|
|
|
oldpathlen = strlen (oldpath);
|
|
|
|
newpathlen = strlen (newpath);
|
|
|
|
if (oldpathlen + newpathlen > 254) {
|
|
|
|
return _mappederrno (EINVAL);
|
2023-11-16 18:46:16 -08:00
|
|
|
}
|
2023-11-17 11:08:51 -08:00
|
|
|
while (oldpathlen) {
|
|
|
|
ria_push_char (oldpath[--oldpathlen]);
|
2023-11-16 18:46:16 -08:00
|
|
|
}
|
2023-11-17 11:08:51 -08:00
|
|
|
ria_push_char (0);
|
|
|
|
while (newpathlen) {
|
|
|
|
ria_push_char (newpath[--newpathlen]);
|
2023-11-16 18:46:16 -08:00
|
|
|
}
|
2023-11-17 11:08:51 -08:00
|
|
|
return ria_call_int_errno (RIA_OP_RENAME);
|
2023-11-16 18:46:16 -08:00
|
|
|
}
|