xref: /illumos-gate/usr/src/cmd/ipf/lib/ratoi.c (revision 8c9d84f540d1f878958d02bef1d5c221fc8d30c0)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: ratoi.c,v 1.4 2001/06/09 17:09:25 darrenr Exp $
7  */
8 
9 #include "ipf.h"
10 
11 
12 int	ratoi(ps, pi, min, max)
13 char 	*ps;
14 int	*pi, min, max;
15 {
16 	int i;
17 	char *pe;
18 
19 	i = (int)strtol(ps, &pe, 0);
20 	if (*pe != '\0' || i < min || i > max)
21 		return 0;
22 	*pi = i;
23 	return 1;
24 }
25