1 | XC compatible RENAME() function
2 | int DOS_RENAME __P((const char *path, const char *newname));
4 | written by Yasha (ITOH Yasufumi)
7 | $NetBSD: dos_rename.S,v 1.1 1999/11/11 08:14:43 itohy Exp $
11 Lbufsz = 92 | sizeof(struct dos_nameckbuf)
12 Lnamoff = 67 | offsetof(struct dos_nameckbuf, name)
13 Lextoff = 86 | offsetof(struct dos_nameckbuf, ext)
15 ENTRY_NOPROFILE(DOS_RENAME)
16 link %a6,#-Lbufsz*2 | allocate two dos_nameckbuf
18 moveal %sp,%a1 | dos_nameckbuf for path
21 movel %a6@(4 + 8),%sp@- | newname
22 .word 0xff37 | DOS_NAMECK
29 movel %a6@(4 + 4),%sp@- | (old) path
30 .word 0xff37 | DOS_NAMECK
34 | we don't pop arguments since the same args are used by DOS_MOVE below
36 | search end of dirname of (old) path
39 subql #1,%a1 | remove nul char
42 lea %sp@(8 + Lbufsz+Lnamoff),%a0 | new name (8: args on stack)
43 Lname: moveb %a0@+,%a1@+
45 subql #1,%a1 | remove nul char
48 lea %sp@(8 + Lbufsz+Lextoff),%a0 | new ext (8: args on stack)
49 Lext: moveb %a0@+,%a1@+
52 | we already have the arguments on stack
53 bsr _C_LABEL(DOS_MOVE)
55 | version check of Human68k and error handlings are done in DOS_MOVE()
57 unlk %a6 | restore stack