>>>>> "David" == David Morgan <[EMAIL PROTECTED]> writes:

David> The problem is the expr replacement and the sed on ac_dir.

David> The expr parts returns '.' on stdout (correct) and 1 - which
David> seems wrong.

So to summarize, the problem is that if you run this:

AC_INIT
echo AC_SHELL_DIRNAME(foo)

you get `. . .' instead of just `.', right?

The first `.' is coming from `expr', which is right, but seems to be
failing anyway.

And then you say that sed is responsible for the two other dots,
right?  This is weird.  Where is it coming from?  Ouch.  In fact I can
reproduce this extra dot too.

/tmp % echo "Xfoo" |                                             nostromo 12:08
pipe>     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/p; q; }
pipe quote>   /^X\(\/\/\)[^/].*/{ s//\1/p; q; }
pipe quote>     /^X\(\/\/\)$/{ s//\1/p; q; }
pipe quote>     /^X\(\/\).*/{ s//\1/p; q; }
pipe quote>     s/.*/./p; q'
.
.


Arg! -n is missing, so since there is a `p', it's printed twice.

Paul, what do you prefer?  I chose not to add `-n' but to remove the
`p', if you think there is a difference and you prefer the other
solution, I'll adjust the code.


David, could you run this script?

#! /bin/sh

expr Xfoo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
     Xfoo : 'X\(//\)[^/]' \| \
     Xfoo : 'X\(//\)$' \| \
     Xfoo : 'X\(/\)' \| \
      .   : '\(.\)'
echo $?

echo ====
echo "Xfoo" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
          /^X\(\/\/\)$/{ s//\1/; q; }
          /^X\(\/\).*/{ s//\1/; q; }
          s/.*/./; q'
echo $?

Reply via email to