home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / timezn_c.zip / TZFIX.CMD < prev   
OS/2 REXX Batch file  |  1996-04-27  |  2KB  |  67 lines

  1. /* OS/2 Rexx Script for MR/2 ICE     */
  2. /* by William H. Geiger III 07 Apr 96 */
  3. /* Geiger Consulting                    */
  4. /* whgiii@amaranth.com                */
  5. /* this script will convert the Date: stamp */
  6. /* in the header of messages back to original */
  7. msg_filename=''
  8. parse arg msg_filename 
  9. xx4=0
  10. xx5='Date:'
  11. xx6='Old TimeStamp:'
  12. xxfix=0
  13. yy1='Date:'
  14. yy2='X-Mailer:'
  15. yy3='From:'
  16. yy4='MR/2'
  17. yyfix='Fixed:'
  18. lin=''
  19. dt_no=0
  20. gb=0
  21. cnt=0
  22. nxy=1
  23. do forever while (length(linein(msg_filename))>0)                        /* pull info from file header */
  24. nxx=stream(msg_filename,'c','seek +0')                                   /* get read pointer */
  25. nxx_rs=stream(msg_filename,'c','seek =' nxy)                            /* reset read pointer */
  26. xx7=0
  27. cnt=cnt+1
  28. lin=linein(msg_filename)
  29. nxy=stream(msg_filename,'c','seek +0')
  30. xx7=pos(xx6,lin,1)
  31. xxfix=pos(yyfix,lin,1)
  32. if xxfix>0 then xxfix1=1
  33. If xx7>0 then do
  34.           dt=lin
  35.           dt_no=cnt
  36.           end
  37. end
  38. st1=stream(msg_filename,'c','close')
  39. if dt_no=0 then call goodby
  40. parse value dt with aa bb dowt date mont yr tm tz tzt
  41. dt1=yy1 dowt date mont yr tm tz tzt
  42. '@echo off'
  43. copy msg_filename 'temp.msg' '>>null'
  44. '@echo off'
  45. erase msg_filename '>>null'
  46. st3=stream('temp.msg','c','open')               /* re-write msg file with original timestamp */
  47. st4=stream(msg_filename,'c','open')
  48. do forever while lines('temp.msg')>0
  49.    lnin = linein('temp.msg')
  50.       If pos(xx5,lnin)>0 then do
  51.               call lineout msg_filename,dt1
  52.               if xxfix1=0 then call lineout msg_filename,'Fixed:'
  53.               end
  54.       else if pos(xx6,lnin)>0 then iterate
  55.                 else call lineout msg_filename,lnin
  56. end /* do */
  57. st3=stream('temp.msg','c','close')
  58. st4=stream(msg_filename,'c','close')
  59. erase 'temp.msg >> null'
  60. goodby= 'all done'
  61. gb=1
  62. call goodby
  63.  
  64. goodby:                                       /* exit routine */
  65. stm_gb=stream(msg_filename,'c','close')
  66. exit
  67.