LD_LIBRARY_PATH="/fabos/lib:/lib"
export LD_LIBRARY_PATH

#
# Enable diagnostics debug variable setting
# commands.  Rest of path in root profile.
#
PATH="/fabos/bin"

# $SWLOGNAME is the login account name $LOGNAME stripped of switch
# instance number. It replaces the usage of LOGNAME in the old
# script to keep it compatible with account name per switch instance.

# The following condition takes care of login without PAM module.
if [ "$SWLOGNAME" = "" ]; then
    SWLOGNAME="$LOGNAME"
fi

# Set terminal type to "vt100" (supported by all platforms)
TERM="vt100"

unset HISTFILE
HISTSIZE=40

PS1="BFOS:$LOGNAME> "

export PATH SWLOGNAME PS1 HISTSIZE TERM

LESS="-isdPType <CR> or <SPACE BAR> to continue, <q> to stop"
PAGER="/usr/bin/less"
MANPAGER=$PAGER

export LESS
export PAGER
export MANPAGER

# Make sure the man pages are displayed correctly
export MANWIDTH=80

scim_id="SWBD55"

savehistory() {
		board_id=`sin | grep Platform | cut -f 2 -d " " | cut -f 2 -d " " | cut -f 1 -d ","`
        if [ "$board_id" = "$scim_id" ] ; then
        	local newcmd
        	newcmd=$(history 1)
        	if [ "$newcmd" != "$oldcmd" ] ; then
        		oldcmd=$newcmd
        		v1=`date`
        		v2="${newcmd#*[0-9]* }"
        		v3="$v1 $v2"
        		echo $v3 >> /mnt/var/log/bp_cli_history.txt
        		nlines=`cat /mnt/var/log/bp_cli_history.txt | wc -l`
        		if [ "$nlines" -gt 500 ] ; then
        			cp /mnt/var/log/bp_cli_history.txt /mnt/var/log/bch.txt
        			tail -500 /mnt/var/log/bch.txt > /mnt/var/log/bp_cli_history.txt
        			rm -rf /mnt/var/log/bch.txt
        		fi
        	fi
        fi 
}
PROMPT_COMMAND=savehistory

