From ba61a412530eb1b5ae3edbf319163377f1768d29 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Thu, 20 Feb 2003 22:14:18 +0000 Subject: * Makefile.in (CFILES): Add lrealpath.c. (REQUIRED_OFILES): Add lrealpath.o. (lrealpath.o): Add rule. * aclocal.m4 (libiberty_NEED_DECLARATION): Add. * configure.in: Add realpath and canonicalize_file_name to checkfuncs and AC_CHECK_FUNCS. Use libiberty_NEED_DECLARATION for canonicalize_file_name. * lrealpath.c: New file. * make-relative-prefix.c: Update documentation. (make_relative_prefix): Simplify. Use lbasename and lrealpath. * config.in: Regenerated. * configure: Regenerated. * functions.texi: Regenerated. --- libiberty/functions.texi | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'libiberty/functions.texi') diff --git a/libiberty/functions.texi b/libiberty/functions.texi index 18b2480..2c7b9e1 100644 --- a/libiberty/functions.texi +++ b/libiberty/functions.texi @@ -392,19 +392,38 @@ and a path ending in @code{/} returns the empty string after it. @end deftypefn -@c make-relative-prefix.c:24 -@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix}) +@c lrealpath.c:25 +@deftypefn Replacement {const char*} lrealpath (const char *@var{name}) + +Given a pointer to a string containing a pathname, returns a canonical +version of the filename. Symlinks will be resolved, and ``.'' and ``..'' +components will be simplified. The returned value will be allocated using +@code{xmalloc} or @code{malloc}. -Given three strings @var{progname}, @var{bin_prefix}, @var{prefix}, return a string -that gets to @var{prefix} starting with the directory portion of @var{progname} and -a relative pathname of the difference between @var{bin_prefix} and @var{prefix}. +@end deftypefn -For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, @var{prefix} -is @code{/alpha/beta/gamma/omega/}, and @var{progname} is @code{/red/green/blue/gcc}, -then this function will return @code{/red/green/blue/../../omega/}. +@c make-relative-prefix.c:24 +@deftypefn Extension {const char*} make_relative_prefix (const char *@var{progname}, const char *@var{bin_prefix}, const char *@var{prefix}) -The return value is normally allocated via @code{malloc}. If no relative prefix -can be found, return @code{NULL}. +Given three paths @var{progname}, @var{bin_prefix}, @var{prefix}, +return the path that is in the same position relative to +@var{progname}'s directory as @var{prefix} is relative to +@var{bin_prefix}. That is, a string starting with the directory +portion of @var{progname}, followed by a relative pathname of the +difference between @var{bin_prefix} and @var{prefix}. + +If @var{progname} does not contain any directory separators, +@code{make_relative_prefix} will search @env{PATH} to find a program +named @var{progname}. Also, if @var{progname} is a symbolic link, +the symbolic link will be resolved. + +For example, if @var{bin_prefix} is @code{/alpha/beta/gamma/gcc/delta}, +@var{prefix} is @code{/alpha/beta/gamma/omega/}, and @var{progname} is +@code{/red/green/blue/gcc}, then this function will return +@code{/red/green/blue/../../omega/}. + +The return value is normally allocated via @code{malloc}. If no +relative prefix can be found, return @code{NULL}. @end deftypefn -- cgit v1.1