Truncate all tables we should.

A copy-paste error led to logentries, notifications,
contactnotifications, contactnotificationmethods and acknowledgements
tables not being truncated as advertised, and the last max_*_age
configuration value specified for those tables would be used for
max_externalcommands_age instead.

A typo in the ndo2db.cfg sample used the wrong variable names for
max_contactnotifications_age and max_contactnotificationmethods_age, so
these would never have been recognized by ndo2db.

Finally, the trimming statements for notifications,
contactnotifications and contactnotificationmethods used the wrong
column.

This commit fixes these bugs, and adds a syslog to record when tables
are trimmed.
Add configure link tests for nanosleep() from Core.
Fix uninitialized, undefined, unused, and other warnings.

This commit removes many unused variables, and several explicit 'extern
int errno' declarations. Notably, cleanup queue.[hc]: several functions
with unspecified arguments; use of an uninitialized variable; a missing
return; and unneeded code.

This fixes most issues in Tracker #428.
Fix undeclared asprintf() and format mismatches.

Get a proper explicit declaration of asprintf() instead of leaving it
undeclared ('implicitly declared' makes this sound acceptable). With a
proper declaration the compiler knows to do printf format argument
checking and can warn us about the type-format mismatches.

This fixes the issues from Tracker #428 remaining after
67f146545339e18fca557aed9168d11a096592ad.
.gitignore and 'make distclean' all build artifacts.