netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=f8e46cea54b65ae6fa8c2f6ded328c75a84307b3

commit f8e46cea54b65ae6fa8c2f6ded328c75a84307b3
Author: Alastair Poole <nets...@gmail.com>
Date:   Wed Jan 27 19:39:16 2021 +0000

    sensors: newline
    
    need to get rid of these if they occur.
---
 src/bin/system/machine/machine.bogox | 16 ++++++++++++++++
 src/bin/system/machine/sensors.bogox |  5 +++++
 2 files changed, 21 insertions(+)

diff --git a/src/bin/system/machine/machine.bogox 
b/src/bin/system/machine/machine.bogox
index b16fa83..4a2e9d2 100644
--- a/src/bin/system/machine/machine.bogox
+++ b/src/bin/system/machine/machine.bogox
@@ -64,6 +64,22 @@ strsli_printf(const char *fmt, ...)
    return buf;
 }
 
+void
+strimmer(char *s)
+{
+   char *cp = s;
+
+   while (*cp)
+     {
+        if ((*cp == '\r') || (*cp == '\n'))
+          {
+             *cp = '\0';
+             return;
+          }
+        cp++;
+     }
+}
+
 #if defined(__FreeBSD__) || defined(__DragonFly__)
 static long int
 _sysctlfromname(const char *name, void *mib, int depth, size_t *len)
diff --git a/src/bin/system/machine/sensors.bogox 
b/src/bin/system/machine/sensors.bogox
index e521ee7..3c35192 100644
--- a/src/bin/system/machine/sensors.bogox
+++ b/src/bin/system/machine/sensors.bogox
@@ -202,9 +202,14 @@ system_sensors_thermal_get(int *sensor_count)
 
                   snprintf(buf, sizeof(buf), "%s/name", link);
                   sensor->name = file_contents(buf);
+                  if (sensor->name)
+                    strimmer(sensor->name);
 
                   snprintf(buf, sizeof(buf), "%s/temp%d_label", link, id);
                   sensor->child_name = file_contents(buf);
+                  if (sensor->child_name)
+                    strimmer(sensor->name);
+
                   snprintf(buf, sizeof(buf), "%s/temp%d_input", link, id);
                   sensor->path = strdup(buf);
                   char *d = file_contents(buf);

-- 


Reply via email to