#!/bin/sh

if test $# -lt 1
then
  echo usage: mod script[.top]
  exit 1
fi

# Relying on the environment variable $EXECUTABLE_TYPE6v2 to select the proper executable.

# program name:
PROGRAM=mod
VERSION=6v2
# the extension for the steering file:
EXT=.top
# the extension for the log output file:
LOG=.log
# select the nice level:
NICE=
# NICE=nice -20

# executable:
EXECUTABLE=${PROGRAM}${VERSION}_${EXECUTABLE_TYPE6v2}
# default steering file name for the $PROGRAM:
DEFAULT=${PROGRAM}

# avoid dirname because not standard:
DIR=`expr ${1-.}'/' : '\(/\)[^/]*/$' \
          \| ${1-.}'/' : '\(.*[^/]\)//*[^/][^/]*//*$' \| .`
ROOT=`basename $1 .top`
STEERF=${DIR}/${ROOT}.top
LOGF=${DIR}/${ROOT}.log

# for IBM RS6000, to make the ERR keyword in I/O work:
cnverr=yes ; export cnverr

# run the program:
$NICE ${EXECUTABLE} $STEERF > $LOGF
