tFixing config default and sorting cfg -l output. - rohrpost - A commandline mail client to change the world as we see it.
(HTM) git clone git://r-36.net/rohrpost
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit c1a076f8bfe69c7c5f741798f8831de09f9f102a
(DIR) parent f8c5bf5bfdd743e475d1cad23cac27d9cd5835bd
(HTM) 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:
cfg.c | 6 +++---
inc.c | 5 ++---
mark.c | 5 ++---
txtdb.c | 1 -
4 files changed, 7 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/cfg.c b/cfg.c
t@@ -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);
t@@ -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;
(DIR) diff --git a/inc.c b/inc.c
t@@ -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);
(DIR) diff --git a/mark.c b/mark.c
t@@ -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);
(DIR) diff --git a/txtdb.c b/txtdb.c
t@@ -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;