summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-04 07:31:17 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-04 07:31:17 +0000
commitb5a69f941e5587e49132ff95fedada49d16b9dc5 (patch)
tree63290d5facdb61619b7bc11d18a6c2549738dbf1
parent61e1a4eb415cc41446063adc6aa04b804b6b6e41 (diff)
minor KNF
-rw-r--r--usr.sbin/apmd/apm-proto.h26
-rw-r--r--usr.sbin/apmd/apmd.c25
2 files changed, 29 insertions, 22 deletions
diff --git a/usr.sbin/apmd/apm-proto.h b/usr.sbin/apmd/apm-proto.h
index 74e74b16106..0eeb403f04e 100644
--- a/usr.sbin/apmd/apm-proto.h
+++ b/usr.sbin/apmd/apm-proto.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm-proto.h,v 1.3 2002/02/16 21:28:00 millert Exp $ */
+/* $OpenBSD: apm-proto.h,v 1.4 2002/07/04 07:31:16 deraadt Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
@@ -30,27 +30,27 @@
*/
enum apm_action {
- NONE,
- SUSPEND,
- STANDBY,
- GETSTATUS
+ NONE,
+ SUSPEND,
+ STANDBY,
+ GETSTATUS
};
enum apm_state {
- NORMAL,
- SUSPENDING,
- STANDING_BY
+ NORMAL,
+ SUSPENDING,
+ STANDING_BY
};
struct apm_command {
- int vno;
- enum apm_action action;
+ int vno;
+ enum apm_action action;
};
struct apm_reply {
- int vno;
- enum apm_state newstate;
- struct apm_power_info batterystate;
+ int vno;
+ enum apm_state newstate;
+ struct apm_power_info batterystate;
};
#define APMD_VNO 1
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 124764e66cd..d5a4c056327 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.25 2002/06/14 04:21:41 deraadt Exp $ */
+/* $OpenBSD: apmd.c,v 1.26 2002/07/04 07:31:16 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -61,9 +61,9 @@ int debug = 0;
extern char *__progname;
-void usage (void);
-int power_status (int fd, int force, struct apm_power_info *pinfo);
-int bind_socket (const char *sn);
+void usage(void);
+int power_status(int fd, int force, struct apm_power_info *pinfo);
+int bind_socket(const char *sn);
enum apm_state handle_client(int sock_fd, int ctl_fd);
void suspend(int ctl_fd);
void stand_by(int ctl_fd);
@@ -128,7 +128,7 @@ power_status(int fd, int force, struct apm_power_info *pinfo)
bstate.ac_state != last.ac_state ||
bstate.battery_state != last.battery_state ||
(bstate.minutes_left && bstate.minutes_left < 15) ||
- abs(bstate.battery_life - last.battery_life) > 20) {
+ abs(bstate.battery_life - last.battery_life) > 20) {
#ifdef __powerpc__
/*
* When the battery is charging, the estimated life
@@ -191,7 +191,7 @@ bind_socket(const char *sockname)
/* remove it if present, we're moving in */
(void) remove(sockname);
- umask (077);
+ umask(077);
if (bind(sock, (struct sockaddr *)&s_un, s_un.sun_len) == -1)
error("cannot connect to APM socket", NULL);
@@ -235,9 +235,15 @@ handle_client(int sock_fd, int ctl_fd)
power_status(ctl_fd, 0, &reply.batterystate);
switch (cmd.action) {
- case SUSPEND: reply.newstate = SUSPENDING; break;
- case STANDBY: reply.newstate = STANDING_BY; break;
- default: reply.newstate = NORMAL; break;
+ case SUSPEND:
+ reply.newstate = SUSPENDING;
+ break;
+ case STANDBY:
+ reply.newstate = STANDING_BY;
+ break;
+ default:
+ reply.newstate = NORMAL;
+ break;
}
reply.vno = APMD_VNO;
@@ -486,6 +492,7 @@ main(int argc, char *argv[])
}
break;
default:
+ ;
}
if ((standbys || suspends) && noacsleep &&