www.pudn.com > iccavr_lib.rar > atol.c, change:2002-12-29,size:345b


#include <ctype.h> 
#include <stdlib.h> 
#include <errno.h> 
 
long atol(CONST char *s) 
	{ 
	int uminus; 
	long v; 
	 
	while (isspace(*s)) 
		s++; 
	uminus = 0; 
	if (*s == '-') 
		{ 
		uminus = 1; 
		s++; 
		} 
	else if (*s == '+') 
		s++; 
	for (v = 0; isdigit(*s); ) 
		v = v * 10 + *s++ - '0'; 
	if (uminus) 
		return -v; 
	return v; 
	}