2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 ANSI C function readlink().
8 #include <aros/debug.h>
10 #include <proto/dos.h>
14 #include "__arosc_privdata.h"
16 #include "__filesystem_support.h"
19 /*****************************************************************************
32 Places the contents of a symbolic link in a buffer of given size. No NUL
33 char is appended to the buffer.
36 path - the path to the symbolic link
37 buf - pointer to the buffer where to store the symbolic link content
38 bufsize - the size of the buffer in bytes
41 The call returns the count of characters placed in the buffer if it
42 succeeds, or a -1 if an error occurs, placing the error code in the
43 global variable errno.
46 struct aroscbase
*aroscbase
= __GM_GetBase();
48 struct DevProc
*dvp
= NULL
;
50 struct Process
*me
= (struct Process
*)FindTask(NULL
);
52 /* check for empty path before potential conversion from "." to "" */
53 if (aroscbase
->acb_doupath
&& path
&& *path
== '\0')
59 path
= __path_u2a(path
);
63 res
= ReadLink(dvp
->dvp_Port
, dvp
->dvp_Lock
, path
, buf
, bufsize
);
69 error
= me
->pr_Result2
= 0;
75 errno
= IoErr2errno(error
);