diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-23 13:16:09 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-23 13:16:09 +0000 |
commit | 76bb0f3309862e021d454783a957306b63613a9a (patch) | |
tree | c23c154a552ba0fd7f2e2d2a2eff3ea72dc7708d /package/iwinfo/src/iwinfo_nl80211.c | |
parent | b1af9a779fda99262632d69c085aea16e17ac809 (diff) | |
download | upstream-76bb0f3309862e021d454783a957306b63613a9a.tar.gz upstream-76bb0f3309862e021d454783a957306b63613a9a.tar.bz2 upstream-76bb0f3309862e021d454783a957306b63613a9a.zip |
iwinfo: replace internal constant mode strings with enums
SVN-Revision: 30692
Diffstat (limited to 'package/iwinfo/src/iwinfo_nl80211.c')
-rw-r--r-- | package/iwinfo/src/iwinfo_nl80211.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/package/iwinfo/src/iwinfo_nl80211.c b/package/iwinfo/src/iwinfo_nl80211.c index 528615079a..bd3a60b0ac 100644 --- a/package/iwinfo/src/iwinfo_nl80211.c +++ b/package/iwinfo/src/iwinfo_nl80211.c @@ -700,7 +700,7 @@ void nl80211_close(void) } } -int nl80211_get_mode(const char *ifname, char *buf) +int nl80211_get_mode(const char *ifname, int *buf) { return wext_get_mode(ifname, buf); } @@ -1525,9 +1525,9 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, void *arg) memcpy(sl->e->mac, nla_data(bss[NL80211_BSS_BSSID]), 6); if (caps & (1<<1)) - memcpy(sl->e->mode, "Ad-Hoc", 6); + sl->e->mode = IWINFO_OPMODE_ADHOC; else - memcpy(sl->e->mode, "Master", 6); + sl->e->mode = IWINFO_OPMODE_MASTER; if (caps & (1<<4)) sl->e->crypto.enabled = 1; @@ -1568,7 +1568,6 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, void *arg) static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len) { - struct nl_msg *ssids = NULL; struct nl80211_msg_conveyor *req; struct nl80211_scanlist sl = { .e = (struct iwinfo_scanlist_entry *)buf }; @@ -1590,11 +1589,6 @@ static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len) *len = sl.len * sizeof(struct iwinfo_scanlist_entry); return *len ? 0 : -1; - -nla_put_failure: - if (ssids) - nlmsg_free(ssids); - return -1; } int nl80211_get_scanlist(const char *ifname, char *buf, int *len) @@ -1652,7 +1646,7 @@ int nl80211_get_scanlist(const char *ifname, char *buf, int *len) memcpy(e->ssid, ssid, min(strlen(ssid), sizeof(e->ssid) - 1)); /* Mode (assume master) */ - sprintf((char *)e->mode, "Master"); + e->mode = IWINFO_OPMODE_MASTER; /* Channel */ e->channel = nl80211_freq2channel(freq); @@ -1685,7 +1679,7 @@ int nl80211_get_scanlist(const char *ifname, char *buf, int *len) nl80211_get_scancrypto(cipher, &e->crypto); /* advance to next line */ - while( *res && *res++ != '\n' ); + while (*res && *res++ != '\n'); count++; e++; |