[Toybox] Looking at nl

idunham at lavabit.com idunham at lavabit.com
Sat May 25 22:26:30 PDT 2013


On Sat, May 25, 2013 at 10:08:51PM -0600, Terrel Shumway wrote:
> On Sat, May 25, 2013 at 5:36 PM,  <idunham at lavabit.com> wrote:
> > I thought I'd look at what nl takes, since it's not much more than
> > looping over some lines, incrementing, and formatting the output.
> > The POSIX reference page is:
> > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/nl.html
> 
> An awk wizard could do that in less than a dozen lines. Since awk is
> already supposed to be in the toybox, why not write nl as a script?

Awk is on the TODO list for toybox. Big difference there. (ie, unless
you plan to add awk, that's not a solution in the near future...)
Not to mention that awk is never really small or fast, and you need a
pretty full-featured awk version to bootstrap Linux.
And much as I like it, I'd rather write more C.

By the way, I already have a skeleton written for nl, along with a plan
for how to do the rest.  
I have discovered that nl is not quite as trivial to write as it looks 
at first glance, though (you have to consider page, section, line, and 
11 variables, with a couple subtle points like a 1-char delimiter gets 
':' appended).

Thanks,
Isaac Dunham


 1369545990.0


More information about the Toybox mailing list