ispell mods

billr at tekred.UUCP billr at tekred.UUCP
Fri Jan 30 11:19:58 AEST 1987


After snarfing bobm at rtech's recent ispell enhancements, I applied the
previously posted diffs for the 'L' (lookup) command to the new changes.
(I also added some code that will use the look(1) command when no
wildcards are specified.) Since the 'L' command looks up words in
/usr/dict/web2 it can used to verify spelling of words that you
think are correct but are not in ispell's dictionary.
For those of you who may wish to do the same, here are a new set of
diffs suitable for "patch" or for hand editing.
	-------cut here------
# The rest of this file is a shell script which will extract:
# config.h.diff ispell.c.diff ispell.man.diff
echo x - config.h.diff
sed -e 's/^X//' >config.h.diff <<'!Funky!Stuff!'
X21a22,30
X> /* define LOOK if look(1) command is available */
X> #define LOOK
X> 
X> /* path to egrep (use speeded up version if available) */
X> #define EGREPCMD "/usr/local/egrep"
X> 
X> /* path to wordlist for Lookup command (typically /usr/dict/{words|web2} */
X> #define WORDS	"/usr/dict/web2"
X> 
!Funky!Stuff!
echo x - ispell.c.diff
sed -e 's/^X//' >ispell.c.diff <<'!Funky!Stuff!'
X59a60
X> 	printf ("L       Look up words in system dictionary.\r\n");
X62c63
X< 	printf ("X       Exit immediately.  Asks for conformation.  ");
X---
X> 	printf ("X       Exit immediately.  Asks for confirmation.  ");
X523a525,539
X> 		case 'l': case 'L':
X> 			{
X> 				char buf[100];
X> 				move (18, 0);
X> 				printf ("Lookup string ('*' is wildcard): ");
X> 				if (getline (buf) == NULL) {
X> 					putchar (7);
X> 					erase ();
X> 					goto checkagain;
X> 				}
X> 				printf ("\r\n\r\n");
X> 				lookharder (buf);
X> 				erase ();
X> 				goto checkagain;
X> 			}
X819a836,866
X> }
X> 
X> lookharder(string)
X> char *string;
X> {
X> 	char cmd[150];
X> 	char *g, *s, grepstr[100];
X> 	int wild = 0;
X> 
X> 	g = grepstr;
X> 	for (s = string; *s != '\0'; s++)
X> 		if (*s == '*') {
X> 			wild++;
X> 			*g++ = '.';
X> 			*g++ = '*';
X> 		} else
X> 			*g++ = *s;
X> 	*g = '\0';
X> 	if (grepstr[0]) {
X> #ifdef LOOK
X> 		if (wild)
X> 			/* string has wild card characters */
X> 			sprintf (cmd, "%s -i '^%s$' %s", EGREPCMD, grepstr, WORDS);
X> 		else
X> 			/* no wild, use look(1) */
X> 			sprintf (cmd, "/usr/bin/look -df %s %s", grepstr, WORDS);
X> #else
X> 		sprintf (cmd, "%s -i '^%s$' %s", EGREPCMD, grepstr, WORDS);
X> #endif
X> 		shellescape (cmd);
X> 	}
!Funky!Stuff!
echo x - ispell.man.diff
sed -e 's/^X//' >ispell.man.diff <<'!Funky!Stuff!'
X53a54,55
X> If you want to see a list of words that might be close using wildcard
X> characters, type "L" to lookup a word in the system dictionary.
X131c133
X< <ispell library directory>/ispell.hash
X---
X> /usr/public/lib/ispell.hash
X133c135,139
X< $HOME/ispell.words
X---
X> /usr/dict/web2		for the Lookup function
X> .br
X> $HOME/ispell.words	user's private dictionary
X> .SH SEE ALSO
X> spell(1), egrep(1), look(1)
!Funky!Stuff!
-- 

	-Bill Randle
	Tektronix, Inc.
	billr at tekred.TEK.COM



More information about the Comp.sources.unix mailing list