summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/lib/ratoi.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ipfilter/lib/ratoi.c')
-rw-r--r--contrib/ipfilter/lib/ratoi.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/ipfilter/lib/ratoi.c b/contrib/ipfilter/lib/ratoi.c
new file mode 100644
index 0000000..31ee122
--- /dev/null
+++ b/contrib/ipfilter/lib/ratoi.c
@@ -0,0 +1,26 @@
+/* $NetBSD$ */
+
+/*
+ * Copyright (C) 1993-2001 by Darren Reed.
+ *
+ * See the IPFILTER.LICENCE file for details on licencing.
+ *
+ * Id: ratoi.c,v 1.4 2001/06/09 17:09:25 darrenr Exp
+ */
+
+#include "ipf.h"
+
+
+int ratoi(ps, pi, min, max)
+char *ps;
+int *pi, min, max;
+{
+ int i;
+ char *pe;
+
+ i = (int)strtol(ps, &pe, 0);
+ if (*pe != '\0' || i < min || i > max)
+ return 0;
+ *pi = i;
+ return 1;
+}
OpenPOWER on IntegriCloud