Only use hilite if stdout is a tty

This commit is contained in:
Roy Marples 2008-02-07 23:24:09 +00:00
parent 483a19a0e3
commit 04b1a62c4b

View File

@ -47,10 +47,14 @@ static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
static void print_level (char *level) static void print_level (char *level)
{ {
printf ("Runlevel: %s%s%s\n", printf ("Runlevel: ");
ecolor (ECOLOR_HILITE), if (isatty (fileno (stdout)))
level, printf ("%s%s%s\n",
ecolor (ECOLOR_NORMAL)); ecolor (ECOLOR_HILITE),
level,
ecolor (ECOLOR_NORMAL));
else
printf ("%s\n", level);
} }
static void print_service (char *service) static void print_service (char *service)