On-Demand Macros issue

Andreas Ericsson ae at op5.se
Fri May 27 10:48:47 CEST 2005


François Laupretre wrote:
>>From: Bryan Loniewski [mailto:brylon at jla.rutgers.edu] 
>>
>>Would others find this useful if a patch is applied?
>>
>>
>>>       command_line    $USER2$/foo $HOSTADDRESS:$ARG1$$ # Where 
>>>$ARG1$=some_host_name
> 
> 
> Unfortunately, as the macro starting and ending tags are the same ($), I
> think that you cannot implement such an extension in an unambiguous way.

Considering every C preprocessor does it properly, I'd say it's not only 
possible but also a fairly straightforward approach. Macros just have to 
be expanded inside out, instead of outside/none, and expanded recursively.

The biggest problem would probably be performance.


> Here is an example:
> 
> If you get :
> 
> $HOSTADDRESS:pre$ARG1$post$
> 

If $ARG1$ is expanded prior to $HOSTADDRESS:therest$ this wouldn't be a 
problem.

> It is impossible to choose between :
> 
> 	($HOSTADDRESS:pre$)ARG1($post$)
> And	($HOSTADDRESS:pre($ARG1$)post$)
> 
> And it is still harder if you get something like
> '$HOSTADDRESS:pre$ARG1$ARG2$'.
> 

That would be '$HOSTADDRESS:pre$ARG1$$ARG2$$', as the complete name of 
each macro must be included (the last $ is to close the $ in the beginning).

> To conclude, unless you define some new tags for macro expansion, I think
> that this extension is not possible. And defining some new tags would bring
> many compatibility problems.
> 

Bah.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list