diff options
author | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-20 22:11:13 +0000 |
---|---|---|
committer | drow <drow@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-20 22:11:13 +0000 |
commit | 846a645c173e6d1b00187f1feed6104d13cb6ac1 (patch) | |
tree | e345914b98acba3281c7933fd21ce8beecd43bb6 /libiberty/functions.texi | |
parent | a12d249cfc78fd9771fce1a54c9417b55b279fc1 (diff) | |
download | gcc-846a645c173e6d1b00187f1feed6104d13cb6ac1.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63186 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/functions.texi')
-rw-r--r-- | libiberty/functions.texi | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/libiberty/functions.texi b/libiberty/functions.texi index 18b2480a781..2c7b9e1276a 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 |