aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-07 23:24:09 +0000
committerRoy Marples <roy@marples.name>2008-02-07 23:24:09 +0000
commit04b1a62c4b3d4269b357c1d12bbd8c68389f1ad4 (patch)
tree068ce1f0eece9c0d5b06d5e8d6351a79f884b42d
parent483a19a0e3c9f2f2bffb1efe1dd75c36d800b898 (diff)
Only use hilite if stdout is a tty
-rw-r--r--src/rc/rc-status.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c
index 0b2b3ec1..5c7f1c60 100644
--- a/src/rc/rc-status.c
+++ b/src/rc/rc-status.c
@@ -47,10 +47,14 @@ static const char *const types_nua[] = { "ineed", "iuse", "iafter", NULL };
static void print_level (char *level)
{
- printf ("Runlevel: %s%s%s\n",
- ecolor (ECOLOR_HILITE),
- level,
- ecolor (ECOLOR_NORMAL));
+ printf ("Runlevel: ");
+ if (isatty (fileno (stdout)))
+ printf ("%s%s%s\n",
+ ecolor (ECOLOR_HILITE),
+ level,
+ ecolor (ECOLOR_NORMAL));
+ else
+ printf ("%s\n", level);
}
static void print_service (char *service)