summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2001-11-14 22:20:22 +0000
committermiod <miod@openbsd.org>2001-11-14 22:20:22 +0000
commita6de8ae44bc1c13bbc20247bad390bca61a423c7 (patch)
tree863fc5d11e57af0139f2393270a59e500ae34d5b
parentOn macppc, when the battery is charging, the life time estimatation is in fact (diff)
downloadwireguard-openbsd-a6de8ae44bc1c13bbc20247bad390bca61a423c7.tar.xz
wireguard-openbsd-a6de8ae44bc1c13bbc20247bad390bca61a423c7.zip
On macppc, print the recharge time estimate as a recharge time estimate, not
a battery life estimate, when the battery is charging. Also, if the ac switched state and the life time, whatever it will be a life estimate or a recharge estimate, has been reset to zero, print it as not available.
-rw-r--r--usr.sbin/apm/apm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index 9421bb79371..a787478755e 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.5 2001/07/06 21:08:00 mickey Exp $ */
+/* $OpenBSD: apm.c,v 1.6 2001/11/14 22:20:22 miod Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
@@ -243,9 +243,19 @@ main(int argc, char *argv[])
if (dopct)
printf("Battery remaining: %d percent\n",
reply.batterystate.battery_life);
- if (domin)
+ if (domin) {
+#ifdef __powerpc__
+ if (reply.batterystate.battery_state == APM_BATT_CHARGING)
+ printf("Remaining battery recharge time estimate: %d minutes\n",
+ reply.batterystate.minutes_left);
+ else if (reply.batterystate.minutes_left == 0 &&
+ reply.batterystate.battery_life > 10)
+ printf("Battery life estimate: not available\n");
+ else
+#endif
printf("Battery life estimate: %d minutes\n",
reply.batterystate.minutes_left);
+ }
if (doac)
printf("A/C adapter state: %s\n",
ac_state(reply.batterystate.ac_state));