summaryrefslogtreecommitdiff
path: root/src/shared/printf.c
diff options
context:
space:
mode:
authordzwdz2022-09-02 23:56:18 +0200
committerdzwdz2022-09-02 23:56:18 +0200
commit6e4b9831f903e583d58de8b4265159f6d859ebc2 (patch)
tree9e941257df8898356d605a7f3398aa09d9b00ec9 /src/shared/printf.c
parente7770ccc0fab8f3a4b65bf2f7a1a11ad453f77e4 (diff)
user/ports: bare minimum to run doomgeneric
Diffstat (limited to 'src/shared/printf.c')
-rw-r--r--src/shared/printf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/printf.c b/src/shared/printf.c
index 9d8eb2d..d28f891 100644
--- a/src/shared/printf.c
+++ b/src/shared/printf.c
@@ -115,6 +115,18 @@ int __printf_internal(const char *fmt, va_list argp,
c = *fmt++;
}
+ if (c == '.') {
+ // TODO implement precision properly, this violates the spec and is stupid
+ c = *fmt++;
+ m.fill_char = '0';
+ m.field_width = 0;
+ while ('0' <= c && c <= '9') {
+ m.field_width *= 10;
+ m.field_width += c - '0';
+ c = *fmt++;
+ }
+ }
+
// TODO length modifiers
enum lenmod lm;
switch (c) {
@@ -174,6 +186,7 @@ int __printf_internal(const char *fmt, va_list argp,
break;
case 'd':
+ case 'i':
if (lm == LM_int) ns = va_arg(argp, int);
else if (lm == LM_long) ns = va_arg(argp, long);
else if (lm == LM_longlong) ns = va_arg(argp, long long);