Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!hoptoad!peora!rtmvax!bilver!bill From: bill@bilver.UUCP (bill vermillion) Newsgroups: comp.unix.wizards Subject: Re: Dot files always first in directory? Message-ID: <537@bilver.UUCP> Date: 7 May 89 01:57:30 GMT References: <11108@bloom-beacon.MIT.EDU> <535@biar.UUCP> Reply-To: bill@bilver.UUCP (bill vermillion) Organization: W. J. Vermillion, Winter Park, FL Lines: 31 In article <535@biar.UUCP> trebor@biar.UUCP (Robert J Woodhead) writes: >In article <11108@bloom-beacon.MIT.EDU> jik@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@bilver.UUCP