On Mon, Feb 12, 2001 at 01:48:40PM +0100, Phil Pennock wrote:
> 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. :^(
Alright, that sounds reasonable, but how are we handling portability
stuff. realpath(3) doesn't exist on win32, but _fullpath does. Should
I suggest this to the APR list, since portability stuff is their domain,
or should I hack up the file with #ifdef WIN32. That way APR could in
theory use the system version if it is not broken, or use their own if
it is broken.
> --
> A formal manipulator in mathematics often experiences the discomforting
> feeling that his pencil surpasses him in intelligence -- Howard W Eves
> ____________________________________________________________
--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Pilch-Bisson
kevin@pilch-bisson.net
http://www.pilch-bisson.net
PGP Public Key At http://pgp.pilch-bisson.net
- application/pgp-signature attachment: stored
Received on Sat Oct 21 14:36:22 2006