FacetTerm  
 
FacetCorp
 

Interfacing to BBx by User 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. Normally, this is based upon the raw device line that is being used. This application note utilizes the user name to assign unique BBx aliases. 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 login,window combination in the second. There is a comma between the login name and the window number. Window number zero refers to the terminal when it is not running FacetTerm.
    #  setbbterm.tbl
    #  BBTERM      tty,window
    T1             donna,0
    T501           donna,1
    T502           donna,2
    T2             tom,0
    T503           tom,1
    T504           tom,2
    T3             joe,0
    T505           joe,1
    T506           joe,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 "setbbterm"

############################################################
#
# setbbterm
#
# This script sets the BBTERM variable based on the original
# login name 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.  If this is being
# run in a FacetTerm window, set the window
# number to the FacetTerm window number.
#
############################################################

if fct_info not_a_window
then
     WINDOW=0
else
     WINDOW=`fct_info window_number`
fi
echo LOGNAME=$LOGNAME
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 $LOGNAME,$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 2 noted
#        lines above are actually the grave accent or
#        "backward quote", hex value of 0x60.
#
############################################################