[Toybox] awk (Re: ps down, top to go)
dmccunney
dennis.mccunney at gmail.com
Sun May 8 23:00:50 PDT 2016
On Mon, May 9, 2016 at 12:06 AM, Andy Chu <andychup at gmail.com> wrote:
>> Hi, Dennis --
>>
>> IANAL, of course, but I certainly would have no objection, and I
>> suspect there is no one left at Lucent (now Alcatel now Nokia)
>> who would even know this program existed, let alone care. Whether
>> it's the best code is an entirely different issue -- it's pretty
>> grimy inside. The main merit is that it isn't very big (but neither
>> was the busybox version if I recall).
>> </quote>
>>
>> *He* certainly wouldn't mind. :-)
>
> I think he's being a characteristically modest... I wouldn't call it
> grimy. There are a lot more globals than I would like, but that's
> typical for C code especially of that era. The grammar looks nice and
> clean.
Given how aggressively Rob refactors to get code usable by other
things into libraries, and generally cleans up, using Brian's code as
a place to start doesn't mean the end result will be as large as the
starting point. :-)
> The fact that busybox can get it done in 3300 LOC is interesting
> though. I'm pretty surprised because I can't see where they're hiding
> the equivalent of Kernighan's parser (awkgram.y). I wonder if it
> really implements awk or it's just the subset that people happen to
> use. There are some huge awk programs out there, but perhaps they're
> just rare.
I think part of it is a matter of what awk will need to do. As I
understand it, it must support the usage needed by build scripts that
call awk It's less likely to be used interactively from a command
line. (It is *highly* unlikely to be used that way in Android, unless
you are one of Elliot's folks or someone like me who just likes to
play.) So something that implements the awk language from the
original ought to be sufficient, and can be looked at some more if
someone yells they actually need a bell or whistle from later
versions.
And (thinking aloud here), I wonder if the parser code might be a
candidate for winding up in a library and also used by toysh.
> Andy
______
Dennis
https://plus.google.com/u/0/105128793974319004519
More information about the Toybox
mailing list