home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d992 / cyberpager.lha / CyberPager / rexx / mwm / pagewatch < prev    next >
Text File  |  1994-04-05  |  1KB  |  51 lines

  1. /*
  2.  * Script to send monitor a stream and send an IXO page on success.
  3.  *
  4.  * Copyright 1992, Mike W. Meyer
  5.  * All Rights Reserved
  6.  *
  7.  * This filters pages out of it's standard input stream. The only argument
  8.  * is "multi", which causes multi-page messages for long messages.
  9.  */
  10. debug = 0            /* set to 1 to enable debugging messages */
  11. if ~debug then trace Background
  12.  
  13. /* argument processing */
  14. parse arg dest format
  15. if dest = "" then do
  16.     say "no destination specified"
  17.     exit
  18.     end
  19.  
  20. if strip(format) = "" then format = "line"
  21.  
  22. /* Arrange things so signals send us somewhere reasonable */
  23. signal on error
  24. signal on ioerr
  25. signal on halt
  26. signal on syntax
  27.  
  28. /* Spin, watching stdin */
  29. do until eof(stdin)
  30.     line = readln(stdin)
  31.     out = builddata(format)
  32.     if out ~= "" then
  33.         if debug then say dest out
  34.         else address command 'spoolpage' dest 'message' out
  35.     end
  36. exit
  37.  
  38. /* Catch errors and exit in that mode */
  39. error:
  40. ioerr:
  41. halt:
  42. syntax:
  43.     status = "Unexpected error:" rc "at line:" sigl
  44.     if debug then say status
  45.     else address command 'spoolpage' dest 'message' status
  46.     exit 20
  47.  
  48. /* create a lexical scope with only the advertized variables visible. */
  49. builddata: procedure expose line
  50.     interpret "return" arg(1)
  51.