summaryrefslogtreecommitdiff
path: root/src/lib/rules/rules_load.c
diff options
context:
space:
mode:
authorGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-26 13:54:18 +0100
committerGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-26 13:54:18 +0100
commit82ce483a36849e86449e26344c66c3b71b70afce (patch)
tree26c49ba33ab6f9a6eb9a371d090f01e82a63b04c /src/lib/rules/rules_load.c
parent85e14096042f1484175f2f396ea76ec4948bf467 (diff)
Tranform tags into a list, to ease the JSON conversion in smman.
Diffstat (limited to '')
-rw-r--r--src/lib/rules/rules_load.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/rules/rules_load.c b/src/lib/rules/rules_load.c
index 47ae3bf..c961739 100644
--- a/src/lib/rules/rules_load.c
+++ b/src/lib/rules/rules_load.c
@@ -34,7 +34,23 @@ rules_load_rule(void *data,
34 if (!strcmp(variable, "filename")) 34 if (!strcmp(variable, "filename"))
35 rule->spec.filename = strdup(value); 35 rule->spec.filename = strdup(value);
36 else if (!strcmp(variable, "tags")) 36 else if (!strcmp(variable, "tags"))
37 rule->spec.tags = strdup(value); 37 {
38 char **tags = eina_str_split(value, ",", 0);
39 int i;
40
41 for (i = 0; tags[i]; i++)
42 {
43 Eina_Strbuf *buf = eina_strbuf_new();
44
45 eina_strbuf_append(buf, tags[i]);
46 eina_strbuf_trim(buf);
47 rule->spec.tags = eina_list_append(rule->spec.tags,
48 eina_strbuf_string_steal(buf));
49 eina_strbuf_free(buf);
50 }
51 free(tags[0]);
52 free(tags);
53 }
38 else if (!strcmp(variable, "source_host")) 54 else if (!strcmp(variable, "source_host"))
39 rule->spec.source_host = strdup(value); 55 rule->spec.source_host = strdup(value);
40 else if (!strcmp(variable, "source_path")) 56 else if (!strcmp(variable, "source_path"))