blob: 0e7cfdfa0d050e52a619c79d3d893c52fe510427 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "status/fan.h"
#include "tools.h"
void status_fan(char *title, char *sysfile)
{
char stline[16];
ssize_t stlen;
stlen = fileRead(stline, sizeof(stline), sysfile);
if (stlen <= 0) {
return;
}
// Read a valid value? Sometimes we get garbage from sysfs...
if (stlen > 5) {
printf(" ^fg(red)%sERROR ", title);
return;
}
fputs(" ^fg(#CCCCCC)", stdout);
fputs(title, stdout);
fwrite(stline, 1, stlen - 1, stdout);
fputs(" rpm ", stdout);
}
|