home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / adeptful.zip / Testupload.Cmd < prev    next >
OS/2 REXX Batch file  |  1997-07-05  |  3KB  |  113 lines

  1. /* ************************************************* */
  2. /* TestUpload.Cmd by Koen Koster (Alias CliP)        */
  3. /* ************************************************* */
  4. /* fname      = complete filename to work on         */
  5. /* linenumber = line number                          */
  6. /* handle     = com port handle                      */
  7. /* name       = just filename (no path, no extension */
  8. /* extension  = just extension                       */
  9. /* ************************************************* */
  10.  
  11. Parse Upper Arg fname linenumber handle name extension
  12. call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  13. call SysLoadFuncs
  14.  
  15. curdir  = directory()
  16. olddir  = curdir
  17. newdir  = directory('.\System\Line'linenumber)
  18.  
  19. arctest = 'arc t'
  20. arjtest = 'unarj t'
  21. lzhtest = 'lh32 T'
  22. rartest = 'rar t -c- -std'
  23. ziptest = 'pkzip  /test'
  24. zootest = 'zoo -test'
  25.  
  26. signature = charin(fname,1,5)
  27. rc = Stream(fname, 'c', 'close')
  28. if stream(name'.'||extension||'.error', 'c', 'query exist') <> '' then call SysFileDelete name'.'||extension||'.error'
  29.  
  30. TestArchive:
  31.    /* Arc file */
  32.    if (substr(signature,2,1)  = "")    then signal TestARC
  33.  
  34.    /* Arj file */
  35.    if (substr(signature,1,2) = "`Ω")    then signal TestARJ
  36.  
  37.    /* Arj SE file */
  38.    if (substr(signature,1,3) = "MZΩ")   then signal TestARJ
  39.  
  40.    /* Lzh lh/2 file */
  41.    if (substr(signature,3,3) = "-lh")   then signal TestLZH
  42.  
  43.    /* Lh/2 2.22 SE file */
  44.    if (substr(signature,1,5) = "MZ▒-") then signal TestLZH
  45.  
  46.    /* Zip 2.0x file */
  47.    if (substr(signature,1,5) = "PK") then signal TestZIP
  48.  
  49.    /* Zip 1.0x file */
  50.    if (substr(signature,1,4) = "PK")  then signal TestZIP
  51.  
  52.    /* Zip SE type 1 file */
  53.    if (substr(signature,1,4) = "MZÜ")  then signal TestZIP
  54.  
  55.    /* Zip SE type 2 file */
  56.    if (substr(signature,1,4) = "MZ╖")  then signal TestZIP
  57.  
  58.    /* Zip SE type 3 file */
  59.    if (substr(signature,1,4) = "MZ⌡")  then signal TestZIP
  60.  
  61.    /* Rar file */
  62.    if (substr(signature,1,4) = "Rar!")  then signal TestRAR
  63.  
  64.    /* Rar SE file */
  65.    if (substr(signature,1,2) = "MZ")    then signal TestRAR
  66.  
  67.    /* Zoo 2.x file */
  68.    if (substr(signature,1,3) = "ZOO")   then signal TestZOO
  69.  
  70.    signal BackToBBS
  71.  
  72. TestARC:
  73.    arctest' 'fname
  74.    if rc = 1 then signal Error
  75.    else signal noError
  76.  
  77. TestARJ:
  78.    arjtest' 'fname
  79.    if rc = 1 then signal Error
  80.    else signal noError
  81.  
  82. TestLZH:
  83.    lzhtest' 'fname
  84.    if rc = 1 then signal Error
  85.    else signal noError
  86.  
  87. TestRAR:
  88.    rartest' 'fname
  89.    if rc = 1 then signal Error
  90.    else signal noError
  91.  
  92. TestZIP:
  93.    ziptest' 'fname
  94.    if rc = 1 then signal Error
  95.    else signal noError
  96.  
  97. TestZOO:
  98.    zootest' 'fname
  99.    if rc = 1 then signal Error
  100.    else signal noError
  101.  
  102. Error:
  103.    error = lineout(name'.'||extension||'.Error','ERROR')
  104.    signal BackToBBS
  105.  
  106. NoError:
  107.    'f:\ut\os2scan /noexpire ' fname
  108.    if rc \= 0 then signal Error
  109.   /* do something like virus scanning */
  110.  
  111. BackToBBS:
  112.   curdir = directory(olddir)
  113.