[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: document AS_BASENAME

From: Ralf Wildenhues
Subject: Re: document AS_BASENAME
Date: Fri, 31 Mar 2006 08:54:31 +0200
User-agent: Mutt/1.5.11

* Paul Eggert wrote on Fri, Mar 31, 2006 at 08:12:35AM CEST:
> Thanks, I installed the following, which I hope addresses all the
> issues that you and others raised.

> (For extra trivia credit, explain
> why the '?' is needed in the patch below.  :-)

I'm cheap, I always go for trivia.  Spoiler after the form feed below.
(Even looked at
once, after finding it in a lucky search; decided we should not "fix"
Autoconf, it would make it unduly easy for your students, it's unobvious
and would require more string copying inside m4.  ;-)

> +# This is not portable.
> +c=`basename "$cname" .c`
> +
> +# This is more portable.
> +c=`AS_BASENAME(["$cname"])`
> +case $c in
> +?*.c) c=`expr "X$c" : 'X\(.*\)\.c'`;;
> +esac

FWIW, I wonder whether using expr at all for general names is a good
idea, as the documented bug on Tru64 that turns everything into a number
that looks like one (after other operations):
 $ expr 'X000123.c' : 'X\(.*\)\.c'

will leave all-numeric leading-zero outputs a bit out in the cold.
(This holds for all kinds of expr expressions we recommend in the

Because you want
  basename .c .c
to output


reply via email to

[Prev in Thread] Current Thread [Next in Thread]