[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: condense_targets and basepath functions

From: Phil Pennock <Phil.Pennock_at_globnix.org>
Date: 2001-02-12 13:48:40 CET

On 2001-02-12 at 07:34 -0500, Kevin Pilch-Bisson gifted us with:
> Offhand, does anyone know the best
> way to convert relative paths to absolute. I looked at realpath(3), but
> it doesn't seem very portable, and says Solaris may give relative paths
> back. I also looked through APR, and the docs for apr_stat seem to
> suggest that it converts paths, but the implementation does nothing of
> the sort. I could obviously do it by walking through the string looking
> for `.'s and `..'s but I would have thought there would be a standard
> way of doing it.
>
> Any ideas.

realpath(3) is the way to go; if the system one is broken, copy one from
a 4.4BSD system (or write your own).

realpath(3) _is_ the standard non-self-rolled way.

A BSD system manual-page notes:
ERRORS
     The function realpath() may fail and set the external variable errno for
     any of the errors specified for the library functions chdir(2), close(2),
     fchdir(2), lstat(2), open(2), readlink(2), and getcwd(3).
which gives a few clues. ;^)

Solaris is a known problem. It's why so many things like ftp daemons
carry their own implementation of realpath with them. :^(

-- 
A formal manipulator in mathematics often experiences the discomforting
feeling that his pencil surpasses him in intelligence -- Howard W Eves
Received on Sat Oct 21 14:36:21 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.