#GIF 89a comment blocks??
03-Apr-93 16:48:30
Sb: #28491-#GIF 89a comment blocks??
Fm: Bill Eastburn 70007,1657
To: Peter Tengstrand 76600,2414
/* Test – read gif comment block */
/* Std. startup. */
if ~show('l','rexxsupport.library') then call
addlib('rexxsupport.library',0,-30,0) if ~show('l','rexxarplib.library')
then call addlib('rexxarplib.library',0,-30,0) options results
file = getfile(0,0,'dl:')
if file = '' then exit
call open(inf,file)
wrk = lastpos('/',file)
if wrk = 0 then wrk = lastpos(':',file)
wrkfil = right(file,length(file)-wrk)
wrkfile = left(wrkfil,length(wrkfil)-4)
chunk = readch(inf,6)
if translate(chunk) ~= 'GIF89A' then do
say 'Not a valid GIF89a file'
exit
end
call open(out,'ram:testfile','w')
do until eof(inf)
y = readln(inf)
if eof(inf) then leave
nr = pos('0021FEFF'x,y)
if nr >0 then do
z = right(y,length(y)-(nr+2))
call writeln(out, z)
leave
end
end
do until eof(inf)
y = readln(inf)
if eof(inf) then leave
if y = '0d'x then iterate
if pos('003b'x,y) >0 then leave
if pos('FFFF'x,y) >0 then leave
if right(y,1) = '0d'x then y = left(y,length(y)-1)
call writeln(out, y)
end
call close(inf)
call close(out)
if nr <1 then do
say 'No Comment Block'
exit
end
call open(inf,'ram:testfile')
call open(out,'ram:'||wrkfile||'.CMT','w')
do until eof(inf)
y = readch(inf,1)
if eof(inf) then leave
if c2d(y) > 128 then iterate
if y = 'FF'x then iterate
if y = '07'x then iterate
if y = '0d'x then iterate
call writech(out,y)
end
call close(inf)
call close(out)
exit