/usr/share/doc/libelektra-dev/examples/kdbintro.c is in libelektra-dev 0.8.14-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include <kdb.h>
int main()
{
KeySet *myConfig = ksNew(0, KS_END);
Key *parentKey = keyNew("/sw/MyApp", KEY_CASCADING_NAME, KEY_END);
KDB *handle = kdbOpen(parentKey);
kdbGet(handle, myConfig, parentKey); // kdbGet() must be first
// now any number of any kdbGet()/kdbSet() calls are allowed, e.g.:
kdbSet(handle, myConfig, parentKey);
ksDel (myConfig); // delete the in-memory configuration
kdbClose(handle, parentKey); // no more affairs with the key database.
keyDel(parentKey); // working with key/ks does not need kdb
}
|