[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Reimplement AS_BASENAME and AS_DIRNAME with shell functions.
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH] Reimplement AS_BASENAME and AS_DIRNAME with shell functions. |
Date: |
Thu, 29 Jul 2010 15:37:37 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
At Thursday 29 July 2010, Eric Blake wrote:
> On 07/29/2010 05:15 AM, Stefano Lattarini wrote:
> > Hello autoconfers.
> >
> > There is any reason why the AS_BASENAME and AS_DIRNAME macros
> > don't have associated as_fn_* shells functions, like e.g.
> > AS_MKDIR_P or AS_UNSET do? If there is no such reason, you
> > might find the attached patch useful.
>
> The biggest reason is that I'd _really_ like to implement
> conditional support for XSI usage, so that on decent shells, we
> can perform dirname/basename without forking via ${a%/*} style
> manipulations, and where we no longer chop trailing newlines. But
> to do that, we need a new interface:
>
> AS_BASENAME_VAR([varname], [name-to-chop])
>
> We tried deprecating AS_BASENAME in the past (and at one point, it
> was even undocumented; we had to reinstate the documentation
> because people use it) because it does not lend itself well to the
> faster implementation.
OK, makes sense.
> And once you have the support for XSI detection and a working
> AS_BASENAME_VAR function, we would then rewrite AS_BASENAME to
> something like:
>
> m4_define([AS_BASENAME],
> [AS_BASENAME_VAR([as_name], [$1]); AS_ECHO([$as_name])])
Thanks for your explanation.
Regards,
Stefano