Commit | Line | Data |
---|---|---|
1a4df3a1 JL |
1 | static 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 | ||
8 | long | |
9 | patol(s) | |
10 | register 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 | } |