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