commit c1a076f8bfe69c7c5f741798f8831de09f9f102a
parent f8c5bf5bfdd743e475d1cad23cac27d9cd5835bd
Author: Christoph Lohmann <20h@r-36.net>
Date: Mon, 17 Dec 2012 07:21:10 +0100
Fixing config default and sorting cfg -l output.
Diffstat:
4 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/cfg.c b/cfg.c
@@ -61,10 +61,9 @@ config_init(char *cfgn)
path = config_mkcfgpath(cfgn);
cfg = config_read(path);
- if (cfg == NULL) {
+ if (cfg == NULL)
cfg = config_new();
- cfg->path = memdup(path, strlen(path)+1);
- }
+ cfg->path = memdup(path, strlen(path)+1);
free(path);
cfg->name = memdup(cfgn, strlen(cfgn)+1);
@@ -237,6 +236,7 @@ configmain(int argc, char *argv[])
cfg = config_init(cfgn);
if (status & DOLIST) {
+ llist_sort(cfg->values);
forllist(cfg->values, elem)
configprintelem(elem, status & ONLYDATA);
return 0;
diff --git a/inc.c b/inc.c
@@ -44,10 +44,9 @@ inc_init(char *cfgn)
path = inc_mkincfile(cfgn);
incs = inc_read(path);
- if (incs == NULL) {
+ if (incs == NULL)
incs = inc_new();
- incs->path = memdup(path, strlen(path)+1);
- }
+ incs->path = memdup(path, strlen(path)+1);
free(path);
incs->name = memdup(cfgn, strlen(cfgn)+1);
diff --git a/mark.c b/mark.c
@@ -44,10 +44,9 @@ mark_init(char *cfgn, char *mailbox)
path = mark_mkmarkfile(cfgn, mailbox);
marks = mark_read(path);
- if (marks == NULL) {
+ if (marks == NULL)
marks = mark_new();
- marks->path = memdup(path, strlen(path)+1);
- }
+ marks->path = memdup(path, strlen(path)+1);
free(path);
marks->data = memdup(mailbox, strlen(mailbox)+1);
diff --git a/txtdb.c b/txtdb.c
@@ -155,7 +155,6 @@ txtdb_write(txtdb_t *txtdb, char *file)
}
}
- fprintf(stderr, "file = %s\n", file);
fp = fopen(file, "w+");
if (fp == NULL)
return NULL;