/* Here they choose general network config, number of nics etc. */ int configtypemenu(void) { struct keyvalue *kv = initkeyvalues(); char temp[STRING_SIZE] = "1"; char message[1000]; int choise, found; int rc, configtype; if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings"))) { freekeyvalues(kv); errorbox(_("Unable to open settings file")); return 0; } found = scan_network_cards(); findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp); choise--; sprintf(message, _("Select the network configuration for %s. " "The following configuration types list those interfaces which have ethernet attached. " "If you change this setting, a network restart will be required, and you will have to " "reconfigure the network driver assignments."), NAME); rc = newtWinMenu(_("Network configuration type"), message, 50, 5, 5, 6, configtypenames, &choise, _("OK"), _("Cancel"), NULL); if ( configtypecards[choise] > found ) { sprintf(message, _("Not enough netcards for your choice.\n\nNeeded: %d - Available: %d\n"), configtypecards[choise], found); errorbox(message); } if (rc == 0 || rc == 1) { choise++; sprintf(temp, "%d", choise); replacekeyvalue(kv, "CONFIG_TYPE", temp); configtype = atol(temp); if (!HAS_RED) clear_card_entry(_RED_CARD_); if (!HAS_ORANGE) clear_card_entry(_ORANGE_CARD_); if (!HAS_BLUE) clear_card_entry(_BLUE_CARD_); writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings"); netaddresschange = 1; } freekeyvalues(kv); return 0; }
int ask_clear_card_entry(int card) { char message[STRING_SIZE]; int rc; sprintf(message, _("Do you really want to remove the assigned %s interface?"), ucolourcard[card]); rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message); if ( rc = 0 || rc == 1) { clear_card_entry(card); } else return 1; return 0; }