Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!beta!unm-la!unmvax!turing.unm.edu!mike From: mike@turing.unm.edu.unm.edu (Michael I. Bushnell) Newsgroups: comp.unix.wizards Subject: Re: /bin/test and stat(2) Message-ID: <673@unmvax.unm.edu> Date: Wed, 14-Oct-87 17:46:08 EDT Article-I.D.: unmvax.673 Posted: Wed Oct 14 17:46:08 1987 Date-Received: Sat, 17-Oct-87 02:35:47 EDT References: <9767@brl-adm.ARPA> Sender: news@unmvax.unm.edu Reply-To: mike@turing.unm.edu.UUCP (Michael I. Bushnell) Organization: University of New Mexico, Albuquerque Lines: 68 In article <9767@brl-adm.ARPA> franco@MIKEY.BBN.COM (Frank A. Lonigro) writes: ~ ~ Thanks very much to those of you who answered my questions with ~intelligence. I have a couple more. ~ ~ Just thought I'd let you know that I found the manual page on ~the description of a path name but found it very contradictory. Here ~is an excerpt from the BSD manual page: ~ ~ File Name ~ Names consisting of up to {FILENAME_MAX} characters may ~ be used to name an ordinary file, special file, or ~ directory. ~ ~ These characters may be selected from the set of all ~ ASCII characters excluding 0 (null) and the ASCII code ~ for / (slash). (The parity bit, bit 8, must be 0.) ~ ~ Note that it is generally unwise to use *, ?, or [ ] as ~ part of file names because of the special meaning ~ attached to these characters by the shell. ~ ~ Path Name ~ A path name is a null-terminated character string ~ starting with an optional slash (/), followed by zero ~ or more directory names separated by slashes, option- ~ ally followed by a file name. The total length of a ~ path name must be less than {PATHNAME_MAX} characters. ~ ~ If a path name begins with a slash, the path search ~ begins at the root directory. Otherwise, the search ~ begins from the current working directory. A slash by ~ itself names the root directory. A null pathname ~ refers to the current directory. ~ ~According to the naming convention of file names, all ASCII chars can be ~used except a NULL or the slash. This convention includes the naming of ~directories. So, how can a null string be considered a file name, let ~alone a directory, and why should there be two ways to refer to the same ~thing (the current directory)? It really doesn't make sense! ~ Look back at the good posting about 0 length strings. A pathname with length zero is NOT the same as a pathname with length one, and the first char being NULL. The reason for not allowing NULL in pathnames is, I hope, obvious. It is also the terminator for strings. A null string is a string of length zero. According the rules in the second section above, it has [no leading slash][no directory names (sep. by '/')][empty final comp.] The rules clearly allow "" as a pathname, and specify that it must mean cwd. But "" is NOT "\0". Michael I. Bushnell a/k/a Bach II mike@turing.unm.edu {ucbvax,gatech}!unmvax!turing!mike --- WHO sees a BEACH BUNNY sobbing on a SHAG RUG?! -- Zippy the Pinhead