On Jan 26, 2010, at 2:26 PM, Paul Goyette wrote: > The powerd(8) man page currently says > > The first location is /etc/powerd/scripts/<power_type>, where > <power_type> is defined by the power management mechanism > supported by the system, e.g., ``apm'' or ``acpi''. If the > script is not found in the first location, powerd looks in > /etc/powerd/scripts. > > This implies that the .../apm/... and .../acpi/... are optional. Yet > src/usr.sbin/powerd.c has not been updated for more than two years, and it > defines only a single path for locating the scripts. > > #define _PATH_POWERD_SCRIPTS "/etc/powerd/scripts" > > <snip> > > static const char *script_paths[] = { > NULL, > _PATH_POWERD_SCRIPTS > }; >
if (ioctl(fd, POWER_IOC_GET_TYPE, &power_type) == -1) { syslog(LOG_ERR, "POWER_IOC_GET_TYPE: %m"); exit(EX_OSERR); } (void)asprintf(&cp, "%s/%s", _PATH_POWERD_SCRIPTS, power_type.power_type); if (cp == NULL) { syslog(LOG_ERR, "allocating script path: %m"); exit(EX_OSERR); } script_paths[0] = cp; -- thorpej