[PATCH] join: new applet

Denys Vlasenko vda.linux at googlemail.com
Wed Jul 8 05:05:04 UTC 2026


Applied with some edits, thank you.


On Sun, Jul 5, 2026 at 5:06 PM Ron Yorston via busybox
<busybox at busybox.net> wrote:
> +       readfields(sep, &f1);
> +       readfields(sep, &f2);
> +
> +       while (f1.linecount && f2.linecount) {
> +               int res = strcmp(f1.field, f2.field);
> +
> +               if (res == 0) {
> +                       if (printpaired)
> +                               printfields(format, empty_str, sep, &f1, &f2);
> +
> +                       readfields(sep, &f1);
> +                       readfields(sep, &f2);
> +               } else if (res < 0) {
> +                       if (print1unpaired)
> +                               printfields(format, empty_str, sep, &f1, NULL);
> +
> +                       readfields(sep, &f1);
> +               } else {
> +                       if (print2unpaired)
> +                               printfields(format, empty_str, sep, NULL, &f2);
> +
> +                       readfields(sep, &f2);
> +               }
> +       }
> +
> +       if (f1.linecount && print1unpaired) {
> +               do {
> +                       printfields(format, empty_str, sep, &f1, NULL);
> +                       readfields(sep, &f1);
> +               } while (f1.linecount);
> +       }
> +
> +       if (f2.linecount && print2unpaired) {
> +               do {
> +                       printfields(format, empty_str, sep, NULL, &f2);
> +                       readfields(sep, &f2);
> +               } while (f2.linecount);
> +       }
> +

Maybe it makes sense to put format, empty_str, and sep
into the usual "struct globals"? This would cut down on
parameter passing in the above fragment.


More information about the busybox mailing list