home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / PStream / Rexx / CMDshell.tsrx < prev   
Text File  |  1993-11-08  |  2KB  |  62 lines

  1. /* CMDshell.tsrx */
  2. /* Copyright 1993 Soft-Logik Publishing Corporation */
  3. /* May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4. /* $VER: 2.0 */
  5.  
  6. /* Purpose: Opens a console window and feeds typed commands directly
  7.    to TypeSmith */
  8.  
  9. /* written by Gary Knight 3/24/93 */
  10.  
  11. options results
  12. options failat 100
  13.  
  14. open('console', 'CON:0/11/640/100/TypeSmith/SCREEN TypeSmith', 'RW')
  15. writeln('console', 'Enter commands, "Q" to exit.')
  16.  
  17. address TYPESMITH
  18.  
  19. /* loop until user exits */
  20. do forever
  21.  
  22.         /* get command string from user */
  23.         writech('console','CMD> ')
  24.         cmd=upper(readln('console'))
  25.  
  26.         select
  27.  
  28.                 /* time to quit? */
  29.                 when (upper(cmd) = "Q") then do
  30.                         leave
  31.                 end
  32.  
  33.                 /* need some help? */
  34.                 when (cmd = "?") then do
  35.                         writeln('console', 'Enter "Q" to exit.')
  36.                 end
  37.  
  38.                 /* do nothing on empty lines */
  39.                 when (cmd = "") then do
  40.                         nop
  41.                 end
  42.  
  43.                 /* whatsinaline */
  44.                 otherwise do
  45.                         /* execute the command string */
  46.                         cmd
  47.  
  48.                         /* if ok show the result, if any */
  49.                         if (RC = 0) then do
  50.                                 if result ~= "RESULT" then writeln('console', result)
  51.                         end
  52.  
  53.                         else do
  54.                                 writeln('console', '*** Error');
  55.                         end
  56.                 end
  57.         end
  58. end
  59.  
  60. exit(0)
  61.  
  62.