Commit db4cda40 authored by chris's avatar chris

""

parent fa64b3dd
......@@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#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);
......
......@@ -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"
......
......@@ -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. */
......
/*
* 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_ */
......@@ -16,7 +16,7 @@ static const char rcsid[] = "$Id$";
#include <string.h>
#include "vector.h"
/*include "util.h"*/
#include "util.h"
vector vector_new(void) {
vector v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment