null filename handling question
Mark Biggar
markb at sdcrdcf.UUCP
Wed Sep 5 06:39:49 AEST 1984
In article <opus.772> rcd at opus.UUCP (Dick Dunn) writes:
>Since posting my original query, I've been corrected--V7 and older systems
>treat a null file name as the current directory; Sys III treats it as a
>nonexistent file. But I'm still curious about the reason for "" meaning
>the current directory.
I don't imagine that it was planned on, it kind of just happened. The code
in the file system name resolution routine probably goes:
if name starts with slash then
use root directory
else
use current directory
endif
while not end of string
if current file not directory then error
get and skip over next name
find in current file
use it as current file
endwhile
Note that this resolves "/" to the right thing, but has the side effect
of resolving "" to the current directory.
This is also explains why things like "cd /usr/spool/" work on v7 & 4bsd
and not on system III.
Mark Biggar
{allegra,burdvax,cbosgd,hplabs,ihnp4,akgua,sdcsvax}!sdcrdcf!markb
More information about the Comp.unix.wizards
mailing list