aboutsummaryrefslogtreecommitdiff
path: root/toys/other/acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other/acpi.c')
-rw-r--r--toys/other/acpi.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/toys/other/acpi.c b/toys/other/acpi.c
index 44fd03b1..363cfb99 100644
--- a/toys/other/acpi.c
+++ b/toys/other/acpi.c
@@ -25,10 +25,7 @@ config ACPI
#include "toys.h"
GLOBALS(
- int ac;
- int bat;
- int therm;
- int cool;
+ int ac, bat, therm, cool;
char *cpath;
)
@@ -44,7 +41,7 @@ int read_int_at(int dirfd, char *name)
return ret;
}
-int acpi_callback(struct dirtree *tree)
+static int acpi_callback(struct dirtree *tree)
{
int dfd, fd, len, on;
@@ -85,11 +82,11 @@ done:
return 0;
}
-int temp_callback(struct dirtree *tree)
+static int temp_callback(struct dirtree *tree)
{
int dfd, temp;
- if (tree->name[0]=='.') return 0;
+ if (*tree->name=='.') return 0;
if (!tree->parent || !tree->parent->parent)
return DIRTREE_RECURSE|DIRTREE_SYMFOLLOW;
errno = 0;
@@ -98,17 +95,17 @@ int temp_callback(struct dirtree *tree)
if ((0 < (temp = read_int_at(dfd, "temp"))) || !errno) {
//some tempertures are in milli-C, some in deci-C
//reputedly some are in deci-K, but I have not seen them
- if (((temp >= 1000) || (temp <= -1000)) && (temp%100 == 0))
- temp /= 100;
+ if (((temp >= 1000) || (temp <= -1000)) && (temp%100 == 0)) temp /= 100;
printf("Thermal %d: %d.%d degrees C\n", TT.therm++, temp/10, temp%10);
}
close(dfd);
}
free(TT.cpath);
+
return 0;
}
-int cool_callback(struct dirtree *tree)
+static int cool_callback(struct dirtree *tree)
{
int dfd=5, cur, max;