From 6826d5842a9568b37a8d1de5662eb7437027b53b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 Jul 2008 17:40:33 +0200 Subject: highlight lines only when good_valid is set --- atasmart.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/atasmart.c b/atasmart.c index 920e947..4ff072c 100644 --- a/atasmart.c +++ b/atasmart.c @@ -1067,6 +1067,7 @@ static void disk_dump_attributes(SkDisk *d, const SkSmartAttributeParsedData *a, char name[32]; char pretty[32]; char tt[32], tw[32], tc[32]; + SkBool highlight; snprintf(tt, sizeof(tt), "%3u", a->threshold); tt[sizeof(tt)-1] = 0; @@ -1075,7 +1076,9 @@ static void disk_dump_attributes(SkDisk *d, const SkSmartAttributeParsedData *a, snprintf(tc, sizeof(tc), "%3u", a->current_value); tc[sizeof(tc)-1] = 0; - if (!a->good && isatty(1)) + highlight = a->good_valid && !a->good && isatty(1); + + if (highlight) fprintf(stderr, HIGHLIGHT); printf("%3u %-27s %-3s %-3s %-3s %-11s %-7s %-7s %-3s\n", @@ -1089,7 +1092,7 @@ static void disk_dump_attributes(SkDisk *d, const SkSmartAttributeParsedData *a, a->online ? "online" : "offline", a->good_valid ? yes_no(a->good) : "n/a"); - if (!a->good && isatty(1)) + if (highlight) fprintf(stderr, ENDHIGHLIGHT); } -- cgit