[Toybox] new toys: expand & unexpand

Rob Landley rob at landley.net
Tue Apr 3 07:01:37 PDT 2012


Looks good, I'll try to make time to review it this evening.

I've got the dirtree rewrite more or less done, but converting ls to use
it (so I had something to test) turned into a complete rewrite of ls
because the order of operations was wrong.  Fun test:

$ ls -l LICENSE README lib/lib.c /dev/null toys/ls.c toynet.h
crw-rw-rw- 1 root    root     1, 3 2012-01-26 07:08 /dev/null
-rw-r--r-- 1 landley landley 21748 2012-04-01 16:50 lib/lib.c
-rw-r--r-- 1 landley landley   908 2011-11-15 02:24 LICENSE
-rw-r--r-- 1 landley landley   881 2012-02-04 11:32 README
-rw-r--r-- 1 landley landley   275 2011-11-13 09:56 toynet.h
-rw-r--r-- 1 landley landley  8962 2012-04-01 17:02 toys/ls.c

I.E. any files listed on the command list go in the first block of
files, no matter where they live.  If you add "lib" right before
toynet.h, the first block doesn't change but it adds a second block with
the contents of lib.

So it's assembling a "files" list and a "directories" list.  Except that
with -R the directories list is actually recursed into, and those
directories are both displayed in the file list and then their contents
displayed later...

Kinda fiddly to get this right, actually.  And that's not counting -m
and -C and -F and so on.

Working on it!  Sorry I haven't had good stopping points to check in the
half-finished stuff, but converting dirtree breaks cp and chmod and such
unless they're converted, and I need to test it before doing that to
make sure the API works as is and doesn't need to change again...

Rob
-- 
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation.  Pick one.

 1333461697.0


More information about the Toybox mailing list