home *** CD-ROM | disk | FTP | other *** search
/ ftp.freefriends.org / ftp.freefriends.org.tar / ftp.freefriends.org / arnold / Writings / plan9.interface.for.unix next >
Text File  |  1995-02-19  |  33KB  |  692 lines

  1. [The usual conventions apply. |foo| should be in courier, and
  2. *foo* in italics. Where I have 1/2, use a 1/2 symbol, in troff it
  3. would be \(12]
  4.  
  5.         What's GNU
  6.         Arnold Robbins
  7.  
  8. In this two-part article, Arnold shows us how small is beautiful
  9. when it comes to user interfaces.
  10.  
  11. This month's column briefly describes [italic] Plan 9 From Bell Labs [normal],
  12. an operating system done by the original group at Bell Labs that did
  13. Unix.  We will be focusing on the user interface part of Plan 9. It is
  14. interesting, since the major components are either freely available from
  15. AT&T, or have been cloned in freely available software. The article will
  16. be concluded next month.
  17.  
  18. Plan 9
  19. ======
  20.  
  21. In the late 1980's, the research group at Bell Labs started to feel that
  22. Unix had reached the end of its useful life as a research vehicle.
  23. They decided that it was time to start over, taking the useful lessons
  24. learned from Unix, and going on from there.  A brand new operating
  25. system was developed, named [italic] Plan 9 From Bell Labs. [normal]
  26.  
  27. The result is documented in two sets of papers.  The early papers discuss
  28. the overall design of Plan 9, its shell, compiler, and window system.
  29. The later set contains additional papers about the system, and the
  30. entire reference manual for the system.  What is really neat is that
  31. Postscript for all of this is available via anonymous |ftp| (see the
  32. sidebar).  The reference manual is huge, over 650 pages; it helps to
  33. print it on a duplexing printer, if you have one available. A mailing
  34. list of Plan 9 licensees and other folks who are interested in Plan 9
  35. is also available.
  36.  
  37. Plan 9 is a distributed system. It consists of three components:
  38. File servers, where all the user files live, CPU servers, where computing
  39. intensive tasks are done, and terminals, which handle the user interface.
  40. The compute and file servers are large machines that live in a machine
  41. room. At Bell Labs, they are connected by a high-speed fiber network,
  42. although the software does not require this. The terminals are small
  43. computers with mice, keyboards, bitmapped displays, and network
  44. connections to the file and compute servers.  Terminals may have local
  45. disk drives for performance reasons, but they are used for caching
  46. files, and are not strictly necessary.
  47.  
  48. Plan 9 is also a heterogeneous system. The operating system has been
  49. ported to the MIPS, Motorola 680x0, Intel 80386/486, and Sun SPARC
  50. architectures. At Bell Labs, they tend to use the MIPS systems for their
  51. servers and the other systems for the terminals, but again, that is
  52. not built in to the software.
  53.  
  54. Plan 9 also has a number of nice innovations in the software
  55. architecture seen by the programmer.  As a simple example of this, in
  56. Unix, there are multiple system calls that affect the meta-information
  57. about a file (owner, mode, etc) such as |chown|, |chmod|, and |utime|.
  58. In Plan 9, there is only one, |wstat|, which writes the |stat|
  59. information about a file.  As another example, all user and group names
  60. are returned by the system as strings, the programmer never has to
  61. manage the conversion between numeric user ids and strings.  There are
  62. many other very elegant improvements upon the Unix design in Plan 9.
  63.  
  64. Plan 9 is also one of the first systems to use Unicode, a 16 bit character
  65. set.  The |sam| and |9term| programs discussed below also support Unicode,
  66. making it possible, for example, to type a real smiley character, instead of
  67. the usual three-character ASCII glyph.
  68.  
  69. (A parenthetical note on my soapbox.  In many ways, Plan 9 is a considerably
  70. superior design over Unix. It would be worthwhile for those interested
  71. in a free version of Plan 9 to consider starting from the Linux code
  72. base, using the device drivers, memory management, and whatnot.  Linux
  73. itself is and will remain a Unix clone, and Unix is not Plan 9.
  74. Starting from Linux will be particularly easy when Linux 2.0 comes out,
  75. as it will be multi-platform, like Plan 9 [or so I'm told].)
  76.  
  77. This should whet your appetite.  Both the early and the current Plan 9
  78. papers are well worth reading.  The manual is also fun to browse.
  79.  
  80. Plan 9 is not (unfortunately) generally available.  Universities
  81. may license it from AT&T for no cost (other than time spent by the
  82. lawyer to review the license).  Upon signing a license, AT&T sends
  83. one hard-copy of the manual and a CD-ROM.  The current (as of December 1994)
  84. release is almost two years old, and the system has evolved somewhat.
  85. A new release, using PC based hardware as the porting base, is in
  86. preparation, but no release date is known yet.  The AT&T researchers are
  87. working towards a way to release it more generally, but it will still
  88. require some kind of license; it will not be freely available the way
  89. Linux, NetBSD, or FreeBSD are.
  90.  
  91. In this article, we will take a look at the Plan 9 editor, windowing
  92. system, and shell.  They are important, because the editor is freely available,
  93. and there are freely available clones of the others.
  94.  
  95. The |sam| Editor
  96. ================
  97.  
  98. The Plan 9 editor is named |sam|. (Some history here. The original Unix
  99. editor was |ed|.  It was command-driven. Rob Pike wrote a mouse-driven
  100. editor for the Blit terminal named |jim|.  The successor to |jim| was
  101. |sam|, also written by Rob Pike.  Basically, they're all a bunch of
  102. friendly, down to earth sort of programs... :-) (I'm told that
  103. |sam| is short for ``samantha,'' and female.)
  104.  
  105. |sam| is a multi-file, multi-window editor that elegantly combines
  106. extended regular expressions (|egrep|-style) and the powerful |ed| command
  107. set with mouse driven text selection, cutting, and pasting. In
  108. particular, all operations act upon the selected text, which can
  109. include *multiple* lines.  Replacement text can include newline
  110. characters as well.
  111.  
  112. |sam| also provides an infinite ``undo'' capability, so you don't have to
  113. worry about making mistakes.
  114.  
  115. One of the windows that |sam| provides you is the command window, where
  116. you type in commands.  What is nice is that just like the text in any
  117. other window, you can edit the text in the command window, then select
  118. the edited line with the mouse, and send it again as input.  In other
  119. words, you can edit previous commands and submit them for execution
  120. again. If a substitution didn't work or do quite what you wanted it to
  121. do, undo the change, edit the command, and try again. Do this as often
  122. as you like.  Or, if you used a series of commands on a chunk of text
  123. once, and need to do that series again, select all the command lines,
  124. and send them all at once. (The command window is similar to the
  125. mini-buffer in Emacs.)
  126.  
  127. As an example, when replying to email, I'll often include the original
  128. letter, preceded with |>| signs.  Sometimes I end up with text that has
  129. only part of a line, like this:
  130.  
  131.     > So what
  132.     > is your opinion about the future life of
  133.     > systems like MVS, VMS, VM, and Solaris?
  134.  
  135. I can select these lines as a single group, and then reformat it with
  136. the following commands:
  137.  
  138.     s/^> //g
  139.     |fmt
  140.     s/^/> /g
  141.  
  142. This removes the |>| signs, runs the text through |fmt| to make it look
  143. nice, and then adds the |>| signs back in. The result might be:
  144.  
  145.     > So what is your opinion about the future life of systems
  146.     > like MVS, VMS, VM, and Solaris?
  147.  
  148. (In fact, I was able to snarf the commands out of my article text, paste
  149. them into the command window, edit them a bit, and then submit them to
  150. make the new text above.)
  151.  
  152. The command language is particularly powerful, using a notation called
  153. ``structural regular expressions''. Essentially, regular expressions can
  154. be cascaded together to select increasingly more specific chunks of text
  155. upon which to operate. Here is an example from the |sam| paper. Suppose
  156. you wish to change all occurrences of a variable |n| to now be called |num|.
  157. You could use the following command:
  158.  
  159.     , x/[A-Za-z_][A-Za-z_0-9]*/ g/n/ v/../ c/num/
  160.  
  161. The comma selects all lines (an abbreviation for 0 through |$|, the
  162. last line). The |x| command extracts text to operate upon. It is an
  163. iterator, meaning that the command following it will be executed for each
  164. match of the text. The |sam| paper explains the rest of the command:
  165. ``The pattern |[A-Za-z_][A-Za-z_0-9]*| matches C identifiers.
  166. Next,  |g/n/| selects those containing an |n|. Then |v/../| rejects those
  167. containing two (or more) characters, and finally |c/num/| changes the
  168. remainder (identifiers |n|) to |num|.''  The |g| and |v| commands are
  169. conditionals. |g| says execute the command only if the pattern matches,
  170. |v| is the opposite, execute the command only if the pattern does not match.
  171.  
  172. Simple changes are often made with the mouse. But for complex, sweeping
  173. changes, a command language such as the one in |sam| is essential. Indeed,
  174. this is why |vi| includes the |ed| command set as a subset.
  175.  
  176. As mentioned, |sam| is a multi-file editor. You can have several files
  177. open in windows at once, and several windows on the same file. This is
  178. particularly useful for cut and paste operations when going from one file
  179. to the next.  The command language also provides commands for doing operations
  180. on all files that contain, or do not contain, a particular regular expression.
  181.  
  182. To summarize why I find |sam| attractive:
  183.  
  184. 1. It is multi-file and multi-window.
  185. 2. It has a powerful command language that makes many editing operations easy.
  186. 3. It is possible to *edit your commands*.
  187.  
  188. This last is particularly useful; it is one of those things that once you
  189. have it, you can't believe you ever lived without it.
  190.  
  191. |sam| is implemented on top of two libraries. The |libframe| library provides
  192. windows (frames) of text.  This library is implemented in turn on top of
  193. |libg|, a graphics library.  For Unix, the Plan 9 |sam| and |libframe| code is
  194. used, essentially unchanged, on top of |libXg|, an implementation of |libg|
  195. for X windows using the Xt toolkit.  All of this software supports Unicode.
  196. It is possible, for example, to enter the 1/2 symbol by typing ALT-1-2.
  197.  
  198. See the sidebar for the |ftp| location of |sam|; AT&T has graciously
  199. made it available free of any licensing worries. There is also a
  200. mailing list for |sam| users.
  201.  
  202. The mailing list archive includes a |sam| emulator for Emacs,
  203. written by Rick Sladkey (|jrs@world.std.com).
  204.  
  205. The |9term| Terminal Emulator
  206. =============================
  207.  
  208. The Plan 9 windowing system is called 8-1/2, since it was the Eight and a
  209. half'th windowing system that Rob Pike had written. To create a new
  210. window, you select |New| from the right button menu, and sweep out the
  211. window you want. That window then runs a shell (|rc|, discussed below).
  212.  
  213. What is unusual about the windows in 8-1/2 is that you can *edit the text
  214. directly in the window*.  Thus, if you make a typing error in a command,
  215. you fix the error, select the entire line, and resubmit it.  This
  216. obsoletes the need for built-in command history as found in
  217. current Unix shells, such as |ksh|, |bash| and |tcsh|.
  218.  
  219. Furthermore, windows provide more complicated text editing capabilities.
  220. By pressing the ESCAPE key, the window goes into ``hold mode''. All text
  221. is kept in the window. It is not sent to the program running in the window
  222. until the ESCAPE key is hit again, leaving hold mode.  Hold mode is indicated
  223. by an extra white border inside the window, and a larger, white arrow
  224. for the mouse cursor.
  225.  
  226. You might use this, for example, when sending mail to someone. Run the
  227. |Mail| command, and then go into hold mode. Type in, edit, and
  228. rearrange your letter to your heart's content. Then leave hold mode,
  229. and out goes your mail to the |Mail| program.
  230.  
  231. Finally, by default, 8-1/2 windows do *not* scroll. Instead, text just
  232. buffers up inside them until you are ready to look at it.  The down-arrow key
  233. on the keyboard allows you to quickly move through the buffered text.
  234. You can use the button 2 menu to change the behavior of the window so
  235. that it does scroll.  The non-scrolling mode is a feature; it obviates the
  236. need for pager programs like |more|, |pg|, and |less|.
  237.  
  238. The Unix program that emulates 8-1/2 windows is called |9term|.
  239. |9term| was written by Matty Farrow, at the University of Sydney, in Australia.
  240. It adds an additional library, |libtext|, on top of |libframe| and
  241. |libXg|. |9term| is both small and fast. On a Sun SPARCstation LX,
  242. |9term| starts almost instantly, while an |xterm| can take several
  243. seconds to start up, noticeably longer.
  244.  
  245. Besides hold mode described above, |9term| provides cut and paste editing,
  246. and the ability to search backwards or forwards in the window for a
  247. particular piece of text (whatever is currently selected). |9term|
  248. also uses the up-arrow key to allow you to go backwards in the window,
  249. something that must be done with the mouse in 8-1/2.
  250.  
  251. The |9term| interface is consciously similar to that of |sam|.  Button 1
  252. in both programs selects text, button 2 supplies the editing menu,
  253. and button 3 provides the control menu.  Double-clicking button 1 at
  254. the end of a line selects the whole line, and double-clicking in the
  255. middle of a word selects the word.  Finally, in both programs, menus
  256. ``remember'' the last command issued. Thus, the next time you call up a
  257. menu, the default action is to do what you did last time, which is often
  258. what you want to do.
  259.  
  260. Having the identical interface makes using your system much easier; you
  261. don't have to mentally ``switch gears'' when moving from one window to
  262. the next, your mouse and keyboard work the same way, no matter what.
  263.  
  264. |9term| is fast because it is simple. Unlike |xterm|, it is not
  265. emulating a real terminal (or two or three), trying to interpret and
  266. process escape sequences. This means, for example, that you can't run
  267. |vi| or |emacs| inside a |9term| window.  On the other hand, why would
  268. you want to?  |sam| is considerably more powerful than |vi|, and much
  269. easier to learn than |emacs|. My intent is not to start Yet Another
  270. Religious Editor War. Rather, the philosophy is that |9term| doesn't
  271. have to be complicated to support screen editors, since a powerful
  272. editor, |sam|, is already available.
  273.  
  274. In the same directory as the |9term| distribution there is a tar file
  275. with a large set of Unicode fonts for use with X.  I particularly like
  276. the |pelm.latin1.9| font.
  277.  
  278. The sidebar describes where to get |9term| and the Unicode fonts.
  279.  
  280. In next month's conclusion, we'll discuss the shells to run inside |9term|,
  281. and the |9wm| window manager that completes the 8-1/2 emulation.
  282.  
  283. ------------- split here --------------------
  284.  
  285.         What's GNU
  286.         Arnold Robbins
  287.  
  288. This month's column concludes the article on [italics] Plan 9 From Bell
  289. Labs [normal], and those parts of it that have been re-implemented in
  290. freely available software.
  291.  
  292. Last month we described the origins of Plan 9, the |sam| editor, and the
  293. |9term| terminal emulator.
  294.  
  295. The |rc| Shell
  296. ==============
  297.  
  298. Well, what about the shell to run inside the window?  Here too, the
  299. Plan 9 people took the opportunity to rethink the issue of just how
  300. should a shell work. The Plan 9 shell is called |rc|, because it ``runs
  301. commands''.
  302.  
  303. Although in many ways the Bourne shell is a simple, elegant, high-level
  304. programming language, it has a serious flaw, in that it was designed to
  305. be much like a macro-processing language. Input text is scanned, rescanned,
  306. and rescanned again, as each stage of processing is performed. (This is
  307. carried to an almost absurd length in the Korn shell, with something like
  308. eleven different processing stages.)  This leads to rather complicated
  309. and baroque quoting rules, with the need for nested escape sequences.
  310.  
  311. In |rc|, the input text is scanned and parsed exactly once. The language
  312. has a real |yacc|-based grammar, making it clear what everything means.
  313. The quoting rules are very simple. Quoted text must be enclosed between
  314. single quotes. To get a single quote inside a quoted string, double it
  315. (as in FORTRAN).  An explicit operator is used to provide string concatenation,
  316. and variables can be lists of strings, not just single strings.
  317.  
  318. The syntax is closer to that of C or |awk|, instead of Bourne's Algol
  319. 68.  This leads to less clutter, avoiding unnecessary keywords and
  320. semi-colons. It is much more like C than the fabled |csh| is.
  321.  
  322. |rc| provides shell functions, and signal handlers are written as
  323. functions with special names (|sighup|, |sigterm|, etc.), instead of
  324. using strings.  I/O redirection is also more powerful, with a notation
  325. for hooking up file descriptors besides 0 and 1 to the input and output
  326. ends of a pipe.
  327.  
  328. A freely distributable clone of |rc| is available. It was written by
  329. Byron Rakitzis, and implements the language described in the |rc|
  330. paper, with some extensions.  The beauty of |rc| is that it is small
  331. and fast, and shell programs can be quite elegant. It also runs on just
  332. about any kind of Unix system.
  333.  
  334. When using |rc| with |9term|, it is conventional to set the primary
  335. prompt to be just a single semi-colon, and the secondary prompt to
  336. be empty. This allows you to snarf entire commands, including the prompt,
  337. and resend them. The semi-colon is treated as a simple null statement.
  338. The use of double-clicking to select the whole line, and the default
  339. saved action of the menus make sending and resending the same line
  340. over again extremely simple; most of the work can be done with just the mouse.
  341.  
  342. The Resources sidebar lists the |ftp| location of the |rc| shell.
  343. There is also a mailing list of people who use |rc|.
  344.  
  345. es
  346. ==
  347.  
  348. |es| is the ``extensible shell.''  Paul Haahr and Byron Rakitzis
  349. thought it would be interesting to try and combine some of the
  350. capabilities of functional languages with those of Unix shells.  Many
  351. internal capabilities of the shell (such as I/O redirection and setting
  352. up pipelines) are available as built-in functions in the language, and
  353. program fragments can be passed around as arguments to functions.
  354.  
  355. |es| provides first class functions, lexical scope, an exception system,
  356. and rich return values (i.e. functions can return values other than
  357. just numbers).  Most of this is beyond the scope of this article to explain.
  358. |es| is described in a paper in the Winter 1993 Usenix Conference Proceedings.
  359. It helps to read this paper, and also to go through the archives of the mailing
  360. list to see how the language evolved.  For the full details on |es|, you'll
  361. need to read the paper, the man page, and the file initial.es in the |es|
  362. distribution. It is a good idea to also look at the sample .esrc file, too.
  363.  
  364. Basically, the idea behind |es| is to take the primitive operations that
  365. a shell does, such as forking processes, creating pipes, and setting up
  366. I/O redirections, and make them available as functions that a user program
  367. can call directly.  In turn, traditional shell syntax is built on top of
  368. these primitive operations.
  369.  
  370. Lexical scoping allows you to save the definition of an operation, and
  371. then replace it with your own operation on top of the previous one.  Here
  372. is an example from the paper on |es|.  This code implements a pipeline
  373. profiler. It saves the definition of |%pipe|, which creates pipes, and
  374. provides a new one that times each component of the pipeline, using the
  375. old |%pipe| to actually create the pipeline. (|es>| is the prompt from
  376. |es| used for examples in the paper. The default prompt is a semi-colon.)
  377.  
  378. es> let (pipe = $fn-%pipe) {
  379.     fn %pipe first out in rest {
  380.         if (~ $#out 0) {
  381.             time first
  382.         } {
  383.             $pipe { time $first } $out $in { %pipe $rest }
  384.         }
  385.     }
  386. }
  387. es> cat paper9 | tr -cs a-zA-Z0-9 '\012' | sort | uniq -c | sort -nr | sed 6q
  388.  213 the
  389.  150 a
  390.  120 to
  391.  115 of
  392.  109 is
  393.   96 and
  394.    2r    0.3u   0.2s    cat paper9
  395.    2r    0.3u   0.2s    tr -cs a-zA-Z0-9 \012
  396.    2r    0.5u   0.2s    sort
  397.    2r    0.4u   0.2s    uniq -c
  398.    3r    0.2u   0.1s    sed 6q
  399.    3r    0.6u   0.2s    sort -nr
  400.  
  401. This is a simple example, yet it illustrates some of the power
  402. available in |es|.  |es| really deserves a column on its own.  For more
  403. information, see the above sources and the mailing list archive.
  404.  
  405. The sidebar lists the |ftp| location for |es|, and a mailing list is
  406. also available.
  407.  
  408. The |9wm| Window Manager
  409. ========================
  410.  
  411. The tools we've seen so far, notably |sam| and |9term|, are built on
  412. top of X Windows, and work with any window manager.  For some time, I
  413. ran them using |mwm|.
  414.  
  415. In the fall of 1993, I obtained a version of |gwm|, the Generic Window
  416. Manager, with WOOL (Windows Object Oriented Lisp) code that implemented an
  417. interface very similar to that of the original Bell Labs Blit terminal.
  418. This provides a simple, clean interface, similar to that used on Plan 9
  419. (8-1/2 can be considered a further evolutionary step from the Blit).
  420. This code was written by John Mackin at the University of Sydney.  The
  421. resources sidebar shows where you can get this code, if you're
  422. interested.  This code works, but it is large and slow.
  423.  
  424. However, a new window manager recently became available, |9wm|. |9wm|
  425. implements the window management policies of 8-1/2, under X windows.
  426. Written by David Hogan at the University of Sydney, it uses raw Xlib
  427. (not a pretty sight), and is completely ICCCM compliant. |9wm| is also
  428. small, and very fast.  To quote from the README file:
  429.  
  430.     9wm is an X window manager which attempts to emulate the Plan 9
  431.     window manager 8-1/2 as far as possible within the constraints
  432.     imposed by X. It provides a simple yet comfortable user
  433.     interface, without garish decorations or title-bars. Or icons.
  434.     And it's click-to-type.  This will not appeal to everybody, but
  435.     if you're not put off yet then read on.  (And don't knock it until
  436.     you've tried it). 
  437.  
  438. |9wm| is ``click to type.'' This means you have to move the mouse into
  439. a particular window and then click button one.  That window becomes the
  440. current window, indicated by a thick black border. Other windows have a
  441. thin black border. This behavior is identical to |sam|'s.
  442.  
  443. The |9wm| menu (accessed through button 3 on the root window) consists of
  444. five items:
  445.     |New|        - open a new window (|9term|, or |xterm| if no |9term|)
  446.     |Reshape|    - change the shape of a window on the screen
  447.     |Move|        - move a window
  448.     |Delete|    - blow away a window
  449.     |Hide|        - ``iconify'' a window
  450.  
  451. What is perhaps most noticable about |9wm| (and the way 8-1/2 works) is that
  452. there are no icons.  Instead, to remove a window from the screen, you select
  453. |Hide| from the main menu. The cursor becomes a target. You move the target
  454. to the window to be hidden, and then click button 3. Clicking any other
  455. button cancels the operation.
  456.  
  457. When a window is hidden, it disappears from the screen completely, not
  458. even leaving an icon. Instead, a new item appears at the bottom of the
  459. button 3 |9wm| menu, with the name of the window. To open the window
  460. again, you simply select the window's name from the menu.
  461.  
  462. As with the other programs, the |9wm| menu remembers what you did last
  463. time, so that the next time you pop up the menu, the previous selection is
  464. already highlighted
  465.  
  466. The |9menu| Command Line Menu Program
  467. =====================================
  468.  
  469. And now, my own small contribution to the picture.  The GWM Blit
  470. emulation, which I used for quite awhile, understood that it was built
  471. on top of X, and when you selected |New|, it gave you a menu of hosts
  472. (that you defined in a configuration file) on which to start remote
  473. |xterm|s.  This was nice, and I found it missing under |9wm|.
  474. (In Plan 9, this is not an issue; the multiple hosts in the network
  475. are very tightly integrated, but in X with Unix, it is a problem.)
  476.  
  477. What I wanted was a simple program to which you could give menu items
  478. and associated commands, and this program would pop up a window that was
  479. nothing but a menu. Selecting an item would run a command.  The program would
  480. be long lived, leaving the menu up permanently.
  481.  
  482. There exists a program that is close to this, |xmenu|. Unfortunately,
  483. |xmenu| goes away after executing the command, and is not well behaved
  484. when interacting with |9wm|.
  485.  
  486. Inspired by |9wm|, starting with its menu code, and with help from
  487. David Hogan, I wrote |9menu|. |9menu| pops up a window containing
  488. the list of items, and executes the corresponding command when a button
  489. is pressed.
  490.  
  491. |9menu| allows you to write your own menus and customize the behavior
  492. to suit you, without the headaches of a .twmrc or .mwmrc file. It is
  493. real easy to have one item spawn another |9menu|, giving a similar effect to
  494. pull-right menus.
  495.  
  496. Here is how I use it, one for remote systems, the other for programs I
  497. may want to run. Being lazy, I have |xterm| in both.  I use a shell
  498. script named |rxterm| that knows about the remote hosts I will want to
  499. open windows on, and whether they can start a |9term| or an |xterm|.
  500. (This is left over from the GWM Blit code, and is mostly for
  501. convenience.) These examples are from my .xinitrc.  The |-geometry|
  502. strings are to get |9wm| to place the windows even though they
  503. start out iconified.
  504.  
  505. 9menu -geometry 67x136-4+477 -iconic -popdown -label Remotes \
  506.     'solaria:rxterm solaria.cc.gatech.edu' \
  507.     'burdell:rxterm burdell.cc.gatech.edu' \
  508.     'chrome:rxterm chrome.cc.gatech.edu' \
  509.     'xterm:rxterm xterm' \
  510.     exit &
  511. 9menu -geometry 103x102-3+624 -iconic -popdown -label 'X programs' \
  512.     'xterm:rxterm xterm' \
  513.     xtetris xlock '9wm restart' '9wm exit' exit &
  514.  
  515. I start the programs using |-iconic| so that they'll be automatically hidden
  516. and part of the |9wm| menu.  The |-popdown| option causes the menu to
  517. automatically iconify itself after an item is selected, since I find this
  518. to be the most convenient way for me to work: pop up the menu, select an
  519. item, and then go on with what I want to do without the menu hanging around.
  520.  
  521. Although not nearly as large scale a program as |sam|, |9term|, or |9wm|,
  522. I find that |9menu| completes the package for me.
  523.  
  524. Experiences
  525. ===========
  526.  
  527. I have been using this environment for almost two years, and find it
  528. to be clean, elegant, and easy to use.  Initially, I started by using |rc|,
  529. and then |sam| when it became available in early 1993.  Shortly after
  530. that, I started beta-testing |9term|, in particular getting it to work
  531. correctly under SunOS.  In the fall of 1993, the GWM Blit code became
  532. available, and I switched to that, using it for almost a year. In the
  533. spring of 1994, I started beta-testing |9wm|, which was finally released
  534. at the end of 1994.  I switched to |es| in January of 1993 after
  535. reading about it and hearing the presentation at the winter Usenix.
  536.  
  537. The research group at Bell Labs is well known for applying the ``small
  538. is beautiful'' principle to software design.  This was initially true
  539. of Unix, and has been re-applied to distributed systems, shells, and
  540. user interfaces with Plan 9.
  541.  
  542. The interface is simple, consistent, easy to use, and very clean.  All the
  543. programs described in this column behave the same way, in terms of what
  544. the buttons do, which window is current, and how the menus remember the
  545. previous operation.
  546.  
  547. An important point that I have not emphasized so far, is that all the
  548. programs use pop-up menus.  I find this to be an enormous
  549. convenience, particularly compared to systems like Windows or the
  550. Macintosh, where you *must* move the mouse to the menu bar to pull down
  551. a particular menu. Pop-up menus save an incredible amount of otherwise
  552. useless mouse motion, leading to a system that is much easier to use.
  553.  
  554. My first exposure to window systems was long ago, on a Blit terminal.
  555. The interface was simple, clean and elegant. Ever since then, I had been
  556. searching for an X windows environment that matched the Blit's elegance.
  557. Now, with the combination of |sam|, |9term|, |9wm| and |rc| or |es|, I
  558. feel that I have finally found that environment, and I'm very happy.
  559. What's even nicer is that all of these programs are fast, and I have the
  560. broad range of X applications available to me also (|xoj|, anyone?).
  561. This latter point is unfortunately not true of the only other
  562. alternative, |mgr| (which I used until |9term| became available.
  563.  
  564. Using These Programs Under Linux
  565. ================================
  566.  
  567. All the programs described here can be made to compile under Linux.
  568. I don't have a Linux system of my own (believe or not!), but for a while
  569. I borrowed one, and was able to bring up all of these programs.  Unfortunately,
  570. the system was a laptop, with too small a screen to make using X worthwhile.
  571.  
  572. |sam| comes up fine, using the Make.solaris makefile as a starting point. |9wm|
  573. also compiled just fine. |9term| took a little bit of work, but it did
  574. compile and run.  After asking on the mailing lists, I learned that |9term|
  575. does not (yet) work quite correctly under Linux.  This may be fixed by the
  576. time you read this column, though. Two people to contact for information
  577. about porting |9term| to Linux are:  Pete Fenelon (|pete@minster.york.ac.uk|),
  578. and Markus Friedl (|msfriedl@faui01.informatik.uni-erlangen.de|).
  579.  
  580. |rc| and |es|, both compile and run under Linux, but with some work.
  581. For |rc|, you have to generate the sigmsgs.c file by hand, based on
  582. /usr/src/linux/include/sys/signal.h.  There is one other bug, reported
  583. by Jeremy Fitzhardinge, which is that |rc| uses |int|s for the array
  584. of additional groups, while Linux uses |gid_t|s, which are |short|s.
  585.  
  586. |es| requires similar changes for the signal handling, but these are actually
  587. documented in the Makefile.
  588.  
  589. Summary
  590. =======
  591.  
  592. The combination of |9term| and |9wm| provides a very close emulation of
  593. the elegant Plan 9 user interface. |sam| is a powerful, easy to use
  594. editor.  |rc| is a simple, clean shell, and |es| is a nifty shell with
  595. lots of promise.  It is worth reading the papers describing each of these
  596. components.  The complete combination proves once again that ``small is
  597. beautiful.''
  598.  
  599. Acknowledgements
  600. ================
  601.  
  602. Thanks to Chris Seibenmann and Daniel Ehrlich, maintainers of the various
  603. mailing lists, for their help, as well as to the members of the lists who
  604. responded to my questions about Linux.  Thanks to Bob Flandrena,
  605. Paul Haahr, and Miriam Robbins for their comments.
  606.  
  607. References
  608. ==========
  609.  
  610. 1. Rob Pike, Dave Presotto, Ken Thompson, and Howard Trickey, ``Plan 9 from
  611.    Bell Labs'', Proc. of the Summer 1990 UKUUG Conf., London, July, 1990,
  612.    pp. 1-9.
  613.  
  614. 2. Rob Pike, Dave Presotto, Ken Thompson, and Howard Trickey, ``Plan 9, A
  615.    Distributed System'', Proc. of the Spring 1991 EurOpen Conf., Troms,
  616.    May, 1991, pp. 43-50.
  617.  
  618. 3. Rob Pike, ``The Text Editor |sam|'', Software---Practice and Experience,
  619.    November 1987, Vol. 17, #11, pp. 133-153.
  620.  
  621. 4. Rob Pike, ``8-1/2, the Plan 9 Window System'', Proc. of the Summer 1991
  622.    Usenix Conf., Nashville, June 1991, pp. 257-265.
  623.  
  624. 5. Tom Duff, ``Rc - A Shell for Plan 9 and UNIX Systems'', Proc. of the
  625.    Summer 1990 UKUUG Conf., London, July, 1990, pp. 21-33.
  626.  
  627. These papers are all available in Postscript as part of the Plan 9
  628. documentation.
  629.  
  630. 6. Paul Haahr and Byron Rakitzis, ``Es: A shell with higher-order functions'',
  631.    Proceedings of the Winter 1993 Usenix Conf., January 1993, pp. 53-62.
  632.  
  633. This paper is available for |ftp| along with the |es| source code.
  634.  
  635. RESOURCES sidebar:
  636.  
  637. plan9.att.com:/plan9/plan9doc/*
  638. plan9.att.com:/plan9/plan9man/*
  639.     information on Plan 9 (including the 8-1/2 manual entry).
  640.  
  641. plan9.att.com:/plan9/doc/*
  642.     troff and Postscript for papers describing the current system.
  643.  
  644. netlib.att.com:/netlib/research/sam.msg.Z
  645.     source code and information on Rob Pike's editor |sam|.
  646.  
  647. ftp.cs.su.oz.au:/matty/unicode/*
  648.     source to |9term| and the Unicode X fonts (get README first).
  649.  
  650. rtfm.mit.edu:/pub/usenet/comp.unix.shell/rc-FAQ
  651.     information on |rc| (or look in |comp.unix.shell|).
  652.  
  653. ftp.sys.toronto.edu:/pub/rc/rc-1.4.tar.Z
  654.     source to |rc|.
  655.  
  656. ftp.sys.toronto.edu:/pub/es/es-0.84.tar.Z
  657. ftp.sys.toronto.edu:/pub/es/usenix-w93.ps.Z
  658.     source to |es| and the Usenix paper describing it.
  659.  
  660. ftp.sys.toronto.edu:/pub/9term/gwm-dist.tar
  661.     source to the GWM Blit distribution.
  662.  
  663. ftp.cs.su.oz.au:/dhog/9wm/*
  664.     source code for |9wm|.
  665.  
  666. ftp.cc.gatech.edu:/pub/people/arnold/9menu-1.3.shar.gz
  667.     source code and man page for |9menu|.
  668.  
  669. Here are the mailing list addresses for |sam|, |rc|, and |es|.
  670. |9term| is generally discussed on the |sam-fans| list.
  671.  
  672.     |sam-fans-request@hawkwind.utcs.utoronto.ca|: subscriptions
  673.     |sam-fans@hawkwind.utcs.utoronto.ca|: messages
  674.  
  675.     |rc-request@hawkwind.utcs.utoronto.ca|: subscriptions
  676.     |rc@hawkwind.utcs.utoronto.ca|: messages
  677.  
  678.     |es-request@hawkwind.utcs.utoronto.ca|: subscriptions
  679.     |es@hawkwind.utcs.utoronto.ca|: messages
  680.  
  681. Mailing list archives are all on ftp.sys.utoronto.ca.
  682.  
  683. The mailing list for Plan 9 is |9fans@cse.psu.edu|, which is the list
  684. itself, and |9fans-request@cse.psu.edu|.  This latter address is an
  685. automated mail server that will reply with a message telling you how to
  686. subscribe.  The server also manages the archives.  According to Daniel
  687. Ehrlich, the manager, ``You can get a list of available files by
  688. sending e-mail to <Majordomo@cse.psu.edu> with 'index plan9-fans' as
  689. the message body.  Files can be retrieved with 'get plan9-fans
  690. <filename>'.  If you want a complete list of available commands send
  691. 'help' to majorodomo@cse.psu.edu.''
  692.