From: Michael Brown Date: Fri, 12 Jan 2007 19:11:28 +0000 (+0000) Subject: Added isspace() and made strtoul() accept whitespace, as per POSIX. X-Git-Tag: v0.9.3~629 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca3db0bf111f57cddba99872ae3153253e446f4a;p=thirdparty%2Fipxe.git Added isspace() and made strtoul() accept whitespace, as per POSIX. --- diff --git a/src/core/misc.c b/src/core/misc.c index 19d114cce..fcbcdd6f7 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -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' ) {