home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BOAV_21.ZIP / BOAV.CMD
OS/2 REXX Batch file  |  1993-01-22  |  15KB  |  456 lines

  1. /* DISCLAIMER:  This software is provided "AS IS" without any warranty of any
  2. kind, either expressed or implied.  USE IT AT YOUR OWN RISK.
  3.  
  4. The BBS OnLine Archive Viewer (BOAV) is an attempt at REXX programming
  5. without a manual, since I got into OS/2 by way of the 2.01 beta offer by IBM.
  6. BOAV will allow you to view the contents of ZIP, ARC, ZOO, LZH, and ARJ files,
  7. and also allow you to extract these files for later download.  It is only a 
  8. shell, you will need the following files for full operation:
  9.  
  10. UNARJ.ZIP  PKZ102-2.EXE  ARC2.EXE  LH2_214.ZIP  ZOO21E.EXE
  11.      
  12.            **** Support for PKZIP v2.xx *****
  13.   UNZ50X32.ZIP (and UNZ50X16.ZIP) will provide BOAV with the capability to
  14.   view and extract files compressed with PKZIP v2.xx for DOS.  If you
  15.   want v2.xx support, you will need one of the 2 files listed above, 
  16.   IN ADDITION TO PKZ102-2.EXE.  You will also need to change the variable
  17.   to Unz='yes'.
  18.  
  19.   BOAVEXTR.ZIP is still compressed using PKZ102-2 to maintain compatability.
  20.  
  21. All of which can be found on The Cereal Port BBS, (603)899-3335, 1:132/152 or
  22. any good OS/2 BBS.
  23.  
  24. Put BOAV.CMD in your MAX directory.  Make sure your archivers are in the path.
  25.  
  26. Modify your Max Menu.ctl file as follows:
  27.  
  28.      Xtern_Run Maxpipe.exe_%P_boav.cmd_%F   normal  "View a file"
  29.  
  30. If you're also going to use the extraction feature, you will want to make sure 
  31. that extracted files are deleted after every caller.  To do this modify your 
  32. spawnbbs.cmd file to perform the following command upon exit from the BBS:
  33.  
  34.      del drive:\pathname\BOAVEXTR.ZIP
  35.  
  36. Where drive\pathname point to the bbs file directory where you will have the
  37. files extracted to.(preferably a separate file area).  You should also modify
  38. the FILES.BBS for that area by adding "BOAVEXTR.ZIP  Files Extracted by the BBS 
  39. Online Archive Viewer".  The entry in the FILES.BBS will report that the file 
  40. is "offline" unless someone actually extracts a file(s).
  41.  
  42. As you can see, the extracted files will be compressed into ZIP format, and
  43. the user can extract files, from different archives, and they will all be
  44. added to the one file, BOAVEXTR.ZIP, for download.
  45.  
  46. Copywrite 1992 by Bill Esposito.  This program is FREEWARE, just let me know
  47. how you like it.
  48.  
  49. There are 8 variables that you will need to modify, and there is a comment 
  50. next to them explaining what they are for.
  51. */
  52.  
  53. extrdir='e:\max\av\'      /* the files will be extracted here 
  54.                              MUST be a subdir off your Max dir 
  55.                              each time BOAV is run it will delete all files
  56.                              in this dir so BE CAREFUL and make this a separate
  57.                              directory*/
  58.  
  59. chngdir='\max\av'         /* for changing to the extrdir for decompressing */
  60.  
  61. max='\max'                /* your MAX directory */
  62.  
  63. ext='yes'                 /* enable file extraction for download (yes or no) */
  64.  
  65. dldir='g:\opus\file28\'   /* Path to the BBS file area where BOAV will place 
  66.                              the extracted files */
  67.  
  68. areaname='File Area 28'   /* Title to be displayed to the users reminding them
  69.                              where to look for the extracted files. */
  70. FourOs2='yes'             /* whether you're running 4OS2 or not (yes or no) */
  71.  
  72. Unz='yes'                /* whether your using pkz102 or unz50x 
  73.                             ('yes' for Unz50x)*/
  74.  
  75.  
  76. '@echo off'
  77. call RxFuncAdd 'SysloadFuncs','RexxUtil','Sysloadfuncs'
  78. call sysloadfuncs
  79. arg path
  80.  
  81. if FourOs2='yes' 
  82.    then
  83.       '@del' extrdir'*.* /y>nul'
  84.      else
  85.         '@del' extrdir'*.* /n>nul'
  86.  
  87. l=1
  88. y=1
  89. sw='0'
  90. loop:
  91. /* ansi on */
  92. cls
  93. noclr:
  94. found=''
  95. say ''
  96. say '                 BBS OnLine Archive Viewer'
  97. say '                           v2.1'
  98. say '                     by Bill Esposito'
  99. say
  100. say '                 ZIP, ARJ, LZH, ARC, ZOO'
  101. say ''
  102. loop1:
  103. say ''
  104. SAY ' Input the Filename (Filename.Ext) of the  Archive'; 
  105. say '                     (? for file list, Q to Quit)'; pull arcname
  106. if arcname='?' then call dir
  107. if arcname=''then call quit
  108. if arcname='Q'then call quit
  109. call sysfiletree path''arcname,'file','fo'
  110. do i=1 to file.0 
  111. found=rc
  112. end
  113. if found <> '0' then call nofile
  114. if left(arcname,1)='\' then call loop
  115. if left(arcname,2)=':' then call loop
  116. if right(arcname,3)=lzh then call lzh
  117. if right(arcname,3)=arj then call arj
  118. if right(arcname,3)=arc then call arc
  119. if right(arcname,3)=zoo then call zoo
  120. if arcname='?'then call dir
  121. if unz='yes' then if right(arcname,3)=zip then call zip2
  122. if unz='no' then if right(arcname,3)=zip then call zip
  123.     else call ziponly
  124. call loop
  125. what_to_do:
  126. fileview = ''
  127. filedl=''
  128. say
  129. say
  130. if nofile='yes' then say 'The File You Selected Was NOT Found.  Please make another Selection '
  131. if nofile='yes' then say ''
  132. if nofile='yes' then cd max
  133. if nofile='yes' then nofile=''
  134. if ext='yes' then say 'Would you like to V)iew or E)xtract a file for download?'
  135. if ext='yes' then say 'Or would you like to select a N)ew archive or Q)uit'
  136.  
  137. if ext='yes' then pull ve
  138. if ext='no' then ve=v
  139. if right(ve,1)='Q' then call quit
  140. if right(ve,1)='N' then call loop
  141. if right(ve,1)=v then say 'Which file would you like to view? (filename.ext)'
  142. if right(ve,1)=v then if ext='no' then say 'Or select a N)ew archive or Q)uit'
  143. if right(ve,1)=v then pull fileview
  144. if right(ve,1)=v then if fileview='Q' then call quit
  145. if right(ve,1)=v then if fileview='N' then call loop
  146. s=1
  147. if right(ve,1)=v then do until s=12
  148.  if substr(fileview,s,1)=':' then call invalid
  149.  if substr(fileview,s,1)='\' then call invalid
  150.  if substr(fileview,s,1)='*' then call invalid
  151.  if substr(fileview,s,1)='?' then call invalid
  152. s=s+y
  153. end
  154. if right(ve,1)=v then return
  155.  
  156. if right(ve,1)=e then say
  157. if right(ve,1)=e then say 'Which file would you like to extract? (filename.ext)'
  158. if right(ve,1)=e then say 
  159. if right(ve,1)=e then pull filedl
  160. if right(ve,1)=e then sw=1
  161. s=1
  162. if right(ve,1)=e then do until s=12
  163.  if substr(filedl,s,1)=':' then call invalid
  164.  if substr(filedl,s,1)='\' then call invalid
  165.  if substr(filedl,s,1)='*' then call invalid
  166. s=s+y
  167. end
  168.  
  169. if right(ve,1)=e then return
  170. else call loop
  171.  
  172.  
  173. dir:
  174. fileview='files.bbs'
  175. '@COPY' PATH''FILES.BBS extrdir '>nul'
  176. call read
  177.  
  178. zip:
  179. cls
  180. kind='zip'
  181. fullname=(path''arcname)  
  182. "pkunzip2 -v" fullname 
  183. if rc=0
  184. then call what_to_do
  185. if fileview='Q' then call quit
  186. if filedl='Q' then call quit
  187. x=1
  188. if right(ve,1)=v then pkunzip2 fullname fileview extrdir '>nul'
  189. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  190. if right(ve,1)=v then if rc <> '0' then call zip
  191. if right(ve,1)=v then call read 
  192. if right(ve,1)=v then return
  193. if right(ve,1)=e then pkunzip2 fullname filedl extrdir '>nul'
  194. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  195. if right(ve,1)=e then if rc <> '0' then call zip
  196. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  197. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  198. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  199. if right(ve,1)=e then if rc <> '0' then call zip
  200. if right(ve,1)=e then del extrdir''filedl '>nul'
  201. if right(ve,1)=e then do until x=6000
  202. x=x+y
  203. end
  204. call zip
  205.  
  206. zip2:
  207. cls
  208. kind='zip2'
  209. fullname=(path''arcname) 
  210. "unzip2 -v" fullname
  211. if rc=0
  212. then call what_to_do
  213. if fileview='Q' then call quit
  214. if filedl='Q' then call quit
  215. x=1
  216. cd chngdir
  217. if right(ve,1)=v then 'unzip2' fullname extrdir fileview '>nul'
  218. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  219. if right(ve,1)=v then if rc <> '0' then call zip2
  220. if right(ve,1)=v then cd max
  221. if right(ve,1)=v then call read 
  222. if right(ve,1)=v then return
  223. if right(ve,1)=e then 'unzip2' fullname filedl '>nul'
  224. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  225. if right(ve,1)=e then if rc <> '0' then call lzh
  226. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  227. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  228. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  229. if right(ve,1)=e then if rc <> '0' then call zip2
  230. if right(ve,1)=e then del filedl '>nul'
  231. if right(ve,1)=e then do until x=6000
  232. x=x+y
  233. end
  234. cd max
  235. call zip2
  236.  
  237. lzh:
  238. cls
  239. kind='lzh'
  240. fullname=(path''arcname) 
  241. "lh /v" fullname
  242. if rc=0
  243. then call what_to_do
  244. if fileview='Q' then call quit
  245. if filedl='Q' then call quit
  246. x=1
  247. cd chngdir
  248. if right(ve,1)=v then 'lh x' fullname extrdir fileview '>nul'
  249. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  250. if right(ve,1)=v then if rc <> '0' then call lzh
  251. if right(ve,1)=v then cd max
  252. if right(ve,1)=v then call read 
  253. if right(ve,1)=v then return
  254. if right(ve,1)=e then 'lh x' fullname filedl '>nul'
  255. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  256. if right(ve,1)=e then if rc <> '0' then call lzh
  257. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  258. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  259. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  260. if right(ve,1)=e then if rc <> '0' then call lzh
  261. if right(ve,1)=e then del filedl '>nul'
  262. if right(ve,1)=e then do until x=6000
  263. x=x+y
  264. end
  265. cd max
  266. call lzh 
  267.  
  268. /* Unarj, Zoo, UNZ50X and Arc do not support exit errorlevels, therefore these 
  269. routines act a bit different than zip and lzh.  I have left the errorlevel
  270. checking routines in, with the hope that later versions of said archivers will
  271. support it. */
  272.  
  273. arj:
  274. cls
  275. kind='arj'
  276. fullname=(path''arcname) 
  277. "unarj" fullname 
  278. if rc=0
  279. then call what_to_do
  280. if fileview='' then if filedl='' then call loop
  281. if filedl='' then if fileview='' then call loop
  282. if fileview='Q' then call quit
  283. if filedl='Q' then call quit
  284. x=1
  285. cd chngdir
  286. if right(ve,1)=v then unarj e fullname fileview '>nul'
  287. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  288. if right(ve,1)=v then if rc <> '0' then call arj
  289. if right(ve,1)=v then cd max
  290. if right(ve,1)=v then call read 
  291. if right(ve,1)=v then return
  292. if right(ve,1)=e then unarj e fullname filedl '>nul'
  293. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  294. if right(ve,1)=e then if rc <> '0' then call arj
  295. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  296. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  297. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  298. if right(ve,1)=e then if rc <> '0' then call arj
  299. if right(ve,1)=e then del filedl '>nul'
  300. if right(ve,1)=e then do until x=6000
  301. x=x+y
  302. end
  303. cd max
  304. call arj 
  305.  
  306. Zoo:
  307. cls
  308. kind='zoo'
  309. fullname=(path''arcname) 
  310. "zoo v" fullname 
  311. if rc=0
  312. then call what_to_do
  313. if fileview='Q' then call quit
  314. if filedl='Q' then call quit
  315. x=1
  316. cd chngdir
  317. if right(ve,1)=v then 'zoo -e' fullname fileview '>nul'
  318. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  319. if right(ve,1)=v then if rc <> '0' then call zoo
  320. if right(ve,1)=v then cd max
  321. if right(ve,1)=v then call read 
  322. if right(ve,1)=v then return
  323. if right(ve,1)=e then 'zoo -e' fullname filedl '>nul'
  324. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  325. if right(ve,1)=e then if rc <> '0' then call zoo
  326. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  327. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  328. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  329. if right(ve,1)=e then if rc <> '0' then call zoo
  330. if right(ve,1)=e then del filedl '>nul'
  331. if right(ve,1)=e then do until x=6000
  332. x=x+y
  333. end
  334. cd max
  335. call zoo 
  336.  
  337. arc:
  338. kind='arc'
  339. cls
  340. fullname=(path''arcname) 
  341. "arc2 l" fullname
  342. if rc=0
  343. then call what_to_do
  344. if fileview='Q' then call quit
  345. if filedl='Q' then call quit
  346. x=1
  347. cd chngdir
  348. if right(ve,1)=v then 'arc2 x' fullname fileview '>nul'
  349. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  350. if right(ve,1)=v then if rc <> '0' then call arc
  351. if right(ve,1)=v then cd max
  352. if right(ve,1)=v then call read 
  353. if right(ve,1)=v then return
  354. if right(ve,1)=e then 'arc2 x' fullname filedl '>nul'
  355. if right(ve,1)=v then if rc <> '0' then nofile='yes'
  356. if right(ve,1)=v then if rc <> '0' then call arc
  357. if right(ve,1)=e then pkzip2 dldir''boavextr extrdir''filedl '>nul'
  358. if right(ve,1)=e then if rc = '0' then say 'File was Extracted to 'areaname
  359. if right(ve,1)=e then if rc <> '0' then nofile='yes'
  360. if right(ve,1)=e then if rc <> '0' then call arc
  361. if right(ve,1)=e then del filedl '>nul'
  362. if right(ve,1)=e then do until x=6000
  363. x=x+y
  364. end
  365. cd max
  366. call arc 
  367.  
  368. ziponly:
  369. cls
  370. say ''
  371. say ''
  372. say '' 
  373. say 'This program supports ZIP, ZOO, LZH, ARJ, and ARC files.'
  374. say 'Be sure to include the complete filename (Filename.zip)'
  375. call loop1
  376. exit:
  377. exit
  378.  
  379. /* Read */
  380. read: 
  381. x=1
  382. loop:
  383. y='1'
  384.  
  385. newq = rxqueue('create')
  386. oq = rxqueue('set',newq)
  387. l=l+y
  388. '@copy' extrdir''fileview extrdir''display''l''.doc '>nul'
  389. if rc <> '0' then nofile='yes'
  390. if rc <> '0' then if kind='zip2' then call zip2
  391. if rc <> '0' then if kind='zip' then call zip
  392. if rc <> '0' then if kind='lzh' then call lzh
  393. if rc <> '0' then if kind='arj' then call arj
  394. if rc <> '0' then if kind='arc' then call arc
  395. if rc <> '0' then if kind='zoo' then call zoo
  396.  
  397. '@del' extrdir''fileview '>nul'
  398. file=extrdir''display''l''.doc
  399. linein(file,1,0)
  400. loop2:
  401. do until x > 20
  402. say ''linein(file)''
  403. if lines(file)=''0'' then say 'Press the <ENTER> key to continue'
  404. if lines(file)=''0'' then pull enter
  405. if lines(file)=''0'' then call qdel
  406. x=x+y
  407. end
  408. more:
  409.   x=1
  410.    say 'more? (Y,n)'
  411.     pull yn
  412.     if yn='N' then call qdel
  413.      else
  414. call loop2
  415. call qdel
  416. qdel:
  417. call rxqueue 'delete',newq
  418. call rxqueue 'set',oq 
  419. if kind='zip2' then call zip2
  420. if kind='zip' then call zip
  421. if kind='lzh' then call lzh
  422. if kind='arj' then call arj
  423. if kind='arc' then call arc
  424. if kind='zoo' then call zoo
  425. call loop
  426.  
  427. invalid:
  428. cls
  429. say
  430. say
  431. say '  Please Do Not Enter Pathnames or WIldcards.  Just enter the Filename.Ext'
  432. cd max
  433. call loop1
  434. nofile:
  435. cls
  436. say
  437. say
  438. say '  The File You Selected Was NOT Found.  Please make another Selection             or hit ''Q'' to Quit'
  439. cd max
  440. call loop1
  441. quit:
  442. exit:
  443. cls
  444. say
  445. say
  446. if sw=1 then say '   The files that you just extracted can be downloaded from'
  447. if sw=1 then say '                      'areaname
  448. if sw=1 then say '   by downloading the file BOAVEXTR.ZIP' 
  449. if sw=1 then say
  450. if sw=1 then say
  451. if sw=1 then say
  452. if sw=1 then say
  453. if sw=1 then say 'press the <ENTER> key to return to BBS.'
  454. if sw=1 then pull enter
  455. exit
  456.