From: Bernard Dautrevaux <[EMAIL PROTECTED]>
Date: Thu, 6 Jul 2000 17:26:48 +0200
under UN*X, '//1' should give '/',
No, under some older flavors of Unix, leading // is a special path
name: it refers to a "super-root" and is used to access other
machines' files. Leading ///, ////, etc. are equivalent to /; but
leading // is special. I think this tradition started with Apollo
Domain/OS, an OS that is still in use on some older hosts.
POSIX.2 allows but does not require the special treatment for //.
It says that the behavior of dirname on path names of the form
//([^/]+/*)? is implementation defined. In these cases, GNU dirname
returns /, but it's more portable to return // as this works even on
those older flavors of Unix.
I have heard rumors that this special treatment of // may be dropped
in future versions of POSIX, but for now it's still the standard.
under Losedows "//1" should probably remain unchanged; after
all it is the root directory of a given machine.
No, // is the parent directory of //1 even if //1 is a root directory
on another host. It's analogous to the situation with mounts. On my
host, /usr is the root directory of its filesystem, but the parent of
/usr is still /.
One could even argue that "//1/2" should remain unchanged as "//1"
is NOT a directory (I cannot create anything in it)
That doesn't mean it is not a directory. In general, if DE is a valid
path name, and D ends in a slash, and E begins with a non-slash, then
D must be a directory -- otherwise path name interpretation doesn't
make sense.
I still think the expr-based solution that I sent to autoconf-patches
yesterday is the way to go.