summaryrefslogtreecommitdiffstats
path: root/usr.sbin/apm
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-07-20 15:37:28 +0000
committergreen <green@FreeBSD.org>1999-07-20 15:37:28 +0000
commit2450f86bb15763e4c1bcb9e1382350815ca719c2 (patch)
treed7342689dfe7e9f795eeaab8106978c68669388a /usr.sbin/apm
parent291fbe9036af6d2f9c61e0a870e15daadf2970b1 (diff)
downloadFreeBSD-src-2450f86bb15763e4c1bcb9e1382350815ca719c2.zip
FreeBSD-src-2450f86bb15763e4c1bcb9e1382350815ca719c2.tar.gz
Make bcd2int work (resume time reporting now works.)
PR: 12613 Submitted by: Michael Constant <mconst@not.there.com>
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r--usr.sbin/apm/apm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index 8ad45ac..e070915 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -15,7 +15,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: apm.c,v 1.14 1998/09/04 16:08:54 imp Exp $";
+ "$Id: apm.c,v 1.15 1999/07/20 15:31:23 green Exp $";
#endif /* not lint */
#include <sys/file.h>
@@ -72,13 +72,15 @@ int
bcd2int(int bcd)
{
int retval = 0;
+ int place = 1;
if (bcd > 0x9999)
return -1;
while (bcd) {
- retval = retval * 10 + ((bcd & 0xf000) >> 12);
- bcd = (bcd & 0xfff) << 4;
+ retval += (bcd & 0xf) * place;
+ bcd >>= 4;
+ place *= 10;
}
return retval;
}
OpenPOWER on IntegriCloud