+ for (dev = 0; ; dev++) {
+ mib[2] = dev;
+ if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1) {
+ if (errno == ENXIO)
+ continue;
+ if (errno == ENOENT)
+ break;
+ goto error;
+ }
+ /* 'path' is the node within the full path (defaults to acpitz0). */
+ if (strncmp(sensordev.xname, path, strlen(path)) == 0) {
+ mib[3] = SENSOR_TEMP;
+ /* Limit to temo0, but should retrieve from a full path... */
+ for (numt = 0; numt < 1 /*sensordev.maxnumt[SENSOR_TEMP]*/; numt++) {
+ mib[4] = numt;
+ if (sysctl(mib, 5, &sensor, &slen, NULL, 0) == -1) {
+ if (errno != ENOENT) {
+ warn("sysctl");
+ continue;
+ }
+ }
+ if ((int)MUKTOC(sensor.value) >= max_threshold) {
+ START_COLOR("color_bad");
+ colorful_output = true;
+ }
+
+ outwalk += sprintf(outwalk, "%.2f", MUKTOC(sensor.value));
+
+ if (colorful_output) {
+ END_COLOR;
+ colorful_output = false;
+ }
+ }
+ }
+ }