Extend commit 25680305095bfcedaa46cb017182544183ab743b to the whole cpu object.
[monky] / src / ibm.c
index 8d1b08c..47b0d33 100644 (file)
--- a/src/ibm.c
+++ b/src/ibm.c
@@ -11,7 +11,7 @@
  *
  * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
  * Copyright (c) 2007 Toni Spets
- * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
+ * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
  *     (see AUTHORS)
  * All rights reserved.
  *
@@ -33,6 +33,8 @@
 #include "config.h"
 #include "ibm.h"
 #include "logging.h"
+#include "temphelper.h"
+#include <ctype.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
@@ -71,13 +73,15 @@ speed:          2944
 commands:       enable, disable
  * Peter Tarjan (ptarjan@citromail.hu) */
 
-void get_ibm_acpi_fan(char *p_client_buffer, size_t client_buffer_size)
+void get_ibm_acpi_fan(struct text_object *obj, char *p, int p_max_size)
 {
        FILE *fp;
        unsigned int speed = 0;
        char fan[128];
 
-       if (!p_client_buffer || client_buffer_size <= 0) {
+       (void)obj;
+
+       if (!p || p_max_size <= 0) {
                return;
        }
 
@@ -101,7 +105,7 @@ void get_ibm_acpi_fan(char *p_client_buffer, size_t client_buffer_size)
        }
 
        fclose(fp);
-       snprintf(p_client_buffer, client_buffer_size, "%d", speed);
+       snprintf(p, p_max_size, "%d", speed);
 }
 
 /* get the measured temperatures from the temperature sensors
@@ -166,14 +170,16 @@ commands:       up, down, mute
 commands:       level <level> (<level> is 0-15)
  * Peter Tarjan (ptarjan@citromail.hu) */
 
-void get_ibm_acpi_volume(char *p_client_buffer, size_t client_buffer_size)
+void get_ibm_acpi_volume(struct text_object *obj, char *p, int p_max_size)
 {
        FILE *fp;
        char volume[128];
        unsigned int vol = -1;
        char mute[3] = "";
 
-       if (!p_client_buffer || client_buffer_size <= 0) {
+       (void)obj;
+
+       if (!p || p_max_size <= 0) {
                return;
        }
 
@@ -203,13 +209,10 @@ void get_ibm_acpi_volume(char *p_client_buffer, size_t client_buffer_size)
 
        fclose(fp);
 
-       if (strcmp(mute, "on") == 0) {
-               snprintf(p_client_buffer, client_buffer_size, "%s", "mute");
-               return;
-       } else {
-               snprintf(p_client_buffer, client_buffer_size, "%d", vol);
-               return;
-       }
+       if (strcmp(mute, "on") == 0)
+               snprintf(p, p_max_size, "%s", "mute");
+       else
+               snprintf(p, p_max_size, "%d", vol);
 }
 
 /* static FILE *fp = NULL; */
@@ -221,13 +224,15 @@ commands:       up, down
 commands:       level <level> (<level> is 0-7)
  * Peter Tarjan (ptarjan@citromail.hu) */
 
-void get_ibm_acpi_brightness(char *p_client_buffer, size_t client_buffer_size)
+void get_ibm_acpi_brightness(struct text_object *obj, char *p, int p_max_size)
 {
        FILE *fp;
        unsigned int brightness = 0;
        char filename[128];
 
-       if (!p_client_buffer || client_buffer_size <= 0) {
+       (void)obj;
+
+       if (!p || p_max_size <= 0) {
                return;
        }
 
@@ -252,7 +257,7 @@ void get_ibm_acpi_brightness(char *p_client_buffer, size_t client_buffer_size)
 
        fclose(fp);
 
-       snprintf(p_client_buffer, client_buffer_size, "%d", brightness);
+       snprintf(p, p_max_size, "%d", brightness);
 }
 
 void parse_ibm_temps_arg(struct text_object *obj, const char *arg)