home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1621 / TESTS < prev    next >
Text File  |  1990-12-28  |  4KB  |  105 lines

  1. #!/bin/sh
  2. # This is a shell script. Feed it to sh.
  3. echo '
  4. Hi, and welcome to the pty test script.
  5.  
  6. As in installation, I'\''m not actually going to do anything.
  7. I'\''ll just guide you through a few (non-comprehensive) tests.
  8.  
  9. Remember: Like all software, pty comes without warranty, to the extent
  10. permitted by applicable law. Use it at your own risk.
  11. '
  12.  
  13. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  14.  
  15. echo '
  16. First, just try % pty vi. You shouldn'\''t be able to tell the
  17. difference between this and a normal vi; stopping and restarting should
  18. work perfectly, as should normal typing.
  19. '
  20.  
  21. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  22.  
  23. echo '
  24. Next, try % pty -0 tr \! \? | pty vi. This should work just like the
  25. last vi, with the following differences: 1. Stopping will require two
  26. ^Zs, because csh idiotically doesn'\''t think a pipeline has stopped
  27. when just its second component stops. 2. Exiting will require an extra
  28. line to feed through tr, so that it gets a broken pipe; this is more
  29. sensible than #1. 3. All exclamation points will be turned into question
  30. marks. This has obvious applications. :w /dev/null helps to escape.
  31. '
  32.  
  33. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  34.  
  35. echo '
  36. Continuing along the lines of how to stick annoying programs into a
  37. pipe, try % pty -0 sed '\''s/foo/bar/g'\'' | more. (Remember that sed outputs
  38. each line only after it receives the next.) Try the same thing without
  39. pty.
  40.  
  41. Note that pty -0 can be abbreviated as condom.
  42. '
  43.  
  44. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  45.  
  46. echo '
  47. Next, try using the replacement script program. % script. Type various
  48. commands; try logging on to another terminal and using talk; observe
  49. that you'\''re listed in /etc/utmp. Try the clones of tty, mesg, biff,
  50. u, wall, who, lock. (Try them under a non-pty session too.)
  51. '
  52.  
  53. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  54.  
  55. echo '
  56. Much of the fun of pty is in disconnecting and reconnecting sessions.
  57. If you'\''re ambitious, try % sess sh. ^Z will get you out and back in.
  58. Try sessname without an argument; try it with an argument. Try sesslist.
  59. Finally, try $ disconnect, and go on to the next part of this script.
  60. '
  61.  
  62. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  63.  
  64. echo '
  65. Although it looks like your sh session has finished, it'\''s actually
  66. sitting in limbo, waiting for you to reconnect. You can still see it
  67. under who, sesslist, or ps. Now try % sess reconnect q7  or whatever the
  68. extension of the disconnected session is; you should be right back in.
  69.  
  70. You can try the same thing by actually hanging up your connection, then
  71. logging in again and reconnecting.
  72. '
  73.  
  74. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  75.  
  76. echo '
  77. For one final trick,
  78. % sess sh
  79. $ PS1=FOO.; disconnect
  80. % sess sh
  81. $ sesslist
  82. ...
  83. $ PS1=BAR.; reconnect q7; disconnect
  84. FOO.reconnect p4; disconnect
  85. BAR.reconnect q7; disconnect
  86. FOO.echo Neat, flipping right back and forth!
  87. '
  88.  
  89. echo '----- Press return to continue. ' | tr -d '\012'; read contline
  90.  
  91. echo '
  92. That'\''s it! Make sure the manual pages and programs are easily
  93. accessible. To repeat a note from INSTALL:
  94.  
  95. If you make it through installation and testing and get pty running,
  96. please send a note to the author, Dan Bernstein, on the Internet
  97. at brnstnd@kramden.acf.nyu.edu. Let him know your computer model, OS
  98. version, and what changes you had to make. If you have any trouble,
  99. please also get in touch with the author. If you have a different kind
  100. of system with pseudo-terminal support that could use a pty port, the
  101. author would love to hear about it.
  102.  
  103. Thanks!
  104. '
  105.