53 lines
1.1 KiB
Diff
53 lines
1.1 KiB
Diff
--- apmd-3.2.2.orig/apm.c.foo 2005-03-16 17:23:14.000000000 -0500
|
|
+++ apmd-3.2.2.orig/apm.c 2005-03-16 17:23:44.000000000 -0500
|
|
@@ -38,7 +38,7 @@
|
|
#define IGNORE 2
|
|
#define NOIGNORE 3
|
|
|
|
-void change_state(int mode)
|
|
+int change_state(int mode)
|
|
{
|
|
int fd;
|
|
time_t then, now;
|
|
@@ -48,7 +48,7 @@
|
|
if (fd < 0)
|
|
{
|
|
fprintf(stderr, "Cannot open APM device: %s\n", strerror(errno));
|
|
- exit(1);
|
|
+ return (1);
|
|
}
|
|
time(&then);
|
|
switch (mode)
|
|
@@ -78,6 +78,7 @@
|
|
time(&now);
|
|
|
|
apm_close(fd);
|
|
+ return error;
|
|
}
|
|
|
|
void usage(void)
|
|
@@ -135,12 +136,10 @@
|
|
break;
|
|
#ifdef APM_IOC_IGNORE /* detect kernel support of IGNORE/NOIGNORE functions */
|
|
case 'i':
|
|
- change_state(IGNORE);
|
|
- exit(0);
|
|
+ exit(change_state(IGNORE));
|
|
break;
|
|
case 'n':
|
|
- change_state(NOIGNORE);
|
|
- exit(0);
|
|
+ exit change_state(NOIGNORE));
|
|
break;
|
|
#endif
|
|
case 'v':
|
|
@@ -182,8 +181,7 @@
|
|
usage();
|
|
if (suspend || standby)
|
|
{
|
|
- change_state((suspend ? SUSPEND : STANDBY));
|
|
- exit(0);
|
|
+ exit(change_state((suspend ? SUSPEND : STANDBY)));
|
|
}
|
|
|
|
if (apm_read(&i))
|