{convertor from generated LOG files to the corresponding TeX sources
this program is for dos-systems}
program log2tex;
uses
dos;
var
fi,fo:text;
line:string;
d:dirstr;
n:namestr;
e:extstr;
procedure
error(txt:string);
begin
writeln(txt);
halt(1);
end;
begin
if paramcount>=1 then begin
line:=paramstr(1);
end else begin
write('input: ');
readln(line);
end;
fsplit(line,d,n,e);
if e='' then line:=line+'.log';
assign(fi,line);
{$i-} reset(fi); {$i+}
if ioresult<>0 then
error('can not open input file');
while not eof(fi) do begin
readln(fi,line);
if copy(line,1,4)='$#@!' then begin
line:=copy(line,5,255);
assign(fo,line+'.tex');
{$i-} rewrite(fo); {$i+}
if ioresult<>0 then
error('can not open output file');
break;
end;
end;
while not eof(fi) do begin
readln(fi,line);
if copy(line,1,4)='!@#$' then
writeln(fo,copy(line,5,255));
end;
close(fo);
close(fi);
end.