core: Check timeperiods for circular exclusions

Doing the exclusion logic right means traversing all the exclusions.
If there are circular paths there we might be at it for ever, which
is bad. With this patch we know we don't need to bother checking it
in the timeperiod handling code, which is messy enough as it is.

Signed-off-by: Andreas Ericsson <ae@op5.se>
cgi: Fix null pointer reference in getcgi.c language selection

Reported as issue 434 to tracker.nagios.org, this only happens on
solaris, where the printf() family functions aren't helpful enough
to replace NULL pointers with the string NULL rather than bombing
out.

While at it, we rename the input parameter so it doesn't collide
with a typename we want to use.

Signed-off-by: Andreas Ericsson <ae@op5.se>