Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Standard C Library Functionsrealpath(3C)


NAME

 realpath - resolve pathname

SYNOPSIS

 
#include <stdlib.h>
char *realpath(const char *file_name, char *resolved_name);

DESCRIPTION

 

The realpath() function derives, from the pathname pointed to by file_name, an absolute pathname that names the same file, whose resolution does not involve ".", "..", or symbolic links. The generated pathname, using PATH_MAX bytes, is stored in the buffer pointed to by resolved_name.

The realpath() function can handle both relative and absolute path names. For absolute path names and the relative names whose resolved name cannot be expressed relatively (for example, ../../reldir), it returns the resolved absolute name. For the other relative path names, it returns the resolved relative name.

RETURN VALUES

 

On successful completion, realpath() returns a pointer to the resolved name. Otherwise, realpath() returns a null pointer and sets errno to indicate the error, and the contents of the buffer pointed to by resolved_name are undefined.

ERRORS

 

The realpath() function will fail if:

EACCES
Read or search permission was denied for a component of file_name.
EINVAL
Either the file_name or resolved_name 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 file_name argument is longer than PATH_MAX or a pathname component is longer than NAME_MAX.
ENOENT
A component of file_name does not name an existing file or file_name points to an empty string.
ENOTDIR
A component of the path prefix is not a directory.

The realpath() function may fail if:

ENAMETOOLONG
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds PATH_MAX.
ENOMEM
Insufficient storage space is available.

USAGE

 

The realpath() function operates on null-terminated strings.

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

The realpath() function may fail to return to the current directory if an error occurs.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

getcwd(3C), sysconf(3C), attributes(5)


SunOS 5.9Go To TopLast Changed 11 May 2000

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.