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

Function print_media_word_ifconfig

tools/ifconfig/ifmedia.c:738–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738static void
739print_media_word_ifconfig(int ifmw)
740{
741 struct ifmedia_description *desc;
742 struct ifmedia_type_to_subtype *ttos;
743 int seen_option = 0, i;
744
745 /* Find the top-level interface type. */
746 desc = get_toptype_desc(ifmw);
747 ttos = get_toptype_ttos(ifmw);
748 if (desc->ifmt_string == NULL) {
749 printf("<unknown type>");
750 return;
751 }
752
753 /*
754 * Don't print the top-level type; it's not like we can
755 * change it, or anything.
756 */
757
758 /* Find subtype. */
759 desc = get_subtype_desc(ifmw, ttos);
760 if (desc == NULL) {
761 printf("<unknown subtype>");
762 return;
763 }
764
765 printf("media %s", desc->ifmt_string);
766
767 desc = get_mode_desc(ifmw, ttos);
768 if (desc != NULL)
769 printf(" mode %s", desc->ifmt_string);
770
771 /* Find options. */
772 for (i = 0; ttos->options[i].desc != NULL; i++) {
773 if (ttos->options[i].alias)
774 continue;
775 for (desc = ttos->options[i].desc;
776 desc->ifmt_string != NULL; desc++) {
777 if (ifmw & desc->ifmt_word) {
778 if (seen_option == 0)
779 printf(" mediaopt ");
780 printf("%s%s", seen_option++ ? "," : "",
781 desc->ifmt_string);
782 }
783 }
784 }
785
786 if (IFM_INST(ifmw) != 0)
787 printf(" instance %d", IFM_INST(ifmw));
788}
789
790/**********************************************************************
791 * ...until here.

Callers 1

media_statusFunction · 0.85

Calls 5

get_toptype_descFunction · 0.85
get_toptype_ttosFunction · 0.85
get_subtype_descFunction · 0.85
get_mode_descFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected