[PATCH] awk: GNU extension -e
Denys Vlasenko
vda.linux at googlemail.com
Thu Nov 21 14:11:56 UTC 2013
On Thu, Nov 21, 2013 at 12:33 PM, Sven-Göran Bergh
<svengbergh-busybox at yahoo.com> wrote:
> 2013-11-19 12:44:15, Denys Vlasenko <vda.linux at googlemail.com>:
> ...
>>> A new patch with theses changes is attached.
>>
>>Oh, sorry... I committed another patch to git already,
>>which should do what you want. Can you test current git?
>>Let me know if it still needs something.
>
> Sorry Denys, but the current git is a regression.
> For ex try:
>
>
> $ echo "{print $2;}" > test.awk
> $ echo "do re mi" > test.txt
> $ busybox awk -f test.awk test.txt
> ^C
> $ busybox awk -e '{print $2;}' test.txt
> ^C
>
> $
>
>
> It does not see the input file, so it hangs waiting for
> an input.
>
> Try my last patch, or based on the current git:
>
> parse_program(llist_pop(&list_e));
> }
> #endif
> - if (!(opt & (OPT_f | OPT_e))) {
> + if (opt & (OPT_f | OPT_e)) {
> + argc++;
> + } else { // no -f nor -e: take program from 1st parameter
> if (!*argv)
> bb_show_usage();
> parse_program(*argv++);
> - argc++;
> }
> if (opt & OPT_W) // -W
> bb_error_msg("warning: option -W is ignored");
Applied with a small change (hopefully one jump less)
and added two testcases to cover it.
--
vda
More information about the busybox
mailing list