<div dir="ltr">I plan to do this as an alias of bzcat, with changes required to create/overwrite/error on writing to file. <div>Restoring the original file modes. As this is all that I need for the moment.</div><div><br></div><div>regards,</div><div>Ashwini</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 16, 2014 at 4:38 PM, Rob Landley <span dir="ltr"><<a href="mailto:rob@landley.net" target="_blank">rob@landley.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 10/15/14 23:53, Ashwini Sharma wrote:<br>
> Hi Rob, List,<br>
><br>
> I was looking into 'bzcat' code.<br>
> Can't this be used as bunzip2 or as __base__ to bunzip2, as I am<br>
> interested in<br>
> bunzip2 utility.<br>
><br>
> At a glance it looked to me that it can be used, please share your opinion.<br>
<br>
</div></div>Yes, it can.<br>
<br>
The only reason I haven't done so yet is busybox tar requires the gunzip<br>
and bunzip it uses to be built-in, so I can't drop the decompression<br>
utilities from the busybox config in aboriginal linux (my main test<br>
harness for toybox) until I switch over to using toybox tar.<br>
<br>
Also, I need to implement the relevant compression-side utilities. I<br>
have about 1/3 of a gzip compressor implemented here (got distracted<br>
while researching when to do dictionary resets; nobody quite seems to<br>
agree on that one), and I did half a bzip2 implementation ages ago (the<br>
fiddly bit is that the string sorting algorithms in the original are<br>
kind of magic and unexplained; it seems to get constant time out of a<br>
somewhat arbitrary set of sorting algorithms which give up and fall back<br>
to the next one after doing a certain amount of work, but I don't<br>
understand how/why it's set up that way. I need to stare at it some more.)<br>
<br>
And then there's the whole "cleanup xz decompression, implement xz<br>
compression" part to look forward to...<br>
<br>
If you want to do a proper bunzip wrapper, be my guest. I did bzcat to<br>
prove the engine works and left the rest on the todo list. I have a note<br>
that loopfiles() needs a replace mode so bunzip and sed -i and maybe<br>
patch can share code, but I can clean that up later. (And I need test<br>
suite code to check that "bunzip blah.bz2" fails when blah already<br>
exists...)<br>
<br>
> Thanks,<br>
> Ashwini<br>
<span class="HOEnZb"><font color="#888888"><br>
Rob<br>
</font></span></blockquote></div><br></div>