#! /bin/sh
# Copyright (c) 1990-1993 The MITRE Corporation
# 
# Authors: W. M. Farmer, J. D. Guttman, F. J. Thayer
#   
# The MITRE Corporation (MITRE) provides this software to you without
# charge to use, copy, modify or enhance for any legitimate purpose
# provided you reproduce MITRE's copyright notice in any copy or
# derivative work of this software.
# 
# This software is the copyright work of MITRE.  No ownership or other
# proprietary interest in this software is granted you other than what
# is granted in this license.
# 
# Any modification or enhancement of this software must identify the
# part of this software that was modified, by whom and when, and must
# inherit this license including its warranty disclaimers.
# 
# MITRE IS PROVIDING THE PRODUCT "AS IS" AND MAKES NO WARRANTY, EXPRESS
# OR IMPLIED, AS TO THE ACCURACY, CAPABILITY, EFFICIENCY OR FUNCTIONING
# OF THIS SOFTWARE AND DOCUMENTATION.  IN NO EVENT WILL MITRE BE LIABLE
# FOR ANY GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY OR
# SPECIAL DAMAGES, EVEN IF MITRE HAS BEEN ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGES.
# 
# You, at your expense, hereby indemnify and hold harmless MITRE, its
# Board of Trustees, officers, agents and employees, from any and all
# liability or damages to third parties, including attorneys' fees,
# court costs, and other related costs and expenses, arising out of your
# use of this software irrespective of the cause of said liability.
# 
# The export from the United States or the subsequent reexport of this
# software is subject to compliance with United States export control
# and munitions control restrictions.  You agree that in the event you
# seek to export this software or any derivative work thereof, you
# assume full responsibility for obtaining all necessary export licenses
# and approvals and for assuring compliance with applicable reexport
# restrictions.
# 
# 
# COPYRIGHT NOTICE INSERTED: Mon May 24 16:51:06 EDT 1993


usage="Usage: `basename $0` [tmp_file [section]]"
tmp=/NFS/imps/jt/dumpo

section=foundation

if test "$1" = "-h"
then 
  echo $usage
  exit 1
fi

if test $1 
then 
  tmp=$1
fi 
if test $2 
then 
  section=$2
fi 

linked=$IMPS/../executables/$section

export tmp 
export section

if (echo "("load-section $section")" ; cat $IMPS/../src/section_script.t ) | $IMPS/../executables/imps_dump -h 24000000 >  $IMPS/../etc/dump_imps_out
then echo "T Done, linking...."
else
 cat $IMPS/../etc/dump_imps_out
 /bin/rm $tmp.o
 exit 1
fi 

cd $TSYSTEM
if linkt $tmp.o $tmp
then 
  echo "Linkt successful; installing..."
  if test -f $linked
  then 
    mv $linked $linked.bak
  fi
  mv $tmp $linked
  rm $tmp.o 
else 
 /bin/rm $tmp.o
 exit 1
fi
echo "installing successful; Imps dump of $section completed"

