areadlink \- read value of a symolic link
#include <pathfns.h>
char *areadlink(const char *path);
This function reads the value of a symbolic link into a buffer allocated with malloc(3), and adds a null terminator.
The behaviour is undefined if path is a null pointer.
If the return value is not a null pointer then the operation succeeded and the return value is a pointer to the newly created string.
If the return value is a null pointer then the operation failed and errno is set appropriately:
ENOTDIR |
A component of path is not a directory. |
ENAMETOOLONG |
path, or a component of path, is too long. |
ENOENT |
path does not exist. |
EACCES |
Permission denied accessing path. |
ELOOP |
path contains too many symbolic links. |
EINVAL |
path is not a symbolic link. |
EIO |
An I/O error occurred while reading from the file system. |
ENOMEM |
Insufficient memory (provided the local malloc sets errno). |
readlink(2) performs a similar operation to this function, but it has an incredibly inconvenient interface.
arealpath(3), readlink(2), malloc(3), free(3)