Date: Thu, 24 Aug 2000 18:02:31 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: lauras AT softhome DOT net Message-Id: <6137-Thu24Aug2000180231+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5b CC: djgpp-workers AT delorie DOT com In-reply-to: <39A5266F.2C931D88@softhome.net> (message from Laurynas Biveinis on Thu, 24 Aug 2000 15:43:11 +0200) Subject: Re: Symlink resolving rewrite References: <39A5266F DOT 2C931D88 AT softhome DOT net> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Thu, 24 Aug 2000 15:43:11 +0200 > From: Laurynas Biveinis > > 2) __solve_dir_symlinks(): > > With this example path: > c:/dir/link/dir2 > Saves last path part (dir2 in example), also saves everything > before second slash from the end (c:/dir/) calls readlink() for > c:/dir/link. If readlink returns relative path, then it is appended > to saved c:/dir/, if absolute, then saved 'c:/dir/' is discarded. > Finally last path part ('dir2') is appended to result. Assuming this indeed is needed, wouldn't it be a better design to have a function that resolves one path component at a time? Then you could simply call it in a loop, replacing the slash after each part with a '\0', and accumulate the full resolved path as you go.