- struct sensordev sensordev;
- struct sensor sensor;
- size_t sdlen, slen;
- int dev, numt, mib[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
-
- sdlen = sizeof(sensordev);
- slen = sizeof(sensor);
-
- 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;
- }
- }
+ struct sensordev sensordev;
+ struct sensor sensor;
+ size_t sdlen, slen;
+ int dev, numt, mib[5] = {CTL_HW, HW_SENSORS, 0, 0, 0};
+
+ sdlen = sizeof(sensordev);
+ slen = sizeof(sensor);
+
+ for (dev = 0;; dev++) {
+ mib[2] = dev;
+ if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1) {
+ if (errno == ENXIO)
+ continue;
+ if (errno == ENOENT)
+ break;
+ return ERROR_CODE;
+ }
+ /* 'path' is the node within the full path (defaults to acpitz0). */
+ if (BEGINS_WITH(sensordev.xname, thermal_zone)) {
+ mib[3] = SENSOR_TEMP;
+ /* Limit to temp0, 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;
+ }