# HG changeset patch # User ali # Date 1369593160 -3600 # Node ID b3385bfb28ac40ea7b841f4d98b1d3c7e303bcf2 # Parent 1e89f47e56dfb9726a31309ded1dae575462ad71 Break check_for_spaced_quotes() out diff -r 1e89f47e56df -r b3385bfb28ac bookloupe/bookloupe.c --- a/bookloupe/bookloupe.c Sun May 26 19:28:31 2013 +0100 +++ b/bookloupe/bookloupe.c Sun May 26 19:32:40 2013 +0100 @@ -2092,6 +2092,50 @@ } /* + * check_for_spaced_quotes: + */ +void check_for_spaced_quotes(const char *aline) +{ + const char *s,*t; + s=aline; + while ((t=strstr(s," \" "))) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Spaced doublequote?\n", + linecnt,(int)(t-aline+1)); + else + cnt_punct++; + s=t+2; + } + s=aline; + while ((t=strstr(s," ' "))) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Spaced singlequote?\n", + linecnt,(int)(t-aline+1)); + else + cnt_punct++; + s=t+2; + } + s=aline; + while ((t=strstr(s," ` "))) + { + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - Spaced singlequote?\n", + linecnt,(int)(t-aline+1)); + else + cnt_punct++; + s=t+2; + } +} + +/* * procfile: * * Process one file. @@ -2333,42 +2377,7 @@ check_for_typos(aline,warnings); check_for_misspaced_punctuation(aline,&parities,isemptyline); check_for_double_punctuation(aline,warnings); - s=aline; - while (strstr(s," \" ")) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Spaced doublequote?\n", - linecnt,(int)(strstr(s," \" ")-aline+1)); - else - cnt_punct++; - s=strstr(s," \" ")+2; - } - s=aline; - while (strstr(s," ' ")) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Spaced singlequote?\n", - linecnt,(int)(strstr(s," ' ")-aline+1)); - else - cnt_punct++; - s=strstr(s," ' ")+2; - } - s=aline; - while (strstr(s," ` ")) - { - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - Spaced singlequote?\n", - linecnt,(int)(strstr(s," ` ")-aline+1)); - else - cnt_punct++; - s=strstr(s," ` ")+2; - } + check_for_spaced_quotes(aline); /* check special case of 'S instead of 's at end of word */ s=aline+1; while (*s)