/usr/share/doc/fp-compiler/2.6.4/text/lines.pp is in fp-compiler-2.6.4 2.6.4+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | {
This file is part of the Free Pascal run time library.
Copyright (c) 1993-98 by Florian Klaempfl
Line Counter Example
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
program count_lines;
{
Program that counts number of Lines in a file
}
uses
dos,crt;
type
td = array[1..10000] of byte;
var
lines : longint;
s : searchrec;
f : file;
d : ^td;
{$ifdef tp}
count : word;
i,z : integer;
{$else}
count,i,z : longint;
{$endif}
begin
lines:=0;
new(d);
if paramcount<1 then
begin
writeln('Usage: ',paramstr(0),' filename.ext [filename.ext] ...');
writeln(' Multiple File Names and Wild Cards Allowed:');
writeln(' Example: lines *.cpp stdio.h *.asm');
halt(1);
end;
for i:=1 to paramcount do
begin
findfirst(paramstr(i),archive,s);
while (doserror=0) do
begin
gotoxy(1,wherey);
write(' ');
gotoxy(1,wherey);
write('Scanning: ',s.name);
assign(f,s.name);
reset(f,1);
while not(eof(f)) do
begin
blockread(f,d^,10000,count);
for z:=1 to count do
if d^[z]=10 then inc(lines);
end;
close(f);
findnext(s);
end;
end;
dispose(d);
gotoxy(1,wherey);
write(' ');
gotoxy(1,wherey);
if lines=1 then writeln('1 Line') else writeln(lines,' Lines');
end.
|