www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/11/15/14:32:35

Message-ID: <38305AFA.F17C62CA@softhome.net>
Date: Mon, 15 Nov 1999 21:11:54 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
CC: djgpp-workers AT delorie DOT com
Subject: Re: First alpha symlink patch
References: <Pine DOT SUN DOT 3 DOT 91 DOT 991115185203 DOT 29634A-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019