/usr/share/doc/libelektra-dev/examples/basename.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 18 19 20 21 22 23 24 25 26 27 | #include <kdb.h>
#include <stdio.h>
int main()
{{
//! [set base basic]
Key * k = keyNew("user/my/long/name", KEY_END);
keySetBaseName(k, "myname");
printf ("%s\n", keyName(k)); // will print user/my/long/myname
keyDel(k);
//! [set base basic]
}{
//! [add base basic]
Key * k = keyNew("user/my/long", KEY_END);
keyAddBaseName(k, "myname");
printf ("%s\n", keyName(k)); // will print user/my/long/myname
keyDel(k);
//! [add base basic]
}{
//! [add base escaped]
Key * k = keyNew("user/my/long", KEY_END);
keyAddBaseName(k, "myname");
printf ("%s\n", keyName(k)); // will print user/my/long/myname
keyDel(k);
//! [add base escaped]
}}
|