pkgsrc/sysutils/ups-nut/patches/patch-af
lukem 7fb5bf88b1 newapc driver: chop any trailing `:'s off the end of APC_F_MINUTES fields;
specifically the RUNTIME field on my SmartUPS-1400.
2001-11-20 14:53:03 +00:00

24 lines
589 B
Text

$NetBSD: patch-af,v 1.3 2001/11/20 14:53:04 lukem Exp $
--- models/newapc.c.orig Thu Oct 11 04:32:07 2001
+++ models/newapc.c
@@ -185,11 +185,18 @@
case APC_F_HEX:
case APC_F_DEC:
case APC_F_SECONDS:
- case APC_F_MINUTES:
case APC_F_HOURS:
case APC_F_LEAVE:
/* All of these just pass through at present */
ptr = upsval;
+ break;
+ case APC_F_MINUTES:
+ strncpy(tmp, upsval, sizeof(tmp) - 1);
+ tmp[sizeof(tmp) - 1] = 0;
+ tval = strlen(tmp) - 1;
+ if (tmp[tval] == ':') /* cull trailing `:' */
+ tmp[tval] = 0;
+ ptr = tmp;
break;
default:
/* Moan */