home *** CD-ROM | disk | FTP | other *** search
- (*
-
- This is included by SQDEMO.PAS. It allows viewing of squish mail
- but can by used for viewing and standard fido message txt.
-
- *)
-
- Procedure Display_Text(
- var fv : file;
- bsize : longint;
- ShowRaw : Boolean;
- ShowKludge : Boolean;
- ShowSeenBy : Boolean;
- var bread : longint
- );
- type buffertype = array[0..maxint] of byte;
- var
- buf : ^buffertype;
- p : longint;
- b : byte;
- s : string;
- clines : word;
- klen : word;
- ok : boolean;
- asize : word;
-
- procedure writeit(var s : string);
- begin
- if (Not ShowSeenBy) and (copy(s,1,9) = 'SEEN-BY: ') then
- begin
- s := '';
- exit;
- end;
- writeln(s);
- inc(clines);
- if (clines mod 18) = 0 then
- begin
- write('<<MORE>>');
- if readkey = #0 then;
- writeln;
- end;
- s := '';
- end;
-
-
- begin
-
- Textcolor(cyan);
- GetMem(buf,Bsize);
- BlockRead(fv,buf^,Bsize,asize);
- bsize := asize;
-
-
- p := 0; (* STARTING BYTE OF MESSAGE CONTENT *)
- s := '';
- clines := 0;
- klen := 0;
- ok := asize > 0;
- fillchar(s,sizeof(s),0);
- while Ok {(p < bsize)} do
- begin
- b := buf^[p];
- case b of
- $00 : begin
- {p := bsize;}
- ok := false;
- end;
- $0D : begin
- if buf^[p+1] = $0A then inc(p);
- if buf^[p+1] = $8D then
- begin
- inc(p);
- if buf^[p+1] IN [$0A,$0D] then inc(p); {get lf/cr}
- end;
- writeit(s);
- end;
- $8D : begin
- if buf^[p+1] IN [$0A,$0D] then inc(p); {get lf/cr}
- writeit(s);
- end;
- $0A : begin
- textcolor(blue);
- writeit(s);
- end;
- $01 : begin
- s := s + chr(b);
- if Not ShowRaw then
- begin
- inc(p);
- while (buf^[p] <> $00) and (p < bsize) do
- begin
- case buf^[p] of
- $01 : begin
- textcolor(red);
- klen := klen +length(s);
- s := removestring(s,#13#10);
- s := removestring(s,#13#10);
- if showkludge
- then writeit(s)
- else s := '';
- textcolor(cyan);
- s := s + chr(buf^[p]);
- end;
- else s := s + chr(buf^[p]);
- end;
- inc(p);
- end;
- if s <> '' then
- begin
- textcolor(red);
- klen := klen +length(s);
- if copy(s,1,5)=^A'PATH' then
- begin
- s := removestring(s,#13#10);
- s := removestring(s,#13#10);
- ok := false;
- end;
- if showkludge
- then writeit(s)
- else s := '';
- textcolor(cyan);
- end;
- end;
- end
- else s := s + chr(b);
- end; {end case}
- inc(p);
- end;
- if s <> '' then writeit(s);
- textcolor(magenta);
- write('<<EOM>>');
- FreeMem(buf,Bsize);
- bread := p;
- end;
-