#! /bin/csh -f  
# @(#)save_config.sh	1.3	8/18/89
#
# save_config
#
#   sysdiag utility for saving sysdiag configuration
#
#   14-Oct-88
#

if (-e $file) then
    echo -n "file $file exists, o.k. to overwrite (y/n) ==> "
    set k = $<
    set ans = ($k)
    if ($ans == y) then
	\rm -f $file
    else if (ans == n) then
	exit 0
    else
	echo "$file not overwritten"
	exit 0
    endif
endif

echo "# this is a sysdiag saved-configuration file" > $file

if ($?DISK) then
    echo "set DISK" >> $file
else
    echo "unset DISK" >> $file
endif

if ($?MNTR) then
    echo "set MNTR" >> $file
else
    echo "unset MNTR" >> $file
endif

if ($?PMEM) then
    echo "set PMEM" >> $file
else
    echo "unset PMEM" >> $file
endif

if ($?VMEM) then
    echo "set VMEM" >> $file
else
    echo "unset VMEM" >> $file
endif

if ($?TAPET) then
    echo "set TAPET" >> $file
else
    echo "unset TAPET" >> $file
endif

if ($?ENET) then
    echo "set ENET" >> $file
else
    echo "unset ENET" >> $file
endif

if ($?PORT) then
    echo "set PORT" >> $file
else
    echo "unset PORT" >> $file
endif

if ($?MUX) then
    echo "set MUX" >> $file
    echo "@ NMUX = $NMUX" >> $file
else
    echo "unset MUX" >> $file
endif

if ($?FPUM) then
    echo "set FPUM" >> $file
else
    echo "unset FPUM" >> $file
endif

if ($?FPUI) then
    echo "set FPUI" >> $file
else
    echo "unset FPUI" >> $file
endif

if ($?FPUP) then
    echo "set FPUP" >> $file
else
    echo "unset FPUP" >> $file
endif

if ($?KEYMS) then
    echo "set KEYMS" >> $file
else
    echo "unset KEYMS" >> $file
endif

if ($?STRESS) then
    echo "set STRESS" >> $file
else
    echo "unset STRESS" >> $file
endif

if ($?VME) then
    echo "set VME" >> $file
else
    echo "unset VME" >> $file
endif

if ($?FLOP) then
    echo "set FLOP" >> $file
else
    echo "unset FLOP" >> $file
endif

if ($?PRE_MENU) then
    echo "set PRE_MENU" >> $file
else
    echo "unset PRE_MENU" >> $file
endif

if ($?POST_MENU) then
    echo "set POST_MENU" >> $file
else
    echo "unset POST_MENU" >> $file
endif

if ($?POST_MORE) then
    echo "set POST_MORE" >> $file
else
    echo "unset POST_MORE" >> $file
endif

if ($?LOOP) then
    echo "set LOOP" >> $file
else
    echo "unset LOOP" >> $file
endif

if ($?windows) then
    echo "set windows" >> $file
else
    echo "unset windows" >> $file
endif

if ($?dryrun) then
    echo "set dryrun" >> $file
else
    echo "unset dryrun" >> $file
endif

if ($?UNIXSCD) then
    echo "set UNIXSCD" >> $file
else
    echo "unset UNIXSCD" >> $file
endif

if ($?RMON) then
    echo "set RMON" >> $file
    echo "set RMONtime = $RMONtime" >> $file
else
    echo "unset RMON" >> $file
endif

if ($?W0_WAIT_CNT) echo "set W0_WAIT_CNT = $W0_WAIT_CNT" >> $file
if ($?W1_WAIT_CNT) echo "set W1_WAIT_CNT = $W1_WAIT_CNT" >> $file
if ($?W2_WAIT_CNT) echo "set W2_WAIT_CNT = $W2_WAIT_CNT" >> $file
if ($?W3_WAIT_CNT) echo "set W3_WAIT_CNT = $W3_WAIT_CNT" >> $file

if ($?LOGDIR) echo "set LOGDIR = $LOGDIR" >> $file

if ($?extra) echo "set extra = $extra" >> $file

