Considering porting acpi

Rich Felker dalias at libc.org
Fri Oct 10 17:16:24 UTC 2014


On Fri, Oct 10, 2014 at 08:43:15AM -0700, Isaac Dunham wrote:
> > > The code I have is currently using dirtree_read(), which corresponds to
> > > recursive_action().
> > > Basically it looks in /sys/class/*/*/, /sys/class/power_supply,
> > > and /sys/class/thermal for device status.
> > > I could make it shorter if I use glob() instead of a recursive callback;
> > > does anyone know whether glob() is likely to be a bloat problem?
> > 
> > There's a cut-down glob function you could borrow from the linux
> > kernel ( lib/glob.c ) if you really wanted it slim.
> 
> That would make a smaller static binary where only the "acpi" applet is
> concerned, but it might well increase the net size; glob uses fnmatch,
> which is use in several parts of busybox.

Yes, I would think replacing glob would be a net increase in size
unless you have an extremely minimal bb config to begin with.

> This reminds me: I keep thinking about writing "fngrep", a grep-like
> tool that uses fnmatch instead of regexes. Not widely useful, perhaps
> on occasion.

Since grep already has -E and -F, wouldn't it make more sense just to
add this as a nonstandard option to normal grep? Then you'd get all
the other grep functionality for free.

Rich


More information about the busybox mailing list