Fix: Protect against segfault while printing a time_t variable. Detected in NetBSD6 RC2(32-bit)
Use atexit(3) to clean up databases on shutdown

Otherwise it generates a dependency loop between generic_agent.c and dbm_api.c
Use atexit(3) to close log on shutdown

Otherwise it creates a dependency between generic_agent.c and win_log.c
Remove wrappers around NovaWin_{Open,Close}Network
Close network using atexit(3) instead of call from GenericDeInitialize

Otherwise it creates a dependency loop between generic_agent.c and win_api.c
Remove no-op GenericDeInitialize
Dropped unused parameter from NovaWin_Rlist2SidList
Only define variables if they are used
Do not use non-standard parameters in strftime(3)
Stop abusing long as a boolean value
NULL is not an integer value
Do not include system headers before cf3.defs.h / conf.h
Use %jd to print time_t
Only declare and define functions if they are used
MinGW's printf does not know %lld, use %I16d instead
build_xpath feature for building the XML corresponding to a given XPath
via CFEngine promises.

Squashed merge of pull request https://github.com/cfengine/core/pull/212,
with the following commits:

commit a6b7c320315edfbf8acbe5f575ec87920cd555a3
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Fri Oct 26 13:43:37 2012 +0200

    Modify print statements from CfOut to cfPS in order to update classes, for build_xpath promises.

commit 621964cde4ccfd9a373112ec663b74aebb471bc3
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Fri Oct 26 13:19:59 2012 +0200

    Updates in response to recent discussions in the diff.

commit e119e108fb028067617d06428b9434b1839a809d
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Thu Oct 25 09:52:43 2012 +0200

    Minor modifications to whitespace

commit 1d9c510f893323459b6e1a0ad5031b6d8b1d8b88
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Wed Oct 24 15:56:46 2012 +0200

    Remove quotes when extracting name and value of nodes, in xpath_build.

commit 21ceeca8651bcf03f1e54db2b36d907d0a99b376
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Wed Oct 24 14:19:41 2012 +0200

    Move xpath acceptance tests into staging.

commit 47c20726ca6534cf1999664454f5abeeb878015f
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Wed Oct 24 14:09:26 2012 +0200

    modify syntax from select_xpath_region to select_xpath

commit ba5d988df9c1913b905c55d676187fb489b504ed
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Fri Oct 19 19:52:09 2012 +0200

    more acceptance testing for using build_xpath as attribute within edit xml bundles

commit 0fba2344de3fea802c275257c8a23f9104fab6a1
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Fri Oct 19 15:40:16 2012 +0200

    Acceptance testing for using build_xpath atribute within edit xml bundles.

commit 9416f9e004f4ce4af05be1cc9bb7329d0d5fa1f8
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Fri Oct 19 15:18:55 2012 +0200

    Syntax and functionality to call build_xpath from within other editxml bundles.

commit d0eb0358901a57f05f02d1113b7f38fce2556b67
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Wed Oct 17 15:45:36 2012 +0200

    code cleanup - modify strings to prevent overlap and unintended behavior

commit 187464ddfb2a223f502aa159646a019a7277cb31
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Tue Oct 2 12:55:48 2012 +0200

    Allow for '.' in element/attribute names

commit 0fc8e3f77d30b4c86198a6ab17ca68d6582a266e
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Tue Oct 2 11:37:39 2012 +0200

    Allow for '-' in xpath node/attribute names and values, used for build_xpath

commit a289fe934079c2e2b9e9f126779c80a590ba37c8
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Mon Oct 1 14:25:54 2012 +0200

    Comments, error printing, checks, and general cleanup.

commit 16682119906ae153fd4857b9a29de45d0868a336
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Mon Oct 1 11:13:09 2012 +0200

    Minor modification to spacing in xml editing documentation

commit cbaa8f0e998ec3ef3833893ce6f885642822a4b6
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Mon Oct 1 09:44:11 2012 +0200

    Continue developing build_xpath functionality, and general code cleanup.

commit 7a552604ca85c3f0a4850e7468007d5604d57444
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Mon Oct 1 09:43:19 2012 +0200

    Documentation for build_xpath

commit 47c1325d176eb42ca9cc9cbbae757cefa31e0dfa
Author: Shauna Thomas <shauna.thomas@cfengine.com>
Date:   Thu Sep 27 11:11:02 2012 +0200

    build_xpath syntax, functionality, and testing

    Implementing syntax, functionality, and acceptance testing, for build_xpath promise within edit_xml bundles,
    under files promise type. Given an xpath, as promiser, will populate an empty or non-empty xml file. In a
    non-empty file, will first locate last unique node, as selected insertion region, and then insert remainder
    of xpath into this node.
Use atexit(3) to call EndAudit

It breaks dependency loop between generic_agent.c, signals.c and logging.c
Clean up pid file during process termination using atexit(3)

This breaks the dependency loop between signals.c, logging.c, generic_agent.c
Implement custom list of atexit handlers to be called by Windows service

Otherwise Windows service would not call those cleanup functions at all,
as atexit(3) is not called in it.
Clean stale locks by using AtExit function