diff options
author | nate <nate@FreeBSD.org> | 1996-03-13 00:48:06 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1996-03-13 00:48:06 +0000 |
commit | 2be838b1dc40d342a95339a2a106ba2ed313a47d (patch) | |
tree | 91ab559ff37679a835e923d1292a59da73ad2e85 /usr.sbin/apm/apm.c | |
parent | 986c9f5c3a8f21824489bd78d88facebe50e9b3c (diff) | |
download | FreeBSD-src-2be838b1dc40d342a95339a2a106ba2ed313a47d.zip FreeBSD-src-2be838b1dc40d342a95339a2a106ba2ed313a47d.tar.gz |
Add the '-s' flag to apm which returns the status of the APM support
(enable/disabled) now that the APM_GETINFO ioctl returns the necessary
information. Also, print out the status along with the other
information as the default behavior.
Diffstat (limited to 'usr.sbin/apm/apm.c')
-rw-r--r-- | usr.sbin/apm/apm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c index 2781a61..b0ae12b 100644 --- a/usr.sbin/apm/apm.c +++ b/usr.sbin/apm/apm.c @@ -43,6 +43,7 @@ void apm_getinfo(int fd, apm_info_t aip) void print_all_info(apm_info_t aip) { printf("APM version: %d.%d\n", aip->ai_major, aip->ai_minor); + printf("APM Managment: %s\n", (aip->ai_status ? "Enabled": "Disabled")); printf("AC Line status: "); if (aip->ai_acline == 255) { printf("unknown"); @@ -83,7 +84,7 @@ void print_all_info(apm_info_t aip) int main(int argc, char *argv[]) { int i, j, fd; - int sleep = 0, all_info = 1, batt_status = 0, batt_life = 0, ac_status = 0; + int sleep = 0, all_info = 1, apm_status = 0, batt_status = 0, batt_life = 0, ac_status = 0; char *cmdname; main_argc = argc; @@ -123,6 +124,9 @@ int main(int argc, char *argv[]) case 'l': batt_life = 1; all_info = 0; + case 's': + apm_status = 1; + all_info = 0; break; default: fprintf(stderr, "%s Unknown option '%s'.\n", argv[0], argv[i]); @@ -138,8 +142,7 @@ finish_option: } if (sleep) { apm_suspend(fd); - } - else { + } else { struct apm_info info; apm_getinfo(fd, &info); @@ -155,6 +158,9 @@ finish_option: if (ac_status) { printf("%d\n", info.ai_acline); } + if (apm_status) { + printf("%d\n", info.ai_status); + } } close(fd); return 0; |