3 extern unsigned long int strtoul(const char *ptr
, char **endptr
, int base
);
5 #define ABS_LONG_MIN 2147483648UL
6 long int strtol(const char *nptr
, char **endptr
, int base
)
12 while(isspace(*nptr
)) nptr
++;
14 if (*nptr
== '-' && isalnum(nptr
[1])) { neg
=-1; ++nptr
; }
15 v
=strtoul(nptr
,endptr
,base
);
16 if (endptr
&& *endptr
==nptr
) *endptr
=(char *)orig
;
17 if (v
>=ABS_LONG_MIN
) {
18 if (v
==ABS_LONG_MIN
&& neg
) {
23 return (neg
?LONG_MIN
:LONG_MAX
);