diff -c xbattbar-1.4.2/Imakefile xbattbar-macppc/Imakefile *** xbattbar-1.4.2/Imakefile Fri Feb 2 14:25:28 2001 --- xbattbar-macppc/Imakefile Thu Aug 30 18:17:22 2001 *************** *** 22,27 **** --- 22,29 ---- LOCAL_LIBRARIES = $(XLIB) + DEPENDFLAGS = -D__MACPPC__ + CCOPTIONS = -D__MACPPC__ SRCS = xbattbar.c OBJS = xbattbar.o TARGET = xbattbar diff -c xbattbar-1.4.2/xbattbar.c xbattbar-macppc/xbattbar.c *** xbattbar-1.4.2/xbattbar.c Fri Feb 2 14:25:29 2001 --- xbattbar-macppc/xbattbar.c Thu Aug 30 18:44:54 2001 *************** *** 577,582 **** --- 577,628 ---- #ifdef __NetBSD__ + #ifdef __MACPPC__ + #define _PATH_APM_NORMAL "/dev/battery" + + int first = 1; + void battery_check(void) + { + int fd, r, p; + int ret, pr, sr; + char info[10]; + + if ((fd = open(_PATH_APM_NORMAL, O_RDONLY)) == -1) { + fprintf(stderr, "xbattbar: cannot open apm device\n"); + exit(1); + } + + if (ret = read(fd, info, 9) == -1) { + fprintf(stderr, "xbattbar: Cannot get battery status\n"); + exit(1); + } + + close(fd); + + ++elapsed_time; + + /* get current remoain */ + ret = sscanf(info, "%d %d %d", &p, &pr, &sr); + if( pr > 100 ) pr=100; + if( sr > 100 ) sr=100; + if (!sr){ /* XXX */ + r=pr; + } else { + r=pr+sr/2; + } + + /* get AC-line status */ + p = p ? 1 : 0; + + if (first || ac_line != p || battery_level != r) { + first = 0; + ac_line = p; + battery_level = r; + redraw(); + } + } + + #else /* !__MACPPC__ */ #include #define _PATH_APM_SOCKET "/var/run/apmdev" *************** *** 625,630 **** --- 671,678 ---- redraw(); } } + + #endif /* !__MACPPC__ */ #endif /* __NetBSD__ */ diff -c xbattbar-1.4.2/xbattbar.man xbattbar-macppc/xbattbar.man *** xbattbar-1.4.2/xbattbar.man Fri Feb 2 14:25:29 2001 --- xbattbar-macppc/xbattbar.man Thu Aug 30 17:17:08 2001 *************** *** 90,95 **** --- 90,99 ---- which shows both AC line status and battery remaining level. This diagnosis window disappears if the mouse cursor leaves from the status indicator. + .Sh BUGS + NetBSD macppc can not get how many batterys installed to the machine. + So now xbattery judges if sub battery status is 0 the sub battery is not + exist. .Sh SEE ALSO .Xr xbatt 1 \- an official battery status check command on BSD/OS 3.0, *************** *** 97,100 **** .Sh AUTHOR Suguru Yamaguchi , Akira Kato , ! Noriyuki Shigechika --- 101,105 ---- .Sh AUTHOR Suguru Yamaguchi , Akira Kato , ! Noriyuki Shigechika , ! HEO SeonMeyong