add a simple maintenance tool for kernel config files
[openwrt.git] / package / busybox / patches / 220-awk_bitops.patch
1
2 Copyright (C) 2006 OpenWrt.org
3
4 --- busybox-1.00/editors/awk.c.orig 2004-09-24 05:24:27 -04:00
5 +++ busybox-1.00/editors/awk.c 2006-03-08 02:16:52 -05:00
6 @@ -271,7 +271,8 @@
7 /* builtins */
8 enum {
9 B_a2=0, B_ix, B_ma, B_sp, B_ss, B_ti, B_lo, B_up,
10 - B_ge, B_gs, B_su
11 + B_ge, B_gs, B_su,
12 + B_an, B_co, B_ls, B_or, B_rs, B_xo,
13 };
14
15 /* tokens and their corresponding info values */
16 @@ -311,6 +312,8 @@
17 "\5while" NTC
18 "\4else" NTC
19
20 + "\3and" "\5compl" "\6lshift" "\2or"
21 + "\6rshift" "\3xor"
22 "\5close" "\6system" "\6fflush" "\5atan2" /* BUILTIN */
23 "\3cos" "\3exp" "\3int" "\3log"
24 "\4rand" "\3sin" "\4sqrt" "\5srand"
25 @@ -364,6 +367,8 @@
26 ST_WHILE,
27 0,
28
29 + OC_B|B_an|P(0x83), OC_B|B_co|P(0x41), OC_B|B_ls|P(0x83), OC_B|B_or|P(0x83),
30 + OC_B|B_rs|P(0x83), OC_B|B_xo|P(0x83),
31 OC_FBLTIN|Sx|F_cl, OC_FBLTIN|Sx|F_sy, OC_FBLTIN|Sx|F_ff, OC_B|B_a2|P(0x83),
32 OC_FBLTIN|Nx|F_co, OC_FBLTIN|Nx|F_ex, OC_FBLTIN|Nx|F_in, OC_FBLTIN|Nx|F_lg,
33 OC_FBLTIN|F_rn, OC_FBLTIN|Nx|F_si, OC_FBLTIN|Nx|F_sq, OC_FBLTIN|Nx|F_sr,
34 @@ -1942,6 +1947,30 @@
35 strncpy(s, as[0]+i, n);
36 s[n] = '\0';
37 setvar_p(res, s);
38 + break;
39 +
40 + case B_an:
41 + setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1]));
42 + break;
43 +
44 + case B_co:
45 + setvar_i(res, ~(long)getvar_i(av[0]));
46 + break;
47 +
48 + case B_ls:
49 + setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1]));
50 + break;
51 +
52 + case B_or:
53 + setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1]));
54 + break;
55 +
56 + case B_rs:
57 + setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1])));
58 + break;
59 +
60 + case B_xo:
61 + setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1]));
62 break;
63
64 case B_lo:
This page took 0.062299 seconds and 5 git commands to generate.