GNU/Linux |
RedHat 5.2(Apollo) |
|
realpath(3) |
realpath − returns the canonicalized absolute pathname.
#include
<sys/param.h>
#include <unistd.h>
char *realpath(char *path, char resolved_path[]);
realpath expands all symbolic links and resolves references to ’/./’, ’/../’ and extra ’/’ characters in the null terminated string named by path and stores the canonicalized absolute pathname in the buffer of size MAXPATHLEN named by resolved_path. The resulting path will have no symbolic link, ’/./’ or ’/../’ components.
If there is no error, it returns a pointer to the resolved_path.
Otherwise it returns a NULL pointer and places in resolved_path the absolute pathname of the path component which could not be resolved. The global variable errno is set to indicate the error.
ENOTDIR |
A component of the path prefix is not a directory. | ||
EINVAL |
The pathname contains a character with the high-order bit set. |
ENAMETOOLONG
A component of a pathname exceeded MAXNAMLEN characters, or an entire path name exceeded MAXPATHLEN characters.
ENOENT |
The named file does not exist. | ||
EACCES |
Search permission is denied for a component of the path prefix. | ||
ELOOP |
Too many symbolic links were encountered in translating the pathname. | ||
EIO |
An I/O error occurred while reading from the file system. |
readlink(2), getcwd(3)
realpath(3) |