Break check_for_unpunctuated_endquote() out
authorali <ali@juiblex.co.uk>
Sun May 26 21:27:50 2013 +0100 (2013-05-26)
changeset 62d4a66d961a69
parent 61 23b81eb371a8
child 63 0a4f8d73b27f
Break check_for_unpunctuated_endquote() out
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Sun May 26 20:24:02 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sun May 26 21:27:50 2013 +0100
     1.3 @@ -2244,6 +2244,29 @@
     1.4  }
     1.5  
     1.6  /*
     1.7 + * check_for_unpunctuated_endquote:
     1.8 + */
     1.9 +void check_for_unpunctuated_endquote(const char *aline)
    1.10 +{
    1.11 +    int i,llen;
    1.12 +    llen=strlen(aline);
    1.13 +    for (i=1;i<llen;i++)
    1.14 +    {
    1.15 +	/* for each character in the line except 1st */
    1.16 +	if (aline[i]==CHAR_DQUOTE && isalpha(aline[i-1]))
    1.17 +	{
    1.18 +	    if (pswit[ECHO_SWITCH])
    1.19 +		printf("\n%s\n",aline);
    1.20 +	    if (!pswit[OVERVIEW_SWITCH])
    1.21 +		printf("    Line %ld column %d - "
    1.22 +		  "endquote missing punctuation?\n",linecnt,i);
    1.23 +	    else
    1.24 +		cnt_punct++;
    1.25 +	}
    1.26 +    }
    1.27 +}
    1.28 +
    1.29 +/*
    1.30   * procfile:
    1.31   *
    1.32   * Process one file.
    1.33 @@ -2489,24 +2512,8 @@
    1.34  	check_for_miscased_genative(aline);
    1.35  	check_end_of_line(aline,warnings);
    1.36  	check_for_unspaced_bracket(aline);
    1.37 -        llen=strlen(aline);
    1.38          if (warnings->endquote)
    1.39 -	{
    1.40 -            for (i=1;i<llen;i++)
    1.41 -	    {
    1.42 -		/* for each character in the line except 1st */
    1.43 -                if (aline[i]==CHAR_DQUOTE && isalpha(aline[i-1]))
    1.44 -		{
    1.45 -		    if (pswit[ECHO_SWITCH])
    1.46 -			printf("\n%s\n",aline);
    1.47 -		    if (!pswit[OVERVIEW_SWITCH])
    1.48 -			printf("    Line %ld column %d - "
    1.49 -			  "endquote missing punctuation?\n",linecnt,i);
    1.50 -		    else
    1.51 -			cnt_punct++;
    1.52 -		}
    1.53 -	    }
    1.54 -	}
    1.55 +	    check_for_unpunctuated_endquote(aline);
    1.56  	/*
    1.57           * Check for <HTML TAG>.
    1.58           * If there is a < in the line, followed at some point