home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / mr2_230.zip / MSG2REP.CMD < prev    next >
OS/2 REXX Batch file  |  1994-03-13  |  3KB  |  98 lines

  1. /*
  2.     MR/2 - MSG2REP.CMD
  3.  
  4.     Author:     Nick Knight
  5.     Created:    03/26/93
  6.     Usage:      msg2rep packet.rep packet.msg
  7.     Purpose:
  8.  
  9.     The author claims no copyright to this particular REXX script.
  10.     Feel free to copy it and/or use it for other purposes.  I *would*
  11.     like to see the results of any improvements to it.
  12.  
  13.     US Mail:    Nick Knight, 1823 David Ave.,  Parma, Ohio 44134
  14.     Fidonet:    1:157/2 or 1:/157/200
  15.     Internet:   nick.knight@pcohio.com
  16.     Compuserve: 76066,1240
  17.     BBS:        Private messages on Nerd's Nook, 356-1772 or 356-1872
  18. */
  19.  
  20. /***********************************************************************/
  21. /*      A R C H I V E R     C O M M A N D    D E F I N I T I O N S     */
  22. /***********************************************************************/
  23. /*  To add support for a new unpacker, simply supply a new command
  24.     definition here.  The file name to unpack will be appended to
  25.     the end of the supplied command.  You can customize in more detail
  26.     by modifying the code directly, if need be.
  27. */
  28.  
  29. path = ''
  30.  
  31. zip_command =       'pkzip'
  32. infozip_command =   'zip -j'
  33. arj_command =       'arj u'
  34. zoo_command =       'zoo u'
  35. lharc_command =     'lha u'
  36. lha_command =       'lh a /i'
  37. /*lha_command =       'lh a /i' */      /* for lh2 for OS/2 */
  38. arc_command =       'arc u'
  39.  
  40. noidfile_command =  zip_command
  41.  
  42. /***********************************************************************/
  43. /*                  U N Q W K    F I L E N A M E                       */
  44. /***********************************************************************/
  45. /*
  46.     Returns -1 if it the file "archive.id" is bad or non-existent.
  47.     Otherwise, the "archive_id" is returned (1 -> 6).
  48. */
  49.  
  50. parse arg filename msgfile
  51.  
  52. idfile = "archiver.id"
  53.  
  54. /*
  55. 04/02/93 - if no packet entry, unarchiver wasn't used - default to something
  56. if stream(idfile,'c','query exists') = "" then do
  57.     return -1
  58. end
  59. */
  60.  
  61. if stream(idfile,'c','query exists') = "" then do
  62.     archiver_id = -1
  63. end
  64. else do
  65.     archiver_id = linein(idfile,1,1)
  66.     status = lineout(idfile)
  67. end
  68.  
  69. /*if archiver_id = 1 then archiver_id = 7 */
  70.  
  71. select                                      /* execute the corresponding command */
  72.     when archiver_id = 1 then path || zip_command filename msgfile
  73.     when archiver_id = 2 then path || arj_command filename msgfile
  74.     when archiver_id = 3 then path || zoo_command filename msgfile
  75.     when archiver_id = 4 then path || lharc_command filename msgfile
  76.     when archiver_id = 5 then path || lha_command filename msgfile
  77.     when archiver_id = 6 then path || arc_command filename msgfile
  78.     when archiver_id = 7 then do
  79.         parse arg filebase"."ext
  80.         path || infozip_command filebase msgfile
  81.         if RC = 0 then do
  82.             'copy' filebase||".zip" filebase||".rep"
  83.         end
  84.         if RC = 0 then do
  85.             'del' filebase||".zip"
  86.         end
  87.     end
  88.     when archiver_id = -1 then path || noidfile_command filename msgfile
  89.     otherwise
  90.         say "UNKNOWN ARCHIVE TYPE: " filename "(" archiver_id ")"
  91.         RC = -1
  92. end
  93.  
  94. if RC <> 0 then return -1
  95.  
  96. return 0
  97.  
  98.