realpath(3C) realpath(3C)
NAME
realpath - output the real filename
SYNOPSIS
#include <stdlib.h>
#include <sys/param.h>
char *realpath(char *filename, char *resolvedname);
DESCRIPTION
realpath() resolves all links and references to "." and ".." in
filename and stores it in resolvedname.
It can handle both relative and absolute path names. For absolute path
names and the relative names whose resolved name cannot be expressed
relatively (e.g., ../../reldir), it returns the resolved absolute
name. For the other relative path names, it returns the resolved rela-
tive name.
resolvedname must be big enough (MAXPATHLEN) to contain the fully
resolved path name.
RESULT
If there is no error, realpath() returns a pointer to the
resolvedname. Otherwise it returns a null pointer and places the name
of the offending file in resolvedname. The global variable errno is
set to indicate the error.
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
The realpath() function will fail if:
EACCES Read or search permission was denied for a component of
filename.
EINVAL Either the filename or resolvedname argument is a null
pointer.
EIO An error occurred while reading from the file system.
ELOOP Too many symbolic links were encountered in resolving
path.
ENAMETOOLONG The filename argument is longer than PATHMAX or a
pathname component is longer than NAMEMAX.
ENOENT A component of filename does not name an existing file
or filename points to an empty string.
ENOTDIR A component of the path prefix is not a directory.
Page 1 Reliant UNIX 5.44 Printed 11/98
realpath(3C) realpath(3C)
The realpath() function may fail if:
ENAMETOOLONG Pathname resolution of a symbolic link produced an
intermediate result whose length exceeds PATHMAX.
ENOMEM Insufficient storage space is available.
NOTES
realpath() operates on null-terminated strings.
One should have execute permission on all the directories in the given
and the resolved path.
realpath() may fail to return to the current directory if an error
occurs.
SEE ALSO
getcwd(3C), sysconf(3C), stdlib(5).
Page 2 Reliant UNIX 5.44 Printed 11/98