home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / clomail.zip / CLOMAIL.CMD < prev   
OS/2 REXX Batch file  |  1994-03-28  |  2KB  |  69 lines

  1. /* automail in rexx version 2 by ken */
  2.  
  3. parse arg cline.1 cline.2 cline.3 cline.4 cline.5 cline.6
  4.  
  5. if cline.1 = '' then call help
  6. if cline.2 = '' then call help
  7.  
  8. CFG = cline.1
  9. OUTBOUND = cline.2
  10. total_x_size = 0
  11. 'echo off'
  12.  
  13. do while lines(CFG)
  14.    parse value linein(CFG) with netnode maxsize;
  15.    if (left(netnode, 1) = ';' ) then nop
  16.    else do
  17.            flo_name = node_to_flo(netnode)
  18.            current_flo = OUTBOUND'\'flo_name'.hlo'
  19.            if ( stream(current_flo, 'c', 'query exists')  = "" )
  20.              then do
  21.                      say netnode 'has no HLO file in' OUTBOUND
  22.                      iterate
  23.                   end
  24.            else do while lines(OUTBOUND'\'flo_name'.hlo')
  25.                    x = linein(OUTBOUND'\'flo_name'.hlo')
  26.                    y = substr(x, pos(':\',x) - 1)
  27.                    size_y = stream(y,'c','query size')
  28.                    total_x_size = total_x_size + size_y
  29.                  end
  30.            if total_x_size > maxsize
  31.            then do
  32.                'type' OUTBOUND'\'flo_name'.hlo' '>>' OUTBOUND'\'flo_name'.clo'
  33.                call stream OUTBOUND'\'flo_name'.hlo','c','close'
  34.  
  35.                 'del' OUTBOUND'\'flo_name'.hlo'
  36.                   say netnode ' packet now crash '
  37.                 end
  38.            else say netnode 'packet still on hold'
  39.          end
  40. end
  41.  
  42. exit
  43.  
  44. node_to_flo: arg
  45. node = arg(1)
  46. temp1 = substr(node,1,(pos('/',node)-1))
  47. temp2 = substr(node,(pos('/',node)+1))
  48. _temp1 = right( d2x(temp1) , 4, '0')
  49. _temp2 = right( d2x(temp2) , 4, '0')
  50. result = insert(_temp1,_temp2)
  51. return result
  52.  
  53.  
  54. help:
  55. say
  56. say 'CloMail.CMD'  '(c)Ken Kavanagh 1994'
  57. say
  58. say '  Used to change the flavour of mail put on hold so that when a FLO'
  59. say 'file contains greater than x bytes (as configured in CloMail.CFG)'
  60. say 'a HLO file will be renamed to CLO'
  61. say
  62. say 'I find it handy in reducing the number of outbound calls at least until'
  63. say 'there is some hefty amount of mail to deliver :)'
  64. say
  65. say 'USAGE:'
  66. say '           CloMail <d:\path\CloMail.cfg> [d:\<outbound>]'
  67. say
  68. exit (1)
  69.