#!/bin/sh
# ESS[BUGS]:  02/18/2004
# runs BUGS taking commands from command file
#

case `config.guess` in
    alpha*-dec-*)       BUGS=bugs05.decalpha;;
    hppa*-hp-hpux*)     BUGS=bugs05.hp;;
    i?86-pc-cygwin)     BUGS=bugs05.exe;;
    i?86-*-freebsd*)    BUGS=bugs05.freebsd;;
    powerpc*-*-*)       BUGS=bugs05.rs6000;;
    sparc-sun-solaris*) BUGS=bugs05.sparc;;
    mips-sgi-irix*)     BUGS=bugs05.sgi;;
    mips-dec-*)         BUGS=bugs05.decmips;;
esac

case $# in
     1) test -f bugs.bog && rm -f bugs.bog || true
	$BUGS bugs.buf bugs.bog bugs.out bugs.ind bugs1.out bugs1.ind $1
	chmod -w bugs.bog
	;;
     2) test -f $1.bog && rm -f $1.bog || true
	$BUGS $1.buf $1.bog $1.out $1.ind ${1}1.out ${1}1.ind $2
	chmod -w $1.bog
	;;
     *) echo "usage: $0 [default_output_name] command_file";;
esac
