diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-14 22:20:23 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-11-14 22:20:23 +0000 |
commit | 5b48c0ac750093c9cfda02dccb35b5782efd697a (patch) | |
tree | 3340bf73c88e0c6af5007d74d660e7e9c32c5c96 /usr.sbin/apm | |
parent | 74aec4583cac467a5572c0f47320add345ffb21e (diff) |
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.
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r-- | usr.sbin/apm/apm.c | 14 |
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)); |