<> <> <> <<>> Plumber PCEDAR 2.0 % FOR INTERNAL XEROX USE ONLY Plumber Peter B. Kessler Ó Copyright 1989 Xerox Corporation. All rights reserved. Abstract: Plumber creates a typescript viewer and starts a shell in it. Created by: Michael Plass Maintained by: Peter B. Kessler Keywords: shell, localhost, rlogin XEROX Xerox Corporation Palo Alto Research Center 3333 Coyote Hill Road Palo Alto, California 94304 For Internal Xerox Use Only 1. User Interface The plumb and term commands The Plumber package enables you to execute Unix commands on the machine on which you are running PCedar (e.g., if PCedar has taken over your screen and keyboard). There are two commands: plumb and term. Plumb opens a typescript viewer and spawns a shell (/bin/sh) such that input to the typescript goes to stdin of the shell and stdout and stderr of the shell goes to the typescript. The term command is identical to the plumb command except that the viewer opened behaves like a terminal rather than like a typescript. Command line arguments The command line aruments to term and plumb are the same, with one exception: the ``-term'' flag, described below. With no arguments, the either command pretends its arguments were ``-E -T LocalShell'', where LocalShell registers you with the machine as if you had logged in, and forks an instance of your login shell for you. Probably you just want to say ``plumb'' or ``term'' with no arguments. An argument (one, use quotes, especially if the command has CommandTool meta characters) not beginning with a `-' is taken to be the command to execute in the spawned shell. For example, you might want to use % plumb "rlogin anotherMachine" to login in to another machine, or % plumb PCedarTools to start up PCedarTools in a separate Unix heavyweight process (this doesn't quite work yet, but Alan knows what the fix is to pcr). The -W argument causes the command to wait until the Unix process has finished before returning to your PCedar command tool. Probably you don't want it; that's why it's optional. The term command accepts the optional switch ``-term terminalName'' to specfiy which kind of terminal to emulate. By default term emulates a Sun workstation console, but there are a few other terminals it can emulate instead, see below. Then there are some debugging switches, which I wouldn't ordinarily document, but I don't like undocumented switches, so here they are: -E says to exec the command instead of executing it in a shell. If you don't know what exec means, you probably don't want to use the -E switch. -T says to pass arguments to the command that tell it what pseudo-terminal it is executing on. The controlling pseudo-terminal device is passed as ``-p /dev/ptyXX'', and the slave pseudo-terminal device is passed as ``-t /dev/ttyXX''. Terminal Emulation [This section should go in TerminalEmulatorDoc.tioga when that document is in better shape.] The terminal emulator that Plumber uses has been sped up considerably over the previous implementation, but to get the speed, we gave up the ability to select shift select to and from the terminal emulator viewer. The terminal emulator can keep a log of lines ``scrolled off the top,'' and you can shift select from the log. Unfortunately, maintaining the log slows the emulator down markedly when scrolling. The `Help' button provides brief documentation for each of the emulator's buttons. When you click `Help' the following is typed into the log: Flush: Cycle among 3 ways of buffering output to the terminal. With selection, set mode to flush every N characters. (Use the selection as the value of N.) Logging: Toggle whether or not lines scrolled off top are written to the transcript. Log: Toggle whether or not the transcript is visible. SetLogLines: Set number of lines in transcript to number in selection, taking space from the terminal, if needed (but see about shift-clicking below). With no selection, fit transcript to unused space in the current viewer. SetLines, SetColumns: Set number of lines(columns) in terminal to number in selection. If the terminal won't fit in the viewer, the bottom of the terminal will be clipped (but see about shift-clicking below). With no selection, fit lines(columns) to current viewer Grab: Copy current selection to terminal as if typed in. Shift-clicking a Set... button or the Log button performs the given action, but then changes the containing viewer's size to fit both the transcript and terminal. Currently the emulator can emulate the these terminals: adm3, adm3a, dm2500, dm2500w, dmwaits, dmdd, sun (a.k.a. sunconsole), vt100, vt52. You must inform Unix of the terminal type you are using. A terminal is inherently fixed size, a viewer is inherently variable size. If you or Viewers resizes the terminal emulator viewer, the size of the terminal and of the viewer may be out of sync. If the terminal is smaller than the viewer then some viewer real estate is wasted. If the viewer is smaller than the terminal then the terminal is clipped in order to fit the viewer. To help you cope with this situation the caption on the terminal emulator window reports, in lines and columns, the size of the terminal being emulated, and the size of the continaing viewer. The SetLines and SetColumns buttons provide a way to get the two sizes back in sync. 2. Programmer's Interface The Plumber interface The Plumber interface is supposed to allow you to fork arbitrary commands to be executed in a shell on the local host with stdin, stdout and stderr hooked up to streams or files of your choice. 3. Associated hacks It turns out there's a one line hack that grabs the output stream that goes to the console. So, I wrote that hack. For example, you can execute the command hostname% BecomeConsole and any output that would go to the console will show up in that viewer instead. Otherwise, if you get that stuff just splattered all over your screen. If things head west the system seems to recover and send future output to the real console. [[BecomeConsole interacts badly with pcr's started on the console. Don't use it in that situation. This is being investigated, too.]] It turns out you can run BecomeConsole in Bridge windows, too (or any place, else, for that matter). You can get the same effect by passing the -C option to LocalShell. For example, I have an alias Alias Console Plumb -E -T "LocalShell -C" which has the advantage that it labels the icon for the console typescript differently.