+ if (BEGINS_WITH(walk + 1, "degrees")) {
+#if defined(LINUX)
+ static char buf[16];
+ long int temp;
+ if (!slurp(thermal_zone, buf, sizeof(buf)))
+ goto error;
+ temp = strtol(buf, NULL, 10);
+ if (temp == LONG_MIN || temp == LONG_MAX || temp <= 0)
+ *(outwalk++) = '?';
+ else {
+ if ((temp / 1000) >= max_threshold) {
+ START_COLOR("color_bad");
+ colorful_output = true;
+ }
+ outwalk += sprintf(outwalk, "%ld", (temp / 1000));
+ if (colorful_output) {
+ END_COLOR;
+ colorful_output = false;
+ }
+ }
+#elif defined(__DragonFly__)
+ struct sensor th_sensor;
+ size_t th_sensorlen;
+
+ th_sensorlen = sizeof(th_sensor);
+
+ if (sysctlbyname(thermal_zone, &th_sensor, &th_sensorlen, NULL, 0) == -1) {
+ perror("sysctlbyname");
+ goto error;
+ }
+ if (MUKTOC(th_sensor.value) >= max_threshold) {
+ START_COLOR("color_bad");
+ colorful_output = true;
+ }
+ outwalk += sprintf(outwalk, "%.2f", MUKTOC(th_sensor.value));
+ if (colorful_output) {
+ END_COLOR;
+ colorful_output = false;
+ }
+
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ int sysctl_rslt;
+ size_t sysctl_size = sizeof(sysctl_rslt);
+ if (sysctlbyname(thermal_zone, &sysctl_rslt, &sysctl_size, NULL, 0))
+ goto error;
+
+ if (TZ_AVG(sysctl_rslt) >= max_threshold) {
+ START_COLOR("color_bad");
+ colorful_output = true;
+ }
+ outwalk += sprintf(outwalk, "%d.%d", TZ_KELVTOC(sysctl_rslt));
+ if (colorful_output) {
+ END_COLOR;
+ colorful_output = false;
+ }
+
+#elif defined(__OpenBSD__)
+ struct sensordev sensordev;
+ struct sensor sensor;
+ size_t sdlen, slen;
+ int dev, numt, mib[5] = {CTL_HW, HW_SENSORS, 0, 0, 0};