diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-06-01 06:45:30 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-06-01 06:45:30 +0000 |
commit | 8dc94dba6511b8db40c0e209b0ea595052650a21 (patch) | |
tree | 1ae7db249d5ad89d18cf9422abfeb034139f5c35 /plugin_i2c_sensors.c | |
parent | a581675c3951031bdc1b71fa654d0dadcc191397 (diff) | |
download | lcd4linux-8dc94dba6511b8db40c0e209b0ea595052650a21.tar.gz |
[lcd4linux @ 2004-06-01 06:45:28 by reinelt]
some Fixme's processed
documented some code
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@456 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_i2c_sensors.c')
-rw-r--r-- | plugin_i2c_sensors.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugin_i2c_sensors.c b/plugin_i2c_sensors.c index 01bef64..2dcea77 100644 --- a/plugin_i2c_sensors.c +++ b/plugin_i2c_sensors.c @@ -1,4 +1,4 @@ -/* $Id: plugin_i2c_sensors.c,v 1.15 2004/05/31 21:05:13 reinelt Exp $ +/* $Id: plugin_i2c_sensors.c,v 1.16 2004/06/01 06:45:30 reinelt Exp $ * * I2C sensors plugin * @@ -23,6 +23,11 @@ * * * $Log: plugin_i2c_sensors.c,v $ + * Revision 1.16 2004/06/01 06:45:30 reinelt + * + * some Fixme's processed + * documented some code + * * Revision 1.15 2004/05/31 21:05:13 reinelt * * fixed lots of bugs in the Cwlinux driver @@ -137,6 +142,7 @@ #include "plugin.h" #include "cfg.h" #include "hash.h" +#include "qprintf.h" #ifdef WITH_DMALLOC #include <dmalloc.h> @@ -160,7 +166,6 @@ static int (*parse_i2c_sensors)(char *key); static int parse_i2c_sensors_sysfs(char *key) { - double value; char val[32]; char buffer[32]; char file[64]; @@ -189,13 +194,9 @@ static int parse_i2c_sensors_sysfs(char *key) !strncmp(key, "curr", 4) || !strncmp(key, "in", 2) || !strncmp(key, "vid", 3)) { - value = strtod(buffer, NULL); - // FIXME: any way to do this without converting to double ? - value /= 1000.0; - sprintf(val, "%f", value); - + qprintf(val, sizeof(val), "%f", strtod(buffer, NULL) / 1000.0); } else { - sprintf(val, "%s", buffer); + qprintf(val, sizeof(val), "%s", buffer); // we supress this nasty \n at the end val[strlen(val)-1]='\0'; } @@ -267,7 +268,7 @@ static int parse_i2c_sensors_procfs(char *key) // debug("%s pos %i -> BREAK", file, pos); break; } else { - sprintf (final_key, "%s%s", procfs_tokens[tokens_index][pos], number); + qprintf (final_key, sizeof(final_key), "%s%s", procfs_tokens[tokens_index][pos], number); // debug ("%s -> %s", final_key, value); hash_set (&I2Csensors, final_key, value); pos++; |