mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-18 21:43:14 +00:00
Added isspace() and made strtoul() accept whitespace, as per POSIX.
This commit is contained in:
parent
83b7933f8a
commit
ca3db0bf11
@ -152,10 +152,27 @@ int inet_aton ( const char *cp, struct in_addr *inp ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int isspace ( int c ) {
|
||||
switch ( c ) {
|
||||
case ' ':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
case '\v':
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long strtoul ( const char *p, char **endp, int base ) {
|
||||
unsigned long ret = 0;
|
||||
unsigned int charval;
|
||||
|
||||
while ( isspace ( *p ) )
|
||||
p++;
|
||||
|
||||
if ( base == 0 ) {
|
||||
base = 10;
|
||||
if ( *p == '0' ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user