cal: convert function like definitions to functions

Reviewed-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: clean up use of constants

The commit also adds few new symbolic names, such as DAYS_IN_WEEK.  While
these definitions may look a little too trivial to have I am sure they
ease understanding what is going on in code where they are used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: add calendar reformation check

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: simplify calendar reformat calculations

The only September 1752 offset calculation that is necessary is whether
Sun or Mon is the first day of the week.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: remove unnecessary initializations

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: de-duplicate julian specific functions

The cost is a little bit more complex functions, while the benefit is
couple data flows fewer to mind about.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: allow day highlight testing

Requires similar trick as done with more to by pass check whether a
session is or isn't interactive.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
tests: add cal day highlight corner cases

Check the first, last, and strange Sep 1752 dates are highlighted
correctly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: trim three month display trailing white spaces

Includes fix to checks that conform earlier output practise.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: move global variables to local scope

Also include small change to function parameter coding style.  The braces
are from function line to new line, and return value is in same line with
the function.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cal: mark all functions static

Proposed-by: Dave Reisner <dreisner@archlinux.org>
Reference: http://marc.info/?l=util-linux-ng&m=136717012419551&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>