summaryrefslogtreecommitdiffstats
path: root/src/core/misc.c
diff options
context:
space:
mode:
authorMichael Brown2006-11-15 03:57:24 +0100
committerMichael Brown2006-11-15 03:57:24 +0100
commit5753f2c58b9559cea178d9e424a337e37cc7fce4 (patch)
tree715a7cbe8021c881376960bcfcd979a1d54ea635 /src/core/misc.c
parentFixed endp bug in strtoul() (diff)
downloadipxe-5753f2c58b9559cea178d9e424a337e37cc7fce4.tar.gz
ipxe-5753f2c58b9559cea178d9e424a337e37cc7fce4.tar.xz
ipxe-5753f2c58b9559cea178d9e424a337e37cc7fce4.zip
May as well add octal support to strtoul()
Diffstat (limited to 'src/core/misc.c')
-rw-r--r--src/core/misc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index 968e232d..2a926313 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;
+ }
}
}