aboutsummaryrefslogtreecommitdiff
path: root/initd/supervisor.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2020-05-08 15:25:41 +0200
committerDavid Oberhollenzer <goliath@infraroot.at>2020-05-08 15:26:40 +0200
commit9430785779a178c2226b86e9ac46013123dea76a (patch)
tree567988e30e9c7e4cbe407b9d8f7a161b77fcf4c5 /initd/supervisor.c
parentf6ef5b8dd3f1b8d6af104304a9988ff1f8edd182 (diff)
Cleanup: remove rest of status.c
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'initd/supervisor.c')
-rw-r--r--initd/supervisor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/initd/supervisor.c b/initd/supervisor.c
index 8de61c9..6fdaae1 100644
--- a/initd/supervisor.c
+++ b/initd/supervisor.c
@@ -21,6 +21,32 @@ static bool waiting = false;
/*****************************************************************************/
+enum {
+ STATUS_OK = 0,
+ STATUS_FAIL,
+ STATUS_WAIT,
+ STATUS_STARTED,
+};
+
+static const char *status_str[] = {
+ [STATUS_OK] = "\033[22;32m OK \033[0m",
+ [STATUS_FAIL] ="\033[22;31mFAIL\033[0m",
+ [STATUS_WAIT] = "\033[22;33m .. \033[0m",
+ [STATUS_STARTED] ="\033[22;32m UP \033[0m",
+};
+
+static void print_status(const char *msg, int type, bool update)
+{
+ if (update)
+ fputc('\r', stdout);
+
+ printf("[%s] %s", status_str[type], msg);
+
+ if (type != STATUS_WAIT)
+ fputc('\n', stdout);
+ fflush(stdout);
+}
+
static svc_run_data_t *run_time_data_from_pid(pid_t pid)
{
size_t i;