Break check_for_starting_punctuation() out
authorali <ali@juiblex.co.uk>
Sat May 25 19:35:44 2013 +0100 (2013-05-25)
changeset 46aa45307a6328
parent 45 d48f66b0ad0d
child 47 7522c36859d0
Break check_for_starting_punctuation() out
bookloupe/bookloupe.c
     1.1 --- a/bookloupe/bookloupe.c	Sat May 25 19:27:51 2013 +0100
     1.2 +++ b/bookloupe/bookloupe.c	Sat May 25 19:35:44 2013 +0100
     1.3 @@ -1152,6 +1152,25 @@
     1.4  }
     1.5  
     1.6  /*
     1.7 + * check_for_starting_punctuation:
     1.8 + *
     1.9 + * Look for punctuation other than full ellipses at start of line.
    1.10 + */
    1.11 +void check_for_starting_punctuation(const char *aline)
    1.12 +{
    1.13 +    if (*aline && strchr(".?!,;:",aline[0]) && strncmp(". . .",aline,5))
    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 1 - Begins with punctuation?\n",
    1.19 +	      linecnt);
    1.20 +	else
    1.21 +	    cnt_punct++;
    1.22 +    }
    1.23 +}
    1.24 +
    1.25 +/*
    1.26   * procfile:
    1.27   *
    1.28   * Process one file.
    1.29 @@ -1391,17 +1410,7 @@
    1.30          last.blen=last.len;
    1.31          last.len=strlen(aline);
    1.32          last.start=aline[0];
    1.33 -        /* Look for punctuation other than full ellipses at start of line. */
    1.34 -        if (*aline && strchr(".?!,;:",aline[0]) && strncmp(". . .",aline,5))
    1.35 -	{
    1.36 -	    if (pswit[ECHO_SWITCH])
    1.37 -		printf("\n%s\n",aline);
    1.38 -	    if (!pswit[OVERVIEW_SWITCH])
    1.39 -		printf("    Line %ld column 1 - Begins with punctuation?\n",
    1.40 -		  linecnt);
    1.41 -	    else
    1.42 -		cnt_punct++;
    1.43 -	}
    1.44 +	check_for_starting_punctuation(aline);
    1.45          /*
    1.46  	 * Check for spaced em-dashes.
    1.47           * We must check _all_ occurrences of "--" on the line