home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
w
/
wrb100b.zip
/
WFILEXFR.BAT
< prev
next >
Wrap
DOS Batch File
|
1993-01-07
|
14KB
|
333 lines
@ECHO OFF
REM
REM %1 - Single character describing the communications port that
REM was in use on WR-BBS when this batch file was called. It
REM will be one of the folllowing: 1, 2, 3, 4, or N. The
REM numbers represent COM ports, while "N" means the session
REM is local and the communications port is not in use.
REM
REM %2 - A numeric string, representing the baud rate that was in
REM effect when this batch file was called. If the session
REM is local, then the string "LOCAL" will be passed as this
REM parameter. Examples include: 300, 1200, 2400, etc.
REM
REM %3 - This parameter indicates whether the file transfer is an
REM upload to this BBS ("RECEIVE"), or a download from this
REM BBS ("SEND"). These are the only values possible.
REM
REM %4 - The protocol keyword.
REM
REM %5 - The name of the file to be transferred, or the file name
REM of a list file which contains several filenames that are
REM to be transferred. A list file will be created only if
REM the protocol is configured for batch transmission. This
REM means that all upload (RECEIVE) protocols and all single
REM action download (SEND) protocols will have a single file
REM name here. If a batch protocol is used but only one file
REM is selected for download, then a single file name will
REM appear here as well. The next parameter (%6) designates
REM whether the transmission is "batch" or "single".
REM
REM %6 - A numeric string, representing the number of files to be
REM transferred. This string will always be "1" for uploads
REM (RECEIVE), non-batch downloads, and batch downloads when
REM a single file is requested. If a multiple file download
REM (batch) is requested, then this string will be a numeric
REM value between 2 and 65355.
REM
REM Verify that all expected parameters were passed.
REM
IF W%1==WW GOTO ERROR01
IF W%2==WW GOTO ERROR02
IF W%3==WW GOTO ERROR02
IF W%4==WW GOTO ERROR02
IF W%5==WW GOTO ERROR02
IF W%6==WW GOTO ERROR02
REM
REM Echo the parameters to the local screen.
REM
ECHO Parameters passed to %0:
ECHO.
ECHO 1 - %1
ECHO 2 - %2
ECHO 3 - %3
ECHO 4 - %4
ECHO 5 - %5
ECHO 6 - %6
ECHO 7 - %7
ECHO 8 - %8
ECHO.
REM
REM Check for LOCAL session, and warn user accordingly.
REM
IF EXIST $FAILURE DEL $FAILURE
IF %1==N GOTO LOCAL
IF %2==LOCAL GOTO LOCAL
REM
REM Branch processing based on the protocol keyword.
REM
IF %4==KERMIT GOTO KERMIT
IF %4==XMODEM_CS GOTO XMODEMCRC
IF %4==XMODEM1K GOTO XMODEM1K
IF %4==XMODEMCRC GOTO XMODEMCRC
IF %4==YMODEM GOTO YMODEM
IF %4==ZMODEM GOTO ZMODEM
GOTO ERROR04
REM -------------------------------------------------------------------------
:KERMIT
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$ KERMIT PROCESSING $$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM
REM Parameter %3 determines if this is a SEND or RECEIVE.
REM
IF %3==RECEIVE GOTO KERMRECV
IF %3==SEND GOTO KERMSEND
REM
REM
REM If match for %3 was not found, there is something wrong.
GOTO ERROR03
:KERMRECV
%WR-BBS%\PCKERMIT -b %2 -l COM%1 -r -a %5 -c
GOTO FINISHED
:KERMSEND
%WR-BBS%\PCKERMIT -l COM%1 -b %2 -s %5 -c
GOTO FINISHED
REM -------------------------------------------------------------------------
:XMODEM1K
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$ XMODEM-1K PROCESSING $$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM
REM Parameter %3 determines if this is a SEND or RECEIVE.
REM
IF %3==RECEIVE GOTO XM1_RECV
IF %3==SEND GOTO XM1_SEND
REM
REM If match for %3 was not found, there is something wrong.
GOTO ERROR03
:XM1_RECV
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 rx %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
:XM1_SEND
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 sx -k %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
REM ------------------------------------------------------------------------
:XMODEMCRC
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$ XMODEM-CRC PROCESSING $$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM
REM Parameter %3 determines if this is a SEND or RECEIVE.
REM
IF %3==RECEIVE GOTO XMC_RECV
IF %3==SEND GOTO XMC_SEND
REM
REM If match for %3 was not found, there is something wrong.
GOTO ERROR03
:XMC_RECV
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 rc %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
:XMC_SEND
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 sx %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
REM ------------------------------------------------------------------------
:YMODEM
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$ YMODEM PROCESSING $$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM
REM Parameter %3 determines if this is a SEND or RECEIVE.
REM
IF %3==RECEIVE GOTO YM_RECV
IF %3==SEND GOTO YM_SEND
REM
REM If match for %3 was not found, there is something wrong.
GOTO ERROR03
:YM_RECV
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 restrict rb %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
:YM_SEND
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 sb %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
REM ------------------------------------------------------------------------
:ZMODEM
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$ ZMODEM PROCESSING $$$$$$$$$$$$$$$$$$$$$$$$
REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
REM
REM Parameter %3 determines if this is a SEND or RECEIVE.
REM
IF %3==RECEIVE GOTO ZM_RECV
IF %3==SEND GOTO ZM_SEND
REM
REM If match for %3 was not found, there is something wrong.
GOTO ERROR03
:ZM_RECV
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 restrict rz %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
:ZM_SEND
REM
REM Invoke DSZ for the file transfer. See DSZ documentation for
REM details on command line arguments. Notice lower case letters,
REM which are required for correct DSZ operation except where the
REM DSZ documentation explicitly indicates otherwise. Remember to
REM register your copy of DSZ with DSZ's author!
REM
dsz port %1 sz %5
REM
REM DSZ, like most file transfer protocols, will set the DOS
REM ERRORLEVEL to something other than zero if any problems
REM were encountered. If a non-zero errorlevel was detected,
REM the following line simply puts a breif message on the
REM screen for the SysOp.
REM
IF ERRORLEVEL 1 GOTO ERROR05
GOTO FINISHED
REM ------------------------------------------------------------------------
:LOCAL
REM (Local session in progress - can't use protocols)
ECHO File transfer protocols cannot be used during local logon!
GOTO FINISHED
:ERROR01
REM (No parameters at all)
ECHO ERROR: No parameters!
GOTO FINISHED
:ERROR02
REM (An incorrect number of parameters was passed to this batch)
ECHO ERROR: Invalid number of parameters!
ECHO.
IF NOT W%1W==WW ECHO PARAMETER 1 = %1
IF NOT W%2W==WW ECHO PARAMETER 2 = %1
IF NOT W%3W==WW ECHO PARAMETER 3 = %1
IF NOT W%4W==WW ECHO PARAMETER 4 = %1
IF NOT W%5W==WW ECHO PARAMETER 5 = %1
IF NOT W%6W==WW ECHO PARAMETER 6 = %1
IF NOT W%7W==WW ECHO PARAMETER 7 = %1
GOTO FINISHED
:ERROR03
REM (Parameter # 3 is invalid)
ECHO ERROR: Invalid keyword (%3)
GOTO FINISHED
:ERROR04
REM (Protocol keyword not found)
ECHO ERROR: Undefined protocol (%4)
GOTO FINISHED
:ERROR05
REM (Transfer failure detected: non-zero errorlevel )
REM
REM To signal to WR-BBS that an error has occurred, a "flag" file
REM is created by redirecting a string into a file named $FAILURE,
REM which will be created in the current directory.
REM
ECHO Error detected during %3 of %5. > $FAILURE
ECHO.
ECHO ERROR OCCUURED DURING %4 %3 OF %5!
ECHO.
:FINISHED