static void proccessCommand (char * line, Tournament tournament) { char * primaryCommand = strtok(line," \n\t"); char * secondaryCommand = strtok(NULL," \n\t"); if (primaryCommand == NULL) { return; } if (strchr(primaryCommand,'#') == primaryCommand) { return; } if (secondaryCommand == NULL) { mtmPrintErrorMessage(stderr, MTM_INVALID_INPUT_COMMAND_PARAMETERS); return; } if (STR_EQUALS(primaryCommand,"reset")) { reset(&tournament); return; } //todo change to static array if (STR_EQUALS(primaryCommand,"chef")) { if (STR_EQUALS(secondaryCommand,"add")) { addChef(tournament); } else if (STR_EQUALS(secondaryCommand,"add-dish")) { addDish(tournament); } else if (STR_EQUALS(secondaryCommand,"compete")) { compete(tournament); } else if (STR_EQUALS(secondaryCommand,"leading")) { printLeading(tournament); } else if (STR_EQUALS(secondaryCommand,"top-dish")) { printTopDish(tournament); } else { mtmPrintErrorMessage(stderr, MTM_INVALID_INPUT_COMMAND_PARAMETERS); } } else if (STR_EQUALS(primaryCommand,"judge")) { if (STR_EQUALS(secondaryCommand,"add")) { addJudge(tournament); } else if (STR_EQUALS(secondaryCommand,"print")) { printJudges(tournament); } else { mtmPrintErrorMessage(stderr, MTM_INVALID_INPUT_COMMAND_PARAMETERS); } } else { mtmPrintErrorMessage(stderr, MTM_INVALID_INPUT_COMMAND_PARAMETERS); } }
void DialogAddJudge::accept() { if (addJudge()) QDialog::accept(); }