Line data Source code
1 : /**
2 : * @file
3 : *
4 : * @brief
5 : *
6 : * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
7 : */
8 :
9 : #include <kdb.h>
10 : #include <stdio.h>
11 :
12 : // clang-format off
13 :
14 0 : int main (void)
15 : {
16 : {
17 : //! [Simple]
18 0 : KeySet * keys = ksNew (0, KS_END);
19 : // work with it
20 0 : ksDel (keys);
21 : //! [Simple]
22 : }
23 :
24 : {
25 : //! [Length 15]
26 0 : KeySet * keys = ksNew (15, keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key01", KEY_VALUE, "value01", 0),
27 : keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key02", KEY_VALUE, "value02", 0),
28 : keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key03", KEY_VALUE, "value03", 0),
29 : // ...
30 : keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key15", KEY_VALUE, "value15", 0), KS_END);
31 : // work with it
32 0 : ksDel (keys);
33 : //! [Length 15]
34 : }
35 : {
36 : //! [Hint 500]
37 0 : KeySet * config = ksNew (500, keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key1", KEY_VALUE, "value1", 0),
38 : keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key2", KEY_VALUE, "value2", 0),
39 : keyNew ("user/sw/org/app/#0/current/fixedConfiguration/key3", KEY_VALUE, "value3", 0),
40 : KS_END); // don't forget the KS_END at the end!
41 : // work with it
42 0 : ksDel (config);
43 : //! [Hint 500]
44 : }
45 : }
|