summaryrefslogtreecommitdiff
path: root/sysutils/ups-nut/patches/patch-af
blob: 1cc9fb42d49b41966bf575051fbb6b6a9506e975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$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 */