remove /etc/functions.sh call from led hotplug script
[openwrt.git] / package / madwifi / patches / 102-multicall_binary.patch
1 --- a/tools/80211debug.c
2 +++ b/tools/80211debug.c
3 @@ -48,6 +48,7 @@
4 #include <ctype.h>
5 #include <getopt.h>
6 #include <err.h>
7 +#include "do_multi.h"
8
9 #undef ARRAY_SIZE
10 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
11 @@ -185,7 +186,7 @@
12 #endif /* __linux__ */
13
14 int
15 -main(int argc, char *argv[])
16 +CMD(a80211debug)(int argc, char *argv[])
17 {
18 const char *ifname = "ath0";
19 const char *cp, *tp;
20 --- a/tools/80211stats.c
21 +++ b/tools/80211stats.c
22 @@ -59,6 +59,7 @@
23 #include "net80211/ieee80211.h"
24 #include "net80211/ieee80211_crypto.h"
25 #include "net80211/ieee80211_ioctl.h"
26 +#include "do_multi.h"
27
28 #ifndef SIOCG80211STATS
29 #define SIOCG80211STATS (SIOCDEVPRIVATE + 2)
30 @@ -240,7 +241,7 @@
31 }
32
33 int
34 -main(int argc, char *argv[])
35 +CMD(a80211stats)(int argc, char *argv[])
36 {
37 int c, len;
38 struct ieee80211req_sta_info *si;
39 --- a/tools/athchans.c
40 +++ b/tools/athchans.c
41 @@ -58,6 +58,7 @@
42 #include "net80211/ieee80211.h"
43 #include "net80211/ieee80211_crypto.h"
44 #include "net80211/ieee80211_ioctl.h"
45 +#include "do_multi.h"
46
47 static int s = -1;
48 static const char *progname;
49 @@ -140,8 +141,9 @@
50 }
51
52 #define MAXCHAN ((int)(sizeof(struct ieee80211req_chanlist) * NBBY))
53 +
54 int
55 -main(int argc, char *argv[])
56 +CMD(athchans)(int argc, char *argv[])
57 {
58 const char *ifname = "wifi0";
59 struct ieee80211req_chanlist chanlist;
60 --- a/tools/athctrl.c
61 +++ b/tools/athctrl.c
62 @@ -52,6 +52,7 @@
63 #include <err.h>
64
65 #include <net/if.h>
66 +#include "do_multi.h"
67
68 static int
69 setsysctrl(const char *dev, const char *control , u_long value)
70 @@ -88,7 +89,7 @@
71 }
72
73 int
74 -main(int argc, char *argv[])
75 +CMD(athctrl)(int argc, char *argv[])
76 {
77 char device[IFNAMSIZ + 1];
78 int distance = -1;
79 --- a/tools/athdebug.c
80 +++ b/tools/athdebug.c
81 @@ -51,6 +51,7 @@
82 #include <ctype.h>
83 #include <getopt.h>
84 #include <err.h>
85 +#include "do_multi.h"
86
87 #undef ARRAY_SIZE
88 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
89 @@ -194,7 +195,7 @@
90 #endif /* __linux__ */
91
92 int
93 -main(int argc, char *argv[])
94 +CMD(athdebug)(int argc, char *argv[])
95 {
96 #ifdef __linux__
97 const char *ifname = "wifi0";
98 --- a/tools/athkey.c
99 +++ b/tools/athkey.c
100 @@ -58,6 +58,7 @@
101 #include "net80211/ieee80211.h"
102 #include "net80211/ieee80211_crypto.h"
103 #include "net80211/ieee80211_ioctl.h"
104 +#include "do_multi.h"
105
106 static int s = -1;
107 static const char *progname;
108 @@ -213,8 +214,7 @@
109 exit(-1);
110 }
111
112 -int
113 -main(int argc, char *argv[])
114 +int CMD(athkey)(int argc, char *argv[])
115 {
116 const char *ifname = "wifi0";
117 struct ieee80211req_key setkey;
118 --- a/tools/athstats.c
119 +++ b/tools/athstats.c
120 @@ -65,6 +65,7 @@
121
122 #undef ARRAY_SIZE
123 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
124 +#include "do_multi.h"
125
126 static const struct {
127 u_int phyerr;
128 @@ -228,7 +229,7 @@
129 }
130
131 int
132 -main(int argc, char *argv[])
133 +CMD(athstats)(int argc, char *argv[])
134 {
135 #ifdef __linux__
136 const char *ifname = "wifi0";
137 --- /dev/null
138 +++ b/tools/do_multi.c
139 @@ -0,0 +1,32 @@
140 +#include <string.h>
141 +#include "do_multi.h"
142 +
143 +int
144 +main(int argc, char *argv[])
145 +{
146 + char *progname;
147 + int ret = 0;
148 +
149 + progname = basename(argv[0]);
150 +
151 + if(strcmp(progname, "80211debug") == 0)
152 + ret = a80211debug_init(argc, argv);
153 + if(strcmp(progname, "80211stats") == 0)
154 + ret = a80211stats_init(argc, argv);
155 + if(strcmp(progname, "athchans") == 0)
156 + ret = athchans_init(argc, argv);
157 + if(strcmp(progname, "athctrl") == 0)
158 + ret = athctrl_init(argc, argv);
159 + if(strcmp(progname, "athdebug") == 0)
160 + ret = athdebug_init(argc, argv);
161 + if(strcmp(progname, "athkey") == 0)
162 + ret = athkey_init(argc, argv);
163 + if(strcmp(progname, "athstats") == 0)
164 + ret = athstats_init(argc, argv);
165 + if(strcmp(progname, "wlanconfig") == 0)
166 + ret = wlanconfig_init(argc, argv);
167 + if(strcmp(progname, "ath_info") == 0)
168 + ret = athinfo_init(argc, argv);
169 +
170 + return ret;
171 +}
172 --- /dev/null
173 +++ b/tools/do_multi.h
174 @@ -0,0 +1,15 @@
175 +#ifdef DO_MULTI
176 +int a80211debug_init(int argc, char *argv[]);
177 +int a80211stats_init(int argc, char *argv[]);
178 +int athchans_init(int argc, char *argv[]);
179 +int athctrl_init(int argc, char *argv[]);
180 +int athdebug_init(int argc, char *argv[]);
181 +int athkey_init(int argc, char *argv[]);
182 +int athstats_init(int argc, char *argv[]);
183 +int wlanconfig_init(int argc, char *argv[]);
184 +int athinfo_init(int argc, char *argv[]);
185 +
186 +#define CMD(name) name##_init
187 +#else
188 +#define CMD(name) main
189 +#endif
190 --- a/tools/Makefile
191 +++ b/tools/Makefile
192 @@ -46,56 +46,55 @@
193 HAL= $(TOP)/hal
194 endif
195
196 +all: compile
197
198 -ALL= athstats 80211stats athkey athchans athctrl \
199 +ALLPROGS= athstats 80211stats athkey athchans athctrl \
200 athdebug 80211debug wlanconfig ath_info
201
202 -all: $(ALL)
203 +OBJS= $(patsubst %,%.o,$(ALLPROGS))
204
205 -INCS= -I. -I$(HAL) -I$(TOP) -I$(ATH_HAL)
206 +INCS= -I. -I../ath -I$(HAL) -I$(TOP) -I$(ATH_HAL)
207 CFLAGS= -g -O2 -Wall
208 ALL_CFLAGS= $(CFLAGS) $(INCS)
209 LDFLAGS=
210
211 -all: $(ALL)
212
213 -athstats: athstats.c
214 - $(CC) -o athstats $(ALL_CFLAGS) -I$(TOP)/ath $(LDFLAGS) athstats.c
215 -80211stats: 80211stats.c
216 - $(CC) -o 80211stats $(ALL_CFLAGS) $(LDFLAGS) 80211stats.c
217 -athkey: athkey.c
218 - $(CC) -o athkey $(ALL_CFLAGS) $(LDFLAGS) athkey.c
219 -athchans: athchans.c
220 - $(CC) -o athchans $(ALL_CFLAGS) $(LDFLAGS) athchans.c
221 -athctrl: athctrl.c
222 - $(CC) -o athctrl $(ALL_CFLAGS) $(LDFLAGS) athctrl.c
223 -athdebug: athdebug.c
224 - $(CC) -o athdebug $(ALL_CFLAGS) $(LDFLAGS) athdebug.c
225 -wlanconfig: wlanconfig.c
226 - $(CC) -o wlanconfig $(ALL_CFLAGS) $(LDFLAGS) wlanconfig.c
227 -80211debug: 80211debug.c
228 - $(CC) -o 80211debug $(ALL_CFLAGS) $(LDFLAGS) 80211debug.c
229 -ath_info: ath_info.c
230 - $(CC) -o ath_info $(CFLAGS) ath_info.c
231 +ifneq ($(DO_MULTI),)
232 +ALL_CFLAGS += -DDO_MULTI=1
233 +%.o: %.c
234 + ${CC} $(ALL_CFLAGS) -c -o $@ $<
235 +
236 +madwifi_multi: $(OBJS) do_multi.o
237 + $(CC) -o $@ $^
238 +
239 +compile: madwifi_multi
240 + for i in $(ALLPROGS); do \
241 + ln -s -f madwifi_multi $$i; \
242 + done
243 +else
244 +$(ALLPROGS):
245 + $(CC) $(ALL_CFLAGS) -o $@ $@.c
246 +
247 +compile: $(ALLPROGS)
248 +endif
249
250
251 install: $(ALL)
252 install -d $(DESTDIR)$(BINDIR)
253 - for i in $(ALL); do \
254 + for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
255 install $$i $(DESTDIR)$(BINDIR)/$$i; \
256 - $(STRIP) $(DESTDIR)$(BINDIR)/$$i; \
257 done
258 install -d $(DESTDIR)$(MANDIR)/man8
259 install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8
260 install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload
261
262 uninstall:
263 - for i in $(ALL); do \
264 + for i in $(ALLPROGS) $(if $(DO_MULTI),madwifi_multi); do \
265 rm -f $(DESTDIR)$(BINDIR)/$$i; \
266 done
267 - for i in $(ALL:=.8); do \
268 - rm -f $(DESTDIR)$(MANDIR)/man8/$$i; \
269 + for i in $(ALLPROGS); do \
270 + rm -f $(DESTDIR)$(MANDIR)/man8/$$i.8; \
271 done
272
273 clean:
274 - rm -f $(ALL) core a.out
275 + rm -f $(ALLPROGS) madwifi_multi *.o core a.out
276 --- a/tools/wlanconfig.c
277 +++ b/tools/wlanconfig.c
278 @@ -61,6 +61,7 @@
279 #include "net80211/ieee80211.h"
280 #include "net80211/ieee80211_crypto.h"
281 #include "net80211/ieee80211_ioctl.h"
282 +#include "do_multi.h"
283
284 /*
285 * These are taken from ieee80211_node.h
286 @@ -100,7 +101,7 @@
287 static int verbose = 0;
288
289 int
290 -main(int argc, char *argv[])
291 +CMD(wlanconfig)(int argc, char *argv[])
292 {
293 const char *ifname, *cmd;
294 unsigned char bnounit = 0;
295 --- a/tools/ath_info.c
296 +++ b/tools/ath_info.c
297 @@ -98,6 +98,7 @@
298 #include <sys/mman.h>
299 #include <endian.h>
300 #include <byteswap.h>
301 +#include "do_multi.h"
302
303 #undef ARRAY_SIZE
304 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
305 @@ -738,7 +739,8 @@
306 "unlawful radio transmissions!\n\n");
307 }
308
309 -int main(int argc, char *argv[])
310 +int
311 +CMD(athinfo)(int argc, char *argv[])
312 {
313 u_int32_t dev_addr;
314 u_int16_t eeprom_header, srev, phy_rev_5ghz, phy_rev_2ghz;
This page took 0.06131 seconds and 5 git commands to generate.