sensors: newline

need to get rid of these if they occur.
master
Alastair Poole 3 years ago
parent 51defa9c1e
commit f8e46cea54
  1. 16
      src/bin/system/machine/machine.bogox
  2. 5
      src/bin/system/machine/sensors.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)

@ -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);

Loading…
Cancel
Save