#!/bin/ksh
# ruc -- Run CONGEN on an input file, and take congen from the local
#        directory, or an alternate directory if specified.

#base=`basename $0`
#usage="Usage: $base [-i] [-n niceval] input-file"
#if [ $base = "ruc" ] 
#then
#	usage="$usage [CONGEN-executable-directory]"
#fi

NICEVAL=4
while [ x"$1" != x ] ; do
    case $1 in
	-i) NICEVAL=0
	    shift
	    continue ;;
	-n) NICEVAL=$2
	    shift 2
	    continue ;;
	-*) echo >2 "Unknown switch: " $1
	    exit 2 ;;
        *)  break ;;
    esac
done

case $# in
1 ) dir=. ;;
2 ) dir=$2 ;;
* ) echo "Incorrect number of arguments."
    exit 2 ;;
esac

nice -${NICEVAL} ${dir}/congen <$1.inp >$1.out 2>&1


