program bInfo;
uses lists, dos, crt, debug;
var
tree:PBTree;
inputFileName:string;
outputFileName:string;
ch:char;
procedure usage;
begin
writeln('bInfo filename.bti output');
halt;
end; // usage
begin
if (paramcount <> 2) then usage();
inputFileName := paramstr(1);
outputFileName := paramstr(2);
if (fsearch(inputFileName, '') = '') then usage();
if (fsearch(outputFileName, '') <> '') then
begin
writeln(outputFileName, ' already exists. Overwrite? [N/y]');
repeat
ch := upcase(readkey);
until ch in [#27, #10, 'Y', 'N'];
if (ch <> 'Y') then halt;
end;
new(tree, open(inputFileName, NIL));
tree^.printWholeTree(outputFileName);
writeln('Tree has ', tree^.getKeyCount(), ' keys');
dispose(tree, done);
end.