summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-06-05 20:32:17 -0400
committerLLLL Colonq <llll@colonq>2026-06-05 20:32:17 -0400
commitb456aa44a172171d4b6120ec566c1499ec25a690 (patch)
tree7a835e42351ffd39e5620f5d8e705ef8c69d838e /src/utils.c
parent48ab2cb8e3de88dbd0722337bd4617ad22de1a12 (diff)
Fix integer parsing
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 7f2831b..53a9ebf 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -45,6 +45,7 @@ int pit_string_vsnprintf(char *buf, size_t len, char *format, va_list ap) {
if (length_mod == 'l') arg = va_arg(ap, long); else arg = va_arg(ap, int);
if (arg == 0) { WRITE('0') }
else {
+ if (arg < 0) { WRITE('-'); arg = -arg; }
while (arg != 0) { WRITE_SCRATCH('0' + (char) (arg % 10)); arg /= 10; }
while (sidx > 0) { WRITE(scratch[sidx - 1]); sidx -= 1; }
}