Implementing a new $(sys.uptime) variable (Mantis #1134)

The $(sys.uptime) variable contains the number of mintues the system
has been up and running. It uses various techniques depending on the OS
platform to find the system uptime:

* sysinfo() for Linux platforms
* kstat() for Solaris platforms
* pstat_getproc() for HP-UX
* sysctl() for BSD platforms

Any platform which doesn't have one of these methods available will default
to a stat(/proc/1) to get the create time of the init process, which falls
within a few seconds of the boot time of the system. (Even though Linux and
Solaris have /proc, this method is not used on those platforms even as a
fallback.)

If any of these approaches fail, the routine falls back to running the
"/usr/bin/uptime" or "/bin/uptime" command, and its output is parsed into
days, hours, and minutes with a PCRE regexp, and converted to a usable time
for the variable. Thanks to Ted Zlatanov for the suggestion: https://github.com/cfengine/core/pull/46#issuecomment-10066632

This popen() approach is unlikely to be used very frequently - probably only if
the /proc filesystem isn't mounted - but it's a decent backstop to give a
system the best possible chance to set $(sys.uptime) successfully.

Two other closely related variables are introduced: $(sys.systime) and
$(sys.sysday). The former is simply the result of the time() system call,
which is useful in manipulating timestamps in HP-UX TCB password databases,
for example, and the latter is that value divided by 86,400 - the number of
seconds in a day - expressed as an integer. This is, of course, useful in the
/etc/shadow file to indicate the password change date.

Three new documents are added in docs/reference/vars to describe the
$(sys.uptime), $(sys.systime), and $(sys.sysday) variables.
BSD <sys/param.h> include is required for <sys/sysctl.h> header checks

See also jail.h, sys/mount.h checks.
64-bit time_t snprintf; cf_popen needs pipes.h - for sys.uptime var

The cf_popen() and cf_pclose() calls now need to have pipes.h included,
because it was factored out in commit 5be64d09bc4c9c9659d53d2b5bf61286f768acbf.

The time_t type needs the proper printf format to support both 32- and 64-bit
platforms. On older platforms which don't have a C99-compliant snprintf, the
"pub/snprintf.c" replacement is used, so that a "%jd" format can be used even
on such platforms. Normally they would use the PRIdMAX definition from
inttypes.h. See commit f6ba42d5b2988be1f94ee4e55baa174fd7906362.
Added FreeBSD portmaster package_method
Make ACL test detect missing ACL capability in filesystem.
Merge pull request #649 from kacfengine/fixAclTest

Make ACL test detect missing ACL capability in filesystem.
Update HACKING
Added a check if we start with the keyword "bundle" or "body" + unit test
Made the acceptance test template more Windows friendly.
(cherry picked from commit c1cf05a1984980c5fda172454679deb415de70cb)
Don't return FNCALL_FAILURE in FnCallReturnsZero.

While it might seem more correct, for "returnszero()" it has the
unintended side effect of making this policy

  classes:
    "commandfailed" not => returnszero("/bin/nosuchcommand", "noshell");

not set the "commandfailed" class. This happens because FNCALL_FAILURE
will never set *any* class, regardless of the negation used.
Support code for Windows Powershell support.

Powershell is implemented for all promise types/functions where
useshell is supported, which are:
  - execresult()
  - returnszero()
  - "commands" promise type

For the two functions, one can now specify "powershell" instead of
"noshell" or "useshell". The "commands" promise type previously
supported only boolean values. These are retained for backwards
compatibility, but the new, preferred keywords are "noshell",
"useshell" and "powershell".

Also removed the need for shell commands to start with a word that is
an absolute filename. Anything you'd want to use a shell for will
defeat this security measure anyway (pipe, chained command), and it
doesn't go well together with shell builtins on either platform (Unix
or Win).

Absolute filenames are still enforced for the "noshell" type.

This solves issue 2143.
Updated documentation for new powershell support.
Added powershell hard class on Windows.

Part of issue 2143, to make Powershell more convenient to use in a
potentially heterogenous environment.
Merge branch 'master' of git://github.com/cfengine/core into winPowershell

Conflicts:
	cf-agent/verify_exec.c
	libpromises/evalfunction.c
	libpromises/exec_tools.c
	libpromises/unix.c
Fix filestat test pass condition.

Pass when all conditions are met, not when any condition is met.
netinet/ip.h requires netinet/in_systm.h

In Linux and other Unixes this is implicitly included, however in
some more exotic Unixes we need to explicitly include it.
Merge pull request #658 from cduclos/master

The joys of exotic unixes
My ChangeLog entries.
fix for redmine #2635
Merge pull request #655 from kacfengine/winPowershell

Powershell support