From: Eric Backus Subject: Re: several questiond from new user To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Date: Thu, 24 Jun 93 13:21:22 PDT Mailer: Elm [revision: 66.25] > > 1. If you call getcwd(buf,255) you will get the current working > > directory but without the DOS drive. Is this a bug, an > > intentional feature or a temporary abberation which will be > > fixed. I would like to know before I make lots of changes to my > > existing code to accomodate this inconsistancy between djgpp > > and the other DOS compilers. > > How many unix programs will break when you change this? It sounds > like an easy change. I think the number of UNIX programs that would break is small, but non-zero. The biggest danger I see is the following: 1. code calls getcwd and puts it in string "dir". 2. code wants to remove any possible trailing slashes from "dir" a. but the code knows that a single lone "/" is the root directory, a special case where the trailing "/" should not be removed. b. So the code sees dir == "a:/", decides that this is not the root directory, and removes the "/" leaving "a:". 3. Now the code uses the "dir", which points to "a:" rather than "a:/", and gets things wrong because "a:" by convention means the current directory on device a, not necessarily the root directory. On the other hand: 1. I took a quick glance through the FSF utilities source code, and I couldn't find any examples of this, so at least we probably wouldn't break any FSF code. 2. Correct handling of DOS device specifiers often requires adding extra code to the original UNIX source code anyway. -- Eric Backus ericb AT lsid DOT hp DOT com (206) 335-2495