Uninitialized vector entry?
[minix3.git] / lib / ansi / atol.c
blob63235d9fc3151acab9aea1de02588764c1c5b262
1 /*
2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
5 /* $Header$ */
7 #include <ctype.h>
8 #include <stdlib.h>
10 /* We do not use strtol here for backwards compatibility in behaviour on
11 overflow.
13 long
14 atol(register const char *nptr)
16 long total = 0;
17 int minus = 0;
19 while (isspace(*nptr)) nptr++;
20 if (*nptr == '+') nptr++;
21 else if (*nptr == '-') {
22 minus = 1;
23 nptr++;
25 while (isdigit(*nptr)) {
26 total *= 10;
27 total += (*nptr++ - '0');
29 return minus ? -total : total;