From db4cda40904688f20bc73246b82e7f531c42009d Mon Sep 17 00:00:00 2001 From: chris <> Date: Tue, 4 Nov 2003 11:57:45 +0000 Subject: [PATCH] "" --- cfgfile.c | 8 +++++--- options.c | 2 +- stringmap.c | 2 +- util.h | 19 +++++++++++++++++++ vector.c | 2 +- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 util.h diff --git a/cfgfile.c b/cfgfile.c index 784fa03..d7a1544 100644 --- a/cfgfile.c +++ b/cfgfile.c @@ -6,6 +6,7 @@ */ #include +#include #include #include "stringmap.h" @@ -162,15 +163,16 @@ int config_get_int(const char *directive, int *value) { * Get an integer value from a config string. Returns 1 on success, -1 on * failure, or 0 if no value was found. */ int config_get_float(const char *directive, float *value) { + stringmap S; item *I; char *s, *t; if (!value) return -1; - I = stringmap_find(config, directive); - if (!I) return 0; + if (!(S = stringmap_find(config, directive))) + return 0; - s = (char*)I->v; + s = (char*)S->d.v; if (!*s) return -1; errno = 0; *value = strtod(s, &t); diff --git a/options.c b/options.c index 289fa4f..ab27857 100644 --- a/options.c +++ b/options.c @@ -240,7 +240,7 @@ static void usage(FILE *fp) { "\n" " -h display this message\n" " -n don't do hostname lookups\n" -" -N don't convery port numbers to services\n" +" -N don't convert port numbers to services\n" " -p run in promiscuous mode (show traffic between other\n" " hosts on the same network segment)\n" " -b don't display a bar graph of traffic\n" diff --git a/stringmap.c b/stringmap.c index 0712a06..24f85fb 100644 --- a/stringmap.c +++ b/stringmap.c @@ -16,7 +16,7 @@ static const char rcsid[] = "$Id$"; #include "stringmap.h" #include "vector.h" -/*include "util.h"*/ +#include "util.h" /* stringmap_new: * Allocate memory for a new stringmap. */ diff --git a/util.h b/util.h new file mode 100644 index 0000000..eb3dd26 --- /dev/null +++ b/util.h @@ -0,0 +1,19 @@ +/* + * util.h: + * Utility functions + * + * $Id$ + * + */ + +#ifndef __UTIL_H_ /* include guard */ +#define __UTIL_H_ + +/* util.c */ +void *xmalloc(size_t n); +void *xcalloc(size_t n, size_t m); +void *xrealloc(void *w, size_t n); +char *xstrdup(const char *s); +void xfree(void *v); + +#endif /* __UTIL_H_ */ diff --git a/vector.c b/vector.c index 08df5f8..81dd563 100644 --- a/vector.c +++ b/vector.c @@ -16,7 +16,7 @@ static const char rcsid[] = "$Id$"; #include #include "vector.h" -/*include "util.h"*/ +#include "util.h" vector vector_new(void) { vector v;