home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume32 / shlm / part01 / shm.doc < prev   
Text File  |  1992-09-20  |  6KB  |  175 lines

  1. SHM(1)                     Unix Programmer's Manual                     SHM(1)
  2.  
  3. NAME
  4.     shm - shell layer manager
  5.  
  6. SYNOPSYS
  7.     shm [ -c | +c ] [ program ... ]
  8.  
  9. DESCRIPTION
  10.     shm is a clone of shl which allows a user to interact with
  11.     more than one shell from a single terminal.  The user controls
  12.     these shells, known as layers, using the key strokes
  13.     described below.  shm automatically sets saves the screen 
  14.         contents when it is started from the console device.  The -c 
  15.         flag forces console saving, the +c flag disables it.
  16.  
  17.         shm differs from shl in five important respects.
  18.     
  19.            1) shm allows quicker switching and layer creation, using
  20.               simple key sequence. Each sequence starts with your
  21.               swtch(switch) character, which is usually ^Z, but may 
  22.               be redefined using stty.
  23.  
  24.                2) when run from the console, shm saves the screen
  25.                   contents of each layer between switches
  26.  
  27.            3) shm allows the specification of one or more programs
  28.               to be placed in separate layers upon startup.
  29.  
  30.            4) shm starts up in a layer, not at an shm prompt.
  31.               In fact, there is no shm prompt, and all commands 
  32.               conclude by re-activating another layer.
  33.  
  34.            5) shm clears the screen when switching layers, and
  35.               automatically exits when all layers have exited.
  36.  
  37.  
  38.     The current layer is the layer that can receive input from
  39.     the keyboard.  Other layers attempting to read from the
  40.     keyboard are blocked. Output from dormant layers causes
  41.        the layer to go to sleep, waiting to become active before
  42.     resuming.  This default behavior can be changed by using
  43.     stty -loblk in that layer or using an shm command described 
  44.     below.
  45.  
  46. COMMANDS
  47.     All shm commands start with your switch character, which we
  48.     will assume is ^Z.  The next character may be:
  49.  
  50.             C, Z                  create a new layer
  51.  
  52.             D                     delete the current layer
  53.  
  54.             S                     show existing layers
  55.  
  56.             ^Z, N, ^N, L, ^L
  57.             Switch, or Return     next layer
  58.  
  59.             P, ^P, Backspace      previous layer
  60.  
  61.             1, 2,..max_layers     create/activate layer number 
  62.  
  63.             R, Space              resume current layer
  64.  
  65.             B                     turn off output blocking for that layer
  66.  
  67.             T                     toggle between layers
  68.  
  69.             H, ?                  help
  70.  
  71.             Q, ^D                 close all layers and quit shm
  72.  
  73.  
  74.     Upper/lower case is insignificant, and ^ designates a control 
  75.     character.  There are many alternatives for several commands
  76.     to suit individual tastes.
  77.  
  78.     Some of my very popular key sequences are:
  79.  
  80.             ^Z, Z           create new layer
  81.  
  82.             ^Z, ^Z           go to next layer
  83.  
  84.             ^Z, ^L, ^L      go to next layer and redisplay
  85.                              application screen
  86.             ^Z, Return,
  87.             Return          go to next layer and display prompt
  88.  
  89.             ^Z, 1           go to layer 1
  90.  
  91.     shm will automatically terminate when all its layers have been
  92.     exited, so if you have three shells active, ^D, ^D, ^D will cause
  93.     shm to exit, and return you to your normal single-layer shell.
  94.  
  95. ENVIRONMENT
  96.     shm reads several environment variables.
  97.  
  98.       ISHELL        Users default interactive shell
  99.  
  100.       SHELL         Shell to invoke if ISHELL is not set
  101.  
  102.       TERM          Used to get string that clears the screen
  103.  
  104.  
  105.     shm sets one or two variables.
  106.  
  107.       LAYER         Equals the layer number
  108.  
  109.       PS1           Set only if shm is compiled with SHELL_STARTUP
  110.                     undefined, this equals $LAYER surrounded by 
  111.                     parentheses
  112.  
  113. NOTES
  114.     I have found that using 'ps' from within a shell layer displays 
  115.     a header but nothing else.  I suppose 'ps' get confused by the
  116.     sxt devices.  Try using this as a substitute for 'ps'.  It should
  117.     be aliased to 'ps' or placed in your path before the real 'ps'.
  118.  
  119.         :
  120.         # ps for shm
  121.         # usage ps [-z & usual ps args]
  122.         MAXPCHAN=8
  123.         if [ $# -eq 0 ] 
  124.         then     SXT_NUM="`expr \`tty\` : '/dev/sxt\(.*\)'`"
  125.             exec /bin/ps -t "sxt/$SXT_NUM"
  126.         elif [ "`expr \"$1\" : '-.*z.*$'`" -ne 0 ]
  127.         then
  128.             [ "$1" != "-z" ] &&
  129.                 ZOPT="`echo $1 | sed 's/\(-.*\)z\(.*\)$/\1\2/'`"
  130.             shift
  131.             SXT_NUM="`expr \`tty\` : '/dev/sxt\(.*\)'`"
  132.             SXT_TERMS="`echo $SXT_NUM $MAXPCHAN | \
  133.                 awk '{ for (i=0; i<$2; i++) \
  134.                     printf \"sxt/%03d,\",\
  135.                     int($1/$2)*$2+i; }'`"
  136.             exec /bin/ps $ZOPT $@ -t $SXT_TERMS
  137.         else    exec /bin/ps $*
  138.         fi
  139.         
  140.  
  141.     It is also difficult to find out the name of the tty you logged
  142.     in on when you are in a shell layer.  'tty' reports the layer
  143.     device, i.e. /dev/sxt001 not /dev/console.  One way to get this 
  144.     information is to add a comment to the end of each (uu)getty 
  145.     line in /etc/inittab, like this:
  146.  
  147.         co:12345:respawn:/etc/getty console console #console
  148.         I00:23:respawn:/etc/uugetty -rt180 tty00 2400 #tty00
  149.         I01:23:respawn:/etc/getty tty01 19200 #tty01
  150.  
  151.     You can then use a script like this one to find the login tty:
  152.  
  153.         :
  154.         # login tty for shm
  155.         TTY_DEV="`expr \`tty\` : '/dev/\(.*\)'`"
  156.         set `/bin/who -u | grep "$TTY_DEV"` ; echo $8
  157.         
  158.     The login tty is often needed in profiles to test for terminal 
  159.     types.
  160.  
  161.     When placing programs in certain layers upon invocation of
  162.     shm, the programs do not actually start running until the 
  163.     layer is activated.  Use the null string('') to start up a
  164.     shell in a certain layer, i.e. shm and shm '' do the same
  165.     thing, and shm '' '' starts two shells.
  166.  
  167.     I have found that when running shm from the console, if a 
  168.     warning message is sent to the console from the kernel, the
  169.     message is lost or the /dev/console becomes the active tty, 
  170.     causing shm to hang.
  171.  
  172. AUTHOR
  173.     Bruce Momjian, root%candle.uucp@bts.com      Sept 13, 1992
  174.     shm version 1.1
  175.