8
extern char * mystrdup(const char * s);
13
main(int argc, char** argv)
21
/* first parse the command line options */
22
/* arg1 - affix file, arg2 dictionary file, arg3 - file of words to check */
25
af = mystrdup(argv[1]);
27
fprintf(stderr,"correct syntax is:\n");
28
fprintf(stderr,"example affix_file dictionary_file file_of_words_to_check\n");
32
df = mystrdup(argv[2]);
34
fprintf(stderr,"correct syntax is:\n");
35
fprintf(stderr,"example affix_file dictionary_file file_of_words_to_check\n");
39
wtc = mystrdup(argv[3]);
41
fprintf(stderr,"correct syntax is:\n");
42
fprintf(stderr,"example affix_file dictionary_file file_of_words_to_check\n");
47
/* open the words to check list */
48
wtclst = fopen(wtc,"r");
50
fprintf(stderr,"Error - could not open file of words to check\n");
55
MySpell * pMS= new MySpell(af,df);
61
while(fgets(buf,100,wtclst)) {
63
*(buf + k - 1) = '\0';
66
fprintf(stdout,"\"%s\" is okay\n",buf);
69
fprintf(stdout,"\"%s\" is incorrect!\n",buf);
70
fprintf(stdout," suggestions:\n");
72
int ns = pMS->suggest(&wlst,buf);
73
for (int i=0; i < ns; i++) {
74
fprintf(stdout," ...\"%s\"\n",wlst[i]);