summaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/parse.c b/parse.c
index d0ed95f..fd91c59 100644
--- a/parse.c
+++ b/parse.c
@@ -59,7 +59,10 @@ getconf(char **db_array, char *name, struct dd_request *req)
memset(req, '\0', sizeof(struct dd_request));
if (cgetent(&buf, db_array, name) != 0)
- errx(1, "Can't find \"%s\" in dddup config", name);
+ errx(1, "can't find \"%s\" in dddup config", name);
+
+ if ((req->name =strdup(name)) == NULL)
+ errx(1, "malloc");
/* get type of service -- optional
* if no one is specified dyndns.org assumes `dynamic'
@@ -69,19 +72,19 @@ getconf(char **db_array, char *name, struct dd_request *req)
f_sys = SYS_DYN;
}
-#define DSCERR "either \"dynamic\" or \"static\" or \"custom\" " \
+#define DSCERR "%s: either \"dynamic\" or \"static\" or \"custom\" " \
"should be specified"
if (cgetcap(buf, "static", ':') != NULL) {
if (req->system != NULL)
- errx(1, DSCERR);
+ errx(1, DSCERR, name);
req->system = "statdns";
f_sys = SYS_STAT;
}
if (cgetcap(buf, "custom", ':') != NULL) {
if (req->system != NULL)
- errx(1, DSCERR);
+ errx(1, DSCERR, name);
req->system = "custom";
f_sys = SYS_CUST;
}
@@ -89,7 +92,7 @@ getconf(char **db_array, char *name, struct dd_request *req)
/* get username -- required */
switch (cgetstr(buf, "username", &user)) {
case -1:
- errx(1, "No username");
+ errx(1, "%s: no username", name);
case -2:
errx(1, "malloc");
}
@@ -97,7 +100,7 @@ getconf(char **db_array, char *name, struct dd_request *req)
/* get password -- required */
switch (cgetstr(buf, "password", &pass)) {
case -1:
- errx(1, "No password");
+ errx(1, "%s: no password", name);
case -2:
errx(1, "malloc");
}
@@ -125,14 +128,14 @@ getconf(char **db_array, char *name, struct dd_request *req)
}
if (if_name != NULL && req->myip != NULL)
- errx(1, "either \"interface\" or \"myip\" should be specified");
+ errx(1, "%s: ither \"interface\" or \"myip\" should be specified", name);
if (if_name != NULL)
if_ntoa(if_name, &req->myip);
switch (cgetstr(buf, "hostname", &req->hostname)) {
case -1:
- errx(1, "No hostname");
+ errx(1, "%s: no hostname", name);
case -2:
errx(1, "malloc");
}
@@ -186,7 +189,7 @@ parse_config(char *file, struct dd_request **req)
*db_array = file;
if (cgetent(&buf, db_array, "all") != 0)
- errx(1, "Can't find \"all\" in dddup config");
+ errx(1, "can't find \"all\" in dddup config");
name = strsep(&buf, ": \t"); /* skip "all" at start */
while ((name = strsep(&buf, ": \t")) != NULL) {