[PATCH] awk: GNU extension -e

Sven-Göran Bergh svengbergh-busybox at yahoo.com
Thu Nov 21 11:33:34 UTC 2013



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");

Brgds
/S-G



More information about the busybox mailing list