Rationalise our colour usage a little.

This commit is contained in:
Roy Marples
2007-04-17 09:32:18 +00:00
parent 0f92b5e7df
commit f657d87b99
9 changed files with 113 additions and 112 deletions

View File

@@ -18,34 +18,34 @@
static void print_level (char *level)
{
printf ("Runlevel: ");
PEINFO_HILITE;
printf ("%s\n", level);
PEINFO_NORMAL;
printf ("Runlevel: %s%s%s\n",
ecolor (ecolor_hilite),
level,
ecolor (ecolor_normal));
}
static void print_service (char *service)
{
char status[10];
int cols = printf (" %s\n", service);
einfo_color_t color = einfo_bad;
einfo_color_t color = ecolor_bad;
if (rc_service_state (service, rc_service_stopping))
snprintf (status, sizeof (status), "stopping ");
else if (rc_service_state (service, rc_service_starting)) {
snprintf (status, sizeof (status), "starting ");
color = einfo_warn;
color = ecolor_warn;
} else if (rc_service_state (service, rc_service_inactive)) {
snprintf (status, sizeof (status), "inactive ");
color = einfo_warn;
color = ecolor_warn;
} else if (geteuid () == 0 && rc_service_state (service, rc_service_crashed))
snprintf (status, sizeof (status), " crashed ");
else if (rc_service_state (service, rc_service_started)) {
snprintf (status, sizeof (status), " started ");
color = einfo_good;
color = ecolor_good;
} else if (rc_service_state (service, rc_service_scheduled)) {
snprintf (status, sizeof (status), "scheduled");
color = einfo_warn;
color = ecolor_warn;
} else
snprintf (status, sizeof (status), " stopped ");
ebracket (cols, color, status);