#define streq(a,b) (strncasecmp(a, b, sizeof(b) - 1) == 0)
+#undef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
static int if_split_name(const char *, char **, unsigned int *);
static void vap_create(struct ifreq *);
static void vap_destroy(const char *);
static void
print_chaninfo(const struct ieee80211_channel *c)
{
-#define IEEE80211_IS_CHAN_PASSIVE(_c) \
- (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE))
-#define IEEE80211_IS_CHAN_RADAR(_c) \
- (((_c)->ic_flags & IEEE80211_CHAN_RADAR) != 0)
char buf[14];
+
buf[0] = '\0';
if (IEEE80211_IS_CHAN_FHSS(c))
strlcat(buf, " FHSS", sizeof(buf));
IEEE80211_IS_CHAN_PASSIVE(c) ? '*' : ' ',
IEEE80211_IS_CHAN_RADAR(c) ? '!' : ' ',
buf);
-#undef IEEE80211_IS_CHAN_PASSIVE
}
static void
static int
do80211priv(struct iwreq *iwr, const char *ifname, int op, void *data, size_t len)
{
-#define N(a) (sizeof(a)/sizeof(a[0]))
-
memset(iwr, 0, sizeof(struct iwreq));
strncpy(iwr->ifr_name, ifname, IFNAMSIZ);
if (len < IFNAMSIZ) {
IOCTL_ERR(IEEE80211_IOCTL_WRITEREG),
};
op -= SIOCIWFIRSTPRIV;
- if (0 <= op && op < N(opnames))
+ if (0 <= op && op < ARRAY_SIZE(opnames))
perror(opnames[op]);
else
perror("ioctl[unknown???]");
return -1;
}
return 0;
-#undef N
}
static int