[PATCH, CFT] fix awk -v -v handling
Bernhard Fischer
rep.dot.nop at gmail.com
Sat Mar 10 12:23:37 UTC 2007
*ping*
On Wed, Feb 14, 2007 at 11:51:07AM +0100, Bernhard Fischer wrote:
>Hi,
>
><wihen> can anyone confirm if awk is broken on 1.4.1?
><wihen> multiple -v don't work.
>
>Confirmed. The attached, untested patch against trunk should fix it.
>
>Please verify and apply to trunk and the 1_4 branch.
>
>TIA and cheers,
>Bernhard
>Index: editors/awk.c
>===================================================================
>--- editors/awk.c (revision 17882)
>+++ editors/awk.c (working copy)
>@@ -2648,7 +2648,8 @@
> int awk_main(int argc, char **argv)
> {
> unsigned opt;
>- char *opt_F, *opt_v, *opt_W;
>+ char *opt_F, *opt_W;
>+ llist_t *opt_v = NULL;
> int i, j, flen;
> var *v;
> var tv;
>@@ -2701,12 +2702,15 @@
> }
> free(s);
> }
>-
>+ opt_complementary = "v::";
> opt = getopt32(argc, argv, "F:v:f:W:", &opt_F, &opt_v, &programname, &opt_W);
> argv += optind;
> argc -= optind;
> if (opt & 0x1) setvar_s(V[FS], opt_F); // -F
>- if (opt & 0x2) if (!is_assignment(opt_v)) bb_show_usage(); // -v
>+ if (opt & 0x2) /* -v */
>+ while (opt_v) {
>+ if (!is_assignment(llist_pop(&opt_v))) bb_show_usage();
>+ }
> if (opt & 0x4) { // -f
> char *s = s; /* die, gcc, die */
> FILE *from_file = afopen(programname, "r");
>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox
More information about the busybox
mailing list