Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!ukma!husc6!ogccse!littlei!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.wizards Subject: giving mouth-to-mouth to a dead horse (was Re: Dot files always first in directory?) Summary: first, a mess in the C group, and now in WIZARDS? Sheesh. Message-ID: <4386@omepd.UUCP> Date: 6 May 89 23:09:43 GMT References: <11108@bloom-beacon.MIT.EDU> <3540@udccvax1.acs.udel.EDU> <2778@buengc.BU.EDU> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 35 In-reply-to: bph@buengc.BU.EDU (Blair P. Houghton) In article <2778@buengc.BU.EDU>, bph@buengc (Blair P. Houghton) writes: | >NO, its not save to assume that. | >try "touch #abcd" then 'list' the directory. | To beat this horse quite dead, any leading character that would sort before | the period will place the filename before the . and .. in a directory | listing. The ascii characters that will do this are space, !, ", #, $, %, | &, ', (, ), *, +, ,, and -. I haven't tried it, but I bet you can get the | nonprinting ascii characters to do it too. There are 32 of those. Nope (he says, donning the usual asbestos suit...), the original requestor was using opendir/readdir. These routines have *NOTHING* to do with ASCII sorting order, but rather return the order of files in the underlying directory. The original statement (paraphrased) was "Can I assume that . and .., having generally been created first, can be safely skipped while scanning the directory *IN DIRECTORY ORDER* without possibly fouling up?" The answer, apparently (according to the half dozen responses arriving here) is *no*. Your response is the right answer to the *wrong question* -- the question you answered was "can I get a filename that sorts before the '.' and '..' entry if I say 'ls -a'?". (Maybe if you try adding the filenames... no... nevermind... :-) P.S. Note the yet-again updated sig. BiiN just killed all contractors and temps -- stay tuned for the dismantling :-) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\ { on contract to BiiN, Hillsboro, Oregon, USA, until 14 May 1989 } { ...!uunet!tektronix!biin!merlyn } { or try after 15 May 1989 } \=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/