Dot files always first in directory?
bill vermillion
bill at bilver.UUCP
Sun May 7 11:57:30 AEST 1989
In article <535 at biar.UUCP> trebor at biar.UUCP (Robert J Woodhead) writes:
>In article <11108 at bloom-beacon.MIT.EDU> jik at athena.mit.edu (Jonathan I. Kamens) writes:
>>It it safe to assume when writing a program which manipulates
>>directories that . and .. will always be the first two entries in a
>>directory?
>No. It isn't safe to make this assumption. Even if it is true on your
>machine, it may not be on another implementation (it isn't on my Xenix
>box, according to a quick test using ``l''), and it surely will be changed
>_just_to_smite_your_program_ at some time in the future.
I think if you will look at the Xenix manual, section F, entry DIR, you will
find that Xenix follows the others. Even the manual is the same "by
convention the first two entires in each director are "dot" (.) and "dotdot"
(..) ...
"l" is a program that sorts directory entries. It has NO relationship to how
they are stored in the directory. To see this go to your directory you did
an "l" on and try od -x . (octal dump of the dirctory you are in).
You will see that . and .. are the two first entries.
If you think about it, it has to be this way, doesn't it. You can't use a
directory until you create it. To create it you must make an entry for it's
parent and itself. Only then can you add other entries. And you can't
remove them and access the directory.
--
Bill Vermillion - UUCP: {uiucuxc,hoptoad,petsd}!peora!rtmvax!bilver!bill
: bill at bilver.UUCP
More information about the Comp.unix.wizards
mailing list