home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
p
/
pb920430.zip
/
DOFILE.BAT
next >
Wrap
DOS Batch File
|
1992-04-30
|
3KB
|
183 lines
REM@ECHO OFF
REM
REM dofile.bat
REM This batch file will run under MS-DOS.
REM
REM It first identifies the compression type and stores that in an
REM environment variable C.
REM
REM It then checks the file type and processes different file types
REM appropriately.
REM
REM You must have a directory \msgs off of your main
REM PACSAT operating directory. It puts ASCII readable text into
REM files called nnnn.msg, where nnnn is replaced by the message
REM number.
REM
pfh_val %1.dl 25 >nul
if errorlevel 4 goto uct
if errorlevel 3 goto lha
if errorlevel 2 goto zip
if errorlevel 1 goto arc
goto nocomp
REM Compression type is ARC
:arc
ECHO Compressed by PKARC
SET C=ARC
goto proc
REM Compression type is ZIP
:zip
ECHO Compressed by PKZIP
SET C=ZIP
goto proc
REM Compression type is LHARC
:lha
ECHO Compressed by LHZ
SET C=LHA
goto proc
REM Compression type is unknown
:uct
ECHO Compressed by an unknown technique.
SET C=UCT
goto proc
REM No compression type field in the file
:nocomp
ECHO Message is not compressed.
SET C=NO
goto proc
:proc
pfh_val %1.dl 8 >nul
if errorlevel 3 goto ubt
if errorlevel 2 goto bbs
if errorlevel 1 goto bbs1
goto text
REM Unknown body type.
:ubt
ECHO Unknown message body type.
goto done
REM Multiple BBS messages
:bbs
ECHO Message body contains multiple BBS messages
goto done
REM Single BBS message
:bbs1
ECHO Message body is a BBS message
goto done
:text
ECHO Message body is plain text. Processing.
if "%C%"=="ZIP" goto txtzip
if "%C%"=="ARC" goto txtarc
if "%C%"=="LHA" goto txtlha
if "%C%"=="UCT" goto txtuct
if "%C%"=="NO" goto txtno
goto err
:txtno
REM Uncompressed ASCII text message.
phs %1.dl /s /o msgs\%1.msg /t /x
goto done
:txtzip
REM Zipped ASCII text message.
REM Gets the .zip file from the PACSAT message
phs %1.dl /s /o %1.zip /x
REM
REM Unzipps it to the screen, but redirects the screen to a .msg file.
pkunzip /c %1.zip >msgs\%1.msg
REM
REM Deletes the .zip file
del %1.zip
goto done
:txtarc
REM Arc'ed ASCII text message.
goto done
:txtlha
REM Lharced ASCII text message.
REM LHArced ASCII text message.
REM Gets the .lhz file from the PACSAT message
phs %1.dl /s /o %1.lzh /x
REM
REM decompress it to the screen, but redirect to a .msg file.
lha p %1.lzh >msgs\%1.msg
REM
REM Deletes the .lzh file
del %1.lzh
goto done
:txtuct
REM Text message with unknown compression type.
ECHO Unknown compression type on text file
goto done
:bbs
if "%C%"=="ZIP" goto bbszip
if "%C%"=="ARC" goto bbsarc
if "%C%"=="LHA" goto bbslha
if "%C%"=="UCT" goto bbsuct
if "%C%"=="NO" goto bbsno
goto err
:bbsno
goto done
:bbszip
goto done
:bbsarc
goto done
:bbslha
goto done
:bbsuct
goto done
:bbs1
if "%C%"=="ZIP" goto bbs1zip
if "%C%"=="ARC" goto bbs1arc
if "%C%"=="LHA" goto bbs1lha
if "%C%"=="UCT" goto bbs1ct
if "%C%"=="NO" goto bbs1no
goto err
:bbs1no
phs %1.dl /s /o msgs\%1.msg /h /x
goto done
:bbs1zip
goto done
:bbs1arc
goto done
:bbs1lha
goto done
:bbs1uct
goto done
:err
REM error
ECHO There was an error!
:done
xcopy %1.dlx dlxfiles >nul
if errorlevel 1 goto end
del %1.dlx
:end
set c=