This trap renames a file.
|Call Parameters||Return Parameters
|A0.L||Channel ID ||A0.L||Preserved.
|A1.L||Pointer to new filename||A1.L||Corrupted.
Any IO sub system errors including
All registers not shown above are not used on entry and are preserved on exit.
The name to which A1.L points should be a QDOS string, length followed by the byte characters. The name should include the device.
This trap does not work on all devices. In particular it does not work on MDV and DOS.
The channel ID in A0 must, obviously, have been opened so that the file can be written to as well as read from. The possible values of D3 in the open routine are thus 0 (OPEN), 2 (OPEN_NEW) and 3 (OPEN_OVER). Any other value would prevent a new name from being set. However, although a file opened to the RAM device with any of values 0, 2 and 3 can have its name altered, other devices require that the open be of type 0 (OPEN). In particular FLP and WIN require this.
The example below shows the use of this trap call. It is assumed that an appropriate ID is set in A0.L.
renm moveq #fs_rename,d0 ; $4A
moveq #-1,d3 ; Timeout
lea name,a1 ; New name
trap #3 ; Do it
tst.l d0 ; OK? . .
bne error ; . . no!
name dc.w name_e-*-2
name_e ds.b 0