diff options
Diffstat (limited to 'components/Linux')
-rw-r--r-- | components/Linux/temperature.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/Linux/temperature.c b/components/Linux/temperature.c new file mode 100644 index 0000000..fa50826 --- /dev/null +++ b/components/Linux/temperature.c @@ -0,0 +1,15 @@ +/* See LICENSE file for copyright and license details. */ +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#include "../../util.h" + +const char * +temp(const char *file) +{ + int temp; + + return (pscanf(file, "%d", &temp) == 1) ? + bprintf("%d", temp / 1000) : NULL; +} |