httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Korthof ...@bitmechanic.com>
Subject Re: FW: general/3563: I want to allow the definition and use of macros within runtime configuration files.
Date Mon, 21 Dec 1998 20:52:15 GMT
On Mon, 21 Dec 1998, Fabien COELHO wrote:

> Hi,
[snip]
> Sure. You can address the meta problem, but I have just practical problems
> right now that I needed to solve. I do not think that I'm the only one
> with such problems, hence my request for adding the feature and sharing
> it.

[snip]

> Another example with M4:
> 
> define(`allowing',`
> # let's define default access
> Order deny,allow
> Deny from all
> Allow from dnl.ensmp.fr $1
> ')
>
> allowing(10.2.16.0/24)
> 
> Looks good? No. It is broken because:
> 
> (1) there is ' in the comment, so it is the end of the `
>     - let us remove the '
>
> (2) the define m4 keyword is used within a the comment.
>     - let us remove define

Well, as you must know from the statement below, you could avoid this
problem by commenting the line out properly via 'dnl'.  You don't need
many comments in the generated file -- you should be editing the .m4 file,
not the generated one.

> (3) the machine is named dnl... but this means "delete line" for m4.
>     - let us rename the machine;-)

Or just:

-----
# DO NOT EDIT THIS FILE!!!
# edit foo.m4 and run make to generate foo.conf

define (`allowing', `
dnl let's define default access
Order deny,allow
Deny from all
Allow from `dnl'.ensmp.fr $1
')

allowing(10.2.16.0/24)
-----

Which works fine.

m4 definitely has it's weaknesses -- but so does every other language in
existence.  Trading it for a custom macro language wouldn't necessarily
avoid ugliness -- it'd just trade one set for another.  Save that the new
set would be nonstandard.

Ed


Mime
View raw message