diff options
Diffstat (limited to 'usr.sbin/apm')
-rw-r--r-- | usr.sbin/apm/apm.8 | 11 | ||||
-rw-r--r-- | usr.sbin/apm/apm.c | 12 |
2 files changed, 19 insertions, 4 deletions
diff --git a/usr.sbin/apm/apm.8 b/usr.sbin/apm/apm.8 index 6e975ac..0cde379 100644 --- a/usr.sbin/apm/apm.8 +++ b/usr.sbin/apm/apm.8 @@ -20,6 +20,7 @@ .Op Fl b .Op Fl a .Op Fl l +.Op Fl s .Pp .Nm zzz .Sh DESCRIPTION @@ -58,13 +59,21 @@ status respectively. Display the current AC-line status as an integer value. The values 0 and 1 correspond to the .Dq off-line -state and +state or .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. +.Pp +.It Fl s +Display the status of the APM support as an integer value. The values +0 and 1 correspond to the +.Dq enabled +state or +.Dq disabled +state respecitively .Sh BUGS Some APM implementations do not support parameters needed by .Nm apm. 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; |