added new variables battery_volts and battery_temp
[monky] / src / core.c
index e93ef58..009cb27 100644 (file)
@@ -245,7 +245,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_short, 0)
@@ -254,7 +254,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_time, 0)
@@ -263,7 +263,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_percent, 0)
@@ -272,7 +272,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
        END OBJ(battery_bar, 0)
@@ -282,7 +282,23 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                if (arg && strlen(arg)>0) {
                        sscanf(arg, "%63s", bat);
                } else {
-                       strcpy(bat, "BAT0");
+                       strcpy(bat, "bq27200-0");
+               }
+               obj->data.s = strndup(bat, text_buffer_size);
+       END OBJ(battery_volts, 0)
+               char bat[64];
+               if (arg) {
+                       sscanf(arg, "%63s", bat);
+               } else {
+                       strcpy(bat, "bq27200-0");
+               }
+               obj->data.s = strndup(bat, text_buffer_size);
+       END OBJ(battery_temp, 0)
+               char bat[64];
+               if (arg) {
+                       sscanf(arg, "%63s", bat);
+               } else {
+                       strcpy(bat, "bq27200-0");
                }
                obj->data.s = strndup(bat, text_buffer_size);
 #endif /* !__OpenBSD__ */
@@ -1652,6 +1668,12 @@ void free_text_objects(struct text_object *root, int internal)
                        case OBJ_battery_time:
                                free(data.s);
                                break;
+                       case OBJ_battery_volts:
+                               free(data.s);
+                               break;
+                       case OBJ_battery_temp:
+                               free(data.s);
+                               break;
 #endif /* !__OpenBSD__ */
                        case OBJ_execpi:
                        case OBJ_execi: