xref: /titanic_41/usr/src/cmd/ipf/lib/common/ratoi.c (revision 9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bb)
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