Commit | Line | Data |
---|---|---|
94bed826 | 1 | #!/bin/sh - |
b8a73b3a | 2 | # |
b8e6ef5e KB |
3 | # Copyright (c) 1983, 1993 |
4 | # The Regents of the University of California. All rights reserved. | |
b8a73b3a | 5 | # |
94bed826 KB |
6 | # %sccs.include.proprietary.sh% |
7 | # | |
b8e6ef5e | 8 | # @(#)spell.sh 8.1 (Berkeley) %G% |
94bed826 KB |
9 | # |
10 | ||
6379139f | 11 | : V data for -v, B flags, D dictionary, S stop, H history, F files, T temp |
b78eab0a | 12 | : R for deroff program |
6379139f | 13 | V=/dev/null B= F= |
f5506e0f | 14 | S=/usr/share/dict/hstop H=/dev/null T=/tmp/spell.$$ |
b78eab0a MK |
15 | R="deroff@-w" |
16 | ||
6379139f KM |
17 | next="F=$F@" |
18 | trap "rm -f $T ${T}a ; exit" 0 | |
b8a73b3a KM |
19 | for A in $* |
20 | do | |
21 | case $A in | |
96d0feec | 22 | -v) B="$B@-v" |
b8a73b3a | 23 | V=${T}a ;; |
96d0feec | 24 | -x) B="$B@-x" ;; |
f5506e0f | 25 | -b) D=${D-/usr/share/dict/hlistb} |
96d0feec | 26 | B="$B@-b" ;; |
6379139f KM |
27 | -d) next="D=" ;; |
28 | -s) next="S=" ;; | |
29 | -h) next="H=" ;; | |
b78eab0a MK |
30 | -t) R=detex ;; |
31 | -l) R=delatex ;; | |
f5506e0f | 32 | -*) echo "spell: illegal option -- $A" |
b78eab0a | 33 | echo "usage: spell [-bvtl] [-d hlist] [-s hstop] [-h spellhist]" |
6379139f KM |
34 | exit ;; |
35 | *) eval $next"$A" | |
36 | next="F=$F@" ;; | |
b8a73b3a | 37 | esac |
6379139f KM |
38 | done |
39 | IFS=@ | |
40 | case $H in | |
9463d4ea | 41 | /dev/null) eval $R $F | sort -u | /usr/libexec/spell $S $T | |
f5506e0f | 42 | /usr/libexec/spell ${D-/usr/share/dict/hlista} $V $B | |
6379139f | 43 | sort -u +0f +0 - $T ;; |
9463d4ea | 44 | *) eval $R $F | sort -u | /usr/libexec/spell $S $T | |
f5506e0f | 45 | /usr/libexec/spell ${D-/usr/share/dict/hlista} $V $B | |
6379139f KM |
46 | sort -u +0f +0 - $T | tee -a $H |
47 | who am i >> $H 2> /dev/null ;; | |
48 | esac | |
b8a73b3a | 49 | case $V in |
6379139f | 50 | /dev/null) exit ;; |
b8a73b3a | 51 | esac |
96d0feec | 52 | sed '/^\./d' $V | sort -u +1f +0 |