#!/bin/sh
#
# A front-end to ispell which allows it to act like the "spell" program
#
# Ispell command line switches-handling added by David Frey <david@eos.lugs.ch>

WORDCHARS=""
# XXX Latin1-centric

ARGS=""
while getopts aAbBcCd:Def:lLMN:p:PsStTw:vV s; do
  case $s in
   a|A|c|e|f|l|L|M|N)	;; # ignored
   b|B|C|n|m|P|S|t|x|V)	ARGS="$ARGS -$s" ;; # pass these options through
   d|p|W|T)         	ARGS="$ARGS -$s $OPTARG" ;; # options with params
   w)			WORDCHARS="$OPTARG" ;; 
  esac
done
shift `expr $OPTIND - 1`

case $# in
	0)	ispell -l -w $WORDCHARS $ARGS| sort | uniq ;;
	*)	cat $* | ispell -l -w $WORDCHARS $ARGS| sort | uniq ;;
esac
