[Toybox] Just checked in xargs.

Rob Landley rob at landley.net
Sat Jan 28 14:00:00 PST 2012


Which I've been slowly plinking away at for a month.  This is about the
first 3/4 of a full implementation.

Commands tend to get hung up on missing pieces of infrastructure, which
are usually missing due to unfinished design work.

In the case of xargs, I want to be able to do limits input ranges, ala
-n{1,} to say "this can't be <1", and not specifically have to test for
that as an error in xargs_main().

This brushes against the fact that numerical inputs currently have to be
integers, I want to mirror "#" with a "." that does floating point input
types (which would require a second set of {,} support, for pretty much
the same reason C++ templates expand per-type).  I want it to support
the largest floating point type that fits in a long, and my first quick
stab at "#if sizeof(long)<=sizeof(double)" didn't work because sizeof()
isnt' available to the preprocessor. :P

Also I want a CONFIG_TOYBOX_FLOAT to enable/disable floating point
support globally (some boards ain't got it, sort currently already uses
it with CONFIG_SORT_BIG), which implies I want some compile-time probes
except that cross compiling couldn't run them so meh.

As I said, unfinished design work.  I have to decide which way to go
with that.  In the meantime, I'm explicitly testing for -n to be zero
(which is wrong, it should test for < 0 because # is signed, sigh).

Oh, and I'm working on scripts/test/xargs.test and doing a documentation
page for the test suite.  I should go in and backfill other command
tests.  (The test suite is halfway documentation: it lists all the funky
corner cases we have to get right, which I tested while building it but
won't necessarily even remember was an issue later, and can always break
at some point in the future if I don't remember WHY the code is twisted
into that strange shape.)

I've got "more" about 1/3 finished.  That has exactly the same tty
querying issues as less, it's just not as obvious about it.  (It has to
know how tall the screen is to know where to stop.  It has to know how
wide the screen is to know how many lines each text line wordwraps to.
Note that "isprint" doesn't tell me if a character is a line feed or tab
or what, and then there's UTF-8.  Sometimes I miss java 1.1's
fontmetrics().)

The two commands that are sort of blinking at me next are "rm" and "ls".
 The ls command because it needs doing and is one of the big obvious
missing pieces from android toolbox, just having _that_ makes toybox
somewhat worth installing on android.

In the case of rm, it's far and away the most often used busybox command
during a Linux From Scratch build, and not all that hard (although rm -r
is nontrivial, I've got to get the symlink following behavior right
which means a test suite full of corner cases...

I'm starting to think about doing a release, on general principles.

Rob

 1327788000.0


More information about the Toybox mailing list