From 231539cd7def9ed345d433f7f088750e71237379 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Tue, 16 Jun 2015 03:12:59 +0200 Subject: [PATCH] Move all custom banner() handling to configure script. Signed-off-by: Joachim Nilsson --- configure | 5 +++-- finit.c | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/configure b/configure index ba60b5e8..4e6510d6 100755 --- a/configure +++ b/configure @@ -13,6 +13,7 @@ # Setup defaults if undefined defaults() { + heading=${heading:='"Finit v" VERSION'} prefix=${prefix:="/usr"} sysconfdir=${sysconfdir:="/etc"} sbindir=${sbindir:="/sbin"} @@ -166,7 +167,7 @@ while [ "$*" != "" ]; do ;; with-heading) - heading="$arg" + heading="\"$arg\"" ;; with-plugins) @@ -282,7 +283,7 @@ if [ $inetd -eq 0 ]; then fi if [ x"$heading" != x"" ]; then - echo "#define INIT_HEADING \"$heading\"" >> config.h + echo "#define INIT_HEADING $heading" >> config.h fi echo "#define VERBOSE_MODE $verbose" >> config.h diff --git a/finit.c b/finit.c index 92111f5d..4ac54aaa 100644 --- a/finit.c +++ b/finit.c @@ -55,16 +55,14 @@ uev_ctx_t *ctx = NULL; /* Main loop context */ static int banner(void) { + char buf[42] = INIT_HEADING; + const char separator[] = "========================================================================"; + if (!verbose) return 0; - delline(); -#ifdef INIT_HEADING - echo("%s", INIT_HEADING); -#else - echo("Finit v" VERSION); - echo("==================================================================="); -#endif + fprintf(stderr, "\e[2K\e[1m%s %.*s\e[0m\n", buf, 66 - (int)strlen(buf), separator); + return 0; }