On 10/15/14 23:53, Ashwini Sharma wrote: > Hi Rob, List, > > I was looking into 'bzcat' code. > Can't this be used as bunzip2 or as __base__ to bunzip2, as I am > interested in > bunzip2 utility. > > At a glance it looked to me that it can be used, please share your opinion.
Yes, it can. The only reason I haven't done so yet is busybox tar requires the gunzip and bunzip it uses to be built-in, so I can't drop the decompression utilities from the busybox config in aboriginal linux (my main test harness for toybox) until I switch over to using toybox tar. Also, I need to implement the relevant compression-side utilities. I have about 1/3 of a gzip compressor implemented here (got distracted while researching when to do dictionary resets; nobody quite seems to agree on that one), and I did half a bzip2 implementation ages ago (the fiddly bit is that the string sorting algorithms in the original are kind of magic and unexplained; it seems to get constant time out of a somewhat arbitrary set of sorting algorithms which give up and fall back to the next one after doing a certain amount of work, but I don't understand how/why it's set up that way. I need to stare at it some more.) And then there's the whole "cleanup xz decompression, implement xz compression" part to look forward to... If you want to do a proper bunzip wrapper, be my guest. I did bzcat to prove the engine works and left the rest on the todo list. I have a note that loopfiles() needs a replace mode so bunzip and sed -i and maybe patch can share code, but I can clean that up later. (And I need test suite code to check that "bunzip blah.bz2" fails when blah already exists...) > Thanks, > Ashwini Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
