#!/bin/sh
#
# jump	- show the jumpering of a target and associated boards
#
# modification history
# --------------------
# 01g,22aug88,gae   documentation
# 01f,02may88,gae   cc flags now include all/h for configAll.h.
# 01e,25apr88,gae   checked for pic_cpu.c before cc'ing.
# 01d,15mar88,gae   uses pic_cpu.c in working directory.
# 01c,09dec87,jcf   changed location of config_sym.c
# 01b,19nov87,gae   added parameter check.
# 01a,18nov87,jcf   written
#
# SYNOPSIS: jump [-a] dir
#
# DESCRIPTION
# jump is a utility to aid users in jumpering VME boards.
# The pictures generated are formed correctly given the parameters defined
# in the config.h in the directory that is specified.
# The only flag is -a which outputs all of the boards.
#
# EXAMPLES
# jump ../config/hkv2f                 # prompt user for boards
# jump -a ../config/hkv2f | lpr        # output all boards on the line printer
#
# FILES
# bin/pic.o     - pictures for network boards, in jump's directory
#*/

tmp=/tmp
jj=/tmp/jump.$$
trap "rm -f $tmp/pic_cpu.o $jj; exit" 0 1 2 15

# pick up any options

readoptions=true
while ($readoptions) do
    case "$1" in
	-a ) switches=$1; shift ;;
	-* ) echo "jump: invalid option $1"; exit ;;
	*  ) readoptions=false	;;
    esac
done

if (test $# -lt 1) then
    echo "usage: jump [-a] dir"
    exit
fi

cd $1

if (test ! -f "pic_cpu.c") then
    echo "No pic_cpu.c file."
    exit
fi

work=`pwd`
vw=$work/../../
cd $tmp

echo "Making pictures.  Please be patient..."
echo

# set shell exit if cc blows up
set -e

INCLUDES="-I$work -I$vw/config/all -I$vw/h"
CFLAGS="$INCLUDES"

cc $CFLAGS -o $jj $work/pic_cpu.c $vw/bin/pic.o

$jj $switches $1

exit
