1 Index: busybox-1.7.2/editors/awk.c
2 ===================================================================
3 --- busybox-1.7.2.orig/editors/awk.c 2007-10-04 19:57:46.859742242 +0200
4 +++ busybox-1.7.2/editors/awk.c 2007-10-05 02:20:02.910793305 +0200
9 + llist_t *opt_f = NULL;
10 llist_t *opt_v = NULL;
17 - opt_complementary = "v::";
18 - opt = getopt32(argv, "F:v:f:W:", &opt_F, &opt_v, &g_progname, &opt_W);
19 + opt_complementary = "v::f::";
20 + opt = getopt32(argv, "F:v:f:W:", &opt_F, &opt_v, &opt_f, &opt_W);
24 @@ -2826,25 +2827,31 @@
25 if (!is_assignment(llist_pop(&opt_v)))
28 - if (opt & 0x4) { // -f
29 - char *s = s; /* die, gcc, die */
30 - FILE *from_file = afopen(g_progname, "r");
31 - /* one byte is reserved for some trick in next_token */
32 - if (fseek(from_file, 0, SEEK_END) == 0) {
33 - flen = ftell(from_file);
34 - s = xmalloc(flen + 4);
35 - fseek(from_file, 0, SEEK_SET);
36 - i = 1 + fread(s + 1, 1, flen, from_file);
38 - for (i = j = 1; j > 0; i += j) {
39 - s = xrealloc(s, i + 4096);
40 - j = fread(s + i, 1, 4094, from_file);
41 + if (opt_f != NULL) { // -f
42 + while (opt_f != NULL) {
46 + g_progname = opt_f->data;
47 + from_file = afopen(g_progname, "r");
48 + /* one byte is reserved for some trick in next_token */
49 + if (fseek(from_file, 0, SEEK_END) == 0) {
50 + flen = ftell(from_file);
51 + s = xmalloc(flen + 4);
52 + fseek(from_file, 0, SEEK_SET);
53 + i = 1 + fread(s + 1, 1, flen, from_file);
55 + for (i = j = 1; j > 0; i += j) {
56 + s = xrealloc(s, i + 4096);
57 + j = fread(s + i, 1, 4094, from_file);
62 + parse_program(s + 1);
64 + opt_f = opt_f->link;
68 - parse_program(s + 1);
70 } else { // no -f: take program from 1st parameter