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 >
Pascal/Delphi Source File  |  1989-01-22  |  3KB  |  80 lines

  1.  
  2.  program lister;
  3.  {$I arglist.pin}
  4.  
  5.     label
  6.        10;
  7.  
  8.     var
  9.        filename : string[80];
  10.        infile,outfile : text;
  11.        inbuf : string[255];
  12.        page,line : integer;
  13.        size,i : integer;
  14.        p1,p2,p3 : string[2];
  15.        date,time : string[8];
  16.        counter : integer;
  17.  
  18.     begin
  19.        counter := 1;
  20.        assign(outfile,'list$$$.prn');
  21.        rewrite(outfile);
  22.        write(outfile,#27'@'#27'M'#27'l'#7#27'Q'#87);
  23.        while (counter <= argc) or (argc = 0) do begin
  24.           page := 1;
  25.           line := 100;
  26.           if argc<>0 then filename := argv(1)
  27.           else begin
  28.               write('File name - ');
  29.               readln(filename);
  30.               if length(filename)=0 then goto 10;
  31.               end;
  32.           assign(infile,filename); {$I-}
  33.           reset(infile);           {$I+}
  34.           if ioresult<>0 then writeln(filename,' does not exist')
  35.           else begin               {
  36.                            writeln('date=',memw[seg(infile):ofs(infile)+11+20],'
  37.                                       time=',
  38.                                       memw[seg(infile):ofs(infile)+11+22]);}
  39.              str((memw[seg(infile):ofs(infile)+11+20] shr 9)+80,p1);
  40.                                    {year}
  41.              str((memw[seg(infile):ofs(infile)+11+20] shr 5) and $F,p2);
  42.                                    {month}
  43.              str(memw[seg(infile):ofs(infile)+11+20] and $1F,p3);
  44.                                    {day}
  45.              date := p2 + '/' + p3 + '/' + p1;
  46.              str(memw[seg(infile):ofs(infile)+11+22] shr 11,p1);
  47.                                    {hour}
  48.              str((memw[seg(infile):ofs(infile)+11+22] shr 5) and $3F,p2);
  49.                                    {min}
  50.              if length(p2)=1 then p2 := '0'+p2;
  51.              time := p1 + ':' + p2;
  52.              while not eof(infile) do begin
  53.                 if line > 60 then begin
  54.                    line := 1;
  55.                    if page > 1 then write(outfile,chr(12));
  56.                    writeln(outfile,#27'-1Page: ',page,'                   ',
  57.                         argv(counter),'   ',date,'   ',time,#27'-0');
  58.                    writeln(outfile,' ');
  59.                    page := page+1;
  60.                    end;
  61.                 readln(infile,inbuf);
  62.                 writeln(outfile,inbuf);
  63.                 size := 0;
  64.                 for i := 1 to length(inbuf) do BEGIN
  65.                    if inbuf[i] <> #9 then size := size+1
  66.                    else size := size+8-(size mod 8)   END;
  67.                 line := line+(size+80) div 80;
  68.                                    {if length(inbuf)<>size then
  69.                                       writeln('length=',length(inbuf),'
  70.                                       size=',size);}
  71.                 end;
  72.              close(infile);
  73.              write(outfile,#12);
  74.              end;
  75.           counter := counter+1;
  76.           end;
  77. 10:    write(outfile,#27'@');
  78.        close(outfile);
  79.        end.
  80.