abs2rel.3 (0ed76ec8e66470e45d74395e12cf425dfb21d381) abs2rel.3 (3d265fce43746c293ae826e9603adbfe09f93cf6)
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

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

114.Pp
115
116 path = abs2rel("/sys/kern", realpath("/sys", resolvedname), result, MAXPATHLEN);
117
118yields:
119
120 path == "../../../sys/kern" /* It's correct but ... */
121
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

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

114.Pp
115
116 path = abs2rel("/sys/kern", realpath("/sys", resolvedname), result, MAXPATHLEN);
117
118yields:
119
120 path == "../../../sys/kern" /* It's correct but ... */
121
122That is correct, but a little redundant. If you wish get the simple
123answer 'kern', do the following.
122That is correct, but a little redundant.
123If you wish get the simple answer 'kern', do the following.
124
125 path = abs2rel(realpath("/sys/kern", r1), realpath("/sys", r2),
126 result, MAXPATHLEN);
127
128The
129.Fn realpath
130function assures correct result, but don't forget that
131.Fn realpath
132requires that all but the last component of the path exist.
133.Sh "SEE ALSO"
134.Xr rel2abs 3
135.Sh AUTHORS
136Shigio Yamaguchi (shigio@tamacom.com)
124
125 path = abs2rel(realpath("/sys/kern", r1), realpath("/sys", r2),
126 result, MAXPATHLEN);
127
128The
129.Fn realpath
130function assures correct result, but don't forget that
131.Fn realpath
132requires that all but the last component of the path exist.
133.Sh "SEE ALSO"
134.Xr rel2abs 3
135.Sh AUTHORS
136Shigio Yamaguchi (shigio@tamacom.com)