From 92ecbd5fb8a7c8e939b1b4dde82cc6c9ba9d41af Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 4 Jan 2017 16:36:27 +0100 Subject: nwztools/upg: move upg handling to its own file, completely rework kas handling This was a huge mess, the new is much cleaner hopefully. Change-Id: I43663d021dc8bc31662d3923e1c3da22d987ebf9 --- utils/nwztools/upgtools/misc.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'utils/nwztools/upgtools/misc.c') diff --git a/utils/nwztools/upgtools/misc.c b/utils/nwztools/upgtools/misc.c index 108235e7fd..ed1ba6c788 100644 --- a/utils/nwztools/upgtools/misc.c +++ b/utils/nwztools/upgtools/misc.c @@ -22,25 +22,19 @@ #include #include #include +#include #include "misc.h" -char OFF[] = { 0x1b, 0x5b, 0x31, 0x3b, '0', '0', 0x6d, '\0' }; +const char OFF[] = { 0x1b, 0x5b, 0x31, 0x3b, '0', '0', 0x6d, '\0' }; -char GREY[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '0', 0x6d, '\0' }; -char RED[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '1', 0x6d, '\0' }; -char GREEN[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '2', 0x6d, '\0' }; -char YELLOW[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '3', 0x6d, '\0' }; -char BLUE[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '4', 0x6d, '\0' }; +const char GREY[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '0', 0x6d, '\0' }; +const char RED[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '1', 0x6d, '\0' }; +const char GREEN[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '2', 0x6d, '\0' }; +const char YELLOW[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '3', 0x6d, '\0' }; +const char BLUE[] = { 0x1b, 0x5b, 0x31, 0x3b, '3', '4', 0x6d, '\0' }; static bool g_color_enable = true; -void *xmalloc(size_t s) -{ - void * r = malloc(s); - if(!r) bugp("malloc"); - return r; -} - void enable_color(bool enable) { g_color_enable = enable; @@ -51,3 +45,14 @@ void color(color_t c) if(g_color_enable) printf("%s", (char *)c); } + +void generic_std_printf(void *u, bool err, color_t c, const char *f, ...) +{ + (void)u; + (void)err; + va_list args; + va_start(args, f); + color(c); + vprintf(f, args); + va_end(args); +} -- cgit v1.2.3