switch to the IXP4xx microcode with crypto support
[openwrt.git] / package / busybox / patches / 360-awk_multi_f.patch
1 Index: busybox-1.7.2/editors/awk.c
2 ===================================================================
3 --- busybox-1.7.2.orig/editors/awk.c 2007-10-30 15:34:59.000000000 -0500
4 +++ busybox-1.7.2/editors/awk.c 2007-10-30 15:35:03.000000000 -0500
5 @@ -2757,6 +2757,7 @@
6 {
7 unsigned opt;
8 char *opt_F, *opt_W;
9 + llist_t *opt_f = NULL;
10 llist_t *opt_v = NULL;
11 int i, j, flen;
12 var *v;
13 @@ -2816,8 +2817,8 @@
14 *s1 = '=';
15 }
16 }
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);
21 argv += optind;
22 argc -= optind;
23 if (opt & 0x1)
24 @@ -2826,25 +2827,31 @@
25 if (!is_assignment(llist_pop(&opt_v)))
26 bb_show_usage();
27 }
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);
37 - } else {
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) {
43 + char *s = NULL;
44 + FILE *from_file;
45 +
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);
54 + } else {
55 + for (i = j = 1; j > 0; i += j) {
56 + s = xrealloc(s, i + 4096);
57 + j = fread(s + i, 1, 4094, from_file);
58 + }
59 }
60 + s[i] = '\0';
61 + fclose(from_file);
62 + parse_program(s + 1);
63 + free(s);
64 + opt_f = opt_f->link;
65 }
66 - s[i] = '\0';
67 - fclose(from_file);
68 - parse_program(s + 1);
69 - free(s);
70 } else { // no -f: take program from 1st parameter
71 if (!argc)
72 bb_show_usage();
This page took 0.050545 seconds and 5 git commands to generate.