macintosh@felix.UUCP (03/23/87)
[dumb virtue: tutorial] --- Using dumb virtue to communicate . . . a short tutorial. Kevin Eric Saunders (copyright 1986) [NOTE: You are advised to read each paragraph before proceeding with any suggestions made. After starting up "dumb virtue," "Get" this file from the diskette so you can read it while using the Macintosh. If you are using a 128K Macintosh to examine this document, you may have already run out of free space on the Macintosh heap; you should use the Command - key to Free Memory so you can display the Menus! Gratuitous advice for 128K owners: "Gibs auf! Gibs auf!"--Franz Kafka.] GETTING STARTED Two windows are present when "dumb virtue" is launched: Window 0, which covers most of the screen, and the ScratchPad window, which is behind Window 0. (Note that the window number appears in the Go Away Box.) Window 0 is configured on startup as the editing or "Input" window. You can edit text in this window, using the mouse to position the cursor and make selections; you can also move the cursor and make selections by using commands in the "Cursor" menu. The amount of text in a text window is limited to 32,767 characters. The ScratchPad is a special text window; it is used to display error messages and other program messages, and it can be used for more general purposes also, since it functions as an editing window when it has been brought forward. You can see the ScratchPad window by moving the Grow Box in the lower right hand corner of Window 0; you can also see the ScratchPad by choosing the "Window" menu option "ScratchPad". Choosing that option again will send it back. (You can also send it back by clicking in its Go-Away Box, but--WARNING!--clicking in the Go-Away Box of other text windows may cause them to disappear completely, along with their contents!). Go ahead and fool around with entering text into the ScratchPad window, if you haven't already. To connect to another computer, you need to use either the "Modem port" or "Printer port" command under the "Comm" menu to select which serial port will be used for communications. Executing this command will create both Window 1 and a "terminal window," which is used when you need to emulate a DEC VT100 (or other ANSI-X3.64-like) intelligent terminal. The program also resizes Window 0 and changes the settings of the windows. Window 0, which was originally both the Input and Output window, will no longer be the Output window, and will also be MUCH SMALLER. Window 1 will now be the Output window. Your typing will appear in Window 0, but will not be sent to the host; when you type "Return" the line of text will be sent, and the response of the host will be displayed in Window 1, the Output window. Thus, you can make corrections to long or tedious commands before sending them to the host, saving much fruitless prestidigitation. Go ahead and choose the proper port for your connection to the host computer. You may also need to reset the baud rate from 1200 (most likely to 9600) using the commands in the "Comm" menu. After putting the cursor on a line below this paragraph, try typing a Return and see if you get a response from your host. (If you don't get a response, or if you get garbage, you should try changing some of the communication parameters. Also, please note: entering text is MUCH faster at the end of a document than in its middle!) If you want to change the size of this window so you can see more of this text, go ahead, you can always move it back when you want to see more output. Log on to your host computer ... (SECRET COMMAND! Use "Record input" [Command-R] and your password will not be recorded in the Input window. Another Command-R will turn recording back on. The perceptive among you will notice that a little "R" goes on and off in the left of the top window's drag bar along with this mode.) As you can see, everything in your session (except the mistakes you correct before sending a line!) is being recorded in Window 1. You can look at long file directories, for example, and the results will be saved as the window scrolls up. (If you're using a UNIX machine, run a "who"--I think Robert Redford just logged on!) Well, so he wasn't there--so sue me. Ahem. If you don't want to save the input or output from your commands, you can use Command-D (the "Terminal" command in the "Window" menu) to switch the VT100 emulation window on (and off, when you want the text windows back). Go ahead and turn it on! Run a few commands and then turn the terminal off again to come back to this text. MANIPULATING WINDOWS If you look under the "Window" menu, you will see that there are entries for 10 windows, numbered from 0 through 9. These help you control the "text windows." When you select one of these window numbers from the menu (or keyboard), the window will be created if it does not yet exist, and will be set according to the current specifications listed at the top of the "Window" menu: Front, Input, and/or Output. If the "Front" item is checked, then the window (0-9) chosen from the menu will be brought up to the front. The commands from the File, Edit, Fonts, Size, and Top menus apply to the Front window. If the "Input" item is checked, the window selected will be made the "Input window." This is the window where typed characters usually first appear, and the cursor motion commands in the "Cursor" menu apply. If the Output item is checked, the window you select will be made the "Output window," which is the window where output from the modem appears. When you're using the Terminal window, the other windows' right edges are apparent at the far right of the screen, so that you can select them with the mouse. Doing so for any one of them makes the Input window active rather than the Terminal window, even if it's still behind another window! The terminally curious can check this out for themselves by selecting Window 1 after selecting the Terminal window. Thus, you can use several Output windows to hold different types of output--for example, a long file list of your current directory in 2, and a copy of your latest mail in 3. You can even do all your window manipulation without using the mouse. For another example, here is a technique for using a mail system: you can list a note into your Output window, and then, if you wish to reply, you can refer to it as you draft your response using an Input window. You might also want to save the note on the Macintosh diskette so you can draft a response at home or keep it for future reference. The Scratchpad is good for drafting notes in this fashion, since it conveniently turns "Edit Locally" on when it's brought up, so that typing a Return at the end of a paragraph won't send the text of a paragraph to the host. Thus, you can compose a long note on your Macintosh using autowrap, referring, as needed, to text in other windows. When you're ready to send it, you can select the whole text and send it by pressing Option-Enter; the text will be wrapped at the 72nd column (or the column you've specified using the "Output Wrap" command from the "Echo" menu) so that your note is reasonably formatted--something that's a bit of a pain to manage when editing notes using some other text editors. FOR THOSE USING UNIX TERMINAL CUSTOMIZATION UNDER UNIX You'll have noticed that text scrolls some distance before the bottom, because it hasn't been reset from 24 lines per screen. If you want more lines, you need to tell the system more precisely what kind of terminal the window emulates. If you want to use more lines--you can have up to 30 with the Mona 8 font--you can follow the directions for setting your terminal type in the paragraphs below. (This will also speed up the terminal!) If you're not interested in using more lines, you should set the font to Mona 9 or Monaco 9 to make the line spacing a little bigger. When you change fonts, the new font will appear only if the current size actually exists; if it doesn't change, set the size to the one you want. To set up your terminal, we will send the host some commands (the ones listed here are compatible with 4.n BSD and XENIX). Place the cursor at the beginning of the line following . Now we will perform some "dumb virtue": press the Shift-Enter key combination, which will send the selection to the host. * 4.n BSD UNIX, using csh (prompt is a "%") setenv TERMCAP "dumv-24|DV|dumv-unk|dumb \ virtue:im=\E[4h:ei=\E[4l:mi:xn:dc=\E[P:dl=\E[M:al=\E[L:cr=^M:nl=^J:bl=^G\ :cl=\E[H\E[J:bs:am:cm=\E[%i%d;%dH:up=\E[A:do=\E[B:le=^H:nd=\E[C:ce=\E[K:\ cd=\E[J:ho=\E[H:ta=^I:pt:sr=\EM:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:so=\E[7m\ :se=\E[m:us=\E[4m:ue=\E[m:cs=\E[%i%d;%dr:is=\E[1;24r:vs=\E[2J\E[1;24r:co\ #80:li#24:" setenv TERM dumv-24; tset - RESPONSE: %dumv-24 The host should have responded with something very much like the text on the next line, where the cursor is now sitting . If the response is not the same, ask your system administrator what to do. You can also use Shift-Enter to send a single line from the Input text window to your host. Tell you what: set the cursor back at the beginning of the line in this window where you typed the "who," and press Shift-Enter. Note that after the line is sent off to the host, the cursor is left at the beginning of the next line. APPLYING DUMB VIRTUE IN A UNIX ENVIRONMENT The features of this program make it easy, when editing using the vi text editor on your host, to dump output you wish to keep around into a text window. For example, say that you are editing a letter, and wish to refer to another letter; you can use the command ":e filename" to get the other letter and look at it without leaving the editor. Alas, the exact name you gave the letter ... you can no longer remember. You need to get a long directory listing (using the command "ls -l") so you can find out what you called it. You can do this without leaving the editor by using a "shell escape." In vi, if you type the characters ":!", the following characters up to a carriage return will be executed by your UNIX shell as a command, and the output from the command will be dumped on your screen (but NOT in your document!). Therefore, using dumb virtue, we can 1) Do a Command-D to go from the terminal window to the text windows, 2) Enter the command line :!ls -l in the Input window (normally 0), and 3) send it with either a Shift- Enter (with the cursor at its beginning) or a Return (with the cursor at its end). The output will be directed into the current Output text window. When output has ceased, vi prints a message, "Press newline to return"; then you can do a Command-D to go back to the terminal window. THEN you can press the Return key, which will cause vi to refresh your terminal screen (pardon it, it doesn't know any better). (If you press Return while still using the text windows, the Output window will receive the control codes vi is using to move the cursor around the terminal window--not very esthetic, really. Aficianados of terminal behavior should investigate dumb virtue's "Literal output" command so they can learn to see ALL THE CODES--IN THEIR NAKED SPLENDOR!) For another example, assume that you are using vi to examine some news messages you've downloaded from a bulletin board service. One of the messages refers to a marvelous program called "Dead Fred", worth every penny of the $49.95 it costs. Your curiosity is stimulated, and you wonder whether other postings have been made commenting on this product--in short, whether you realize this yet or not, you WANT to run the command egrep 'Dead Fred' * (assuming your current directory is the one containing files with such news in them, so the '*'--sometimes called a "wildcard character"--will match the filenames of the files you're interested in searching through). So, you do a Command-D, and type :! egrep 'Dead Fred' * to cause the creation of a new shell level which will run the deadly accurate egrep command. You can then sort through the matches--if any-- to see whether more encomiums for this civilization-builder of a program have accumulated. ---