#!/usr/bin/env bash

# Read in language
source ${BBROOTDIR}/lang/${BBLANG}/datadefine.lang

# Read in functions
source ${BBROOTDIR}/misc/commonfunctions.sh
source ${BBROOTDIR}/func/definefunc.sh

#####PROGRAM START#####
while true; do
# This is for the numbering of the menu choices. It is
# updated once before each entry printout in the menu
# except exit which should always be 0. The variable must
# be reset within this while loop or bad things will happen.
(( bb_m_c = 0 ))
# <colors>
#source "$BBROOTDIR"/misc/colors.idx
# </colors>
clear
# <table>
echo -e "${BBTABLECOLOR}${BBDECOLINE}"
echo -e "${BBTABLECOLOR}|${BBHEADCOLOR} ${BBVERSION} ${BBTABLECOLOR}|"
echo -e "${BBTABLECOLOR}${BBDECOLINE}"
echo -e "${BBTABLECOLOR}|"
echo -e "${BBTABLECOLOR}|-(${BBSUBCOLOR}$bb_mnt_menu_title${BBTABLECOLOR})"
(( bb_m_c += 1 ))
echo -e "${BBTABLECOLOR}|${BBMAINCOLOR} $bb_m_c)$bb_dc_menu_1${BBBURNDIR}"
(( bb_m_c += 1 ))
echo -e "${BBTABLECOLOR}|${BBMAINCOLOR} $bb_m_c)$bb_dc_menu_2${BBBURNDIR}"
(( bb_m_c += 1 ))
echo -e "${BBTABLECOLOR}|${BBMAINCOLOR} $bb_m_c)$bb_dc_menu_3${BBBURNDIR}"
echo -e "${BBTABLECOLOR}|${BBMAINCOLOR} 0)$bb_dc_menu_0"
echo -e "${BBTABLECOLOR}|"

# Display size of current data (If any)
echo -e "${BBCOLOROFF}"
show_data_size

echo -n -e "${BBINPUTCOLOR}$bb_mnt_menu_input[0-$bb_m_c] |>${BBMAINCOLOR} "
read action
echo -e "${BBCOLOROFF}"
# </table>

case $action in
	1)      # Copy Link data
		copy_link_data
		continue
		;;
	2)	# View what's in it
		view_contents
		wait_for_enter
		continue
		;;
	3)      # Delete data
		delete_data
		wait_for_enter
		continue
		;;
	0)	# Exit
		break
		;;
	*)
		echo -e "$bb_dc_menu_err [0-$bb_m_c]"
		wait_for_enter
		continue
		;;
esac
done



syntax highlighted by Code2HTML, v. 0.9.1