Mail Archives: djgpp/1993/06/25/15:12:26
> > > 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.
>
I would think the best way to handle this would be to "unix-ize" the dos
pathname by modifying the open routines to handle filenames that specify
the drive in a unix compatible, but DOS recognizable fashion...
One possible solution would be:
/<drive>//path
ie c:\src\djgpp would be /c//src/djgpp
but \c\src\djgpp would be /c/src/djgpp
This method shouldn't break any utilities unless they parse the full pathname
to remove duplicate /'s...
- Raw text -