diff options
author | deraadt <> | 1995-10-18 08:42:23 +0000 |
---|---|---|
committer | deraadt <> | 1995-10-18 08:42:23 +0000 |
commit | 0527d29da443886d92e9a418180c5b25a5f8d270 (patch) | |
tree | 86b3a64928451a669cefa27900e5884036b4e349 /src/lib/libc/stdlib/realpath.3 | |
download | openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.tar.gz openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.tar.bz2 openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.zip |
initial import of NetBSD tree
Diffstat (limited to 'src/lib/libc/stdlib/realpath.3')
-rw-r--r-- | src/lib/libc/stdlib/realpath.3 | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/lib/libc/stdlib/realpath.3 b/src/lib/libc/stdlib/realpath.3 new file mode 100644 index 0000000000..9d8b1ff2ce --- /dev/null +++ b/src/lib/libc/stdlib/realpath.3 | |||
@@ -0,0 +1,126 @@ | |||
1 | .\" Copyright (c) 1994 | ||
2 | .\" The Regents of the University of California. All rights reserved. | ||
3 | .\" | ||
4 | .\" This code is derived from software contributed to Berkeley by | ||
5 | .\" Jan-Simon Pendry. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" 1. Redistributions of source code must retain the above copyright | ||
11 | .\" notice, this list of conditions and the following disclaimer. | ||
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer in the | ||
14 | .\" documentation and/or other materials provided with the distribution. | ||
15 | .\" 3. All advertising materials mentioning features or use of this software | ||
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 | ||
21 | .\" without specific prior written permission. | ||
22 | .\" | ||
23 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
24 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
25 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
26 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
27 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
28 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
29 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
30 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
31 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
33 | .\" SUCH DAMAGE. | ||
34 | .\" | ||
35 | .\" from: @(#)realpath.3 8.2 (Berkeley) 2/16/94 | ||
36 | .\" $Id: realpath.3,v 1.1.1.1 1995/10/18 08:42:19 deraadt Exp $ | ||
37 | .\" | ||
38 | .Dd "February 16, 1994" | ||
39 | .Dt REALPATH 3 | ||
40 | .Os | ||
41 | .Sh NAME | ||
42 | .Nm realpath | ||
43 | .Nd returns the canonicalized absolute pathname | ||
44 | .Sh SYNOPSIS | ||
45 | .Fd #include <sys/param.h> | ||
46 | .Fd #include <stdlib.h> | ||
47 | .Ft "char *" | ||
48 | .Fn realpath "const char *pathname" "char resolvedname[MAXPATHLEN]" | ||
49 | .Sh DESCRIPTION | ||
50 | The | ||
51 | .Fn realpath | ||
52 | function resolves all symbolic links, extra | ||
53 | .Dq / | ||
54 | characters and references to | ||
55 | .Pa /./ | ||
56 | and | ||
57 | .Pa /../ | ||
58 | in | ||
59 | .Fa pathname , | ||
60 | and copies the resulting absolute pathname into | ||
61 | the memory referenced by | ||
62 | .Fa resolvedname . | ||
63 | The | ||
64 | .Fa resolvedname | ||
65 | argument | ||
66 | .Em must | ||
67 | refer to a buffer capable of storing at least | ||
68 | .Dv MAXPATHLEN | ||
69 | characters. | ||
70 | .Pp | ||
71 | The | ||
72 | .Fn realpath | ||
73 | function will resolve both absolute and relative paths | ||
74 | and return the absolute pathname corresponding to | ||
75 | .Fa pathname . | ||
76 | All but the last component of | ||
77 | .Fa pathname | ||
78 | must exist when | ||
79 | .Fn realpath | ||
80 | is called. | ||
81 | .Sh "RETURN VALUES" | ||
82 | The | ||
83 | .Fn realpath | ||
84 | function returns | ||
85 | .Fa resolved_name | ||
86 | on success. | ||
87 | If an error occurs, | ||
88 | .Fn realpath | ||
89 | returns | ||
90 | .Dv NULL , | ||
91 | and | ||
92 | .Fa resolved_name | ||
93 | contains the pathname which caused the problem. | ||
94 | .Sh ERRORS | ||
95 | The function | ||
96 | .Fn realpath | ||
97 | may fail and set the external variable | ||
98 | .Va errno | ||
99 | 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 , | ||
104 | .Xr open 2 , | ||
105 | .Xr readlink 2 | ||
106 | and | ||
107 | .Xr getcwd 3 . | ||
108 | .Sh CAVEATS | ||
109 | This implementation of | ||
110 | .Fn realpath | ||
111 | differs slightly from the Solaris implementation. | ||
112 | The | ||
113 | .Bx 4.4 | ||
114 | version always returns absolute pathnames, | ||
115 | whereas the Solaris implementation will, | ||
116 | under certain circumstances, return a relative | ||
117 | .Fa resolved_path | ||
118 | when given a relative | ||
119 | .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 . | ||