<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2656.60">
<TITLE>RE : RE : [Nagios-users] Re: On-Demand Macros issue</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Sorry but I don't understand what you mean when you say that 'every C preprocessor does it properly' ?</FONT>
</P>

<P><FONT SIZE=2>You can arbitrarily decide to process macros inside out, but it means that a string like '$string1$string2$string3$' would be expanded as '($string1($string2$)string3$)', which is incompatible with the current way of expanding such a string. </FONT></P>

<P><FONT SIZE=2>If I am wrong, please let me know because it would be a very nice feature to expand the variables recursively.</FONT>
</P>

<P><FONT SIZE=2>> -----Original Message-----</FONT>
<BR><FONT SIZE=2>> From: Andreas Ericsson [<A HREF="mailto:ae@op5.se">mailto:ae@op5.se</A>] </FONT>
<BR><FONT SIZE=2>> Sent: Friday, May 27, 2005 10:49 AM</FONT>
<BR><FONT SIZE=2>> To: nagios-users@lists.sourceforge.net</FONT>
<BR><FONT SIZE=2>> Subject: Re: RE : [Nagios-users] Re: On-Demand Macros issue</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> François Laupretre wrote:</FONT>
<BR><FONT SIZE=2>> >>From: Bryan Loniewski [<A HREF="mailto:brylon@jla.rutgers.edu">mailto:brylon@jla.rutgers.edu</A>]</FONT>
<BR><FONT SIZE=2>> >></FONT>
<BR><FONT SIZE=2>> >>Would others find this useful if a patch is applied?</FONT>
<BR><FONT SIZE=2>> >></FONT>
<BR><FONT SIZE=2>> >></FONT>
<BR><FONT SIZE=2>> >>>       command_line    $USER2$/foo $HOSTADDRESS:$ARG1$$ # Where </FONT>
<BR><FONT SIZE=2>> >>>$ARG1$=some_host_name</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> > Unfortunately, as the macro starting and ending tags are </FONT>
<BR><FONT SIZE=2>> the same ($), </FONT>
<BR><FONT SIZE=2>> > I think that you cannot implement such an extension in an </FONT>
<BR><FONT SIZE=2>> unambiguous </FONT>
<BR><FONT SIZE=2>> > way.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Considering every C preprocessor does it properly, I'd say </FONT>
<BR><FONT SIZE=2>> it's not only </FONT>
<BR><FONT SIZE=2>> possible but also a fairly straightforward approach. Macros </FONT>
<BR><FONT SIZE=2>> just have to </FONT>
<BR><FONT SIZE=2>> be expanded inside out, instead of outside/none, and expanded </FONT>
<BR><FONT SIZE=2>> recursively.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> The biggest problem would probably be performance.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> > Here is an example:</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> > If you get :</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> > $HOSTADDRESS:pre$ARG1$post$</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> If $ARG1$ is expanded prior to $HOSTADDRESS:therest$ this </FONT>
<BR><FONT SIZE=2>> wouldn't be a </FONT>
<BR><FONT SIZE=2>> problem.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> > It is impossible to choose between :</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> >     ($HOSTADDRESS:pre$)ARG1($post$)</FONT>
<BR><FONT SIZE=2>> > And ($HOSTADDRESS:pre($ARG1$)post$)</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> > And it is still harder if you get something like </FONT>
<BR><FONT SIZE=2>> > '$HOSTADDRESS:pre$ARG1$ARG2$'.</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> That would be '$HOSTADDRESS:pre$ARG1$$ARG2$$', as the </FONT>
<BR><FONT SIZE=2>> complete name of </FONT>
<BR><FONT SIZE=2>> each macro must be included (the last $ is to close the $ in </FONT>
<BR><FONT SIZE=2>> the beginning).</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> > To conclude, unless you define some new tags for macro expansion, I </FONT>
<BR><FONT SIZE=2>> > think that this extension is not possible. And defining </FONT>
<BR><FONT SIZE=2>> some new tags </FONT>
<BR><FONT SIZE=2>> > would bring many compatibility problems.</FONT>
<BR><FONT SIZE=2>> > </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Bah.</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> -- </FONT>
<BR><FONT SIZE=2>> Andreas Ericsson                   andreas.ericsson@op5.se</FONT>
<BR><FONT SIZE=2>> OP5 AB                             www.op5.se</FONT>
<BR><FONT SIZE=2>> Lead Developer</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> -------------------------------------------------------</FONT>
<BR><FONT SIZE=2>> This SF.Net email is sponsored by Yahoo.</FONT>
<BR><FONT SIZE=2>> Introducing Yahoo! Search Developer Network - Create apps </FONT>
<BR><FONT SIZE=2>> using Yahoo! Search APIs Find out how you can build Yahoo! </FONT>
<BR><FONT SIZE=2>> directly into your own Applications - visit </FONT>
<BR><FONT SIZE=2>> <A HREF="http://developer.yahoo.net/?fr=offad-ysdn-" TARGET="_blank">http://developer.yahoo.net/?fr=offad-ysdn-</A>> ostg-q22005</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> _______________________________________________</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Nagios-users mailing list</FONT>
<BR><FONT SIZE=2>> Nagios-users@lists.sourceforge.net</FONT>
<BR><FONT SIZE=2>> <A HREF="https://lists.sourceforge.net/lists/listinfo/nagios-users" TARGET="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</A></FONT>
<BR><FONT SIZE=2>> ::: Please include Nagios version, plugin version (-v) and OS </FONT>
<BR><FONT SIZE=2>> when reporting any issue. </FONT>
<BR><FONT SIZE=2>> ::: Messages without supporting info will risk being sent to /dev/null</FONT>
<BR><FONT SIZE=2>> </FONT>
</P>

</BODY>
</HTML>