diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-07-02 17:40:33 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-07-02 17:40:33 +0200 |
commit | 6826d5842a9568b37a8d1de5662eb7437027b53b (patch) | |
tree | 91b73d325f160d2ff206152e976f310b97127d0b /atasmart.c | |
parent | 1a97c4dcca25a79298af05942f7ca7cbb208da18 (diff) |
highlight lines only when good_valid is set
Diffstat (limited to 'atasmart.c')
-rw-r--r-- | atasmart.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); } |