date and time created 87/02/15 16:03:36 by lepreau
[unix-history] / usr / src / local / sccscmds / sccscmds.ok / util / patol.c
CommitLineData
1a4df3a1
JL
1static char Sccsid[] "@(#)patol 2.1";
2/*
3 Function to convert ascii string to long. Converts
4 positive numbers only. Returns -1 if non-numeric
5 character encountered.
6*/
7
8long
9patol(s)
10register char *s;
11{
12 long i;
13
14 i = 0;
15 while (*s >= '0' && *s <= '9')
16 i = 10*i + *s++ - '0';
17
18 if (*s)
19 return(-1);
20 return(i);
21}