Mail Archives: djgpp-workers/1999/11/15/14:32:35
Eli Zaretskii wrote:
> `ftw' recursively descends a directory tree, applying a user-defined
> function to each file. What happens if you pass it a user-defined
> function that, if the file is a directory, chdirs to that directory and
> prints what getcwd returns? Just for fun, make it chdir by calling
> __dpmi_in directly.
OK, tried it with chdir(), tried with my own chdir() through __dpmi_int() -
everything works. Of course, if I use __dpmi_int(), I have to resolve
symlinks by hand, and getwd() returns real directory instead.
> > BTW, how could DOS store `current directory' itself? IMHO in global
> > variable.
> DOS can do it because it is itself the server of the chdir call. Our
> libc isn't, so it isn't simple for it to keep track of cwd.
Yes, but I try to determine, when I can and when I cannot keep track of
current dir: in chdir() I remember real directory name as well as symlink,
and in getwd() I always make a DOS call and compare results with real
directory name. Only if they match, I return symlink. IMHO this way should work.
Laurynas Biveinis
- Raw text -