Rewrote RlistFromSplitString() to not limit fragment lengths.

It previously restricted the sizes of fragments to 1024 bytes,
CF_MAXVARSIZE; it now uses a dynamically-sized buffer.  Also, instead
of appending fragments to the Rlist, prepend them and reverse the list
just before returning it; this reduces an O(len^2) to an O(len).
(cherry picked from commit b796914262747321fbd9fca67da5f2983ffdf039)
redmine6466: preserve order in readstringarrayidx

Reading the file's contents via a Set is harmless for the other
read*array functions, since they use data from each line as the key,
so naturally discard duplicates and have no other ordering than that
of the keys themselves; however, for readstringarrayidx, the order of
lines actually matters and duplicates are meaningful.  So convert
BuildLineArray to use an Rlist instead of a StringSet (and iterator);
and add an acceptance test (which was actually the hard part).
(cherry picked from commit 6e11153492f13ff2057101cb2d5e9726dad41f93)
Un-suppress AIX, as it now works.

Builds of testing-enterprise-master were failing because
check_outputs.cf expected to fail and didn't ;-)
(cherry picked from commit 3411df88c8d7981b24d7cd8733d89f76de34dffa)
Make regex tests accept const-qualified parameters.

The string passed to IsRegex or IsPathRegex is not modified, so allow
these to be passed a const pointer; likewise for IsRegexItemIn's regex
and the list of entries that's used to check.
(cherry picked from commit 11053e88b5f05b5a633236e83dc78ba0e293e129)
the detection of dead symbolic links must also be ported to protocol_version 2 to my surprise
(cherry picked from commit cd0950473aaa9ba427a548b60229b263979fd75c)
Include type definitions when declaring functions that use them.

A header should not reference a type for which it doesn't provide a
declaration, ideally via the appropriate other header.  I wanted to
call cf_closesocket but pulling in the header that provides it gave me
compiler errors because of references to undefined types in functions
I wasn't interested in.
(cherry picked from commit c736ad146602bcb8ebd3c8fee9419ddf843add8e)
Only filter init out of process matches when we *are* signaling.

FindPidMatches() filters pid 1 (init) out of its result list because
we don't want to be sending it stray signals - we should only do this
when a.signals is set, though !  We special-case HUP and allow it; but
then a check on pid < 4 will exclude it anyway, regardless; so make
that an else clause of the pid == 1 check, so avoid subverting the HUP
exception.  Finally, combine these and the "don't shoot yourself"
exception for cfengine_pid into a single block conditioned on
a.signals instead of testing it separately for each of these cases.

(cherry picked from commit 8cdf3d733ed1d8a1e3fcc3eca002e575358254e6)
Merge pull request #1902 from ediosyncratic/cherries-36x

[3.6.x] Cherries from master for 3.6.x