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

Function get_media_mode

tools/ifconfig/ifmedia.c:540–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540static int
541get_media_mode(int type, const char *val)
542{
543 struct ifmedia_description *desc;
544 struct ifmedia_type_to_subtype *ttos;
545 int rval, i;
546
547 /* Find the top-level interface type. */
548 for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
549 desc->ifmt_string != NULL; desc++, ttos++)
550 if (type == desc->ifmt_word)
551 break;
552 if (desc->ifmt_string == NULL)
553 errx(1, "unknown media mode 0x%x", type);
554
555 for (i = 0; ttos->modes[i].desc != NULL; i++) {
556 rval = lookup_media_word(ttos->modes[i].desc, val);
557 if (rval != -1)
558 return (rval);
559 }
560 return -1;
561}
562
563static int
564get_media_options(int type, const char *val)

Callers 1

setmediamodeFunction · 0.85

Calls 1

lookup_media_wordFunction · 0.85

Tested by

no test coverage detected