home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
TESERACT
/
TESS-025.ZIP
/
PASUTIL2.LBR
/
LISTXXXX.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-01-22
|
3KB
|
80 lines
program lister;
{$I arglist.pin}
label
10;
var
filename : string[80];
infile,outfile : text;
inbuf : string[255];
page,line : integer;
size,i : integer;
p1,p2,p3 : string[2];
date,time : string[8];
counter : integer;
begin
counter := 1;
assign(outfile,'list$$$.prn');
rewrite(outfile);
write(outfile,#27'@'#27'M'#27'l'#7#27'Q'#87);
while (counter <= argc) or (argc = 0) do begin
page := 1;
line := 100;
if argc<>0 then filename := argv(1)
else begin
write('File name - ');
readln(filename);
if length(filename)=0 then goto 10;
end;
assign(infile,filename); {$I-}
reset(infile); {$I+}
if ioresult<>0 then writeln(filename,' does not exist')
else begin {
writeln('date=',memw[seg(infile):ofs(infile)+11+20],'
time=',
memw[seg(infile):ofs(infile)+11+22]);}
str((memw[seg(infile):ofs(infile)+11+20] shr 9)+80,p1);
{year}
str((memw[seg(infile):ofs(infile)+11+20] shr 5) and $F,p2);
{month}
str(memw[seg(infile):ofs(infile)+11+20] and $1F,p3);
{day}
date := p2 + '/' + p3 + '/' + p1;
str(memw[seg(infile):ofs(infile)+11+22] shr 11,p1);
{hour}
str((memw[seg(infile):ofs(infile)+11+22] shr 5) and $3F,p2);
{min}
if length(p2)=1 then p2 := '0'+p2;
time := p1 + ':' + p2;
while not eof(infile) do begin
if line > 60 then begin
line := 1;
if page > 1 then write(outfile,chr(12));
writeln(outfile,#27'-1Page: ',page,' ',
argv(counter),' ',date,' ',time,#27'-0');
writeln(outfile,' ');
page := page+1;
end;
readln(infile,inbuf);
writeln(outfile,inbuf);
size := 0;
for i := 1 to length(inbuf) do BEGIN
if inbuf[i] <> #9 then size := size+1
else size := size+8-(size mod 8) END;
line := line+(size+80) div 80;
{if length(inbuf)<>size then
writeln('length=',length(inbuf),'
size=',size);}
end;
close(infile);
write(outfile,#12);
end;
counter := counter+1;
end;
10: write(outfile,#27'@');
close(outfile);
end.