#!/bin/sh

# protect against multiple inclusion
if [ $FILE_PRMSG ]; then
	return 0
else
	FILE_PRMSG=DONE
fi

displayMsg() {
	if [ "$prt" = "1" ]; then
        printf "\t""$1""\t""$2""\n"
    else
    	if [ "$all" = "1" ]; then
    	    printf "\t""$1""\t""$2""\n"
    	    printf "\t""$1""\t""$2""\n" >> /home/user/flash.log
    	    echo -e "\001TD\"$1\n$2\";1;1;0\027" > /dev/ttyO1
        else
            echo -e "\001TD\"$1\n$2\";1;1;0\027" > /dev/ttyO1
        fi
    fi
}

show_help() {
    echo "-p for output over prtsoft"
    echo "-a for output on display, command line and log-file"
    echo "..or nothing for standard command line"
}

get_opts() {
	if [ "$prt" = "1" ]; then
        return
    fi
    export prt="0"
    while getopts "h?pa" opt; do
        case "${opt}" in
        h|\?)
            show_help
            exit 0
            ;;
        p)  export prt="1"
            ;;
        a)  export all="1"
            rm /home/user/flash.log
            ;;
        esac
    done
    shift $((OPTIND -1))
}
