summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordeva <deva>2005-03-24 16:59:01 +0000
committerdeva <deva>2005-03-24 16:59:01 +0000
commit3be06e552546a0c10b860d83bbd23d639590774c (patch)
tree3c134c6ac15d2b4202cdd778b2f5becd14107cfe /src
parentfed5c1dbf6a6c01719efc686a3d966f810ab0ade (diff)
Added comments ;)
Diffstat (limited to 'src')
-rw-r--r--src/miav_config.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/miav_config.cc b/src/miav_config.cc
index 9364131..05e0d06 100644
--- a/src/miav_config.cc
+++ b/src/miav_config.cc
@@ -63,8 +63,16 @@ MiavConfig::~MiavConfig()
if(die) free(die);
}
+/**
+ * Adds one configuration entry, from a single zero terminated line.
+ */
_cfg *MiavConfig::addConfig(_cfg *parent, char* conf)
{
+
+ //
+ // FIXME: Check for wellformedness
+ //
+
_cfg *cfg;
printf("[%s]\n", conf);
@@ -97,6 +105,9 @@ _cfg *MiavConfig::addConfig(_cfg *parent, char* conf)
return cfg;
}
+/**
+ * Main parse function, iterates the lines of the file.
+ */
int MiavConfig::parse(char* raw)
{
// Strip the string
@@ -115,13 +126,18 @@ int MiavConfig::parse(char* raw)
start = p+1;
}
}
+ // Allocated in strip
free(conf);
printf("done!\n");
return 0;
}
+/**
+ * Strip all unwanted data from the string, initial to parsing.
+ */
char* MiavConfig::strip(char* conf)
{
+ // Freed in parse!!!
char *stripped = (char*)calloc(strlen(conf) + 2, 1);
char *r;
char *w = stripped;