]> Pileus Git - lackey/blobdiff - src/conf.c
Add args and usage output
[lackey] / src / conf.c
index 5d59d22e29c983fe39b01e122236521d70e71ca9..1a81b91c2e160f4035c45d3d4a9cc388e9d3fb01 100644 (file)
@@ -44,8 +44,6 @@ static const char *booleans[] = {
 /* Setup info */
 static char     *filename;
 static parser_t  parser;
-static int       argc;
-static char    **argv;
 
 /* Static data */
 static line_t   *settings;
@@ -103,10 +101,10 @@ static void set_value(const char *group, const char *name,
        if (groupend) {
                /* Append to group */
                line_t *line = new0(line_t);
-               groupend->next = line;
                line->key      = strcopy(key);
                line->value    = strcopy(value);
                line->next     = groupend->next;
+               groupend->next = line;
        } else if (fileend)  {
                /* Create new group */
                line_t *blank  = new0(line_t);
@@ -271,7 +269,7 @@ static void conf_load(const char *path, parser_t parser)
                }
 
                /* debug printout */
-               printf("parse: %s.%s.%s = '%s'\n", group, name, line->key, line->value);
+               debug("parse: %s.%s.%s = '%s'", group, name, line->key, line->value);
 
                /* save line formatting for the next write */
                if (prev == NULL)
@@ -316,14 +314,12 @@ void conf_save(const char *path)
 }
 
 /* Initialize */
-void conf_setup(int _argc, char **_argv, const char *_name, parser_t _parser)
+void conf_setup(const char *_name, parser_t _parser)
 {
        const char *home = getenv("HOME");
        filename = alloc0(strlen(home) + 1 + strlen(_name) + 1);
        sprintf(filename, "%s/%s", home, _name);
        parser   = _parser;
-       argc     = _argc;
-       argv     = _argv;
 }
 
 /* Initialize */