Reindent and restyle
[sysstatus.git] / statuses / temp.c
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <unistd.h>
4 #include "temp.h"
5
6 void status_temp(char *title, char *sysfile)
7 {
8   char stline[16];
9   int stfile;
10   ssize_t stlen;
11
12   stlen = fileRead(stline, sizeof(stline), sysfile);
13   if (stlen <= 0) {
14     return;
15   }
16
17   /*
18    * Read a valid value?
19    * Sometimes we get garbage from sysfs...
20    */
21   if (stlen < 6 || stlen > 7) {
22     printf(" ^fg(red)%sERROR ", title);
23     return;
24   }
25
26   fputs(" ^fg(#FF33FF)", stdout);
27   fputs(title, stdout);
28   fwrite(stline, 1, stlen - 4, stdout);
29   /*
30   fputs(".", stdout);
31   fwrite(&stline[stlen - 3], 1, 1, stdout);
32   */
33   fputs("°C ", stdout);
34 }