#!/usr/bin/ruby # vim: et sw=2 VER="(d4e2ac8)" ME="blppr: " $lpp=0 $fl=0 class Block attr_reader :la, :lc Line=Struct.new :l, :st, :b, :c def initialize(h,s) @hdr=h @hst=s @hdr2=nil @hst2=nil @fld=nil @sep=nil @la=[] @lc=2 @b=nil @c=nil end def hdr2(h,s) @hdr2=h @hst2=s @lc+=1 end def fld(f,s) @fld=f @sep=s @lc+=2 end def add(l,s) t=Line.new(l,s,nil,nil) if l.start_with?("\t") or l.start_with?(" "*8) t.c=@c elsif l.start_with?(" ") t.b=@b @c=t else @b=@c=t end @la<0 res+=tmp[i]+" "*t else res+=tmp[i] end end return res end def fmt(l) if ($fl&2)!=0 return l.st+l.l end return l.l end def usage me=ME.delete(":") puts "Usage: "+me+"[-d] [-w] [-l ] []" puts " -l - num of lines per page" puts " -w - fix whitespaces (tabs to spaces)" puts " -d - parse bldiff output" puts " -c - continuous output (no pages)" exit end i=0 while i0 and c>$lpp and (bl.lc<$lpp/2 or n<10) ($lpp-lc).times { buf<<"" } lc=0 end if lc>0 buf<<"" lc+=1 end arr=bl.header buf+=arr lc+=arr.length for l in bl.la if tmp.empty? or l.c tmp<$lpp/2 or tmp.first.c while lc<$lpp-1 buf<$lpp/2 or tmp.first.c while lc<$lpp-1 buf<