summaryrefslogtreecommitdiffstats
path: root/src/core/misc.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-12 20:11:28 +0100
committerMichael Brown2007-01-12 20:11:28 +0100
commitca3db0bf111f57cddba99872ae3153253e446f4a (patch)
treea76d65acb175b954adde0b173094310bfca0199b /src/core/misc.c
parentDamn it; my lovely resilient scheme falls down when you have a protocol (diff)
downloadipxe-ca3db0bf111f57cddba99872ae3153253e446f4a.tar.gz
ipxe-ca3db0bf111f57cddba99872ae3153253e446f4a.tar.xz
ipxe-ca3db0bf111f57cddba99872ae3153253e446f4a.zip
Added isspace() and made strtoul() accept whitespace, as per POSIX.
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 19d114cc..fcbcdd6f 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' ) {