X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=util-linux%2Facpid.c;h=2f27cfd1cc30baec2a224846e12a8598cefe70a1;hb=66426760beef7e87c4735f433d123daf911b5b4a;hp=0b227a8aef5ad3867368b5d1f58b11f06b5876ce;hpb=e4dcba1c103dc28e927e004791e331aaf604383d;p=oweals%2Fbusybox.git diff --git a/util-linux/acpid.c b/util-linux/acpid.c index 0b227a8ae..2f27cfd1c 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -6,6 +6,29 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ + +//usage:#define acpid_trivial_usage +//usage: "[-d] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" +//usage:#define acpid_full_usage "\n\n" +//usage: "Listen to ACPI events and spawn specific helpers on event arrival\n" +//usage: "\n -c DIR Config directory [/etc/acpi]" +//usage: "\n -d Don't daemonize, (implies -f)" +//usage: "\n -e FILE /proc event file [/proc/acpi/event]" +//usage: "\n -f Run in foreground" +//usage: "\n -l FILE Log file [/var/log/acpid.log]" +//usage: "\n -p FILE Pid file [/var/run/acpid.pid]" +//usage: "\n -a FILE Action file [/etc/acpid.conf]" +//usage: "\n -M FILE Map file [/etc/acpi.map]" +//usage: IF_FEATURE_ACPID_COMPAT( +//usage: "\n\nAccept and ignore compatibility options -g -m -s -S -v" +//usage: ) +//usage: +//usage:#define acpid_example_usage +//usage: "Without -e option, acpid uses all /dev/input/event* files\n" +//usage: "# acpid\n" +//usage: "# acpid -l /var/log/my-acpi-log\n" +//usage: "# acpid -e /proc/acpi/event\n" + #include "libbb.h" #include #include @@ -16,9 +39,9 @@ enum { OPT_e = (1 << 2), OPT_f = (1 << 3), OPT_l = (1 << 4), - OPT_p = (1 << 5) * ENABLE_FEATURE_PIDFILE, - OPT_a = (1 << 6), - OPT_M = (1 << 7), + OPT_a = (1 << 5), + OPT_M = (1 << 6), + OPT_p = (1 << 7) * ENABLE_FEATURE_PIDFILE, }; struct acpi_event { @@ -199,8 +222,9 @@ int acpid_main(int argc UNUSED_PARAM, char **argv) INIT_G(); opt_complementary = "df:e--e"; - opts = getopt32(argv, "c:de:fl:p:a:M:" IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"), - &opt_dir, &opt_input, &opt_logfile, &opt_pidfile, &opt_action, &opt_map + opts = getopt32(argv, "c:de:fl:a:M:" IF_FEATURE_PIDFILE("p:") IF_FEATURE_ACPID_COMPAT("g:m:s:S:v"), + &opt_dir, &opt_input, &opt_logfile, &opt_action, &opt_map + IF_FEATURE_PIDFILE(, &opt_pidfile) IF_FEATURE_ACPID_COMPAT(, NULL, NULL, NULL, NULL) ); @@ -258,7 +282,7 @@ int acpid_main(int argc UNUSED_PARAM, char **argv) char *buf; int len; - buf = xmalloc_reads(pfd[i].fd, NULL, NULL); + buf = xmalloc_reads(pfd[i].fd, NULL); /* buf = "button/power PWRB 00000080 00000000" */ len = strlen(buf) - 9; if (len >= 0)