cal: use control structure for run time configuration

Runtime configuration is set at the time of command line option parsing,
and other initialization.  Later the configuration is read-only.  This
should make code a little bit more understandable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: rename ascii_wnum() to ascii_weeknum()

Week is not long word, so it does not need to be enshorted and made more
difficult to understand.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: add input variable names to function prototypes

While prototypes such as 'function(int, int, char, int);' are legal they
do not help when trying to understand how the function is expected to be
used.  Adding variable names gives at least a hint when looking the
prototypes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: make day_in_week() use same variable names as other functions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: simplify ascii_weeknum() function

Either the week is or isn't highlighted, there is no need to over
complicate printing of that.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: determine output width at beginning of run and reuse result

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: cal: take account week numbers when determing month lenght

The month header does not need to wrap if month width with week number
allows printing to single line.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: make user request to be part of read-only control struct

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: cal: do not let --week=<num> to adjust requested month

The previous commit made --week=<number> to have smaller weight value
than a month supplied by user.  The commit started to print the month
that has more days at the week when a week is split to two months, and
only one month output is requested.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: determine how many header lines are needed at initialization

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: add month contents structure

This changes determination of calendar month content completely, as well
as outputing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: use month contents structure for --three printing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: use month contents structure for --year printing

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