#!/bin/sh

# mkrep.bkg
# SHELL SCRIPT TO DETERMINE THE BACKGROUND COLOR A
# BIG BROTHER REPORT PAGE
# Sean MacGuire
# Version 1.9
# Mar 13th, 2002
#
# (c) Copyright Quest Software, Inc.  1997-2002  All rights reserved.
#

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
        . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi

#
# NOW ESTABLISH THE BACKGROUND COLOR...
# IF THERE'S ANY EMERGENCY FILES, THEN WE'RE RED
# THEN IF YELLOW
# THEN IF PURPLE
#
BKG="green"

for COLOR in yellow red
do
	$GREP "${COLOR}[ 	]" $REPDATA  > /dev/null
	if test "$?" = "0"
	then
		BKG="$COLOR" 		# SET THE COLOR
	fi
done

# IF NO RED/YELLOW THEN CHECK IF ANY GREEN
# IF NO GREEN THEN IT'S CLEAR
#if [ "$BKG" = "green" ]
#then
#	$GREP "green[ 	]" $REPDATA  > /dev/null
#	if test "$?" -ne 0
#	then
#		# DOUBLE CHECK THAT AT LEAST THERE'S ONE CLEAR
#		# REPDATA MAY HAVE NO ENTRIES AT ALL ...
#		$GREP "clear[ 	]" $REPDATA  > /dev/null
#		if test "$?" -eq 0
#		then
#			BKG="clear" 		# SET THE COLOR
#		fi
#	fi
#fi	
	
echo $BKG
