bug in Andrew Large's "sp" spell checker + patch

Richard Robison rr at chmsr
Sun Jan 1 07:32:14 AEST 1989


I would have sent this to Andrew, but I can't find his e-mail address.

-Richard


Problem:

On a Sun 3 running SunOS 4.0 changes made during spell check session will
not save.

Fix:

I noticed Andrew was fclose'ing a popen'ed FILE pointer.  Changing fclose
to pclose fixes the problem.  The patch is listed below.


*** doc_correct.c.orig	Wed Dec  7 16:50:19 1988
--- doc_correct.c	Wed Dec  7 16:50:31 1988
***************
*** 23,29 ****
  		if (strcmp (bad_words[loop], good_words[loop]) != 0)
  			fprintf (ex_ptr, "%%s/\\<%s\\>/%s/g\n", bad_words[loop],
  				good_words[loop]);
! 	fprintf (ex_ptr, "w\nq\n"); fclose (ex_ptr);
  
  	addstr (" done"); refresh ();
  }
--- 23,29 ----
  		if (strcmp (bad_words[loop], good_words[loop]) != 0)
  			fprintf (ex_ptr, "%%s/\\<%s\\>/%s/g\n", bad_words[loop],
  				good_words[loop]);
! 	fprintf (ex_ptr, "w\nq\n"); pclose (ex_ptr);
  
  	addstr (" done"); refresh ();
  }

*** spell.c.orig	Wed Dec  7 17:56:31 1988
--- spell.c	Wed Dec  7 17:56:44 1988
***************
*** 57,63 ****
  		else
  			bad_words[i][strlen (bad_words[i]) - 1] = '\0';
  	}
! 	fclose (spell_out);
  
  	if ((num_bad = i) >= MAX_WORDS) {
  		getyx (stdscr, ypos, xpos);
--- 57,63 ----
  		else
  			bad_words[i][strlen (bad_words[i]) - 1] = '\0';
  	}
! 	pclose (spell_out);
  
  	if ((num_bad = i) >= MAX_WORDS) {
  		getyx (stdscr, ypos, xpos);
Richard Robison

UUCP:	rr at chmsr.UUCP
        {backbones}!gatech!chmsr!rr
INTERNET:	rr at chmsr.gatech.edu



More information about the Comp.sources.bugs mailing list