xref: /titanic_52/usr/src/cmd/ipf/lib/common/ratoi.c (revision 0eb822a1c0c2bea495647510b75f77f0e57633eb)
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