:	'(c) Copyright	Empress Software Inc.	1983, 2000'

USAGE="*** Usage ***  $0  internal use only"

case "$EMPRESSPATH/rdbms" in
 "")	echo "$USAGE"; exit 1;;
esac

case "$EMPSVUTL_CALL" in
 "")	echo "$USAGE"; exit 1;;
esac

NLSECHO="$EMPRESSPATH/common/nls/nlsecho"
UI_E0_SVUTL_0010=10229
UI_E0_SVUTL_0015=10230
UI_E0_SVUTL_100=10234
UI_E0_SYNERROR_010=10231
UI_E0_SYNERROR_020=10232
UI_E0_SYSNERROR_030=10235

TRUE=yes
FALSE=no

case $# in
 1)	
	OUTFILE=$1

	if test -d $OUTFILE
	then
	   $NLSECHO "*** User Error *** \"%s\" is directory " \
		$UI_E0_SVUTL_0010 $OUTFILE
	   exit 1
	fi

	if test -f $OUTFILE
	then
	   exec $0 $OUTFILE $OUTFILE < $OUTFILE
        else
	   $NLSECHO "*** User Error *** \"%s\" not found " $UI_E0_SVUTL_0015 \
$OUTFILE
	   exit 1
	fi
	;;
 2)	OUTFILE=$1
	;;
 *)	echo "$USAGE";  exit 1;;
esac

BLK_LINE_NUM=0
INET_BLK_LINE=0
LINECOUNT=0

while :
do
   read INPUT
   case $? in
     0) ;;
     *) break ;;
   esac
   INPUT=`echo $INPUT`		: get rid of tab and spaces
   LINECOUNT=`expr $LINECOUNT + 1`

   case $INPUT in
     "") continue ;;
     ":"*) continue ;;
     MSSERVERNAME=*) ;;
     MSSERVERHOSTNAME=*) ;;
     MSSERVERNPROCS=*) ;;
     MSSERVERADMINISTRATOR=*) ;;
     MSSERVERNETTYPE=*) ;;
     MSINETPORT=*) ;;
     MSINETREPLYTIMEOUT=*) ;;
     MSINETREPLYRETRY=*) ;;
     MSINETMESSAGETIMEOUT=*) ;;
     MSINETMESSAGERETRY=*) ;;
     MSINETPACKETTIMEOUT=*) ;;
     MSINETPACKETRETRY=*) ;;
     MSSERVERNETEND) ;;
     MSSERVEREND) ;;
     *) $NLSECHO "*** Syntax Error *** line %s " $UI_E0_SYNERROR_010 $LINECOUNT
   	exit 1 ;;
   esac
          
   case $BLK_LINE_NUM in
      0) 
        case $INPUT in
	   MSSERVERNAME=*) BLK_LINE_NUM=1
   	      continue
   		;;
   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNAME 
   		exit 1
   		;;
        esac
        ;;
      1)
        case $INPUT in
   	   MSSERVERHOSTNAME=*) BLK_LINE_NUM=2
   		continue
   		;;
   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERHOSTNAME 
   		exit 1
   		;;
        esac
        ;;
      2)
        case $INPUT in
   	   MSSERVERNPROCS=*) BLK_LINE_NUM=3
   		continue
   		;;
   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNPROCS 
   		exit 1
   		;;
        esac
        ;;
      3)
        case $INPUT in
   	   MSSERVERADMINISTRATOR=*) BLK_LINE_NUM=4
   		continue
   		;;
   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERADMINISTRATOR 
   		exit 1
   		;;
        esac
        ;;
      4)
        case $INPUT in
   	   MSSERVERNETTYPE=*) BLK_LINE_NUM=5
   		INET_BLK_LINE=a
   		continue
   		;;
   	*) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETTYPE 
   		exit 1
   		;;
        esac
        ;;
      5)

: start of inet block 
	case $INET_BLK_LINE in
	   a)
        	case $INPUT in
		   MSINETPORT=*) INET_BLK_LINE=b
   			continue
   			;;
   	   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSINETPORT 
   			exit 1
	   		;;
 	        esac
	        ;;
	   b)
		case $INPUT in
		   MSINETREPLYTIMEOUT=*) INET_BLK_LINE=c ; continue ;;
		   MSINETREPLYRETRY=*) INET_BLK_LINE=d ; continue ;;
		   MSINETMESSAGETIMEOUT=*) INET_BLK_LINE=e ; continue ;;
		   MSINETMESSAGERETRY=*) INET_BLK_LINE=f ; continue ;;
		   MSINETPACKETTIMEOUT=*) INET_BLK_LINE=g ; continue ;;
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   c)
		case $INPUT in
		   MSINETREPLYRETRY=*) INET_BLK_LINE=d ; continue ;;
		   MSINETMESSAGETIMEOUT=*) INET_BLK_LINE=e ; continue ;;
		   MSINETMESSAGERETRY=*) INET_BLK_LINE=f ; continue ;;
		   MSINETPACKETTIMEOUT=*) INET_BLK_LINE=g ; continue ;;
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   d)
		case $INPUT in
		   MSINETMESSAGETIMEOUT=*) INET_BLK_LINE=e ; continue ;;
		   MSINETMESSAGERETRY=*) INET_BLK_LINE=f ; continue ;;
		   MSINETPACKETTIMEOUT=*) INET_BLK_LINE=g ; continue ;;
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   e)
		case $INPUT in
		   MSINETMESSAGERETRY=*) INET_BLK_LINE=f ; continue ;;
		   MSINETPACKETTIMEOUT=*) INET_BLK_LINE=g ; continue ;;
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   f)
		case $INPUT in
		   MSINETPACKETTIMEOUT=*) INET_BLK_LINE=g ; continue ;;
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   g)
		case $INPUT in
		   MSINETPACKETRETRY=*) INET_BLK_LINE=h ; continue ;;
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   h)
		case $INPUT in
		   MSINETMAXPACKETSIZE=*) INET_BLK_LINE=i ; continue ;;
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	   i)
		case $INPUT in
		   MSSERVERNETEND) BLK_LINE_NUM=6 
				   INET_BLK_LINE=0; continue ;;
		   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVERNETEND 
		      exit 1
		      ;;
 		esac
 		;;
	 esac
: 	end of inet block
	 ;;

      6)
        case $INPUT in
   	   MSSERVEREND) BLK_LINE_NUM=0
   		continue
   		;;
   	   *) $NLSECHO "*** Syntax Error *** line %s : %s not found" \
$UI_E0_SYNERROR_020 $LINECOUNT MSSERVEREND 
   		exit 1
   		;;
        esac
        ;;
   esac
     
done

case $BLK_LINE_NUM in
  0) $NLSECHO "%s file \"%s\" passes primary checking" \
	$UI_E0_SVUTL_100 "Server Configuration" $OUTFILE
	exit 0 
	;;
  *) $NLSECHO "*** Syntax Error *** Unexpected end of file" $UI_E0_SYSNERROR_030
     exit 1
	;;
esac
