home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgprex12.arj / PGPREXX.ZIP / JOINMAIL.CMD next >
Encoding:
Text File  |  1996-07-25  |  1.7 KB  |  68 lines

  1. /* REXX
  2.    Program JOINMAIL 1.2
  3.    REceives Header from Queue
  4.    Looks for a '-----BEGIN PGP' line in STDIN
  5.        and skips everything before
  6.    Writes the rest from STDIN to the file named in the first argument
  7.    By deleting the file it is made sure that nothing is sent out when there was a PGP error
  8. */
  9. /* CopyRight Lueko Willms <lueko.willms@T-Online.de>
  10.                           <L.WILLMS@LINK-F.rhein-main.de>
  11. */
  12.  
  13. arg OutMail DEBUG .
  14.  
  15. DEBUG = (strip(translate(DEBUG)) = 'DEBUG')
  16. TRUE = 1
  17.  
  18. CR = '0D'x
  19.  
  20. If DEBUG then
  21.   PARSE SOURCE BetrSyst Shell MyName
  22.  
  23.  
  24. Erg = ''
  25. Say
  26. Call CHAROUT  ,'         Wait for / Warte auf ' Outmail
  27.  
  28. Zaehler = 0
  29. DO UNTIL Erg = 'READY:'          /* Waiting indefinitely for exclusive WRITE access to OutMail */
  30.   If (Zaehler // 10) = 0 Then
  31.       Call CHAROUT ,CR||Zaehler
  32.   Erg = STREAM(Outmail,'C','OPEN WRITE')
  33.   Zaehler = Zaehler + 1
  34.   If DEBUG Then
  35.      Say MyName i'. Versuch: Ergebnis von OPEN WRITE von ' Outmail':' Erg
  36. end /* do */
  37. Say
  38.  
  39. Erg = STREAM(Outmail,'C','CLOSE')
  40. 'del ' Outmail
  41. Erg = STREAM(Outmail,'C','OPEN WRITE')
  42. Erg = LINEOUT(Outmail,,1)
  43. If DEBUG Then
  44.   Say MyName 'ERgebnis von RESET ' OUtmail ':' Erg
  45.  
  46. IF (DEBUG & QUEUED() = 0) Then
  47.    ERg = LINEOUT(STDERR,'He! nix in der Warteschlange! Queue is empty!')
  48.  
  49. DO UNTIL QUEUED() = 0
  50.    Erg = Lineout(Outmail,LINEIN('QUEUE:'))
  51. End
  52.  
  53. Textline=''
  54. DO UNTIL (ABBREV(Textline,'-----BEGIN PGP') | (LINES() = 0))
  55.    Textline = LINEIN()
  56. END /* DO skip lines before PGP output */
  57. Erg = LINEOUT(Outmail,Textline)
  58.  
  59. Do WHILE LINES() > 0
  60.    Erg = LINEOUT(Outmail,LINEIN())
  61. END
  62.  
  63. Erg = STREAM(Outmail,'C','CLOSE')
  64. If DEBUG Then
  65.   Say MyName 'Ergebnis von CLOSE ' OUtmail ':' Erg
  66.  
  67. EXIT 
  68.