home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
cpymsg.zip
/
cpymsg.cmd
next >
Wrap
OS/2 REXX Batch file
|
1997-07-07
|
2KB
|
52 lines
/* CPYMSG.cmd - Julian Thomas 1997: rexx script to append msg to file */
/* Version 0.01 */
/* based on code from William H. Geiger III */
/* whgiii@amaranth.com */
parse arg outfilename msg_filename .
if msg_filename = '' then do
say 'usage is cpymsg outfile infile'
say 'can be called from msgutil or used standalone; purpose'
say 'is to append a message (omitting some junk from the header)'
say 'to a file to build a digest or whatever.'
exit
end
'@echo off'
blank=''
fence='=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+'
m.=''
m.1="From:"
m.2="To:"
m.3="Date:"
m.4="Subject:"
m.5="Message-ID:"
m.6="Reply-To:"
m.7="Sender"
m.0=7
nxy=1
nxz=stream(outfilename,'c','open write')
nxz=stream(outfilename,'c','seek <0')
nzz=stream(msg_filename,'c','open read')
do forever while (length(linein(msg_filename))>0) /* pull file header */
nxx=stream(msg_filename,'c','seek +0') /* get read pointer */
nxx_rs=stream(msg_filename,'c','seek =' nxy) /* reset read pointer */
lin=linein(msg_filename)
/* test to see if we put it out */
headout=0
do i=1 to m.0 by 1
if pos(m.i,lin)=1 then headout=1
end /* loop */
if headout=1 then lo=lineout(outfilename,lin)
nxy=stream(msg_filename,'c','seek +0')
end
lo=lineout(outfilename,blank)
do forever while lines(msg_filename)
lin=linein(msg_filename)
lo=lineout(outfilename,lin)
end
st1=stream(msg_filename,'c','close')
lo=lineout(ouffilename,fence)
st3=stream(outfilename,'c','close')
exit