# HG changeset patch # User ali # Date 1369511270 -3600 # Node ID 8a53979c0d657d2bfee66f56d763709fdb8b8886 # Parent 274aa1e09099a380d79de7f67f9cef453c8cbb73 Break check_for_jeebies() out diff -r 274aa1e09099 -r 8a53979c0d65 bookloupe/bookloupe.c --- a/bookloupe/bookloupe.c Sat May 25 20:38:17 2013 +0100 +++ b/bookloupe/bookloupe.c Sat May 25 20:47:50 2013 +0100 @@ -1263,6 +1263,89 @@ } /* + * check_for_jeebies: + * + * Check for "to he" and other easy h/b errors. + * + * This is a very inadequate effort on the h/b problem, + * but the phrase "to he" is always an error, whereas "to + * be" is quite common. + * Similarly, '"Quiet!", be said.' is a non-be error + * "to he" is _not_ always an error!: + * "Where they went to he couldn't say." + * Another false positive: + * What would "Cinderella" be without the . . . + * and another: "If he wants to he can see for himself." + */ +void check_for_jeebies(const char *aline) +{ + const char *s; + s=strstr(aline," be could "); + if (!s) + s=strstr(aline," be would "); + if (!s) + s=strstr(aline," was be "); + if (!s) + s=strstr(aline," be is "); + if (!s) + s=strstr(aline," is be "); + if (!s) + s=strstr(aline,"\", be "); + if (!s) + s=strstr(aline,"\" be "); + if (!s) + s=strstr(aline,"\" be "); + if (!s) + s=strstr(aline," to he "); + if (s) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Query he/be error?\n", + linecnt,(int)(s-aline)+1); + else + cnt_word++; + } + s=strstr(aline," the had "); + if (!s) + s=strstr(aline," a had "); + if (!s) + s=strstr(aline," they bad "); + if (!s) + s=strstr(aline," she bad "); + if (!s) + s=strstr(aline," he bad "); + if (!s) + s=strstr(aline," you bad "); + if (!s) + s=strstr(aline," i bad "); + if (s) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Query had/bad error?\n", + linecnt,(int)(s-aline)+1); + else + cnt_word++; + } + s=strstr(aline,"; hut "); + if (!s) + s=strstr(aline,", hut "); + if (s) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Query hut/but error?\n", + linecnt,(int)(s-aline)+1); + else + cnt_word++; + } +} + +/* * procfile: * * Process one file. @@ -1509,88 +1592,7 @@ check_for_spaced_dash(aline); } check_for_unmarked_paragraphs(aline); - /* - * Check for "to he" and other easy he/be errors. - * This is a very inadequate effort on the he/be problem, - * but the phrase "to he" is always an error, whereas "to - * be" is quite common. - * Similarly, '"Quiet!", be said.' is a non-be error - * "to he" is _not_ always an error!: - * "Where they went to he couldn't say." - * Another false positive: - * What would "Cinderella" be without the . . . - * and another: "If he wants to he can see for himself." - */ - s=wrk; - *s=0; - if (strstr(aline," to he ")) - s=strstr(aline," to he "); - if (strstr(aline,"\" be ")) - s=strstr(aline,"\" be "); - if (strstr(aline,"\", be ")) - s=strstr(aline,"\", be "); - if (strstr(aline," is be ")) - s=strstr(aline," is be "); - if (strstr(aline," be is ")) - s=strstr(aline," be is "); - if (strstr(aline," was be ")) - s=strstr(aline," was be "); - if (strstr(aline," be would ")) - s=strstr(aline," be would "); - if (strstr(aline," be could ")) - s=strstr(aline," be could "); - if (*s) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Query he/be error?\n", - linecnt,(int)(s-aline)+1); - else - cnt_word++; - } - s=wrk; - *s=0; - if (strstr(aline," i bad ")) - s=strstr(aline," i bad "); - if (strstr(aline," you bad ")) - s=strstr(aline," you bad "); - if (strstr(aline," he bad ")) - s=strstr(aline," he bad "); - if (strstr(aline," she bad ")) - s=strstr(aline," she bad "); - if (strstr(aline," they bad ")) - s=strstr(aline," they bad "); - if (strstr(aline," a had ")) - s=strstr(aline," a had "); - if (strstr(aline," the had ")) - s=strstr(aline," the had "); - if (*s) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Query had/bad error?\n", - linecnt,(int)(s-aline)+1); - else - cnt_word++; - } - s=wrk; - *s=0; - if (strstr(aline,", hut ")) - s=strstr(aline,", hut "); - if (strstr(aline,"; hut ")) - s=strstr(aline,"; hut "); - if (*s) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Query hut/but error?\n", - linecnt,(int)(s-aline)+1); - else - cnt_word++; - } + check_for_jeebies(aline); /* * Special case - angled bracket in front of "From" placed there by an * MTA when sending an e-mail.