summaryrefslogtreecommitdiffstats
path: root/usr.sbin/apm
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1994-11-01 22:46:40 +0000
committerphk <phk@FreeBSD.org>1994-11-01 22:46:40 +0000
commit78746675615710e5ad559354cce31bf7f7e3dba1 (patch)
tree9b7973e6dace2096f3258a313ca64dba0ee4c4ca /usr.sbin/apm
parentdcf7506baaa555db6bb633aacabb8788461d51f5 (diff)
downloadFreeBSD-src-78746675615710e5ad559354cce31bf7f7e3dba1.zip
FreeBSD-src-78746675615710e5ad559354cce31bf7f7e3dba1.tar.gz
The latest user-land changes from the author. I added a big warning to the
apm.4 man-page. I also hope the Makefiles make sense now. Submitted by: HOSOKAWA Tatsumi
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r--usr.sbin/apm/Makefile12
-rw-r--r--usr.sbin/apm/apm.888
-rw-r--r--usr.sbin/apm/apm.c10
3 files changed, 99 insertions, 11 deletions
diff --git a/usr.sbin/apm/Makefile b/usr.sbin/apm/Makefile
index 1198407..ffcd5cf 100644
--- a/usr.sbin/apm/Makefile
+++ b/usr.sbin/apm/Makefile
@@ -1,10 +1,6 @@
-# $Id: Makefile,v 1.1 1994/10/01 03:23:23 davidg Exp $
-
PROG= apm
-# CFLAGS+= -I/sys/i386/include
-# BINGRP= apm
-# BINMODE= 550
-# LINKS= ${DESTDIR}/usr/sbin/apm ${DESTDIR}/usr/sbin/zzz
-NOMAN= 1
-
+LINKS= ${BINDIR}apm /usr/sbin/zzz
+MANDIR= /usr/share/man/man
+MAN8= apm.8
+MLINKS= apm.8 zzz.8
.include <bsd.prog.mk>
diff --git a/usr.sbin/apm/apm.8 b/usr.sbin/apm/apm.8
new file mode 100644
index 0000000..6e975ac
--- /dev/null
+++ b/usr.sbin/apm/apm.8
@@ -0,0 +1,88 @@
+.\" LP (Laptop Package)
+.\"
+.\" Copyright (c) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>
+.\"
+.\" This software may be used, modified, copied, and distributed, in
+.\" both source and binary form provided that the above copyright and
+.\" these terms are retained. Under no circumstances is the author
+.\" responsible for the proper functioning of this software, nor does
+.\" the author assume any responsibility for damages incurred with its
+.\" use.
+.Dd November 1, 1994
+.Dt APM 8
+.Os
+.Sh NAME
+.Nm apm, zzz
+.Nd control the APM BIOS and display its information
+.Sh SYNOPSIS
+.Nm apm
+.Op Fl z
+.Op Fl b
+.Op Fl a
+.Op Fl l
+.Pp
+.Nm zzz
+.Sh DESCRIPTION
+.Nm apm
+controls the Intel / Microsoft APM (Advanced Power Management) BIOS and
+displays the current status of APM on laptop PCs.
+.Nm zzz
+suspends the system by controlling APM.
+.Pp
+The following options are available for
+.Nm apm
+(no options are available for
+.Nm zzz.
+)
+If no options are specified,
+.Nm apm
+displays information and current status of APM in verbose mode.
+.Bl -tag -width indent
+.It Fl z
+Suspend the system. It is equivalent to
+.Nm zzz.
+.Pp
+.It Fl b
+Display an integer value reflecting the current battery status.
+The values 0, 1, 2, 3, correspond to the
+.Dq high
+status,
+.Dq low
+status,
+.Dq critical
+status,
+.Dq charging
+status respectively.
+.Pp
+.It Fl a
+Display the current AC-line status as an integer value. The values
+0 and 1 correspond to the
+.Dq off-line
+state and
+.Dq on-line
+state, respectively.
+.Pp
+.It Fl l
+Display the remaining battery percentage. If your laptop does not
+support this function, 255 is displayed.
+.Sh BUGS
+Some APM implementations do not support parameters needed by
+.Nm apm.
+On such systems,
+.Nm apm
+displays them as unknown.
+.Pp
+Some APM implementations cannot handle events such as pushing the
+power button or closing the cover. On such implementations, the system
+.Ar must
+be suspended
+.Ar only
+by using
+.Nm apm
+or
+.Nm zzz.
+.Sh SEE ALSO
+.Xr apm 4 ,
+.Xr apmconf 8
+.Sh AUTHOR
+HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> (Keio Univ., Japan)
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index e2e1224..224bc4e 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -17,9 +17,9 @@
#include <string.h>
#include <sys/file.h>
#include <sys/ioctl.h>
-#include <machine/apm_bios.h>
+#include <apm_bios.h>
-#define APMDEV "/dev/apm"
+#define APMDEV "/dev/apm0"
int main_argc;
char **main_argv;
@@ -103,7 +103,8 @@ int main(int argc, char *argv[])
for (i = argc - 1; i >= 1; i--) {
if (argv[i][0] != '-') {
- fprintf(stderr, "%s: Unknown option '%s'.", argv[0], argv[i]);
+ fprintf(stderr, "%s: Unknown option '%s'.\n", argv[0], argv[i]);
+ exit(1);
}
for (j = 1; argv[i][j]; j++) {
switch (argv[i][j]) {
@@ -123,6 +124,9 @@ int main(int argc, char *argv[])
batt_life = 1;
all_info = 0;
break;
+ default:
+ fprintf(stderr, "%s Unknown option '%s'.\n", argv[0], argv[i]);
+ exit(1);
}
}
}
OpenPOWER on IntegriCloud