aboutsummaryrefslogtreecommitdiff
path: root/lib/io/io.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2022-12-19 23:10:44 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2022-12-19 23:10:44 +0100
commit6f77c541db4f58d7a3fbc8fbd52caa4c379a884e (patch)
treecfb1fb6d46f984d4ba3278f2be1f3fbd9aeeb23d /lib/io/io.c
parent85139c4208063a911d9ac8c871dc1052d2712c17 (diff)
add aec to wstdf
Diffstat (limited to 'lib/io/io.c')
-rw-r--r--lib/io/io.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/io/io.c b/lib/io/io.c
index 160b4cb..3b0ea96 100644
--- a/lib/io/io.c
+++ b/lib/io/io.c
@@ -1,6 +1,7 @@
#include "io.h"
#include "../cstr/cstr.h"
+#include "../aec/aec.h"
void __wstdn(const char *buf, u64 n)
{
@@ -33,7 +34,20 @@ void wstdf__(const char *buf, const void **args)
case '%': __wstdn("%", 1); break;
case 's':
__wstdn(((const char **)args)[0], cstr_length(((const char**)args)[0]));
- ++args; break;
+ ++args;
+ break;
+ case 'S':
+ sgr(((const char **)args)[0]);
+ ++args;
+ break;
+ case 'F':
+ foreground(((const char **)args)[0]);
+ ++args;
+ break;
+ case 'B':
+ background(((const char **)args)[0]);
+ ++args;
+ break;
}
start = buf + 1;
@@ -46,7 +60,6 @@ void wstdf__(const char *buf, const void **args)
#ifdef IO_LIB_UNIT_TEST
int main() {
- void *args[] = { "hallo", "welt" };
- wstdf__("%s %s\n", args);
+ wstdf("%s %S%F%s%S\n", "hallo", SGR_UNDERLINE, COLOR_RED, "welt", SGR_RESET);
}
#endif