Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!dciem!nrcaer!cognos!garyp From: garyp@cognos.UUCP (Gary Puckering) Newsgroups: net.sources,net.sources.bugs Subject: ispell bug fix and enhancement Message-ID: <464@cognos.UUCP> Date: Tue, 24-Mar-87 15:23:46 EST Article-I.D.: cognos.464 Posted: Tue Mar 24 15:23:46 1987 Date-Received: Fri, 27-Mar-87 01:09:28 EST Reply-To: garyp@cognos.UUCP (Gary Puckering) Organization: Cognos Incorporated, Ottawa, Canada Lines: 65 Xref: dciem net.sources:6019 net.sources.bugs:1189 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(¤tchar,5); + while (*currentchar && isspace(*currentchar)) + copyout(¤tchar, 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(¤tchar, 3); + while (*currentchar && isspace(*currentchar)) + copyout(¤tchar, 1); + while (*currentchar && !isspace(*currentchar)) + copyout(¤tchar, 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