aboutsummaryrefslogtreecommitdiffstats
path: root/pingu_conf.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-08-05 10:46:10 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2011-08-05 10:46:10 +0200
commitff32d7fa04f120a459a76fd2931150e8be1747f8 (patch)
tree57753a23cd47e8fe675b0f5e988164974c679c8c /pingu_conf.c
parentdcd2b0e077ff2995660f15ef28580e8a002c5c5f (diff)
downloadpingu-ff32d7fa04f120a459a76fd2931150e8be1747f8.tar.bz2
pingu-ff32d7fa04f120a459a76fd2931150e8be1747f8.tar.xz
pingu_conf: fix lineno on error messages
and some whitespace fixes
Diffstat (limited to 'pingu_conf.c')
-rw-r--r--pingu_conf.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/pingu_conf.c b/pingu_conf.c
index be92483..145b029 100644
--- a/pingu_conf.c
+++ b/pingu_conf.c
@@ -24,7 +24,7 @@ static void parse_line(char *line, char **key, char **value)
(*value) = NULL;
(*key) = NULL;
- /* strip comments and trailng \n */
+ /* strip comments and trailing \n */
p = strpbrk(line, "#\n");
if (p)
*p = '\0';
@@ -34,7 +34,7 @@ static void parse_line(char *line, char **key, char **value)
line++;
if (*line == '\0')
return;
-
+
(*key) = line;
/* find space between keyword and value */
@@ -87,14 +87,14 @@ static char *pingu_conf_get_key_value(FILE *f, char **key, char **value, int *li
*value = v;
return line;
}
-
-
+
+
static int pingu_conf_read_iface(FILE *f, char *ifname, int *lineno)
{
struct pingu_iface *iface;
char *key, *value;
-
+
iface = pingu_iface_get_by_name(value);
if (iface != NULL) {
log_error("Interface %s already declared");
@@ -112,7 +112,7 @@ static int pingu_conf_read_iface(FILE *f, char *ifname, int *lineno)
pingu_iface_set_route_table(iface, atoi(value));
} else {
log_error("Unknown keyword '%s' on line %i", key,
- lineno);
+ *lineno);
}
}
return 0;
@@ -122,7 +122,7 @@ static int pingu_conf_read_host(FILE *f, char *hoststr, int *lineno)
{
char *key, *value;
struct pingu_host *host;
-
+
host = pingu_host_new(xstrdup(hoststr), default_burst_interval,
default_max_retries, default_required_replies,
default_timeout, default_up_action,
@@ -134,7 +134,7 @@ static int pingu_conf_read_host(FILE *f, char *hoststr, int *lineno)
host->iface = pingu_iface_get_by_name_or_new(value);
if (host->iface == NULL) {
log_error("Undefined interface %s on line %i",
- value, lineno);
+ value, *lineno);
return -1;
}
} else if (strcmp(key, "label") == 0) {
@@ -167,7 +167,7 @@ int pingu_conf_read(const char *filename)
char line[256];
int r = 0;
FILE *f = pingu_conf_open(filename);
-
+
if (f == NULL)
return -1;