fix: uppercase letters not recognized by strtol() etc.

This commit is contained in:
Lephenixnoir 2024-07-06 08:51:51 +02:00
parent 83d0ab858e
commit dd735428b0
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -49,7 +49,7 @@ int __strto_int(struct __scanf_input *input, int base, long *outl,
int v = -1;
int c = __scanf_peek(input);
if(isdigit(c)) v = c - '0';
if(islower(c)) v = c - 'a' + 10;
if(isalpha(c)) v = tolower(c) - 'a' + 10;
if(v == -1 || v >= base) break;
/* The value is valid as long as there is at least one digit */