/* cfint.c */ /* Copyright 1997-2000 by Eberhard Mattes Donated to the public domain. No warranty. 1997-07-22 Initial version 2000-05-27 Use config_arg_count() */ #include #include #include #include "firewall.h" #include "libemfw.h" int config_int (Cfg *confp, const char *name, int lo, int hi, int def) { char *end; Cfg *cf; long n; cf = cfg_get (name, confp); if (cf == (Cfg *)0) return def; config_arg_count (cf, 1); errno = 0; n = strtol (cf->argv[0], &end, 10); if (end == cf->argv[0] || *end != 0 || errno != 0 || n < lo || n > hi) { syslog (LLEV, "fwtkcfgerr: bad value for %s, line %d", name, cf->ln); exit (1); } return (int)n; }