On Fri, Feb 06, 2009 at 02:16:11PM +0100, Alexander Orlovskyy wrote:
Hi Martin! I have question about your manual (Ini agent description ). I have one config file which is read by the scr agent, but in the config file i have following entry in the config file:
# variable1 = value # variable2 = value # variable3 = value # variable4 = value
Is it possible to configure the scr agent so that he can read and write those values without # sign?
This will give you regular variables with value_type 0 and commented-out ones with value_type 1. `ag_ini ( `IniAgent ( "/foo/bar.conf", $[ "options" : [ "global_values" ], "params" : [ // unfortunately this is the simplest way to write // '"whatever = whatever", including whitespace' $[ "match" : [ "^[ \t]*([^=]*[^ \t=])[ \t]*=[ \t]*(.*[^ \t]|)[ \t]*$", "%s %s" ]], // same as above, with "# " added $[ "match" : [ "^# [ \t]*([^=]*[^ \t=])[ \t]*=[ \t]*(.*[^ \t]|)[ \t]*$", "%s %s" ]], ], // something which does NOT match the above, because comments are processed first "comments" : [ "^#[^ ].*" ], "subindent" : " ", ] ) ) Unfortunately, if you add just "#" instead of "# " then you have much harder time negating that regex to specify what constitutes an uninteresting comment. IIRC for smb.conf, we used '#' for free comments and ';' for disabled values to solve this problem Let's say we have foo = bar # baz = quux SCR::Read(.myagent.value.foo) -> "bar" SCR::Read(.myagent.value.baz) -> "quux" SCR::Read(.myagent.value_type.foo) -> 0 SCR::Read(.myagent.value_type.baz) -> 1 SCR::Write(.myagent.value_type.foo, 1) // comment it out http://svn.opensuse.org/svn/yast/trunk/core/agent-ini/doc/ag_ini.html#access -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org