# HG changeset patch # User ali # Date 1369600747 -3600 # Node ID a83ca5ff8511da53db11b78635cca0abc6bfe21e # Parent 0a4f8d73b27f21ece9ddc3f3c9ec85b90032c8f4 Break check_for_html_entity() out diff -r 0a4f8d73b27f -r a83ca5ff8511 bookloupe/bookloupe.c --- a/bookloupe/bookloupe.c Sun May 26 21:33:49 2013 +0100 +++ b/bookloupe/bookloupe.c Sun May 26 21:39:07 2013 +0100 @@ -2302,6 +2302,44 @@ } /* + * check_for_html_entity: + * + * Check for &symbol; HTML. + * + * If there is a & in the line, followed at + * some point by a ; then we suspect HTML. + */ +void check_for_html_entity(const char *aline) +{ + int i; + const char *s,*amp,*scolon; + amp=strstr(aline,"&"); + if (amp) + { + scolon=strstr(aline,";"); + if (scolon) + { + i=(int)(scolon-amp+1); + for (s=amp;s0) + { + strncpy(wrk,amp,i); + wrk[i]=0; + if (pswit[ECHO_SWITCH]) + printf("\n%s\n",aline); + if (!pswit[OVERVIEW_SWITCH]) + printf(" Line %ld column %d - HTML symbol? %s \n", + linecnt,(int)(amp-aline)+1,wrk); + else + cnt_html++; + } + } + } +} + +/* * procfile: * * Process one file. @@ -2550,30 +2588,7 @@ if (warnings->endquote) check_for_unpunctuated_endquote(aline); check_for_html_tag(aline); - /* - * Check for &symbol; HTML. - * If there is a & in the line, followed at - * some point by a ; then we suspect HTML. - */ - if (strstr(aline,"&") && strstr(aline,";")) - { - i=(int)(strstr(aline,";")-strstr(aline,"&")+1); - for (s=strstr(aline,"&");s0) - { - strncpy(wrk,strstr(aline,"&"),i); - wrk[i]=0; - if (pswit[ECHO_SWITCH]) - printf("\n%s\n",aline); - if (!pswit[OVERVIEW_SWITCH]) - printf(" Line %ld column %d - HTML symbol? %s \n", - linecnt,(int)(strstr(aline,"&")-aline)+1,wrk); - else - cnt_html++; - } - } + check_for_html_entity(aline); /* * At end of paragraph, check for mismatched quotes. * We don't want to report an error immediately, since it is a