cal: determine how many header lines are needed at initialization

Signed-off-by: Sami Kerola <kerolasa@iki.fi>