Break check_for_spaced_quotes() out
authorali <ali@juiblex.co.uk>
Sun May 26 19:32:40 2013 +0100 (2013-05-26)
changeset 58b3385bfb28ac
parent 57 1e89f47e56df
child 59 11c6d93eebd9
Break check_for_spaced_quotes() out
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Sun May 26 19:28:31 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sun May 26 19:32:40 2013 +0100
     1.3 @@ -2092,6 +2092,50 @@
     1.4  }
     1.5  
     1.6  /*
     1.7 + * check_for_spaced_quotes:
     1.8 + */
     1.9 +void check_for_spaced_quotes(const char *aline)
    1.10 +{
    1.11 +    const char *s,*t;
    1.12 +    s=aline;
    1.13 +    while ((t=strstr(s," \" ")))
    1.14 +    {
    1.15 +	if (pswit[ECHO_SWITCH])
    1.16 +	    printf("\n%s\n",aline);
    1.17 +	if (!pswit[OVERVIEW_SWITCH])
    1.18 +	    printf("    Line %ld column %d - Spaced doublequote?\n",
    1.19 +	      linecnt,(int)(t-aline+1));
    1.20 +	else
    1.21 +	    cnt_punct++;
    1.22 +	s=t+2;
    1.23 +    }
    1.24 +    s=aline;
    1.25 +    while ((t=strstr(s," ' ")))
    1.26 +    {
    1.27 +	if (pswit[ECHO_SWITCH])
    1.28 +	    printf("\n%s\n",aline);
    1.29 +	if (!pswit[OVERVIEW_SWITCH])
    1.30 +	    printf("    Line %ld column %d - Spaced singlequote?\n",
    1.31 +	      linecnt,(int)(t-aline+1));
    1.32 +	else
    1.33 +	    cnt_punct++;
    1.34 +	s=t+2;
    1.35 +    }
    1.36 +    s=aline;
    1.37 +    while ((t=strstr(s," ` ")))
    1.38 +    {
    1.39 +	if (pswit[ECHO_SWITCH])
    1.40 +	    printf("\n%s\n",aline);
    1.41 +	if (!pswit[OVERVIEW_SWITCH])
    1.42 +	    printf("    Line %ld column %d - Spaced singlequote?\n",
    1.43 +	      linecnt,(int)(t-aline+1));
    1.44 +	else
    1.45 +	    cnt_punct++;
    1.46 +	s=t+2;
    1.47 +    }
    1.48 +}
    1.49 +
    1.50 +/*
    1.51   * procfile:
    1.52   *
    1.53   * Process one file.
    1.54 @@ -2333,42 +2377,7 @@
    1.55  	check_for_typos(aline,warnings);
    1.56  	check_for_misspaced_punctuation(aline,&parities,isemptyline);
    1.57  	check_for_double_punctuation(aline,warnings);
    1.58 -        s=aline;
    1.59 -        while (strstr(s," \" "))
    1.60 -	{
    1.61 -            if (pswit[ECHO_SWITCH])
    1.62 -		printf("\n%s\n",aline);
    1.63 -            if (!pswit[OVERVIEW_SWITCH])
    1.64 -                printf("    Line %ld column %d - Spaced doublequote?\n",
    1.65 -		  linecnt,(int)(strstr(s," \" ")-aline+1));
    1.66 -            else
    1.67 -                cnt_punct++;
    1.68 -            s=strstr(s," \" ")+2;
    1.69 -	}
    1.70 -        s=aline;
    1.71 -        while (strstr(s," ' "))
    1.72 -	{
    1.73 -            if (pswit[ECHO_SWITCH])
    1.74 -		printf("\n%s\n",aline);
    1.75 -            if (!pswit[OVERVIEW_SWITCH])
    1.76 -                printf("    Line %ld column %d - Spaced singlequote?\n",
    1.77 -		  linecnt,(int)(strstr(s," ' ")-aline+1));
    1.78 -            else
    1.79 -                cnt_punct++;
    1.80 -            s=strstr(s," ' ")+2;
    1.81 -	}
    1.82 -        s=aline;
    1.83 -        while (strstr(s," ` "))
    1.84 -	{
    1.85 -            if (pswit[ECHO_SWITCH])
    1.86 -		printf("\n%s\n",aline);
    1.87 -            if (!pswit[OVERVIEW_SWITCH])
    1.88 -                printf("    Line %ld column %d - Spaced singlequote?\n",
    1.89 -		  linecnt,(int)(strstr(s," ` ")-aline+1));
    1.90 -            else
    1.91 -                cnt_punct++;
    1.92 -            s=strstr(s," ` ")+2;
    1.93 -	}
    1.94 +	check_for_spaced_quotes(aline);
    1.95          /* check special case of 'S instead of 's at end of word */
    1.96          s=aline+1;
    1.97          while (*s)