added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / rom / dos / readlink.c
blobf36dc4c4788f8e50f081a323a95ae763c49e8d40
1 /*
2 Copyright © 1995-2007, 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
60 struct IOFileSys iofs;
61 struct FileHandle *fh = BADDR(lock);
62 LONG err;
64 InitIOFS(&iofs, FSA_READ_SOFTLINK, DOSBase);
66 iofs.IOFS.io_Device = fh->fh_Device;
67 iofs.IOFS.io_Unit = fh->fh_Unit;
68 iofs.io_Union.io_READ_SOFTLINK.io_Filename = path;
69 iofs.io_Union.io_READ_SOFTLINK.io_Buffer = buffer;
70 iofs.io_Union.io_READ_SOFTLINK.io_Size = size;
72 DosDoIO(&iofs.IOFS);
73 err = iofs.io_DosError;
74 SetIoErr(err);
76 return err == 0 ? DOSTRUE : DOSFALSE;
78 AROS_LIBFUNC_EXIT
79 } /* ReadLink */