diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-02-25 14:33:19 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-03-24 17:04:20 +0100 |
commit | 9a88f7da453eadc72d8f333700dbd80777feecd1 (patch) | |
tree | 8a096e37123ece1d20bcb4d0ae8e064bdd39747a /initd/status.c |
Initial commit
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'initd/status.c')
-rw-r--r-- | initd/status.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/initd/status.c b/initd/status.c new file mode 100644 index 0000000..280670b --- /dev/null +++ b/initd/status.c @@ -0,0 +1,27 @@ +#include <stdio.h> + +#include "init.h" + +void print_status(const char *msg, int type, bool update) +{ + const char *str; + + switch (type) { + case STATUS_FAIL: + str = "\033[22;31mFAIL\033[0m"; + break; + case STATUS_WAIT: + str = "\033[22;33m .. \033[0m"; + break; + default: + str = "\033[22;32m OK \033[0m"; + break; + } + + if (update) + fputc('\r', stdout); + printf("[%s] %s", str, msg); + if (type != STATUS_WAIT) + fputc('\n', stdout); + fflush(stdout); +} |