bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: config files substitution with awk


From: Pascal Bourguignon
Subject: Re: config files substitution with awk
Date: Wed, 06 Dec 2006 11:00:51 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:
>> Note that it must be done carefully, since we could have:
>> 
>> s/@var1@/@var2@/g
>> s/@var2@/text2/g
>> 
>> and @var1@ in the input would sustitute to text2.
>
> No.  Autoconf specifically forbids this.  The old pre-Autoconf 2.60
> sed-based implementation was not reliable here.  In 2.60 the
> implementation was fixed to not allow this, by doing essentially:
>   s/@var1@/@|#_!!_#|var2@/g
>   s/@var2@/text2/g
>   ...
>   s/|#_!!_#|//g
>
> The documentation was adjusted to reflect this.

Yes.  I was pointing to the semantics of sed, not to the restricted
usage autoconf needs.  With this later s/|#_!!_#//g we still have the
problem, if we must use a generic sed.  IMO, it would be better to use
a specific tool, since it could be easily implemented in
O(length(input-file)), and wouldn't even need to implement
sophisticated DFA at all (given the @..@ convention).


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The mighty hunter
Returns with gifts of plump birds,
Your foot just squashed one.




reply via email to

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