|
NAMEabs2rel —
make a relative path name from an absolute path name
SYNOPSISchar *abs2rel (const
char *path, const char
*base, char *result,
size_t size);
DESCRIPTIONTheabs2rel () function makes a relative path name from
an absolute path name path based on a directory
base and copies the resulting path name into the memory
referenced by result. The result
argument must refer to a buffer capable of storing at least
size characters.
The resulting path name may include symbolic links. The
RETURN VALUESTheabs2rel () function returns relative path name on
success. If an error occurs, it returns NULL .
ERRORSTheabs2rel () function may fail and set the external
variable errno to indicate the error.
EXAMPLEchar result[MAXPATHLEN]; char *path = abs2rel("/usr/src/sys", "/usr/local/lib", result, MAXPATHLEN); yields:
Similarly,
yields:
BUGSIf the base directory includes symbolic links, theabs2rel () function produces the wrong path. For
example, if '/sys' is a symbolic link to '/usr/src/sys',
yields:
You should convert the base directory into a real path in advance.
yields:
That is correct, but a little redundant. If you wish get the simple answer 'kern', do the following.
The SEE ALSOrel2abs(3)AUTHORSShigio Yamaguchi (shigio@tamacom.com)
Visit the GSP FreeBSD Man Page Interface. |