Computer Science
REALPATH(3) Linux Programmer's Manual REALPATH(3)
NAME
realpath - returns the canonicalized absolute pathname.
SYNOPSIS
#include <sys/param.h>
#include <unistd.h>
char *realpath(char *path, char resolved_path[]);
DESCRIPTION
realpath expands all symbolic links and resolves refer-
ences to '/./', '/../' and extra '/' characters in the
null terminated string named by path and stores the canon-
icalized absolute pathname in the buffer of size MAX-
PATHLEN named by resolved_path. The resulting path will
have no symbolic link, '/./' or '/../' components.
RETURN VALUE
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.
ERRORS
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 char-
acters, 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 trans-
lating the pathname.
EIO An I/O error occurred while reading from the file
system.
SEE ALSO
readlink(2), getcwd(3)
GNU July 29th 1994 1
Back to the index