Thanks, I adapted the patch. It works.
Do you want to be the author / Signed-off-by of the commit?

On Thu, Jul 15, 2021 at 1:40 PM Rob Landley <[email protected]> wrote:
>
> On 6/19/21 6:50 AM, Denys Vlasenko wrote:
> > On Tue, Jun 15, 2021 at 3:01 PM Rob Landley <[email protected]> wrote:
> >> The pending follow-up question to my previous email beyond "do you want 
> >> this
> >> feature" was "are you willing to add it yourself, or do you want me to
> >> refamiliarize myself with busybox cut.c and whatever libbb sharp edges I 
> >> hit
> >> enough to knock up a patch". I felt the odds of you implementing it 
> >> yourself
> >> were higher if I DIDN'T offer a patch in the email, but if the busybox 
> >> project
> >> only wants the feature if I provide a patch, yes I can provide that patch.
> >
> > I would be quite happy if someone posts a patch.
>
> The attached passes busybox's cut tests, and all of toybox's cut tests except
> the one that essentially does:
>
>   $ echo potatosalad | cut --output-delimiter x -b 1-3,2-5,7-9,9-10
>   potatxsala
>
> In part because I only implemented -O and not --output-delimiter because I 
> don't
> remember how to make busybox's --longopt parsing work.
>
> Also, I dunno how you prefer to suppress the "a string constant that will
> segfault if you try to write to it doesn't have the const annotation and thus
> assigning it to a const char * complains" warnings. Me, I rip every occurrence
> of "const" out of my code because the compiler is ALREADY doing liveness
> analysis and "stored in rodata" is apparently not enough for it to be const.
> (What, spray it down with gratuitous typecasts? Or is there a less ugly way?)
>
> I implemented -O because -DF implies --output-delimiter since the input
> delimiter and the output delimiter don't match, so it's only polite to let 
> them
> override it. The default output delimiter is "a single space" because if you
> just output whatever the regex matched you get inconsistent output from
> inconsistent input, ala:
>
> echo "one   two three         four" | cut -DF 2-4
>
> which would behave differently from cut -DF 2,3,4 and "what would awk do"
> implies single space, so that's what I implemented.
>
> I haven't bloatchecked the code, I merely got it working. *shrug* First stab 
> at
> it. Sorry for the delay, my todo list runneth over...
>
> Rob
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to