realpath(3C)


realpath -- returns the real file name

Synopsis

   #include <stdlib.h> 
   #include <sys/param.h> 
   

char *realpath (const char *file_name, char *resolved_name);

Description

realpath resolves all links, symbolic links, and references to ``.'' and ``..'' in file_name and stores it in resolved_name.

realpath takes as input both relative and absolute path names. It returns the ``resolved absolute'' name.

resolved_name must be big enough (MAXPATHLEN) to contain the fully resolved path name.

Return values

If there is no error, realpath returns a pointer to the resolved_name. Otherwise it returns a null pointer and places the name of the offending file in resolved_name. The global variable errno is set to indicate the error.

References

getcwd(3C)

Notices

realpath operates on null-terminated strings.

One should have execute permission on all the directories in the given and the resolved path.


30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.