#!/bin/sh

#
#
# read_media tapeset:tapenum mediaFile
#
# prints to stdout the media information obtained from mediaFile
#
#############################################################################
#
#	Copyright (C) Cadence Design Systems, Inc. All rights
#	reserved.  Unpublished -- rights reserved under the
#	copyright laws of the United States of America.
#
#			RESTRICTED RIGHTS LEGEND
#	Use, duplication, or disclosure by the Government is subject
#	to restrictions as set forth in subparagraph (c)(l)(ii) of 
#	the Rights in Technical Data and Computer Software clause 
#	at DFARS 52.227-7013.
#
#			Cadence Design Systems, Inc.
#			555 River Oaks Parkway
#			San Jose, CA 95134	USA
#
#############################################################################
BOURNE=/bin/sh
XTERMPATH=/usr/openwin/bin
XTERMBIN=xterm
XTERMOPTS="-T 'SoftLoad 6.0 Console' -fn 9x15  -sl 200 -g 80x40+0+0 -bg \#e0e0e0 -fg \#800000 -sb -e ${BOURNE} softload_GUI"
sysPATH=/bin:/usr/bin:/usr/ucb:$XTERMPATH

jsr=''

test -z "$bin_dir"  && bin_dir=`pwd`;           export bin_dir

tapesetID=$1;     shift
mediaMap=$1

if [ -s $mediaMap ]; then
   mediaType=`awk '/^'$tapesetID' / {print $2}' $mediaMap`
   mediaTxt="`awk '/^'$tapesetID' / {print $3}' $mediaMap`"
fi

test "$mediaType" = "" && mediaType=UNKNOWN

case $mediaType in
  TAPE)   media="tape" ;;
  CDROM)  media="CD-ROM" ;;
esac

test "$mediaTxt" = "" && mediaTxt="the~$tapesetID~$media"

if [ $mediaType = UNKNOWN ]; then
   cat - <<EOF_DATAFILE
echo "
SL-8: No information available on $tapesetID.
Call the Cadence Customer Response Center (CRC) at 1-800-Cadenc2
(1-800-223-3622) to get the right $mediaMap file."
exit 1
EOF_DATAFILE
else
   cat - <<EOF_DATAFILE
media=$media
mediaTxt=$mediaTxt
mediaType=$mediaType
EOF_DATAFILE
fi
