Adding cf-isalive

Per @zzamboni request
See https://groups.google.com/forum/#!topic/help-cfengine/NmyIOyUMLxw
Applied @ediosyncratic suggestions
Merge branch 'master' into cf-isalive
Support for CFEngine 3.6
Updated with latest version
Wrap HACKING.md where lines exceed 78 columns.
HACKING.md: add do-while exception, and rewrap some text around it.
Add: Acceptance test for ifelapsed

Ifelapsed should always be respected, especially at the individual
promise level.

Ref: https://dev.cfengine.com/issues/6334
Move long running test case earlier to speed up parallel testing.

This is purely an optimization. Since the test case is long running,
it should occupy a job slot early in the process, so it can chew on it
for a while, while the rest of the tests are running.

Also fix a typo in the path that has been bugging me for ages.
Make sure all relevant variables are inherited by sub invokations.

This fixes parallel test runs in sub projects.
Make sure serial tests are run, even if parallel ones fail.

This moves the serial tests out of the makefile, since make would
refuse to run them if any parallel tests had failed.
Catch errors resulting from miscalculating the number of test results.

This will save us if we make a mistake in testall which leaves out
some test results.
Fixing LocalExec in cf-execd-runner.c

The premature return was only doing most of the tidy-up needed, so
make it a break instead and add a flag for whether the command
actually completed; use that to condition the one Log() after the loop
that wasn't appropriate to run after this failure.  The alternate
branch to that return's if was in fact the only path out of the loop
for which the Log() was relevant, so made it set the flag for that
Log().  Made the Log() say something sensible as an alternative when
the work isn't complete.  Simplified the code to detect a non-blank
string.

Code skipping spaces at the start of a string could be simplified to
avoid the need for a bool flag to say whether we found anything else.
Kill some stray apostrophes.

Some function names were formatted using '%s'' with two dangling
apostrophes; there should only be one before and one after !
Also: split a long line, purged dangling hspace, added braces demanded
by coding style.
Leak-fixes and clean-up in FnCallPackagesMatching().

Move computation of regex outside the loop - no need to recompute the
same regex for every line of the CSV file ! - and pre-compile it so
that we can search using it more efficiently.  Localise all the
variables related to that at the same time.

Split up various long lines, notably when Log()ging failure to open
the inventory.

Move creation of some objects to where they're needed, to save the
need to tidy them away on failure in the interval.

Don't leak the allocated line when it doesn't match our expectations.

Restructure the for(;;) loop as a while with assignment in its
condition so as to move the failure-handling out of the loop and avoid
duplication of clean-up code.  Reviewed the error message on that
failure: it claimed fread() was involved, which is a lie, so re-worked
it.
Petty leak-fix: close socket on which we failed to listen.

About to exit with error anyway, so not crucial.
Tidy up in SocketConnect().

PR #1952 added an ap = ap->ai_next in an if branch that duplicated one
in its else; replacing these with one after the whole branch put the
loop in the form of a for() unrolled as a while, so I rolled it up as
a for().

If an iteration of the loop managed to create a socket but failed to
connect it, we were leaking it (unless it happened to be the last time
round the loop); the "on failure close the socket" was after the loop,
where it belonged inside.  Further, the Log()ging of that tried to use
GetErrorStr() when enough other functions had been called since the
error that the error string might easily be from something unrelated
to the connection failure.  So Log() before closing the socket in the
loop and don't try to include an error string with the final "none of
it worked" Log().

Tweaked a couple of other Log() messages.
Don't leak return from logging hook function.
Fix a badly-thought-out loop.

The BSD compiler warned that i >= 0 is always true for a size_t i; the
loop conditioned on that could have spun for ever.  So turn it into a
while that terminates correctly and simplify what's left.
Break out of thread main-loop on signal.

If we get a signal that we catch and use as reason to exit, we need
our threads to exit, not just the main thread.  I believe it's safe
for the threads to simply call IsPendingTermination(); it's not
super-critical that they synchronise round that, as long as they
notice after a few laps round their loops.