| 806 | } |
| 807 | |
| 808 | static void |
| 809 | getchannel(int s, struct ieee80211_channel *chan, const char *val) |
| 810 | { |
| 811 | int v, flags; |
| 812 | char *eptr; |
| 813 | |
| 814 | memset(chan, 0, sizeof(*chan)); |
| 815 | if (isanyarg(val)) { |
| 816 | chan->ic_freq = IEEE80211_CHAN_ANY; |
| 817 | return; |
| 818 | } |
| 819 | getchaninfo(s); |
| 820 | errno = 0; |
| 821 | v = strtol(val, &eptr, 10); |
| 822 | if (val[0] == '\0' || val == eptr || errno == ERANGE || |
| 823 | /* channel may be suffixed with nothing, :flag, or /width */ |
| 824 | (eptr[0] != '\0' && eptr[0] != ':' && eptr[0] != '/')) |
| 825 | errx(1, "invalid channel specification%s", |
| 826 | errno == ERANGE ? " (out of range)" : ""); |
| 827 | flags = getchannelflags(val, v); |
| 828 | if (v > 255) { /* treat as frequency */ |
| 829 | mapfreq(chan, v, flags); |
| 830 | } else { |
| 831 | mapchan(chan, v, flags); |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | static void |
| 836 | set80211channel(const char *val, int d, int s, const struct afswtch *rafp) |
no test coverage detected