31dec0f4e496a98a5711cebbb6c8eeb810dc8c1f
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 102-multicall_binary.patch
1 Index: madwifi-ng-r2420-20070602/tools/80211debug.c
2 ===================================================================
3 --- madwifi-ng-r2420-20070602.orig/tools/80211debug.c 2007-06-04 13:21:53.599828256 +0200
4 +++ madwifi-ng-r2420-20070602/tools/80211debug.c 2007-06-04 13:21:53.990768824 +0200
5 @@ -49,6 +49,10 @@
6 #include <getopt.h>
7 #include <err.h>
8
9 +#ifdef DOMULTI
10 +#include "do_multi.h"
11 +#endif
12 +
13 #define N(a) (sizeof(a)/sizeof(a[0]))
14
15 const char *progname;
16 @@ -180,9 +184,19 @@
17 }
18 #endif /* __linux__ */
19
20 +#ifdef DOMULTI
21 +
22 +int
23 +a80211debug_init(int argc, char *argv[])
24 +{
25 +
26 +#else
27 +
28 int
29 main(int argc, char *argv[])
30 {
31 +
32 +#endif
33 const char *ifname = "ath0";
34 const char *cp, *tp;
35 const char *sep;
36 Index: madwifi-ng-r2420-20070602/tools/80211stats.c
37 ===================================================================
38 --- madwifi-ng-r2420-20070602.orig/tools/80211stats.c 2007-06-04 13:21:53.607827040 +0200
39 +++ madwifi-ng-r2420-20070602/tools/80211stats.c 2007-06-04 13:21:53.991768672 +0200
40 @@ -60,6 +60,10 @@
41 #include "net80211/ieee80211_crypto.h"
42 #include "net80211/ieee80211_ioctl.h"
43
44 +#ifdef DOMULTI
45 +#include "do_multi.h"
46 +#endif
47 +
48 #ifndef SIOCG80211STATS
49 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
50 #endif
51 @@ -243,9 +247,19 @@
52 #undef STAT
53 }
54
55 +#ifdef DOMULTI
56 +
57 +int
58 +a80211stats_init(int argc, char *argv[])
59 +{
60 +
61 +#else
62 +
63 int
64 main(int argc, char *argv[])
65 {
66 +
67 +#endif
68 int c, len;
69 struct ieee80211req_sta_info *si;
70 u_int8_t buf[24*1024], *cp;
71 Index: madwifi-ng-r2420-20070602/tools/athchans.c
72 ===================================================================
73 --- madwifi-ng-r2420-20070602.orig/tools/athchans.c 2007-06-04 13:21:53.613826128 +0200
74 +++ madwifi-ng-r2420-20070602/tools/athchans.c 2007-06-04 13:21:53.991768672 +0200
75 @@ -59,6 +59,10 @@
76 #include "net80211/ieee80211_crypto.h"
77 #include "net80211/ieee80211_ioctl.h"
78
79 +#ifdef DOMULTI
80 +#include "do_multi.h"
81 +#endif
82 +
83 static int s = -1;
84 const char *progname;
85
86 @@ -138,9 +142,20 @@
87 }
88
89 #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
90 +
91 +#ifdef DOMULTI
92 +
93 +int
94 +athchans_init(int argc, char *argv[])
95 +{
96 +
97 +#else
98 +
99 int
100 main(int argc, char *argv[])
101 {
102 +
103 +#endif
104 const char *ifname = "wifi0";
105 struct ieee80211req_chanlist chanlist;
106 int c;
107 Index: madwifi-ng-r2420-20070602/tools/athctrl.c
108 ===================================================================
109 --- madwifi-ng-r2420-20070602.orig/tools/athctrl.c 2007-06-04 13:21:53.618825368 +0200
110 +++ madwifi-ng-r2420-20070602/tools/athctrl.c 2007-06-04 13:21:53.991768672 +0200
111 @@ -53,6 +53,10 @@
112
113 #include <net/if.h>
114
115 +#ifdef DOMULTI
116 +#include "do_multi.h"
117 +#endif
118 +
119 static int
120 setsysctrl(const char *dev, const char *control , u_long value)
121 {
122 @@ -87,9 +91,19 @@
123 exit(1);
124 }
125
126 +#ifdef DOMULTI
127 +
128 +int
129 +athctrl_init(int argc, char *argv[])
130 +{
131 +
132 +#else
133 +
134 int
135 main(int argc, char *argv[])
136 {
137 +
138 +#endif
139 char device[IFNAMSIZ + 1];
140 int distance = -1;
141 int c;
142 Index: madwifi-ng-r2420-20070602/tools/athdebug.c
143 ===================================================================
144 --- madwifi-ng-r2420-20070602.orig/tools/athdebug.c 2007-06-04 13:21:53.624824456 +0200
145 +++ madwifi-ng-r2420-20070602/tools/athdebug.c 2007-06-04 13:21:53.991768672 +0200
146 @@ -52,6 +52,10 @@
147 #include <getopt.h>
148 #include <err.h>
149
150 +#ifdef DOMULTI
151 +#include "do_multi.h"
152 +#endif
153 +
154 #define N(a) (sizeof(a)/sizeof(a[0]))
155
156 const char *progname;
157 @@ -179,9 +183,20 @@
158 }
159 #endif /* __linux__ */
160
161 +#ifdef DOMULTI
162 +
163 +int
164 +athdebug_init(int argc, char *argv[])
165 +{
166 +
167 +#else
168 +
169 int
170 main(int argc, char *argv[])
171 {
172 +
173 +#endif
174 +
175 #ifdef __linux__
176 const char *ifname = "wifi0";
177 #else
178 Index: madwifi-ng-r2420-20070602/tools/athkey.c
179 ===================================================================
180 --- madwifi-ng-r2420-20070602.orig/tools/athkey.c 2007-06-04 13:21:53.630823544 +0200
181 +++ madwifi-ng-r2420-20070602/tools/athkey.c 2007-06-04 13:21:54.000767304 +0200
182 @@ -59,6 +59,10 @@
183 #include "net80211/ieee80211_crypto.h"
184 #include "net80211/ieee80211_ioctl.h"
185
186 +#ifdef DOMULTI
187 +#include "do_multi.h"
188 +#endif
189 +
190 static int s = -1;
191 const char *progname;
192
193 @@ -211,9 +215,19 @@
194 exit(-1);
195 }
196
197 +#ifdef DOMULTI
198 +
199 +int
200 +athkey_init(int argc, char *argv[])
201 +{
202 +
203 +#else
204 +
205 int
206 main(int argc, char *argv[])
207 {
208 +
209 +#endif
210 const char *ifname = "wifi0";
211 struct ieee80211req_key setkey;
212 struct ieee80211req_del_key delkey;
213 Index: madwifi-ng-r2420-20070602/tools/athstats.c
214 ===================================================================
215 --- madwifi-ng-r2420-20070602.orig/tools/athstats.c 2007-06-04 13:21:53.635822784 +0200
216 +++ madwifi-ng-r2420-20070602/tools/athstats.c 2007-06-04 13:21:54.000767304 +0200
217 @@ -63,6 +63,10 @@
218 #include "wireless_copy.h"
219 #include "if_athioctl.h"
220
221 +#ifdef DOMULTI
222 +#include "do_multi.h"
223 +#endif
224 +
225 static const struct {
226 u_int phyerr;
227 const char* desc;
228 @@ -226,9 +230,20 @@
229 signalled = 1;
230 }
231
232 +#ifdef DOMULTI
233 +
234 +int
235 +athstats_init(int argc, char *argv[])
236 +{
237 +
238 +#else
239 +
240 int
241 main(int argc, char *argv[])
242 {
243 +
244 +#endif
245 +
246 #ifdef __linux__
247 const char *ifname = "wifi0";
248 #else
249 Index: madwifi-ng-r2420-20070602/tools/do_multi.c
250 ===================================================================
251 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
252 +++ madwifi-ng-r2420-20070602/tools/do_multi.c 2007-06-04 13:21:54.000767304 +0200
253 @@ -0,0 +1,30 @@
254 +#include <string.h>
255 +#include "do_multi.h"
256 +
257 +int
258 +main(int argc, char *argv[])
259 +{
260 + char *progname;
261 + int ret = 0;
262 +
263 + progname = basename(argv[0]);
264 +
265 + if(strcmp(progname, "80211debug") == 0)
266 + ret = a80211debug_init(argc, argv);
267 + if(strcmp(progname, "80211stats") == 0)
268 + ret = a80211stats_init(argc, argv);
269 + if(strcmp(progname, "athchans") == 0)
270 + ret = athchans_init(argc, argv);
271 + if(strcmp(progname, "athctrl") == 0)
272 + ret = athctrl_init(argc, argv);
273 + if(strcmp(progname, "athdebug") == 0)
274 + ret = athdebug_init(argc, argv);
275 + if(strcmp(progname, "athkey") == 0)
276 + ret = athkey_init(argc, argv);
277 + if(strcmp(progname, "athstats") == 0)
278 + ret = athstats_init(argc, argv);
279 + if(strcmp(progname, "wlanconfig") == 0)
280 + ret = wlanconfig_init(argc, argv);
281 +
282 + return ret;
283 +}
284 Index: madwifi-ng-r2420-20070602/tools/do_multi.h
285 ===================================================================
286 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
287 +++ madwifi-ng-r2420-20070602/tools/do_multi.h 2007-06-04 13:21:54.000767304 +0200
288 @@ -0,0 +1,9 @@
289 +
290 +int a80211debug_init(int argc, char *argv[]);
291 +int a80211stats_init(int argc, char *argv[]);
292 +int athchans_init(int argc, char *argv[]);
293 +int athctrl_init(int argc, char *argv[]);
294 +int athdebug_init(int argc, char *argv[]);
295 +int athkey_init(int argc, char *argv[]);
296 +int athstats_init(int argc, char *argv[]);
297 +int wlanconfig_init(int argc, char *argv[]);
298 Index: madwifi-ng-r2420-20070602/tools/Makefile
299 ===================================================================
300 --- madwifi-ng-r2420-20070602.orig/tools/Makefile 2007-06-04 13:21:53.649820656 +0200
301 +++ madwifi-ng-r2420-20070602/tools/Makefile 2007-06-04 13:21:54.001767152 +0200
302 @@ -49,6 +49,12 @@
303
304 ALL= athstats 80211stats athkey athchans athctrl \
305 athdebug 80211debug wlanconfig
306 +
307 +ifdef DOMULTI
308 +OBJS= do_multi.o athstats.o 80211stats.o athkey.o athchans.o athctrl.o \
309 + athdebug.o 80211debug.o wlanconfig.o
310 +ALL= ${OBJS} madwifi_multi
311 +endif
312
313 all: $(ALL)
314
315 @@ -59,6 +65,30 @@
316
317 all: $(ALL)
318
319 +athstats.o: athstats.c
320 + ${CC} -c -o athstats.o -DDOMULTI=1 ${ALL_CFLAGS} -I../ath athstats.c
321 +80211stats.o: 80211stats.c
322 + ${CC} -c -o 80211stats.o -DDOMULTI=1 ${ALL_CFLAGS} 80211stats.c
323 +athkey.o: athkey.c
324 + ${CC} -c -o athkey.o -DDOMULTI=1 ${ALL_CFLAGS} athkey.c
325 +athchans.o: athchans.c
326 + ${CC} -c -o athchans.o -DDOMULTI=1 ${ALL_CFLAGS} athchans.c
327 +athctrl.o: athctrl.c
328 + ${CC} -c -o athctrl.o -DDOMULTI=1 ${ALL_CFLAGS} athctrl.c
329 +athdebug.o: athdebug.c
330 + ${CC} -c -o athdebug.o -DDOMULTI=1 ${ALL_CFLAGS} athdebug.c
331 +wlanconfig.o: wlanconfig.c
332 + ${CC} -c -o wlanconfig.o -DDOMULTI=1 ${ALL_CFLAGS} wlanconfig.c
333 +80211debug.o: 80211debug.c
334 + ${CC} -c -o 80211debug.o -DDOMULTI=1 ${ALL_CFLAGS} 80211debug.c
335 +do_multi.o: do_multi.c
336 + ${CC} -c -o do_multi.o -DDOMULTI=1 ${ALL_CFLAGS} do_multi.c
337 +madwifi_multi:
338 + ${CC} -o madwifi_multi ${LDFLAGS} ${OBJS}
339 + for i in athstats 80211stats athkey athchans athctrl athdebug wlanconfig 80211debug; do \
340 + ln -s -f madwifi_multi $$i; \
341 + done
342 +
343 athstats: athstats.c
344 $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
345 80211stats: 80211stats.c
346 Index: madwifi-ng-r2420-20070602/tools/wlanconfig.c
347 ===================================================================
348 --- madwifi-ng-r2420-20070602.orig/tools/wlanconfig.c 2007-06-04 13:21:53.656819592 +0200
349 +++ madwifi-ng-r2420-20070602/tools/wlanconfig.c 2007-06-04 13:21:54.001767152 +0200
350 @@ -62,6 +62,10 @@
351 #include "net80211/ieee80211_crypto.h"
352 #include "net80211/ieee80211_ioctl.h"
353
354 +#ifdef DOMULTI
355 +#include "do_multi.h"
356 +#endif
357 +
358 /*
359 * These are taken from ieee80211_node.h
360 */
361 @@ -96,9 +100,19 @@
362
363 int verbose = 0;
364
365 +#ifdef DOMULTI
366 +
367 +int
368 +wlanconfig_init(int argc, char *argv[])
369 +{
370 +
371 +#else
372 +
373 int
374 main(int argc, char *argv[])
375 {
376 +
377 +#endif
378 const char *ifname, *cmd;
379 unsigned char bnounit = 0;
380 char *if_base = NULL;