Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / readlink.c
blob20e75e75539c1f527e80eff0d69c209077c88d5c
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Read the soft link information.
6 Lang: English
7 */
8 #include "dos_intern.h"
9 #include <dos/filesystem.h>
11 /*****************************************************************************
13 NAME */
14 #include <proto/dos.h>
16 AROS_LH5(LONG, ReadLink,
18 /* SYNOPSIS */
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),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 73, Dos)
28 /* FUNCTION
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.
34 INPUTS
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.
41 RESULT
42 != 0 success
43 == 0 failure, see IoErr() for more information.
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 MakeLink()
54 INTERNALS
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
59 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
61 struct IOFileSys iofs;
62 struct FileHandle *fh = BADDR(lock);
63 ULONG error = 0;
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;
78 DosDoIO(&iofs.IOFS);
80 error = iofs.io_DosError;
82 iofs.IOFS.io_Command = FSA_CLOSE;
83 DosDoIO(&iofs.IOFS);
85 SetIoErr(error);
88 return (!error);
90 AROS_LIBFUNC_EXIT
91 } /* ReadLink */