diff options
Diffstat (limited to 'src/lib/libc/stdlib/realpath.3')
-rw-r--r-- | src/lib/libc/stdlib/realpath.3 | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3 index 9d8b1ff2ce..e1e0b10605 100644 --- a/src/lib/libc/stdlib/realpath.3 +++ b/src/lib/libc/stdlib/realpath.3 | |||
@@ -12,11 +12,7 @@ | |||
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer in the | 13 | .\" notice, this list of conditions and the following disclaimer in the |
14 | .\" documentation and/or other materials provided with the distribution. | 14 | .\" documentation and/or other materials provided with the distribution. |
15 | .\" 3. All advertising materials mentioning features or use of this software | 15 | .\" 3. Neither the name of the University nor the names of its contributors |
16 | .\" must display the following acknowledgement: | ||
17 | .\" This product includes software developed by the University of | ||
18 | .\" California, Berkeley and its contributors. | ||
19 | .\" 4. Neither the name of the University nor the names of its contributors | ||
20 | .\" may be used to endorse or promote products derived from this software | 16 | .\" may be used to endorse or promote products derived from this software |
21 | .\" without specific prior written permission. | 17 | .\" without specific prior written permission. |
22 | .\" | 18 | .\" |
@@ -32,10 +28,9 @@ | |||
32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
33 | .\" SUCH DAMAGE. | 29 | .\" SUCH DAMAGE. |
34 | .\" | 30 | .\" |
35 | .\" from: @(#)realpath.3 8.2 (Berkeley) 2/16/94 | 31 | .\" $OpenBSD: realpath.3,v 1.13 2005/04/03 18:59:15 otto Exp $ |
36 | .\" $Id: realpath.3,v 1.1.1.1 1995/10/18 08:42:19 deraadt Exp $ | ||
37 | .\" | 32 | .\" |
38 | .Dd "February 16, 1994" | 33 | .Dd February 16, 1994 |
39 | .Dt REALPATH 3 | 34 | .Dt REALPATH 3 |
40 | .Os | 35 | .Os |
41 | .Sh NAME | 36 | .Sh NAME |
@@ -45,7 +40,7 @@ | |||
45 | .Fd #include <sys/param.h> | 40 | .Fd #include <sys/param.h> |
46 | .Fd #include <stdlib.h> | 41 | .Fd #include <stdlib.h> |
47 | .Ft "char *" | 42 | .Ft "char *" |
48 | .Fn realpath "const char *pathname" "char resolvedname[MAXPATHLEN]" | 43 | .Fn realpath "const char *pathname" "char resolved[PATH_MAX]" |
49 | .Sh DESCRIPTION | 44 | .Sh DESCRIPTION |
50 | The | 45 | The |
51 | .Fn realpath | 46 | .Fn realpath |
@@ -57,18 +52,17 @@ and | |||
57 | .Pa /../ | 52 | .Pa /../ |
58 | in | 53 | in |
59 | .Fa pathname , | 54 | .Fa pathname , |
60 | and copies the resulting absolute pathname into | 55 | and copies the resulting absolute pathname into the memory referenced by |
61 | the memory referenced by | 56 | .Fa resolved . |
62 | .Fa resolvedname . | ||
63 | The | 57 | The |
64 | .Fa resolvedname | 58 | .Fa resolved |
65 | argument | 59 | argument |
66 | .Em must | 60 | .Em must |
67 | refer to a buffer capable of storing at least | 61 | refer to a buffer capable of storing at least |
68 | .Dv MAXPATHLEN | 62 | .Dv PATH_MAX |
69 | characters. | 63 | characters. |
70 | .Pp | 64 | .Pp |
71 | The | 65 | The |
72 | .Fn realpath | 66 | .Fn realpath |
73 | function will resolve both absolute and relative paths | 67 | function will resolve both absolute and relative paths |
74 | and return the absolute pathname corresponding to | 68 | and return the absolute pathname corresponding to |
@@ -78,33 +72,37 @@ All but the last component of | |||
78 | must exist when | 72 | must exist when |
79 | .Fn realpath | 73 | .Fn realpath |
80 | is called. | 74 | is called. |
81 | .Sh "RETURN VALUES" | 75 | .Sh RETURN VALUES |
82 | The | 76 | The |
83 | .Fn realpath | 77 | .Fn realpath |
84 | function returns | 78 | function returns |
85 | .Fa resolved_name | 79 | .Fa resolved |
86 | on success. | 80 | on success. |
87 | If an error occurs, | 81 | If an error occurs, |
88 | .Fn realpath | 82 | .Fn realpath |
89 | returns | 83 | returns |
90 | .Dv NULL , | 84 | .Dv NULL |
91 | and | 85 | and the contents of |
92 | .Fa resolved_name | 86 | .Fa resolved |
93 | contains the pathname which caused the problem. | 87 | are undefined. |
94 | .Sh ERRORS | 88 | .Sh ERRORS |
95 | The function | 89 | The function |
96 | .Fn realpath | 90 | .Fn realpath |
97 | may fail and set the external variable | 91 | may fail and set the external variable |
98 | .Va errno | 92 | .Va errno |
99 | for any of the errors specified for the library functions | 93 | for any of the errors specified for the library functions |
100 | .Xr chdir 2 , | ||
101 | .Xr close 2 , | ||
102 | .Xr fchdir 2 , | ||
103 | .Xr lstat 2 , | 94 | .Xr lstat 2 , |
104 | .Xr open 2 , | 95 | .Xr readlink 2 , |
105 | .Xr readlink 2 | ||
106 | and | 96 | and |
107 | .Xr getcwd 3 . | 97 | .Xr getcwd 3 . |
98 | .Sh SEE ALSO | ||
99 | .Xr readlink 1 , | ||
100 | .Xr getcwd 3 | ||
101 | .Sh HISTORY | ||
102 | The | ||
103 | .Fn realpath | ||
104 | function call first appeared in | ||
105 | .Bx 4.4 . | ||
108 | .Sh CAVEATS | 106 | .Sh CAVEATS |
109 | This implementation of | 107 | This implementation of |
110 | .Fn realpath | 108 | .Fn realpath |
@@ -114,13 +112,6 @@ The | |||
114 | version always returns absolute pathnames, | 112 | version always returns absolute pathnames, |
115 | whereas the Solaris implementation will, | 113 | whereas the Solaris implementation will, |
116 | under certain circumstances, return a relative | 114 | under certain circumstances, return a relative |
117 | .Fa resolved_path | 115 | .Fa resolved |
118 | when given a relative | 116 | when given a relative |
119 | .Fa pathname . | 117 | .Fa pathname . |
120 | .Sh "SEE ALSO" | ||
121 | .Xr getcwd 3 | ||
122 | .Sh HISTORY | ||
123 | The | ||
124 | .Fn realpath | ||
125 | function call first appeared in | ||
126 | .Bx 4.4 . | ||