$OpenBSD: patch-src_print_battery_info_c,v 1.11 2014/03/12 07:56:52 jasper Exp $

From 52814295a0b3a0785631256e9e2dc6b8139e2be8 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Mon, 10 Mar 2014 09:22:47 +0000
Subject: For the %percentage display of batteries, drop the leading '0' for values < 10.

--- src/print_battery_info.c.orig	Sun Jan  5 12:34:07 2014
+++ src/print_battery_info.c	Wed Mar 12 08:55:26 2014
@@ -284,7 +284,8 @@ void print_battery_info(yajl_gen json_gen, char *buffe
 	}
 
 	(void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status));
-        (void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", apm_info.battery_life);
+	/* integer_battery_capacity is implied as battery_life is already in whole numbers. */
+	(void)snprintf(percentagebuf, sizeof(percentagebuf), "%.00d%%", apm_info.battery_life);
 
 	if (status == CS_DISCHARGING && low_threshold > 0) {
 		if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0
