commit 3d1393ab7719d2e9f3b6d6f3003369fb4f3527eb
parent d12066fb46f960728396efe124aa7c4d592e2366
Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 9 Dec 2012 21:32:53 +0100
Removing the warnings for cfg. This needs better logic.
Diffstat:
3 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/cfg.c b/cfg.c
@@ -10,6 +10,7 @@
#include <string.h>
#include <strings.h>
#include <errno.h>
+#include <libgen.h>
#include "ind.h"
#include "arg.h"
@@ -62,15 +63,8 @@ config_init(char *cfgn)
cfg = config_read(path);
free(path);
- if (cfg == NULL) {
- if (!strcmp(cfgn, "default")) {
- die("No default config is set and no cfg was given."
- " Please use $(rpcfg -e cfg) to set the"
- " default configuration.\n");
- }
-
+ if (cfg == NULL)
cfg = config_new();
- }
cfg->name = memdup(cfgn, strlen(cfgn)+1);
diff --git a/inc.c b/inc.c
@@ -46,14 +46,8 @@ inc_init(char *cfgn)
incs = inc_read(path);
free(path);
- if (incs == NULL) {
- if (!strcmp(cfgn, "default")) {
- die("No default config is set and no cfg was given."
- " Please use $(rpcfg -e cfg) to set the"
- " default configuration.\n");
- }
+ if (incs == NULL)
incs = inc_new();
- }
incs->name = memdup(cfgn, strlen(cfgn)+1);
diff --git a/mark.c b/mark.c
@@ -46,15 +46,8 @@ mark_init(char *cfgn, char *mailbox)
marks = mark_read(path);
free(path);
- if (marks == NULL) {
- if (!strcmp(cfgn, "default")) {
- die("No default config is set and no cfg was given."
- " Please use $(rpcfg -e cfg) to set the"
- " default configuration.\n");
- }
-
+ if (marks == NULL)
marks = mark_new();
- }
marks->data = memdup(mailbox, strlen(mailbox)+1);
marks->name = memdup(cfgn, strlen(cfgn)+1);