Uppercase hex number conversions fail for abtol, strtol, strtoul, strtoull, atoi, and abtod.
The following patch fixes it. This fix allows tcc to handle assembly language, which is necessary to build the Fiwix kernel as part of the kernel bootstrapping in progress for the live-bootstrap project.
diff --git a/lib/ctype/isxdigit.c b/lib/ctype/isxdigit.c
index 13f7a66d..b15546e2 100644
--- a/lib/ctype/isxdigit.c
+++ b/lib/ctype/isxdigit.c
@@ -24,5 +24,5 @@
int
isxdigit (int c)
{
- return isdigit (c) || (c >= 'a' && c <= 'f');
+ return isdigit (c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
}
diff --git a/lib/mes/abtol.c b/lib/mes/abtol.c
index 0fafb5c1..37889070 100644
--- a/lib/mes/abtol.c
+++ b/lib/mes/abtol.c
@@ -43,10 +43,15 @@ abtol (char const **p, int base)
while (isnumber (s[0], base) != 0)
{
i = i * base;
- if (s[0] > '9')
+ if (s[0] >= 'a')
m = 'a' - 10;
else
- m = '0';
+ {
+ if (s[0] >= 'A')
+ m = 'A' - 10;
+ else
+ m = '0';
+ }
i = i + s[0] - m;
s = s + 1;
}