> -----Original Message-----
> From: Akim Demaille [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 06, 2000 5:04 PM
> To: Bernard Dautrevaux
> Cc: Lars J. Aas; Alexandre Oliva; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]; Mark Elbrecht;
> Eli Zaretskii
> Subject: Re: [patch] acgeneral.m4 (dirname usage)
>
>
> >>>>> "Bernard" == Bernard Dautrevaux
> <[EMAIL PROTECTED]> writes:
>
> Bernard> If a path starts by a double '/' (that is for any UNC path,
> Bernard> quite often found on DOS boxes), we will strip one of these
> Bernard> leading '/'; thus the directory part of
> Bernard> "//server00/home/me/myfile" (which is myfile in my home
> Bernard> directory on my NT box) became "/serve00/home/me" which is an
> Bernard> unknown directory... 8-)
>
> No no:
>
> #! /bin/sh
>
> format="%12s %12s %12s\n"
>
> # alexandre, GNU dirname
> printf "$format" "dir" "al" "dn"
> # echo "" al dn
>
> for dir in //1 /1 ./1 ../../2 \
> //1/ /1/ ./1/ ../../2 \
> //1/3 /1/3 ./1/3 ../../2/3 \
> //1/3/// /1/3/// ./1/3/// ../../2/3/// \
> //1//3/ /1//3/ ./1//3/ ../../2//3/
> do
> al=`echo $dir | sed
> '/^\/*$/!s,//*$,,;s,[^/]*$,,;s,//*$,/,;/^\/$/!s,/$,,'`
> dn=`command dirname $dir`
> printf "$format" "$dir" "$al" "$dn"
> # echo "$dir $al $dn"
> done
>
> % sh /tmp/dirname.sh
> dir al dn
> //1 / /
> /1 / /
> ./1 . .
> ../../2 ../.. ../..
> //1/ / /
> /1/ / /
> ./1/ . .
> ../../2 ../.. ../..
> //1/3 //1 //1 <========
> /1/3 /1 /1
> ./1/3 ./1 ./1
> ../../2/3 ../../2 ../../2
> //1/3/// //1 //1 <========
> /1/3/// /1 /1
> ./1/3/// ./1 ./1
> ../../2/3/// ../../2 ../../2
> //1//3/ //1 //1
> /1//3/ /1 /1
> ./1//3/ ./1 ./1
> ../../2//3/ ../../2 ../../2
>
> Unless you are referring to the case `//1' -> `1'.
I'm afraid I've read a bit too fast this whole thread; i've just seen some
double '/' becoming single ones and don't read carefully enough :-)
However your last point is a problem in foreignward compatibility: under
UN*X, '//1' should give '/', but under Losedows "//1" should probably remain
unchanged; after all it is the root directory of a given machine... One
could even argue that "//1/2" should remain unchanged as "//1" is NOT a
directory (I cannot create anything in it) and "//1/2" is the root directory
of share "2" on machine "1".
However relax; I'm not asking that this is added to AC_DIRNAME, at least not
till full DOSish compatibility is added; one thing this seems to show is
that AC_DIRNAME should be different depending on the machine for which it is
used; so we may need AC_HOST_DIRNAME and AC_BUILD_DIRNAME, and even perhaps
AC_TARGET_DIRNAME 8-|.
This is however another story I think :-)
Regards,
Bernard
>
>
> Bernard> I send this in answer to this "jokeward" path as I just read
> Bernard> all this thread now, and think it is appropriate as I request
> Bernard> some "bizarre-ward" compatibility ;-)
>
> Foreignward compatibility is indeed desired. But are you sure we're
> losing here? Mark, or Eli, what do you think we should do? We're
> trying to implement dirname. `al' is the current CVS solution.
>
> Akim
>
--------------------------------------------
Bernard Dautrevaux
Microprocess Ingéniérie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel: +33 (0) 1 47 68 80 80
Fax: +33 (0) 1 47 88 97 85
e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
--------------------------------------------