From: Michael Brown Date: Wed, 15 Nov 2006 02:57:24 +0000 (+0000) Subject: May as well add octal support to strtoul() X-Git-Tag: v0.9.3~998 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5753f2c58b9559cea178d9e424a337e37cc7fce4;p=thirdparty%2Fipxe.git May as well add octal support to strtoul() --- diff --git a/src/core/misc.c b/src/core/misc.c index 968e232d4..2a9263138 100644 --- a/src/core/misc.c +++ b/src/core/misc.c @@ -155,11 +155,14 @@ unsigned long strtoul ( const char *p, char **endp, int base ) { unsigned int charval; if ( base == 0 ) { - if ( ( p[0] == '0' ) && ( ( p[1] | 0x20 ) == 'x' ) ) { - base = 16; - p += 2; - } else { - base = 10; + base = 10; + if ( *p == '0' ) { + p++; + base = 8; + if ( ( *p | 0x20 ) == 'x' ) { + p++; + base = 16; + } } }