[net.sources.bugs] ispell bug fix and enhancement

garyp@cognos.UUCP (Gary Puckering) (03/24/87)

The following is a patch to ispell.c which will improve handling of nroff
and troff requests.  It is far from perfect, but it does eliminate some of
the most common pitfalls, namely the definition of register and macro names.

This patch is based on the version of ispell recently reposted by Geoff
Kuenning.  It also contains a fix which Geoff (and others) missed, namely
the removal of an unnecessary (and unwanted) carriage return which appears
at the end of the output line in -l mode.

You should be able to just run this through patch.

*** ispell.c.orig	Tue Mar 24 14:53:39 1987
--- ispell.c	Tue Mar 24 15:08:45 1987
***************
*** 311,313 ****
  	if ((infile = fopen (tempfile, "r")) == NULL) {
! 		fprintf (stderr, "tempoary file disappeared (%s)\r\n", tempfile);	
  		sleep (2);
--- 311,313 ----
  	if ((infile = fopen (tempfile, "r")) == NULL) {
! 		fprintf (stderr, "temporary file disappeared (%s)\r\n", tempfile);	
  		sleep (2);
***************
*** 360,361 ****
--- 360,385 ----
  		len = strlen (secondbuf) - 1;
+ 
+ 		/* skip over .if */
+ 		if (strncmp(currentchar,".if t",5) == 0 
+ 		||  strncmp(currentchar,".if n",5) == 0) {
+ 			copyout(&currentchar,5);
+ 			while (*currentchar && isspace(*currentchar)) 
+ 				copyout(&currentchar, 1);
+ 		}
+ 
+ 		/* skip over .ds XX or .nr XX */
+ 		if (strncmp(currentchar,".ds ",4) == 0 
+ 		||  strncmp(currentchar,".de ",4) == 0
+ 		||  strncmp(currentchar,".nr ",4) == 0) {
+ 			copyout(&currentchar, 3);
+ 			while (*currentchar && isspace(*currentchar)) 
+ 				copyout(&currentchar, 1);
+ 			while (*currentchar && !isspace(*currentchar))
+ 				copyout(&currentchar, 1);
+ 			if (*currentchar == 0) {
+ 				if (!lflag) putc ('\n', outfile);
+ 				continue;
+ 			}
+ 		}
+ 
  		if (secondbuf [ len ] == '\n')
***************
*** 420,422 ****
  				if (!good (token)  &&  !cflag)
! 					printf ("%s\r\n", token);
  			} else {
--- 444,447 ----
  				if (!good (token)  &&  !cflag)
! 					if (lflag) printf ("%s\n", token);
! 					else       printf ("%s\r\n", token);
  			} else {
-- 
Gary Puckering        3755 Riverside Dr.
Cognos Incorporated   Ottawa, Ontario       decvax!utzoo!dciem!
(613) 738-1440        CANADA  K1G 3N3       nrcaer!cognos!garyp

geoff@desint.UUCP (03/29/87)

Many thanks to Gary for his improvement.  People who have installed
this fix might want to hang onto their .orig files, as my first "official"
patch for ispell will probably include this change.

As long as I'm posting, let me take the opportunity to both thank those
who have sent me bug fixes and changes, and also to ask for more of same.
If you have done something useful to ispell, I'd love to get a copy.
When things settle down a bit and I've integrated everything to my
satisfaction, I'll submit it to mod.sources.
-- 

	Geoff Kuenning
	{hplabs,ihnp4}!trwrb!desint!geoff