#!/bin/rc
rfork ne
db='*'
dot=()
cmd=DEFINE
fn usage {
echo Usage: fdict [-lm] [-d database] word >[1=2]
exit usage
}
if(~ $#* 0)
usage
while(! ~ $#* 0 && ~ $1 -*) {
switch ($1) {
case -d
db=$2
shift
case -l
show='SHOW DB'
case -m
cmd=MATCH
dot=.
case -*
usage
}
shift
}
{
if(! ~ $# 0)
echo $cmd $db $dot $*
echo $show
echo QUIT
} |
con -nrl tcp!dict.org!2628 |
sed '/^[0-9][0-9][0-9] /d; /^$/d; /^.$/d'
|