2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Read the soft link information.
8 #include "dos_intern.h"
9 #include <dos/filesystem.h>
11 /*****************************************************************************
14 #include <proto/dos.h>
16 AROS_LH5(LONG
, ReadLink
,
19 AROS_LHA(struct MsgPort
*, port
, D1
),
20 AROS_LHA(BPTR
, lock
, D2
),
21 AROS_LHA(STRPTR
, path
, D3
),
22 AROS_LHA(STRPTR
, buffer
, D4
),
23 AROS_LHA(ULONG
, size
, D5
),
26 struct DosLibrary
*, DOSBase
, 73, Dos
)
29 Read the filename referred to by the soft-linked object contained
30 in |path| (relative to the lock |lock|) into the buffer |buffer|.
31 The variable |path| should contain the name of the object that
32 caused the original OBJECT_IS_SOFT_LINK error.
35 port - The handler to send the request to.
36 lock - Object that |path| is relative to.
37 path - Name of the object that caused the error.
38 buffer - Buffer to fill with resolved filename.
39 size - Length of the buffer.
43 == 0 failure, see IoErr() for more information.
56 *****************************************************************************/
59 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
61 struct IOFileSys iofs
;
62 struct FileHandle
*fh
= BADDR(lock
);
65 InitIOFS(&iofs
, FSA_OPEN
, DOSBase
);
66 iofs
.IOFS
.io_Device
= fh
->fh_Device
;
67 iofs
.IOFS
.io_Unit
= fh
->fh_Unit
;
69 iofs
.io_Union
.io_OPEN
.io_FileMode
= FMF_READ
;
71 if( (error
= DoName(&iofs
, path
, DOSBase
)) == 0 )
73 iofs
.IOFS
.io_Command
= FSA_READ_SOFTLINK
;
75 iofs
.io_Union
.io_READ_SOFTLINK
.io_Buffer
= buffer
;
76 iofs
.io_Union
.io_READ_SOFTLINK
.io_Size
= size
;
80 error
= iofs
.io_DosError
;
82 iofs
.IOFS
.io_Command
= FSA_CLOSE
;