spell..adding new words

Chris Torek chris at mimsy.umd.edu
Wed Nov 22 08:33:20 AEST 1989


In article <11615 at smoke.BRL.MIL> gwyn at smoke.BRL.MIL (Doug Gwyn) writes:
>System V flavors of "spell" support local word lists; RTFM again.
>For older flavors, you may have to add the words to the "local"
>file found in the source directory for the "spell" utility and
>perform a "make install" (which will run "spellin" and copy the
>resulting hash list file to the needed place).

Or add local word list support to your `spell' shell script:

*** /usr/bin/spell	Wed Sep  2 18:03:07 1987
--- /usr/local/bin/spell	Mon Sep 14 01:18:42 1987
***************
*** 3,4 ****
--- 3,5 ----
  #	@(#)spell.sh	1.3	(Berkeley)	83/09/10
+ #	@(#)spell.sh	(U of M Hacked: 10-Aug-84)
  #
***************
*** 5,6 ****
--- 6,10 ----
  : V data for -v, B flags, D dictionary, S stop, H history, F files, T temp
+ 
+ PATH=/usr/local/bin:/usr/ucb:/bin:/usr/bin
+ 
  V=/dev/null		B=			F= 
***************
*** 7,10 ****
  S=/usr/dict/hstop	H=/dev/null		T=/tmp/spell.$$
  next="F=$F@"
! trap "rm -f $T ${T}a ; exit" 0
  for A in $*
--- 11,21 ----
  S=/usr/dict/hstop	H=/dev/null		T=/tmp/spell.$$
+ T1=/tmp/spell1.$$
+ 
+ # next two are so that spell, spelltex, and spelllatex are almost identical,
+ # except of course for these lines:
+ ME=spell
+ DE="deroff at -w"	# @ is IFS when this is eval'd
+ 
  next="F=$F@"
! trap "rm -f $T $T1 ${T}a ; exit" 0
  for A in $*
***************
*** 20,24 ****
  	-h)	next="H=" ;;
! 	-*)	echo "Bad flag for spell: $A"
! 		echo "Usage:  spell [ -v ] [ -b ] [ -d hlist ] [ -s hstop ] [ -h spellhist ]"
! 		exit ;;
  	*)	eval $next"$A"
--- 31,35 ----
  	-h)	next="H=" ;;
! 	-*)	echo "Bad flag for $ME: $A" 1>&2
! 		echo "Usage: $ME [ -v ] [ -b ] [ -d hlist ] [ -s hstop ] [ -h spellhist ]" 1>&2
! 		exit 1;;
  	*)	eval $next"$A"
***************
*** 28,38 ****
  IFS=@
! case $H in
! /dev/null)	deroff -w $F | sort -u | /usr/lib/spell $S $T |
! 		/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 		sort -u +0f +0 - $T ;;
! *)		deroff -w $F | sort -u | /usr/lib/spell $S $T |
! 		/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 		sort -u +0f +0 - $T | tee -a $H
! 		who am i >> $H 2> /dev/null ;;
! esac
  case $V in
--- 39,91 ----
  IFS=@
! 
! # Cull out any words appearing in any file named in the environment
! # variable ``SPELL_LISTS''. Note that ``comm'' can't be instructed to
! # ignore case, so we must lower-caseify everything. (18-Jan-83 FLB)
! 
! if
! 	private_lists=`printenv SPELL_LISTS`
! then
! 
! #	Handle as in default, but dump output to T1
! 	case $H in
! 	/dev/null)	$DE $F | sort -u | /usr/lib/spell $S $T |
! 			/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 			sort -u +0f +0 - $T > $T1 ;;
! 	*)		$DE $F | sort -u | /usr/lib/spell $S $T |
! 			/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 			sort -u +0f +0 - $T | tee -a $H > $T1
! 			who am i >> $H 2> /dev/null ;;
! 	esac
! 
! #	Lower-caseify everything (ugh!)
! 	mv $T1 $T
! 	tr '[A-Z]' '[a-z]' < $T | sort -u +0f +0 > $T1
! 
! #	Comb out words appearing in user's private lists.
! 	for list in $private_lists
! 	do
! 		if
! 			[ -r "$list" ]
! 		then
! 			mv $T1 $T
! 			comm -23 $T "$list" > $T1
! 		else
! 			echo "$0: $list unreadable"
! 		fi
! 	done
! 	cat $T1
! 
! else
! #	Default case: handle as distributed by Berkeley
! 	case $H in
! 	/dev/null)	$DE $F | sort -u | /usr/lib/spell $S $T |
! 			/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 			sort -u +0f +0 - $T ;;
! 	*)		$DE $F | sort -u | /usr/lib/spell $S $T |
! 			/usr/lib/spell ${D-/usr/dict/hlista} $V $B |
! 			sort -u +0f +0 - $T | tee -a $H
! 			who am i >> $H 2> /dev/null ;;
! 	esac
! fi
! 
  case $V in

(I am not sure why Fred used printenv instead of simply examining
$SPELL_LISTS directly.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list