/* verificador.c */ #include #include #include #include /* maximum word def */ #define MAXNW 50 /* maximum word length including \0 */ #define MAXWL 19 /* This function does what its name tells */ void exitNow(int s) { exit(0); } /* reads forbidden word list from file */ /* assume all words have at most 19 chars */ /* file must not have more than one word per line */ /* return number of word read */ int readWordFile(FILE * f, char wdef[][MAXWL], int maxw) { int numw = 0; while (!feof(f) && numw < maxw) if (fscanf(f,"%s", wdef[numw])>0) numw++; return numw; } /* checks word agains forbidden word dictionary */ /* word must match exactly - partials do not count */ /* returns 0 or 1*/ int checkWord(char * word, char wdef[][MAXWL], int maxw) { int i; for (i=0; i