bail out if module_init fails; clean up in dlsym cases as well

if dlsym returns error, we leaked the dl handle

if the module_init failed and returned NULL, we would have deref'd the
pointer and crash

Signed-off-by: Michael Leibowitz <michael.leibowitz@intel.com>
test: Add test conf file, remove test conf from default

Signed-off-by: William Douglas <william.douglas@intel.com>
API: Change buxton module init to return a bool
test: Make initial set test use gdbm
Ensure we malloc the BuxtonBackend

Credit to William for discovering this, null pointer was being
passed to the modules when initialising them.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Add buxton_data_copy to perform deep copy of BuxtonData

This required us to go back to using a BuxtonData in the parameters
of get_value, ensuring we deal with a BuxtonData by reference.
Rationale is simple, we cannot return an internal member from the gdbm
backend, and leave the responsibility on the client to free the
internal member.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Implement get_value in gdbm backend and lbuxton

Quite simply we can now retrieve an entire BuxtonData struct from
the gdbm backend now. In order to avoid internal problems we create
a deep copy of the struct so that we do not return the internal pointer.

Client user should free data.store.d_string, as this is set using strdup.
Example use of get:

	BuxtonData get;
	buxton_client_get_value(&client, "base", "KeyName", &get);

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Add argument counting and usage to the CLI client

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Fix missing space betwen backend functions

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Implement set_string in CLI client

We can now set strings in a given (named) layer, and observe they are
indeed stored to disk. The following commit will implement get_string,
before we change the returns of the lbuxton utility methods to use
enums, so that we can identify errors (note that an unintentional cast
from bool to int is happening, affecting return code from buxtonctl)

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Implement get_string in client

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Implement get/set_int methods in CLI.

It may be worth merging get/set's into just two methods, performing
a switch on type, which we pass from main(). This will save a lot
of redundant code.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
db: Change gdbm set to write over previous values

The usage model for buxton is to change settings so if a key already
has a value just write over it. This also changes our possible return
codes we care about and allows us to return a true bool for the cli
to report correctly at exit.
db: Fix gdbm open flags and mode

We don't want a world writable db file, also only need to use WRCREAT
since that applies READER.
libbuxton: assert on the correct name
db: assert on the correct name