Both execute the command with the same name in C: and send the output
back in a mail to the sender. James can handle normal FidoNet netmails
as well as gated e-mails from Usenet as long as they have the REPLYNAME
and REPLYADDR kludges as specified in FSC-0035.
*/
IF ~SHOW(Libraries,'rexxsupport.library') THEN
IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
parse arg file
kg=TRUE
to=""
toaddr=""
from=""
fromname=""
replyaddr=""
replytoaddr="2:200/427.3"
replytoname="uucp"
call open('file',file,'R')
do while kg=TRUE
str = readln('file')
if eof('file') then do
kg=FALSE
end
else if length(str)=0 then do
kg=FALSE
end
else do
if left(str,5)="From:" then parse var str 'From: 'fromaddr'@'dummy' ('fromname')'
if left(str,3)="To:" then parse var str 'To: 'toaddr'@'dummy' ('toname')'
if left(str,14)="X-Fido-REPLYTO" then parse var str 'X-Fido-REPLYTO 'replytoaddr' 'replytoname
if left(str,16)="X-Fido-REPLYADDR" then parse var str 'X-Fido-REPLYADDR 'replyaddr
end
end
call open('out','T:James.tmp','W')
call close('out')
if replyaddr~="" then do
fromaddr=replytoaddr
fromname=replytoname
call open('out','T:James.tmp','A')
call writeln('out',"To: " || replyaddr)
call writeln('out',"")
call close('out')
end
kg=TRUE
do while kg=TRUE
str = readln('file')
if left(str,3)="---" then do
kg=FALSE
end
else if length(str)>0 then do
call open('out','T:James.tmp','A')
call writeln('out'," > " || str);
call writeln('out',"");
call close('out')
if str="avail" then address command "avail >>T:James.tmp"
else if str="info" then address command "info >>T:James.tmp"
else do
call open('out','T:James.tmp','A')
call writeln('out',"Unknown command");
call close('out')
end
call open('out','T:James.tmp','A')
call writeln('out',"");
call close('out')
end
if eof('file') then do
kg=FALSE
end
end
call close('file')
/* Send the mail using CrashWrite */
address command 'Work:UMS/CrashMail/CrashWrite FN "Butler James" FA 'toaddr' TN "'fromname'" TA 'fromaddr' SUBJ "Butler James at your service, sir!" t:James.tmp'