initscr() { PGMNAME="Bourne Shell Curses demo" DEV_NULL="/dev/null" CMD_TPUT="tput" # Terminal "put" command eval CMD_MOVE=\`echo \"`tput cup`\" \| sed \\\ -e \"s/%p1%d/\\\\\${1}/g\" \\\ -e \"s/%p2%d/\\\\\${2}/g\" \\\ -e \"s/%p1%02d/\\\\\${1}/g\" \\\ -e \"s/%p2%02d/\\\\\${2}/g\" \\\ -e \"s/%p1%03d/\\\\\${1}/g\" \\\ -e \"s/%p2%03d/\\\\\${2}/g\" \\\ -e \"s/%p1%03d/\\\\\${1}/g\" \\\ -e \"s/%d\\\;%dH/\\\\\${1}\\\;\\\\\${2}H/g\" \\\ -e \"s/%p1%c/'\\\\\\\`echo \\\\\\\${1} P | dc\\\\\\\`'/g\" \\\ -e \"s/%p2%c/'\\\\\\\`echo \\\\\\\${2} P | dc\\\\\\\`'/g\" \\\ -e \"s/%p1%\' \'%+%c/'\\\\\\\`echo \\\\\\\${1} 32 + P | dc\\\\\\\`'/g\" \\\ -e \"s/%p2%\' \'%+%c/'\\\\\\\`echo \\\\\\\${2} 32 + P | dc\\\\\\\`'/g\" \\\ -e \"s/%p1%\'@\'%+%c/'\\\\\\\`echo \\\\\\\${1} 100 + P | dc\\\\\\\`'/g\" \\\ -e \"s/%p2%\'@\'%+%c/'\\\\\\\`echo \\\\\\\${2} 100 + P | dc\\\\\\\`'/g\" \\\ -e \"s/%i//g\;s/%n//g\"\` CMD_CLEAR="$( ${CMD_TPUT} clear 2>${DEV_NULL} )" # Clear display CMD_LINES="$( ${CMD_TPUT} lines 2>${DEV_NULL} )" # Number of lines on display CMD_COLS="$( ${CMD_TPUT} cols 2>${DEV_NULL} )" # Number of columns on display CMD_CLRTOEOL="$( ${CMD_TPUT} el 2>${DEV_NULL} )" # Clear to end of line CMD_CLRTOBGN="$( ${CMD_TPUT} el1 2>${DEV_NULL} )" # Clear to beginning of line CMD_CLRTOEOD="$( ${CMD_TPUT} ed 2>${DEV_NULL} )" # Clear to end of display CMD_DELCH="$( ${CMD_TPUT} dch1 2>${DEV_NULL} )" # Delete current character CMD_DELETELN="$( ${CMD_TPUT} dl1 2>${DEV_NULL} )" # Delete current line CMD_INSCH="$( ${CMD_TPUT} ich1 2>${DEV_NULL} )" # Insert 1 character CMD_INSERTLN="$( ${CMD_TPUT} il1 2>${DEV_NULL} )" # Insert 1 Line CMD_ATTROFF="$( ${CMD_TPUT} sgr0 2>${DEV_NULL} )" # All Attributes OFF CMD_ATTRSET="${CMD_TPUT}" # requires arg ( rev, blink, etc ) CMD_BEEP="$( ${CMD_TPUT} bel 2>${DEV_NULL} )" # ring bell CMD_LISTER="cat" CMD_SYMLNK="ln -s" CMD_ECHO="echo" CMD_ECHO="print" OPT_ECHO='-n --' CMD_MAIL="mail" WHOAMI="${LOGNAME}@$( uname -n )" WRITER="dfrench@mtxia.com" CMD_NOTIFY="\${CMD_ECHO} ${OPT_ECHO} \"\${PGMNAME} - \${WHOAMI} - \$( date )\" | \${CMD_MAIL} \${WRITER}" ERROR_PAUSE="sleep 2" case "_$( uname -s )" in "_Windows_NT") ${DEV_NULL}="NUL"; CMD_SYMLNK="cp";; # "_Linux") CMD_ECHO="echo -e";; esac IFS_CR="$'\n'" IFS_CR=" " IFS_NORM="$' \t\n'" IFS_NORM=" " MAC_TIME="TIMESTAMP=\`date +\"%y:%m:%d:%H:%M:%S\"\`" MAX_LINES=$( ${CMD_TPUT} lines ) MAX_COLS=$( ${CMD_TPUT} cols ) BUF_SCREEN="" BUF_TOT="" return 0 } ################################################################ clear() { addstr "${CMD_CLEAR}" return ${?} } ################################################################ refresh() { if [[ "_${1}" != "_" ]] then eval \${CMD_ECHO} ${OPT_ECHO} \"\${${1}}\" else ${CMD_ECHO} ${OPT_ECHO} "${BUF_SCREEN}" BUF_TOT="${BUF_TOT}${BUF_SCREEN}" BUF_SCREEN="" fi return 0 } ################################################################ move() { # chklines "${0}" "${1}" \ # && chkcols "${0}" "${2}" \ # ################################################################ # HEATH-KIT MOVE COMMAND # addstr "Y${1} ${2}" # VT100 MOVE COMMAND # addstr "[${1};${2}H" # TPUT MOVE COMMAND eval addstr \"${CMD_MOVE}\" # HP TERMINAL MOVE COMMAND # addstr "&a${1}y${2}C" ################################################################ # add your move command below this line return ${?} }