MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getchannel

Function getchannel

tools/ifconfig/ifieee80211.c:808–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

806}
807
808static void
809getchannel(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
835static void
836set80211channel(const char *val, int d, int s, const struct afswtch *rafp)

Callers 2

set80211channelFunction · 0.70
set80211chanswitchFunction · 0.70

Calls 7

memsetFunction · 0.85
isanyargFunction · 0.85
getchaninfoFunction · 0.85
strtolFunction · 0.85
getchannelflagsFunction · 0.85
mapfreqFunction · 0.85
mapchanFunction · 0.85

Tested by

no test coverage detected