Added negative numbers support

This commit is contained in:
Devine Lu Linvega 2024-04-29 09:08:41 -07:00
parent 3d9ecb0b7b
commit d24af00098
1 changed files with 3 additions and 2 deletions

View File

@ -34,10 +34,11 @@ walk(char *s)
static int
sint(char *s)
{
int r = 0;
char c;
int r = 0, n = 1;
if(*s == '-') { n = -1, s++; }
while((c = *s++) && c > 0x20) r = r * 10 + c - '0';
return r;
return r * n;
}
static void