summaryrefslogtreecommitdiff
path: root/usr.sbin/sensorsd/sensorsd.c
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2008-03-14 00:06:19 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2008-03-14 00:06:19 +0000
commitcda8833d4db159de81d5738eee816e7c9fd46b23 (patch)
treec38d87005316b26f755a8d65078d732871047cd4 /usr.sbin/sensorsd/sensorsd.c
parent1a5a196c25fa0f13b93e46e5c1d54f4f3fba8cf8 (diff)
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
Diffstat (limited to 'usr.sbin/sensorsd/sensorsd.c')
-rw-r--r--usr.sbin/sensorsd/sensorsd.c25
1 files changed, 23 insertions, 2 deletions
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 <henning@openbsd.org>
@@ -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,