#!/bin/sh
#
# jump - show jumpering of target and associated boards
#
# modification history
# --------------------
# 01i,01may89,gae   include vw/lib/host/vxWorks.a on cc line for copyright.
# 01h,30mar89,gae   fixed 'trap' to always delete temp files on termination.
# 01h,29sep88,gae   documentation
# 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 derived from the parameters
# in the config.h of the specified directory.
# 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
#
# WARNING
# Not all target CPU's have 100% reliable pictures.
# Verify with board's hardware manual.
#
# FILES
#  vw/bin/pic.o               pictures for network boards
#  vw/config/<cpu>/pic_cpu.c  target CPU's picture program
#*/

tool=`basename $0`
tmp=/tmp
prog=/tmp/$tool.$$
trap "rm -f $tmp/pic_cpu.o $prog; exit 1" 0 1 2 3 15

# pick up any options

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

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

cd $1

if (test ! -f "pic_cpu.c") then
    echo "$tool: no pic_cpu.c file."
    exit 1
fi

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

echo "$tool: making pictures..."
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 $prog $work/pic_cpu.c $vw/bin/pic.o $vw/lib/host/vxWorks.a

$prog $switches $1

exit 0
