From cda8833d4db159de81d5738eee816e7c9fd46b23 Mon Sep 17 00:00:00 2001 From: Chris Kuethe Date: Fri, 14 Mar 2008 00:06:19 +0000 Subject: Add a "%l" token to signal whether a sensor value is in or out of bounds, without regard for the specific value. It's a big heavy binary hammer... ok & style feedback from cnst --- usr.sbin/sensorsd/sensorsd.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'usr.sbin/sensorsd/sensorsd.c') diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index b24ab1f3723..7f43ab9f05c 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.37 2008/03/13 21:24:45 ckuethe Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.38 2008/03/14 00:06:18 ckuethe Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -434,6 +434,27 @@ report_sdlim(struct sdlim_t *sdlim, time_t last_report) r = snprintf(&buf[n], len - n, "%d", limit->numt); break; + case 'l': + { + char *s = ""; + switch(limit->ustatus){ + case SENSORSD_S_UNSPEC: + s = "uninitialised"; + break; + case SENSORSD_S_INVALID: + s = "invalid"; + break; + case SENSORSD_S_WITHIN: + s = "within"; + break; + case SENSORSD_S_OUTSIDE: + s = "exceeds"; + break; + } + r = snprintf(&buf[n], len - n, "%s", + s); + break; + } case 's': { char *s; @@ -455,8 +476,8 @@ report_sdlim(struct sdlim_t *sdlim, time_t last_report) } r = snprintf(&buf[n], len - n, "%s", s); - } break; + } case '2': r = snprintf(&buf[n], len - n, "%s", print_sensor(limit->type, -- cgit v1.2.3