home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 2 BBS
/
02-BBS.zip
/
ftpfid17.zip
/
FTPTIC16.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-03-09
|
31KB
|
1,017 lines
/* FTPFIDO.CMD - rexx script to get FidoNet mail via FTP */
/*------------------------------------------------------------------
* Version 1.6tic by Jerry Gause 1:3651/9
* This version uses a list of unwanted fileareas and deletes those files
* from the remote system w/o dling them.
* If a provider sends the entire filebone,this greatly reduces connect
* time by only getting the areas from a taglist.
* Many thanks go to John Souvestre for the original base code
* and of course to Patrick J. Mueller & Cliff Nadler for RxFtp.
* Change global variables below to suit your system.
* Change lines marked with "CFP!!!" to suit your provider.
* Important!!!!!!!!!!!!!
* Dlls needed for this script are: RxFtp, Rexxutil and Rexxlib.
* Rxftp is included in it's own archive.
* If using OS/2 2.X be sure to use the Rxftp32.Dll renamed
* to Rxftp.dll.
* Rexxlib was not included because it's shareware.
* You can freq it from me as Rexxlb.Zip.
* This is tailored for a Binkley style outbound. For FD style outbounds
* you need to set the "fd" verb below and "arcname" must point to
* the arcmail bundles destined for your uplink.
* You also need to setup a seperate Binkley style outbound
* and use something like SQUISH to pack out netmail.
* I have made many changes to the original code including much more
* mailer-like operation. I simply truncate the file the same way Bink would.
* Lot's of error checking and logging of errors as well as normal
* operation. If anything goes wrong, it is logged and the session
* is aborted.
*------------------------------------------------------------------*/
'@echo off'
host = "ftp.sstar.com"
name = ""
password = ""
seqfile = 'f:\bbs\ftpfido.seq'
fd = 0 /* Set to 1 to enable the FD mode */
arcname = '??????.*' /* Arcmail bundles FD only */
inbound = 'd:\ftpin2' /* Binkley or FD secure inbound */
ftpin = 'd:\ftpin' /* Inbound for FTP */
errlog = 'f:\bbs\logs\error.log' /* a logfile for errors */
bsy = 'f:\binkley\IHUB.BSY' /* local file sent as remote busy flag */
remotebsyname = 'IHUB.BSY' /* remote name for above */
avbps = 2000 /* Your average bps rate */
flg = 'f:\bbs\logs\Doing_ftp.flg' /* process flag */
logfile = 'F:\bbs\logs\ftpfido.log' /* Drive containing logs */
listfile = 'F:\bbs\logs\ftplist.log'
mailbundle = 'd:\ftpin\f349fff8.*' /* I only move mailbundles from ftpin to inbound. Change to *.* if you move all */
ndyet = 'd:\ftpin\ndyet.flg' /* Use this flag to prevent Allfix from running to prevent tics w/o files and vice versa */
tcpbin = 'd:\tcpip\bin' /* where hangup.cmd is located to terminate slip session */
hangup = 1 /* whether to hangup or not */
scrlgth = 25
/* netout is only used in FD mode to send netmail that has been packed Bink style. */
netout = 'f:\' /* Binkley style outbound for sending netmail in FD mode. */
outbound = 'f:\binkley\outbound' /* normal mailer outbound */
fidosite = '018c0001' /* 396/1 In hex for Binkley bsy flags and hlo files */
fidobsy = fidosite'.bsy'
fidohold = fidosite'.hlo'
pktname = fidosite'.hut' /* Only hold mail is handled */
newname = fidosite'.pkt' /* Remote file name */
/* To enable the delete unwanted files function */
killfile = 0 /* Kill off unwanted files for uplinks who send everything */
nogetlist = 'F:\afix\noget.lst' /* List of unwanted fileareas */
fixtic = 0 /* Set to 1 if you have blank lines in your tics CFP!!! */
'mode co80,'||scrlgth
bttm2 = scrlgth - 2
bttm3 = scrlgth - 3
total_received = 0
total_sent = 0
total_uls = 0
total_files = 0
sizethere = 0
howmucht = 0
howlongt = 0
UpperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
LowerCase = 'abcdefghijklmnopqrstuvwxyz'
Signal on Syntax Name ErrorStop
Signal on Halt Name Abort
Signal on Failure Name FailureStop
rc = stream(logfile,'C','open write')
call Lineout logfile ,date('N') Time('N') 'FTPFIDO starting up.'
Call SysCurState Off
Call CopyInfo
if RxFuncQuery("FtpLoadFuncs") then
do
rc = RxFuncAdd("FtpLoadFuncs","RxFtp","FtpLoadFuncs")
rc = FtpLoadFuncs(quiet)
end
if RxFuncQuery("SysLoadFuncs") then
do
rc = RxFuncAdd("SysLoadFuncs","RexxUtil","SysLoadFuncs")
rc = SysLoadFuncs()
end
if RxFuncQuery("rexxlibregister") then
do
rc = RxFuncAdd('rexxlibregister','rexxlib','rexxlibregister')
rc = rexxlibregister()
end
/* Check the busy flag */
New=Directory(outbound)
IF Stream(fidobsy,'C', 'Query Exists') <>' ' Then
Do
say '
!Tosser Busy - Not this time...
'
rc = lineout(logfile,'!Tosser Busy - Not this time.')
signal exit
end
else
do
rc= doscreat(fidobsy) /* Set local busy flag */
if rc <> 1 Then
Do
say '
!Error creating busy flag.
'
rc = lineout(logfile,'!Error creating busyflag.')
signal exit
end
end
IF Stream(flg,'C', 'Query Exists') <>' ' Then
Do
say '
!Must be running already.
'
rc = lineout(logfile,' Must be running already.')
New=Directory(outbound)
'del 'fidobsy '> nul: 2>&1'
IF rc <> 0 Then
Do
say '
!Error deleting 'fidobsy'
'
rc = lineout(logfile,'!Error deleting 'fidobsy)
end
signal exit
end
else
do
rc=doscreat(flg) /* Set process flag */
IF rc <> 1 Then
Do
say '
!Error creating flagfile.
'
rc = lineout(logfile,'!Error creating flagfile.')
signal exit
end
end
killme = DosPid()
Call SysCurPos 0,21
say '
Process id: 'killme 'Begin: 'Time('N')'
'
if hangup = 1 then do
New = Directory(tcpbin)
'start /fs /c /b hangup.cmd 'killme
end
/* Get the latest send sequence*/
seqstr = "0123456789abcdefghijklmnopqrstuvwxyz"
daywk = "mo tu we th fr sa su"
/* Contains the day and sequence*/
IF Stream(seqfile,'C', 'Query Exists') <>' ' Then
Do
line = LINEIN(seqfile)
day = WORD(line, 1)
if POS(day, daywk) = 0 then
day = "mo"
seq = WORD(line, 2)
seqno = POS(seq, seqstr)
if seqno = 0 then do
seq = "0"
seqno = 1
end
end
else do
file = LINEOUT(seqfile, 'mo 0')
seqno = 1
end
file = LINEOUT(seqfile)
rc = FtpSetBinary('Binary')
/*------------------------------------------------------------------
* LOGON
*------------------------------------------------------------------*/
rc = FtpSetUser(host, name, password)
stime = time('e')
attached = FtpSys(siteinfo)
Call SysCurPos 1,21
say '
'attached '
'
len = length(attached)
if len > 8 then /* CFP!!! */
do
Call SysCurPos 2,21
rc = lineout(logfile,' Login successful')
say '
Login successful
'
Call datetime
rc = FtpChDir('..') /* CFP!!! */
rc = FtpPut(bsy,remotebsyname)
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error putting busy flag on remote.
'
rc = lineout(logfile,'!Error putting busy flag on remote.')
signal abort
end
/*------------------------------------------------------------------
* Change to remote inbound directory.
*------------------------------------------------------------------*/
rc = FtpChDir("in") /* CFP!!!! */
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error changing directory on remote.
'
rc = lineout(logfile,'!Error changing directory on remote.')
signal abort
end
/*------------------------------------------------------------------
* Send Raw Packets
*------------------------------------------------------------------*/
if fd = 1 then
New=Directory(netout)
else
New=Directory(outbound)
p = 5
rc = SysFileTree(pktname,files.,"F")
if files.0 > 0 then
do
Call datetime
filename = filespec("name", word(files.1,5))
Trunc = 0
Nuke = 1
Call Put filename word(files.1,5) word(files.1,3) newname
p = p + 1
end
/*------------------------------------------------------------------
* Send Mail Bundles and files
*------------------------------------------------------------------*/
IF Stream(fidohold,'C', 'Query Exists') <>' ' Then
Do
do until LINES(fidohold) = 0
Call datetime
ennd = scrlgth - 4
if p > ennd then do
p = ennd
do until p = 5
Call SysCurPos p,0
say " "
p = p - 1
end /* do until */
end
line = LINEIN(fidohold)
/* Get the file name out of the path ect*/
posfile = LASTPOS('\', line) + 1
filename = SUBSTR(line, posfile)
Select
When Pos('^', line) = 1 then
Do
fullname = strip(line,l,'^')
rc = SysFileTree(fullname,outfile.,"F")
IF Stream(fullname,'C', 'Query Exists') <>' ' Then
Do
Trunc = 0
Nuke = 1
Call Put filename word(outfile.1,5) word(outfile.1,3) filename
end
else do
p = p + 1
Call SysCurPos p,0
say '
!'fullname' not found .
'
rc = lineout(logfile,'!'fullname' not found.')
end
end
When Pos('#', line) = 1 then
Do
fullname = strip(line,l,'#')
rc = SysFileTree(fullname,outfile.,"F")
IF Stream(fullname,'C', 'Query Exists') <>' ' & word(outfile.1,3) <> 0 Then
Do
/* Make sure the sequence is correct*/
posfile = LASTPOS('.', filename) + 1
setseq = SUBSTR(filename, posfile)
fday = TRANSLATE(DELSTR(setseq, 3))
fseq = TRANSLATE(SUBSTR(setseq, 3, 1))
fseqno = POS(fseq, seqstr)
/* Check if the days match*/
if day = fday then
do
if fseqno > seqno then
do
seqno = fseqno
seq = SUBSTR(seqstr, seqno, 1)
end
end
else do
day = fday
seqno = fseqno
if seqno = 0 then seqno = 1
seq = SUBSTR(seqstr, seqno, 1)
end
remfile1 = DELSTR(filename, posfile)||day||seq
Trunc = 1
Nuke = 0
Call Put filename word(outfile.1,5) word(outfile.1,3) remfile1
/* Update the sequence file*/
'erase 'seqfile
seqno = seqno + 1
seq = SUBSTR(seqstr, seqno, 1)
file = LINEOUT(seqfile, day' 'seq)
file = LINEOUT(seqfile)
end
else do
p = p + 1
Call SysCurPos p,0
say '
!'fullname' not found or 0 length.
'
rc = lineout(logfile,'!'fullname' not found or 0 length.')
end
end
otherwise
Do
IF Stream(line,'C', 'Query Exists') <>' ' Then
Do
rc = SysFileTree(line,outfile.,"F")
Trunc = 0
Nuke = 0
Call Put filename word(outfile.1,5) word(outfile.1,3) filename
end
else do
p = p + 1
Call SysCurPos p,0
say '
!'fullname' not found .
'
rc = lineout(logfile,'!'fullname' not found.')
end
end
end /* Select */
p = p + 1
end /* Do Until */
rc = stream(fidohold,'C','close')
'del 'fidohold '> nul: 2>&1'
IF rc <> 0 Then
Do
p = p + 1
Call SysCurPos p,0
say '
!Error deleting 'fidohold'
'
rc = lineout(logfile,'!Error deleting 'fidohold)
end
end /* Do */
if sizethere = '0' then
do
Call SysCurPos p,0
say '
No mail to send at this time.
'
rc = lineout(logfile,' No mail to send at this time')
p = p + 1
end
/*------------------------------------------------------------------
* Send FD Mail Bundles
*------------------------------------------------------------------*/
if fd = 1 then
do
New=Directory(outbound)
rc = SysFileTree(arcname,outfile.,"F")
if outfile.0 > 0 then
do
sizethere = 0
x = 1
do outfile.0 /* loop through all the files here */
Call datetime
ennd = scrlgth - 4
if p > ennd then do
p = ennd
do until p = 5
Call SysCurPos p,0
say " "
p = p - 1
end /* do until */
end
filename = filespec("name", word(outfile.x,5))
fullname = word(outfile.x,5)
if filename <> '' & LENGTH(filename) > 3 & word(outfile.x,3) <> 0 then
do
/* Make sure the sequence is correct*/
posfile = LASTPOS('.', filename) + 1
setseq = SUBSTR(filename, posfile)
fday = TRANSLATE(DELSTR(setseq, 3))
fseq = TRANSLATE(SUBSTR(setseq, 3, 1))
fseqno = POS(fseq, seqstr)
/* Check if the days match*/
if day = fday then
do
if fseqno > seqno then
do
seqno = fseqno
seq = SUBSTR(seqstr, seqno, 1)
end
end
else do
day = fday
seqno = fseqno
if seqno = 0 then seqno = 1
seq = SUBSTR(seqstr, seqno, 1)
end
remfile1 = DELSTR(filename, posfile)||day||seq
Trunc = 1
Nuke = 0
Call Put filename fullname word(outfile.x,3) remfile1
/* Update the sequence file*/
'erase 'seqfile
seqno = seqno + 1
seq = SUBSTR(seqstr, seqno, 1)
file = LINEOUT(seqfile, day' 'seq)
file = LINEOUT(seqfile)
end
else
do
say '
!'fullname' not found or 0 length.
'
rc = lineout(logfile,'!'fullname' not found or 0 length.')
end
x = x + 1
p = p + 1
end /* Do loop */
end
if sizethere = '0' then
do
say '
No echomail to send at this time.
'
rc = lineout(logfile,' No echomail to send at this time')
p = p + 1
end
end
/*------------------------------------------------------------------
* Change to remote outbound directory.
*------------------------------------------------------------------*/
rc = FtpChDir("..") /* CFP!!!! */
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error changing directory on remote.
'
rc = lineout(logfile,'!Error changing directory on remote.')
signal abort
end
rc = FtpChDir("out") /* CFP!!!! */
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error changing directory on remote.
'
rc = lineout(logfile,'!Error changing directory on remote.')
signal abort
end
/*------------------------------------------------------------------
* Get Tics and delete unwanted files from remote.
*------------------------------------------------------------------*/
New=Directory(ftpin)
if killfile = 1 then
do
rc = Ftpdir('*.tic',ticlist.) /* get list of tics there. */
if ticlist.0 > 1 & rc = 0 then
do
say '
Receiving 'ticlist.0 'tic(s)
'
rc = lineout(logfile,' Receiving 'ticlist.0 'tic(s)')
bps = 2000
x = 1
o = 1 /* reset the pointer */
rc = stream(delfile,'C','open write')
/* time to get tics here from There */
do ticlist.0
Call datetime
ennd = scrlgth - 4
if p > ennd then do
p = ennd
do until p = 5
Call SysCurPos p,0
say " "
p = p - 1
end /* do until */
end
filename = word(ticlist.x,9)
Call Get filename word(ticlist.x,5)
rc = stream(filename,'C','open read')
areaf = LINEIN(filename)
farea = word(areaf,2)
if fixtic = 1 then blankline = LINEIN(filename)
Toline = LINEIN(filename)
if fixtic = 1 then blankline = LINEIN(filename)
Fromline = LINEIN(filename)
if fixtic = 1 then blankline = LINEIN(filename)
nametic = LINEIN(filename)
ticname = word(nametic,2)
rc = stream(filename,'C','close')
do until LINES(nogetlist) = 0
line = LINEIN(nogetlist)
If farea = line then
do
say '
Deleting 'ticname 'from 'farea'
'
rc = lineout(delfile,'deleting 'ticname 'from 'farea)
'del 'filename '> nul: 2>&1'
rc = FtpDelete(ticname)
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error deleting 'ticname 'from remote.
'
rc = lineout(logfile,'!Error deleting 'ticname 'from remote.')
end
leave
end
end
rc = stream(nogetlist,'C','close')
x = x + 1
p = p + 1
end /* Do loop */
rc = stream(delfile,'C','close')
tics_received = total_received
total_received = 0
total_tics = total_files
total_files = 0
end
else
do
Call SysCurPos p,0
rc = lineout(logfile,' No tics to get')
say '
No tics to get.
'
p = p + 1
end
end
/*------------------------------------------------------------------
* Get Mail and Files
*------------------------------------------------------------------*/
rc = Ftpdir('*.*',infile.) /* get list of files there for list */
if infile.0 > 0 & rc = 0 then
do
y = 0
'del 'listfile '> nul: 2>&1'
rc = stream(listfile,'C','open write')
total_bytes = 0
do i = 1 to infile.0
filename = word(infile.i,9)
size = word(infile.i,5)
total_bytes = total_bytes + size
rc = LINEOUT(listfile, filename size)
if y < bttm2 then do
Call SysCurPos y,55
say '
'filename' -' size'
'
end
y = y + 1
end
rc = stream(listfile,'C','close')
apxsecs = total_bytes%avbps
apxmins = apxsecs%60
bttm3 = scrlgth - 3
Call SysCurPos bttm3,0
say '
Receiving 'infile.0 'file(s) 'total_bytes' bytes 'apxmins' avg. mins.
'
rc = lineout(logfile,' Receiving 'infile.0 'file(s) 'total_bytes' bytes 'apxmins' avg. mins.')
bps = 2000
x = 1 /* reset the pointer */
/* time to get files here from There */
do infile.0
Call datetime
ennd = scrlgth - 4
if p > ennd then do
p = ennd
do until p = 5
Call SysCurPos p,0
say " "
p = p - 1
end /* do until */
end
filename = word(infile.x,9)
if filename = "incoming" then x = x + 1 /* CFP!!!! */
if filename = "incoming" then iterate /* CFP!!!! */
Call Get filename word(infile.x,5)
x = x + 1
p = p + 1
end /* Do loop */
end
else
do
Call SysCurPos p,0
rc = lineout(logfile,' No files to get')
say '
No files to get.
'
end
/*------------------------------------------------------------------
* Change to remote root directory and remove busy flag.
*------------------------------------------------------------------*/
rc = FtpChDir('..')
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error changing directory on remote.
'
rc = lineout(logfile,'!Error changing directory on remote.')
end
rc = FtpDelete(remotebsyname)
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error deleting busy flag from remote.
'
rc = lineout(logfile,'!Error deleting busy flag from remote.')
end
signal done
end /* Login loop */
else
do
Call SysCurPos 1,28
say '
!Login failed... session aborted
'
rc = lineout(logfile,'!Login failed... session aborted')
signal abort
end
/*------------------------------------------------------------------
* SubRoutines
*------------------------------------------------------------------*/
DateTime:
Call SysCurPos 3,21
say '
'date('N') Time('N')'
'
Return
/*------------------------------------------------------------------
* PUT
*------------------------------------------------------------------*/
Put:
parse arg filehere fullname sizehere filethere
o = 1
Call SysCurPos p,0
filethere = translate(filethere, LowerCase, UpperCase)
if filehere <> filethere then
do
rc = lineout(logfile,' sending 'fullname '- 'sizehere 'bytes as 'filethere)
say '
Sending 'filehere ' - 'sizehere' bytes as 'filethere'
'
end
else
do
rc = lineout(logfile,' sending 'fullname '- 'sizehere 'bytes')
say '
Sending 'filehere ' - 'sizehere' bytes
'
end
ustart = time('e')
err = FtpPut(fullname, filethere, 'binary')
uelapsed = time('e')
howmuch = strip(uelapsed-ustart,,0)
bps = strip(format(sizehere/howmuch,10,0))
if err = -1 & FTPERRNO = '0' then
do
/* add code to test for good transfer by filesize */
rc = FtpDir(filethere,test.) /* get size from remote */
if test.0 = 1 then /* it did get there */
do
sizethere = word(test.1,5)
if sizehere = sizethere then /* if the same size, delete or truncate if necessary */
do
p = p + 1
Call SysCurPos p,0
total_sent = total_sent + sizethere /* get size for report */
howmucht = howmucht + howmuch
total_uls = total_uls + 1
Select
When Trunc = 1 then
do
rc = lineout(logfile,' Successful - Truncating 'filehere)
say '
Truncating 'filehere'
'
rc=doscreat(fullname)
IF rc <> 1 Then
do
say '
!Error truncating 'fullname'
'
rc = lineout(logfile,'!Error truncating 'fullname
signal abort
end
end
When Nuke = 1 then
do
rc = lineout(logfile,' Successful - Deleting 'fullname)
say '
Deleting 'fullname'
'
rc = SysFileDelete(fullname)
IF rc <> 0 Then
do
say '
!Error deleting 'fullname'
'
rc = lineout(logfile,'!Error deleting 'fullname
signal abort
end
end
otherwise
end /* Select */
p = p + 1
Call SysCurPos bttm2,0
say " "
Call SysCurPos bttm2,0
say '
Sent 'total_uls 'file(s) 'total_sent 'bytes 'howmucht%60 'min. 'strip(format(howmucht//60,3,0)) 'secs.
'
Call SysCurPos p,0
say '
Sent 'filehere '- 'howmuch%60 'min. 'strip(format(howmuch//60,3,0)) 'secs. 'bps 'bps.
'
rc = lineout(logfile,' sent 'filehere' - 'howmuch%60 'min. 'strip(format(howmuch//60,3,0)) 'secs. Baud = 'bps)
end /* size */
else
do
rc = lineout(logfile,'!Error in size - Deleting 'filethere 'from inbound')
say '
!Error in size - Deleting 'filethere 'from inbound
'
rc = FtpDelete(filethere)
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error deleting 'filethere 'from remote.
'
rc = lineout(logfile,'!Error deleting 'filethere 'from remote.')
signal abort
end
end
end /* test */
else
do
say '
!Error in filetest
'
rc = lineout(logfile,'!Error in filetest!')
signal xabort
end
end
else
do
say '
!FTP returned error 'FTPERRNO'
'
rc = lineout(logfile,'!FTP returned error 'FTPERRNO)
signal xabort
end
Return
/*------------------------------------------------------------------
* GET
*------------------------------------------------------------------*/
Get:
parse arg filename filesize
Call SysCurPos p,0
say '
Recieving 'filename '- ' filesize 'bytes
'
start = time('e')
err = FtpGet(filename, filename,"binary") /* Transfer the file */
elapsed = time('e')
if err = -1 & FTPERRNO = '0' then
do
sizehere = stream(filename,'C','query size') /* get the filesize here */
if sizehere = filesize then
do
Call SysCurPos p,0
say " "
Call SysCurPos p,0
howlong = strip(elapsed-start,,0)
bps = strip(format(sizehere/howlong,10,0))
say '
Recieved 'filename '- 'howlong%60 'min. 'strip(format(howlong//60,3,0)) 'secs. 'bps 'bps.
'
rc = lineout(logfile,' received 'filename' - 'sizehere' - 'howlong%60 'min. 'strip(format(howlong//60,3,0)) 'secs. Baud = 'bps)
total_received = total_received + sizehere
total_files = total_files + 1
rc = FtpDelete(filename)
if err <> -1 & FTPERRNO <> '0' then
do
say '
!Error deleting 'filename 'from remote.
'
rc = lineout(logfile,'!Error deleting 'filename 'from remote.')
end
Call SysCurPos bttm2,0
say " "
Call SysCurPos bttm2,0
howlongt = howlongt + howlong
say '
Received 'total_files 'file(s) 'total_received 'bytes 'howlongt%60 'min. 'strip(format(howlongt//60,3,0)) 'secs.
'
if bps < 500 & filesize > 50000 then
do
say '
!Something ain''t right!! too slow??
'
rc = lineout(logfile,'!Something went wrong with bps')
signal abort
end
end /* size */
else
do
say '
!Error in filesize
'
rc = lineout(logfile,'!Error in filesize')
x = x - 1
end
end
else
do
say '
!FTP returned error 'FTPERRNO'
'
rc = lineout(logfile,'!FTP returned error 'FTPERRNO)
signal xabort
end
Return
/*------------------------------------------------------------------
* Aborts
*------------------------------------------------------------------*/
Xabort:
Call SysCurPos p,0
say '
!File transfer failed..
'
rc = lineout(logfile,'!File transfer failed..')
Abort:
Call SysCurPos 3,28
say '
!Session Aborted
'
rc = lineout(logfile,'!Session Aborted')
rc= doscreat(ndyet)
if rc <> 1 Then
Do
say '
!Error creating ndyet flag.
'
rc = lineout(logfile,'!Error creating ndyet flag.')
end
rc = FtpChDir('..')
rc = FtpDelete(remotebsyname)
signal Abort1
/*------------------------------------------------------------------
* DONE
*------------------------------------------------------------------*/
Done:
New=Directory(ftpin)
IF Stream('*.tic','C', 'Query Exists') <>' ' & fixtic = 1 Then
do
rc = sysfiletree('*.tic',"mfiles","FO")
do i = 1 to mfiles.0
parse var mfiles.i filename
fname = filespec("Name",filename)
CurrentLine = Linein(filename)
rc = stream(filename,'c','close')
do while CurrentLine > ''
CurrentLine = Linein(filename)
BlankLine = Linein(filename)
posfile = LASTPOS('.', filename) + 1
new='tib'
outfile = DELSTR(filename, posfile)||new
rc = lineout(outfile,CurrentLine)
end
rc = stream(filename,'c','close')
'erase 'filename
rc = stream(outfile,'c','close')
end
'ren *.tib *.tic'
end
IF Stream(mailbundle,'C', 'Query Exists') <>' ' Then
do
New=Directory(inbound)
copy ftpin||'\*.* > nul: 2>&1'
del ftpin||'\*.* /N > nul: 2>&1'
end
/* 'echo mailproc | rxqueue mailproc' ------This triggers my mailtosser */
Abort1:
rc = FtpSetUser("X","X","X")
rc = FtpLogoff()
rc = FtpDropFuncs()
Call SysCurPos bttm3,0
Say " "
Call SysCurPos bttm2,0
Say " "
Call SysCurPos bttm3,0
etime = time('e')
say '
Sent 'total_sent 'bytes, received 'total_received 'bytes in 'etime%60 'minutes, 'strip(format(etime//60,6,0)) 'seconds.
'
rc = lineout(logfile, ' $Sent 'total_sent 'bytes, received 'total_received 'bytes in 'etime%60 'minutes, 'strip(format(etime//60,10,0)) 'seconds.' )
if total_sent > 0 then
do
say '
Total u/l time - 'howmucht%60 'min. 'strip(format(howmucht//60,3,0))' secs. 'strip(format(total_sent/howmucht,10,0))' avg. u/l bps.
'
rc = lineout(logfile, ' Total u/l time - 'howmucht%60 'min. 'strip(format(howmucht//60,3,0))' secs. 'strip(format(total_sent/howmucht,10,0))' avg. u/l bps.')
end
if total_received > 0 then
do
say '
Total d/l time - 'howlongt%60 'min. 'strip(format(howlongt//60,3,0))' secs. 'strip(format(total_received/howlongt,10,0))' avg. d/l bps.
'
say '
Sent 'total_uls 'files(s) Received 'total_files 'file(s).
'
rc = lineout(logfile, ' Total d/l time - 'howlongt%60 'min. 'strip(format(howlongt//60,3,0))' secs. 'strip(format(total_received/howlongt,10,0))' avg. d/l bps.')
rc = lineout(logfile, ' Sent 'total_uls 'file(s) Received 'total_files 'file(s).')
end
/* Clearing Local bsy Flag*/
New=Directory(outbound)
'del 'fidobsy '> nul: 2>&1'
IF rc <> 0 Then
Do
say '
!Error deleting 'fidobsy'
'
rc = lineout(logfile,'!Error deleting 'fidobsy)
end
/* remove process flag */
'del 'flg '> nul: 2>&1'
IF rc <> 0 Then
Do
say '
!Error deleting 'flg'
'
rc = lineout(logfile,'!Error deleting 'flg)
end
/* remove ndyet flag */
IF Stream(ndyet,'C', 'Query Exists') <>' ' Then
Do
'del 'ndyet' > nul: 2>&1'
IF rc <> 0 Then
Do
say '
!Error deleting ndyet.flg
'
rc = lineout(logfile,'!Error deleting ndyet.flg')
end
end
call Lineout logfile ,date('N') Time('N') 'FTPFIDO closing down.'
rc = stream(logfile,'C','close')
exit
CopyInfo: Procedure
Call SysCls
Say '
░░░░▒▒▒▒▓▓▓▓████
'
Say '
FTPFido'
Say ' By Jerry Gause'
Say 'Warped Software'
Say '
████▓▓▓▓▒▒▒▒░░░░
'
Say ''
Return
FailureStop:
parse upper source tst
tst=word(tst,3)
tst=parsefn(tst)
tst=word(tst,3)'.'word(tst,4)
say '
A Failure ('RC') has occurred on Line 'Sigl' in 'tst'
'
say 'ftpfido has Failure Exited'
call Lineout errlog ,date('N') Time('N') ': ftpfido , A Failure ('RC') has occurred on Line 'Sigl' in 'tst
Signal Exit
ErrorStop:
parse upper source tst
tst=word(tst,3)
tst=parsefn(tst)
tst=word(tst,3)'.'word(tst,4)
say '
An Error ('RC') has occurred on Line 'Sigl' in 'tst'
'
say 'ftpfido has Error Exited'
call Lineout errlog ,date('N') Time('N') ': ftpfido , An Error ('RC') has occurred on Line 'Sigl' in 'tst
exit:
if hangup = 1 then do
New = Directory(tcpbin)
'start /fs /c /b hangup.cmd 'killme
end
rc = stream(errlog,'C','close')
rc = stream(logfile,'C','close')
exit