Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
REL2ABS(3)		 BSD Library Functions Manual		    REL2ABS(3)

NAME
     rel2abs --	make an	absolute path name from	a relative path	name

SYNOPSIS
     char *
     rel2abs(const char	*path, const char *base, char *result, size_t size);

DESCRIPTION
     The rel2abs() function makes an absolute path name	from a relative	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 character

     The resulting path	name may include symbolic links.  abs2rel() doesn't
     check whether or not any path exists.

RETURN VALUES
     The rel2abs() function returns absolute path name on success.  If an er-
     ror occurs, it returns NULL.

ERRORS
     The rel2abs() function may	fail and set the external variable errno to
     indicate the error.

     [EINVAL]		The base directory isn't an absolute path name or the
			size argument is zero.

     [ERANGE]		The size argument is greater than zero but smaller
			than the length	of the pathname	plus 1

EXAMPLE
	 char result[MAXPATHLEN];
	 char *path = rel2abs("../../src/sys", "/usr/local/lib", result, MAX-
     PATHLEN);

     yields:

	 path == "/usr/src/sys"

     Similarly,

	 path1 = rel2abs("src/sys", "/usr", result, MAXPATHLEN);
	 path2 = rel2abs(".", "/usr/src/sys", result, MAXPATHLEN);

     yields:

	 path1 == "/usr/src/sys"
	 path2 == "/usr/src/sys"

SEE ALSO
     abs2rel(3)

AUTHORS
     Shigio Yamaguchi (shigio@tamacom.com)

BSD				 Dec 3,	1997"				   BSD

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | EXAMPLE | SEE ALSO | AUTHORS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=rel2abs&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help