home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / rxjis096.zip / mimerecv.cmd < prev    next >
OS/2 REXX Batch file  |  1997-08-07  |  3KB  |  66 lines

  1. /* product name: RXJIS                                                */
  2. /* Version:      0.40                                                 */
  3. /* author:       YANO Takashi                                         */
  4. /* target:       OS/2 Warp J3.0+                                      */
  5. /* module name:  MIMERECV.CMD                                         */
  6. /* source name:  MIMERECV.CMD                                         */
  7. /* compiler:     N.A.                                                 */
  8. /* address:      tyano@ca2.so-net.or.jp or tyano@yamato.ibm.co.jp     */
  9. /* comment:      RXJIS is a utility functions for REXX.               */
  10. /*               It encodes and decodes JIS 7 bit strings and MIME    */
  11. /*               format strings.                                      */
  12. /*                                                                    */
  13. /*               MIMERECV.CMD is a sample program how to use          */
  14. /*               RXJIS. I am using it with PostRoadMailer 1.03a.      */
  15. /*               It converts a mail message with MIME or JIS 7bit     */
  16. /*               into PC Kanji codet mail message.                    */
  17. /*                                                                    */
  18. /* how to use:   MIMERECV fn                                          */
  19. /*               fn is a mail message file. The converted result is   */
  20. /*               in fn. The original is lost.                         */
  21. /*                                                                    */
  22. /* history:      1996-2-5 0.00 initial release                        */
  23. /*               1996-3-2 0.20 try to remove control chars in         */
  24. /*                             message.                               */
  25. /*                             Use RxLoadFuncs.                       */
  26. /*               1996-4-21 0.30 charset can be lower.                 */
  27. /*               1996-5-1  0.40 Use RxJisMimeJisTo.                   */
  28. /*               1996-5-24 0.51 Quit to translate control chars       */
  29. /*                                                                    */
  30. signal on novalue
  31. arg fn
  32. parse source . . a
  33. workingdir = filespec('D', a) || filespec('P', a)
  34. errorlog = workingdir || 'errorlog.log'
  35. call rxfuncadd 'RxJisLoadFuncs', 'RXJIS', 'RxJisLoadFuncs'
  36. call RxJisLoadFuncs
  37. call rxfuncadd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs' /* A@0.20 */
  38. call SysLoadFuncs                                         /* A@0.20 */
  39. if stream(fn, 'c', 'query exists') = '' then exit
  40. do i = 1 by 1 while lines(fn)
  41.    line.i = linein(fn)
  42.    if line.i = '' then iterate
  43.    line.i = RxJisMimeJisTo(line.i)
  44. end /* do */
  45. call stream fn, 'c', 'close'
  46. line.0 = i - 1
  47. tfn = value('TMP', , 'OS2ENVIRONMENT')
  48. if tfn = '' then tfn = workingdir
  49. if right(tfn, 1) <> '\' then tfn = tfn || '\'
  50. tfn = SysTempFileName(tfn || '????')
  51. do i = 1 to line.0
  52.    call lineout tfn, line.i
  53. end /* do */
  54. call stream tfn, 'c', 'close'
  55. '@copy' tfn fn
  56. call SysFileDelete tfn
  57. exit
  58.  
  59. novalue:
  60. call lineout errorlog, date('S') time() condition('C') '@' sigl
  61. call lineout errorlog, date('S') time() condition('D')
  62. call lineout errorlog, date('S') time() condition('I')
  63. call stream errorlog, 'c', 'close'
  64. say 'SEE:' errorlog
  65. exit
  66.