[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: |
Eric Blake |
Subject: |
Re: [PATCH] Reimplement AS_BASENAME and AS_DIRNAME with shell functions. |
Date: |
Thu, 29 Jul 2010 06:07:36 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1 |
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.
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])])
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature