FacetTerm  
 
FacetCorp
 

Interfacing BBx Using Line Name


The enclosed files are an example of a way to use a table lookup to set the terminal ID for BBx when running in a FacetTerm window. To implement the example on your system, do the following:

  1. Create a file called "setbbterm" like the example shell script on the following page. Put it in some directory where you keep local script files, or in /etc.
  2. Call setbbterm from your .profile by adding the command ". /etc/setbbterm" after FacetTerm starts but before the call to BBx. If you do not start FacetTerm or BBx from your profile, add the ". /etc/setbbterm" command to a script that you can use to call your BBx program. Note, there is a space character after the "." in the command ". /etc/setbbterm".
  3. Create the file /etc/setbbterm.tbl like the example table below. It should have the BBx terminal ID in the first column, and the tty,window combination in the second. There is a comma between the ttyname and the window number. Window number zero refers to the terminal when it is not running FacetTerm.

    # setbbterm.tbl
    # BBTERM tty,window
    T1    /dev/tty1a,0
    T11   /dev/tty1a,1
    T12   /dev/tty1a,2
    T2    /dev/tty2a,0
    T21   /dev/tty2a,1
    T22   /dev/tty2a,2
    T3    /dev/tty3a,0
    T31   /dev/tty3a,1
    T32   /dev/tty3a,2

  4. Modify or add the terminal ID's in the config.bbx file. They should all be in there, and use device name "/dev/tty". This is the generic device that will always mean "the current window". Below is an example line in a config.bbx file.

    alias    T20  /dev/tty  term

Example shell script named setbbtem

###############################################################
#
# setbbterm
#
# This script sets the BBTERM variable based on the original
# login terminal and the FacetTerm window number,
# if any.  It should be invoked using # the ". setbbterm"
# command (so that the exported BBTERM variable is available to
# bbx. Then, when bbx is run, it will look for the alias line
# in the config.bbx file whose TTYID matches BBTERM.
#
###############################################################
###############################################################
#
# If this is not being run in a FacetTerm window,
# set the window number to zero and the ttyname using the tty
# command. If this is being run in a facetterm window, set the
# window number to the FacetTerm window number
# and the ttyname to the original terminal.
#
###############################################################

if fct_info not_a_window
then
     TTY=`tty`
     WINDOW=0
else
     TTY=`fct_info ttyname`
     WINDOW=`fct_info window_number`
fi
echo TTY=$TTY
echo WINDOW=$WINDOW

###############################################################
#
# Now, look up the combination of ttyname,window in the file
# and set the BBTERM variable to the first entry on that line,
# or to TX if no entry is found that matches.
#
###############################################################

set `grep $TTY,$WINDOW /etc/setbbterm.tbl` XxXx
if [ "$1" != "XxXx" ]
then
     BBTERM=$1
else
     BBTERM=TX
fi
export BBTERM
echo BBTERM=$BBTERM

###############################################################
#
# Note:  What may appear to be apostrophes in the 4 noted
#        lines above are actually the grave accent or "backward
#        quote", or hex value 0x60.
#
###############################################################