human68k: implemented do_rename

This commit is contained in:
Karoly Balogh 2023-12-06 04:41:21 +01:00
parent 8ceeb8d165
commit 005cb5914c
2 changed files with 26 additions and 0 deletions

View File

@ -125,3 +125,9 @@ function h68kdos_malloc(size: longint): pointer; syscall $ff48;
function h68kdos_mfree(ptr: pointer): longint; syscall $ff49;
function h68kdos_setblock(ptr: pointer; size: longint): longint; syscall $ff4a;
procedure h68kdos_exit2(code: smallint); noreturn; syscall $ff4c;
{ * human68k v2 only calls * }
function h68kdos_rename_v2(oldname: PChar; newname: PChar): longint; syscall $ff56;
{ * human68k v3 only calls * }
function h68kdos_rename_v3(oldname: PChar; newname: PChar): longint; syscall $ff86;

View File

@ -46,7 +46,27 @@ end;
procedure do_rename(p1,p2 : pchar; p1changeable, p2changeable: boolean);
var
oldp1, oldp2 : PAnsiChar;
dosResult: longint;
begin
oldp1:=p1;
oldp2:=p2;
DoDirSeparators(p1,p1changeable);
DoDirSeparators(p2,p2changeable);
if hi(human68k_vernum) <= 2 then
dosResult:=h68kdos_rename_v2(p1,p2)
else
dosResult:=h68kdos_rename_v3(p1,p2);
if dosResult < 0 then
Error2InOutRes(dosResult);
if oldp1<>p1 then
FreeMem(p1);
if oldp2<>p2 then
FreeMem(p2);
end;