diff options
author | hrs <hrs@FreeBSD.org> | 2011-05-29 02:53:52 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2011-05-29 02:53:52 +0000 |
commit | 8fe640108653f13042f1b15213769e338aa524f6 (patch) | |
tree | 91f5675a7c792e61d68635707501027daa3f566f /lib/libc/stdlib/realpath.3 | |
parent | 97f64b711efa9ff0011bef5d46cf9645638a38f9 (diff) | |
parent | f3726238c8e8206eb1df4cfaf3f00947ceba3cce (diff) | |
download | FreeBSD-src-8fe640108653f13042f1b15213769e338aa524f6.zip FreeBSD-src-8fe640108653f13042f1b15213769e338aa524f6.tar.gz |
Merge from head@222434.
Diffstat (limited to 'lib/libc/stdlib/realpath.3')
-rw-r--r-- | lib/libc/stdlib/realpath.3 | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/lib/libc/stdlib/realpath.3 b/lib/libc/stdlib/realpath.3 index 4205a3d..fec5258 100644 --- a/lib/libc/stdlib/realpath.3 +++ b/lib/libc/stdlib/realpath.3 @@ -31,7 +31,7 @@ .\" @(#)realpath.3 8.2 (Berkeley) 2/16/94 .\" $FreeBSD$ .\" -.Dd February 16, 1994 +.Dd April 19, 2010 .Dt REALPATH 3 .Os .Sh NAME @@ -43,7 +43,7 @@ .In sys/param.h .In stdlib.h .Ft "char *" -.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]" +.Fn realpath "const char *pathname" "char *resolved_path" .Sh DESCRIPTION The .Fn realpath @@ -56,15 +56,16 @@ and in .Fa pathname , and copies the resulting absolute pathname into -the memory referenced by +the memory pointed to by .Fa resolved_path . The .Fa resolved_path argument .Em must -refer to a buffer capable of storing at least +point to a buffer capable of storing at least .Dv PATH_MAX -characters. +characters, or be +.Dv NULL . .Pp The .Fn realpath @@ -82,13 +83,22 @@ The function returns .Fa resolved_path on success. +If the function was supplied +.Dv NULL +as +.Fa resolved_path , +and operation did not cause errors, the returned value is +a null-terminated string in a buffer allocated by a call to +.Fn malloc 3 . If an error occurs, .Fn realpath returns .Dv NULL , -and +and if .Fa resolved_path -contains the pathname which caused the problem. +is not +.Dv NULL , +the array that it points to contains the pathname which caused the problem. .Sh ERRORS The function .Fn realpath @@ -99,6 +109,18 @@ for any of the errors specified for the library functions .Xr readlink 2 and .Xr getcwd 3 . +.Sh SEE ALSO +.Xr getcwd 3 +.\" .Sh STANDARDS +.\" The +.\" .Fn realpath +.\" function conforms to +.\" .St -p1003.1-2001 . +.Sh HISTORY +The +.Fn realpath +function first appeared in +.Bx 4.4 . .Sh CAVEATS This implementation of .Fn realpath @@ -111,10 +133,3 @@ under certain circumstances, return a relative .Fa resolved_path when given a relative .Fa pathname . -.Sh "SEE ALSO" -.Xr getcwd 3 -.Sh HISTORY -The -.Fn realpath -function first appeared in -.Bx 4.4 . |