63 lines
1.7 KiB
Plaintext
63 lines
1.7 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3c.realpath @(#)realpath 41.3 of 5/22/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.\" @(#)realpath.3 1.8 88/03/07 SMI;
|
|
'\"! tbl | mmdoc
|
|
'\"macro stdmacro
|
|
.if n .pH g3c.realpath @(#)realpath 31.1 of 4/5/88
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.nr X
|
|
.if \nX=0 .ds x} realpath 3C "C Development Set" "\&"
|
|
.if \nX=1 .ds x} realpath 3C "C Development Set"
|
|
.if \nX=2 .ds x} realpath 3C "" "\&"
|
|
.if \nX=3 .ds x} realpath "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4realpath\f1 \- returns the real file name
|
|
.SH SYNOPSIS
|
|
.PP
|
|
.nf
|
|
\f4#include <stdlib.h>
|
|
#include <sys/param.h>\f1
|
|
.P
|
|
\f4char \(**realpath (const char \(**file_name, char \(**resolved_name);
|
|
.fi
|
|
.SH DESCRIPTION
|
|
\f4realpath\f1
|
|
resolves all links, symbolic links, and references to ``.'' and ``..'' in
|
|
\f2file_name\fP
|
|
and stores it in
|
|
\f2resolved_name\fP.
|
|
.PP
|
|
It 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, \f4../../reldir\fP),
|
|
it returns the
|
|
\f2resolved absolute\fP name.
|
|
.PP
|
|
\f2resolved_name\fP should point to a buffer
|
|
(\f4MAXPATHLEN\fP) bytes in length to contain the
|
|
fully resolved path name.
|
|
.SH SEE ALSO
|
|
\f4getcwd\f1(3C).
|
|
.SH DIAGNOSTICS
|
|
If there is no error, \f4realpath\fP returns a pointer to the
|
|
\f2resolved_name\fP.
|
|
Otherwise it returns a
|
|
null
|
|
pointer and places the name of the offending file in
|
|
\f2resolved_name\fP.
|
|
The global variable
|
|
\f4errno\fP
|
|
is set to indicate the error.
|
|
.SH NOTES
|
|
\f4realpath\fP operates on null-terminated strings.
|
|
.PP
|
|
One should have execute permission on all the directories
|
|
in the given and the resolved path.
|
|
.PP
|
|
\f4realpath\fP
|
|
may fail to return to the current directory if an error occurs.
|