From 6e4b9831f903e583d58de8b4265159f6d859ebc2 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 2 Sep 2022 23:56:18 +0200 Subject: user/ports: bare minimum to run doomgeneric --- src/shared/include/camellia/errno.h | 2 ++ src/shared/printf.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/shared') diff --git a/src/shared/include/camellia/errno.h b/src/shared/include/camellia/errno.h index 2c5594b..1e4841c 100644 --- a/src/shared/include/camellia/errno.h +++ b/src/shared/include/camellia/errno.h @@ -11,3 +11,5 @@ #define EACCES 10 #define EMFILE 11 /* All file descriptors taken. */ #define ECONNRESET 12 + +#define EISDIR 200 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); -- cgit v1.2.3