[collectd] [PATCH] parser.y: Allow an argument list to be empty.

Sebastian Harl sh at tokkee.org
Sun Jul 15 16:43:35 CEST 2007


This allows you to specify options without any or optional arguments in the
config file. This is quite useful to e.g. implement "flag" options to change
program behavior in just one way where the opposite way does not make sense or
is not possible at all.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/parser.y |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/parser.y b/src/parser.y
index ea6ed0a..a5fcfce 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -91,6 +91,13 @@ argument_list:
 	 $$.argument[0] = $1;
 	 $$.argument_num = 1;
 	}
+	| /* epsilon */
+	{
+	 $$.argument = malloc (sizeof (oconfig_value_t));
+	 $$.argument[0].value.string = NULL;
+	 $$.argument[0].type = OCONFIG_TYPE_STRING;
+	 $$.argument_num = 1;
+	}
 	;
 
 identifier:
-- 
1.5.1.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070715/e5f3a189/attachment.pgp 


More information about the collectd mailing list