xref: /plan9/acme/bin/aspell (revision 7dd7cddf99dd7472612f1413b4da293630e6b1bc)
1#!/bin/rc
2
3spellflags=()
4fflag=''
5for(x){
6	switch($x){
7	case -[bcvx]
8		spellflags=($spellflags $x)
9	case -f
10		fflag=$x
11	case *
12		if(~ $fflag -f)	{
13			spellflags=($spellflags -f $x)
14			fflag=''
15		}
16		if not args = ($args $x)
17	}
18}
19
20dir = /mnt/wsys
21if(! test -f $dir/cons)
22	dir = /mnt/term/$dir
23id=`{cat $dir/new/ctl}
24id=$id(1)
25
26if(~ $#args 1 && ~ $args /*){
27	adir = `{basename -d $args}
28	args = `{basename $args}
29	echo 'name '^$adir^/-spell > $dir/$id/ctl
30	cd $adir
31}
32if not {
33	echo 'name '^`{pwd}^/-spell > $dir/$id/ctl
34}
35
36{
37	echo noscroll
38	if(~ $#args 0)
39		/acme/bin/$cputype/spout | sort  -t: -u +2 | sort  -t: +1.1n | aux/sprog -a $spellflags > $dir/$id/body
40	if not for(i in $args)
41		/acme/bin/$cputype/spout $i | sort  -t: -u +2 | sort  -t: +1.1n | aux/sprog -a $spellflags > $dir/$id/body
42	echo clean
43}> $dir/$id/ctl
44