Mail Archives: djgpp-workers/1999/05/14/22:38:58
> > do you plan to support the realpath() function?
>
> Nobody asked for it until now (personally, I didn't even know such a
> function existed on Unix platforms).
It seems to come from the BSD variants...
> It should be easy to add a simple wrapper around _fixpath. Volunteers
> are welcome ;-)
I don't have enough knowledge of Dos and DJGPP to do it myself. (I
develop on Linux, and compile my code also for DJGPP for others who
need/want it.)
Anyway, what a realpath function would have to do is simply:
call _fixpath (with the same 2 arguments that it takes)
check if the resulting path exists
if so, return it (i.e., the second parameter resolved_path)
otherwise:
find the first component that does not exist
truncate resolved_path after that component
return NULL
In particular, I don't know how to check for existence of a path in
the best way. access could be used, I suppose, but since it's a bit
longish and calls _fixpath again, this might not be the best
solution, since it may be necessary to call it a number of times.
Perhaps it's better to extract the parts of access that do the real
work, but that seems to be low-level Dos stuff I'd rather not get
into...
Frank
--
Frank Heckenbach, frank AT fjf DOT gnu DOT de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan
- Raw text -