#! /bin/sh
#
# usage:        undotarZ.sh
#
# abstract:     This Bourne Shell script checks to see if a compressed
#		tar file is there. If so, it decompresses and untars the
#		files from the single matlab.Z file. This file is
#		currently made by the 9 track distribution.
#
# note(s):      1. This routine must be called using a . (period)
#
# Copyright (c) 1992-1998 The Mathworks, Inc. All Rights Reserved.
# $Revision: 1.7 $  $Date: 1998/12/24 17:31:51 $
#----------------------------------------------------------------------------
#
# Check for file. If not then do nothing.
#
    cd $ML_ROOT_DIR
    if [ -f matlab.Z ]; then
	. $dir/$clearsc_sh
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ''
    echo '               Found compressed distribution file (matlab.Z)'
    echo '               ---------------------------------------------'
    echo ''
    echo 'Decompressing distribution file . . .'
    echo ''
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	uncompress -v matlab.Z
	if [ $? -ne 0 ]; then
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ''
    echo '    Decompression failed.'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	    . $dir/$abort_sh
	else
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ''
    echo 'Extract files from distribution file using tar.'
    echo ''
    echo 'This will take a while . . .'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	    tar -xvf matlab > tar.list 2>&1
	    if [ $? -ne 0 ]; then
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ''
    echo '    Extraction failed. See the file $MATLAB/tar.list for output.'
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	    . $dir/$abort_sh
	    fi
	fi
	rm -f matlab > /dev/null 2>&1
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    echo ''
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        . $dir/$cont_sh
    fi
    cd $WD
