summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-08-19 17:55:03 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2009-08-19 17:55:03 +0200
commit131f5592347929c3d28a4a9406e242e2cfdd5db9 (patch)
treea7434fb93b1856665c34380a77f655a54bae0332 /config.c
parent44f3e1486fb5fd45644683af83aaaf27047e4250 (diff)
Write data to an XML file.
File path for the XML file is read per channel from the 'xmlpath' option.
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/config.c b/config.c
index d50c90b..79eae42 100644
--- a/config.c
+++ b/config.c
@@ -52,15 +52,21 @@ int cfg_init() {
int channel_count = config_setting_length(channels_setting);
for(int i = 0; i < channel_count; i++) {
config_setting_t *channel_setting = config_setting_get_elem(channels_setting, i);
- const char *name;
+ const char *name, *xmlpath;
if(!config_setting_lookup_string(channel_setting, "name", &name)) {
char *sname;
sname = malloc(sizeof(char) * 16);
sprintf(sname, "channel #%d", i+1);
name = sname;
}
+ if(!config_setting_lookup_string(channel_setting, "xmlpath", &xmlpath)) {
+ /* Index-based filename if xmlpath isn't set. */
+ char temp[0xf];
+ sprintf(temp, "%d.xml", i);
+ xmlpath = strdup(temp);
+ }
struct channel_t *channel;
- if(!(channel = channel_add(name))) {
+ if(!(channel = channel_add(name, xmlpath))) {
return 0;
}
config_setting_t *files = config_setting_get_member(channel_setting, "files");