rel2abs.3 (0ed76ec8e66470e45d74395e12cf425dfb21d381) rel2abs.3 (094517119c62c23369d545a7475ae982d86330a3)
1.\"
2.\" Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
3.\" Copyright (c) 1999 Tama Communications Corporation. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
1.\"
2.\" Copyright (c) 1997 Shigio Yamaguchi. All rights reserved.
3.\" Copyright (c) 1999 Tama Communications Corporation. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD$
27.\"
28.Dd Dec 3, 1997"
28.Dd December 3, 1997
29.Dt REL2ABS 3
30.Os
31.Sh NAME
32.Nm rel2abs
33.Nd make an absolute path name from a relative path name
34.Sh SYNOPSIS
35.Ft "char *"
36.Fn rel2abs "const char *path" "const char *base" "char *result" "size_t size"

--- 16 unchanged lines hidden (view full) ---

53.Fn abs2rel
54doesn't check whether or not any path exists.
55.Sh "RETURN VALUES"
56The
57.Fn rel2abs
58function returns absolute path name on success.
59If an error occurs, it returns
60.Dv NULL .
29.Dt REL2ABS 3
30.Os
31.Sh NAME
32.Nm rel2abs
33.Nd make an absolute path name from a relative path name
34.Sh SYNOPSIS
35.Ft "char *"
36.Fn rel2abs "const char *path" "const char *base" "char *result" "size_t size"

--- 16 unchanged lines hidden (view full) ---

53.Fn abs2rel
54doesn't check whether or not any path exists.
55.Sh "RETURN VALUES"
56The
57.Fn rel2abs
58function returns absolute path name on success.
59If an error occurs, it returns
60.Dv NULL .
61.Sh EXAMPLES
62 char result[MAXPATHLEN];
63 char *path = rel2abs("../../src/sys", "/usr/local/lib", result, MAXPATHLEN);
64
65yields:
66
67 path == "/usr/src/sys"
68
69Similarly,
70
71 path1 = rel2abs("src/sys", "/usr", result, MAXPATHLEN);
72 path2 = rel2abs(".", "/usr/src/sys", result, MAXPATHLEN);
73
74yields:
75
76 path1 == "/usr/src/sys"
77 path2 == "/usr/src/sys"
61.Sh ERRORS
62The
63.Fn rel2abs
64function may fail and set the external variable
65.Va errno
66to indicate the error.
67.Bl -tag -width Er
68.It Bq Er EINVAL
69The
70.Fa base
71directory isn't an absolute path name or the
72.Fa size
73argument is zero.
74.It Bq Er ERANGE
75The
76.Fa size
77argument is greater than zero but smaller than the length of the pathname plus 1
78.Sh ERRORS
79The
80.Fn rel2abs
81function may fail and set the external variable
82.Va errno
83to indicate the error.
84.Bl -tag -width Er
85.It Bq Er EINVAL
86The
87.Fa base
88directory isn't an absolute path name or the
89.Fa size
90argument is zero.
91.It Bq Er ERANGE
92The
93.Fa size
94argument is greater than zero but smaller than the length of the pathname plus 1
78.Sh EXAMPLE
79 char result[MAXPATHLEN];
80 char *path = rel2abs("../../src/sys", "/usr/local/lib", result, MAXPATHLEN);
81
82yields:
83
84 path == "/usr/src/sys"
85
86Similarly,
87
88 path1 = rel2abs("src/sys", "/usr", result, MAXPATHLEN);
89 path2 = rel2abs(".", "/usr/src/sys", result, MAXPATHLEN);
90
91yields:
92
93 path1 == "/usr/src/sys"
94 path2 == "/usr/src/sys"
95.Sh "SEE ALSO"
95.Sh SEE ALSO
96.Xr abs2rel 3
97.Sh AUTHORS
96.Xr abs2rel 3
97.Sh AUTHORS
98Shigio Yamaguchi (shigio@tamacom.com)
98.An Shigio Yamaguchi (shigio@tamacom.com)