#!/bin/sh
# Displays credit on top of the screen
# Eko M. Budi for Vector Linux
# License: GNU GPL

mkcredit()
{
    cat /mnt/source/CREDIT | while read NAME; do
        echo -n "- $NAME "
    done
}

CREDIT=" Vector Tigger Kocil JohnB UKBill JohnVan Joe1962 Uelsk8s"

if [ -r /mnt/source/CREDIT ]; then
    CREDIT=$(mkcredit)
fi

SAVEPOS="\033[s"
BACKPOS="\033[u"
CLREOL="\033[K"
GOSTART="\033[1;1f"

BLINK="\033[05m"   	
REVERSE="\033[07m"    	
BLACK="\033[0;30m"
BLUE="\033[0;34m"
LTBLUE="\033[1;34m"
WHITE="\033[1;37m"
NRED="\033[0;31m"
LTRED="\033[1;31m"
GREEN="\033[0;32m"
LTGREEN="\033[1;32m"
PURPLE="\033[0;35m"
LTPURP="\033[1;35m"
YELLOW="\033[1;33m"
BROWN="\033[0;33m"
CYAN="\033[0;36m"
LTCYAN="\033[1;36m"
DKGREY="\033[1;30m"
LTGREY="\033[0;37m"
OFF="\033[0m"

COLOR="\033[1;36m"
BACKCOLOR="\033[0;34;37m"

SLEEP=1
CUT_INC=2
CUT_START=1
STR_LENGTH=${#CREDIT}

STR=`echo $CREDIT | cut -b1-78`
sleep 1
echo -e -n ${SAVEPOS}${GOSTART}${COLOR}${STR}${CLREOL}${BACKCOLOR}${BACKPOS}
sleep 5
while [ 1 ]; do
    CUT_END=`expr $CUT_START '+' 78`
    STR=`echo $CREDIT | cut -b${CUT_START}-${CUT_END}`
    LEN=${#STR}
    if [ $LEN -lt 76 ]; then
	LEN1=`expr 76 '-' $LEN`
	STR="$STR `echo $CREDIT | cut -b 1-$LEN1`"
    fi
    sleep $SLEEP
    echo -e -n ${SAVEPOS}${GOSTART}${COLOR}${STR}${CLREOL}${BACKCOLOR}${BACKPOS}
    CUT_START=`expr $CUT_START '+' $CUT_INC`
    if [ $CUT_START -gt $STR_LENGTH ]; then
	CUT_START=1
    fi
done
