/* AddFile 1.2 by Anthony Brice - 22nd February 1996 */

CALL ADDLIB('rexxsupport.library',0,-30,0)
CALL ADDLIB('rexxreqtools.library',0,-30,0)

ver=1.2
CR='0d'X

/* Config options */

FileDefault = 'Files:'
Outbound = 'Outbound:'

/* End of user config */

ADDRESS Spot
OPTIONS results

temp='AddFile 1.2 by Anthony Brice 1996'||CR||CR
temp=temp'Message-ware as usual.'||CR||CR
temp=temp'anthony@backyard.demon.co.uk'||CR
'requestresponse TITLE "Addfile '||ver||' By Anthony Brice" PROMPT "'||TEMP||'" GADGETS "_Send file|_About|_ABORT" center'
If rc=0 then Do
  Exit 0
  End

If rc=2 then Do
  Call About
  Exit 0
  End

'requestresponse TITLE "System selection" PROMPT "What system do you wish to attach to?" GADGETS "_Unlisted|_Requestor|_Abort" CENTER'

If rc=0 then Do
  Exit 0
  End

If rc=1 then do
  'requeststring TITLE "Poll" PROMPT "Which nodenumber?" CENTER'
  If RC~=0 then Exit 0
  System=Strip(Result)
  Temp = Translate(System,' ',':/.')
  Parse Var Temp Zone Net Node Point 
  If Point='' then Point='.0'
  End

If rc=2 then Do
  'requestfile TITLE "Select the systems address" PATTERN "#?.**O" PATH '||Outbound
  If result=0 then Exit 0
  System=Strip(Result)
  Temp = Translate(System,' ',':/.')
  Parse Var Temp Bollox Zone Net Node Point Crap 
  End

'requestfile TITLE "Select a file to send" PATH '||FileDefault
If RC~=0 then Exit 0
File=Strip(Result)

If ~EXISTS(File) then DO
  'requestnotify PROMPT "That file does not exist!"'
  Exit 5
  End

'requestresponse TITLE "Delete file" PROMPT "Delete after send?" GADGETS "_Yes|_No|_Abort" CENTER'

DC = ''
If RC=0 then Exit 0
If RC=1 then DC = '^'

System = Zone||"."||Net||"."||Node||"."||Strip(Point)

New = 0

IF exists(outbound||system'.HLO') then flowfile = system'.HLO'
IF exists(outbound||system'.DLO') then flowfile = system'.DLO'
IF exists(outbound||system'.CLO') then flowfile = system'.CLO'
IF exists(outbound||system'.FLO') then flowfile = system'.FLO'

If FlowFile='' then Do
  FlowFile = System||'.FLO'
  New = 1
  End

SubString='A'

If New = 1 then Do
  SubString="W"
End

Call Open(Crap,Outbound||FlowFile,SubString)
Call WriteLN(Crap,DC||File)
Call Close(Crap)
'requestnotify PROMPT "File added to the waiting list" CENTER'
Exit 0

About:
temp=''
temp=temp'Addfile 1.2 for Spot by Anthony Brice - Feb 22nd 1996'||CR||CR
temp=temp'Add a file to FLO,HLO,CLO and DLO packets which are waiting'||CR
temp=temp'to be sent to down or uplinks from your mail system'||CR
temp=temp'Basically knocked up as a quick way to send a file to'||CR
temp=temp'a node or point from your system if your filefreq is'||CR
temp=temp'up the creek, or you want to make life very easy for'||CR
temp=temp'yourself ;)'||CR||CR
temp=temp'Many thanks to Mat Bettinson for the early code and to'||CR
temp=temp'Arthur Sawilejskij for the bug reports that prompted me'||CR
temp=temp'to fix up the original early arexx mess :-)'||CR
'requestnotify PROMPT "'||TEMP||'" center'
Return

