#! /bin/sh
# don't source this file. It changes the enviornment !!

if [ `mwgetmode` = "virtual" ]; then
   is_standard_mode=0
else
   is_standard_mode=1
fi

if [ $is_standard_mode -eq 1 ]; then
    tmpfile=/tmp/regbackup$$
    regbackup $tmpfile > /dev/null
    if [ $? -ne 0 ]; then
	echo regbackup failed! 
	echo You must be MainWin administrator to run $0 in standard mode.
	exit 1
    fi
    MWREGISTRY=$tmpfile
    export MWREGISTRY
fi

${MWHOME}/lib-${MWOS}/mwregvalid > /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
    echo The binary structure of the registry file is valid.
else
    echo The binary structure of the registry file is NOT valid !!!
fi

if [ $is_standard_mode -eq 1 ]; then
    rm -f $MWREGISTRY
fi


