aboutsummaryrefslogtreecommitdiffstats
path: root/src/libtipidee/tipidee_conf_get_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libtipidee/tipidee_conf_get_string.c')
-rw-r--r--src/libtipidee/tipidee_conf_get_string.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libtipidee/tipidee_conf_get_string.c b/src/libtipidee/tipidee_conf_get_string.c
new file mode 100644
index 0000000..0ea93cd
--- /dev/null
+++ b/src/libtipidee/tipidee_conf_get_string.c
@@ -0,0 +1,17 @@
+/* ISC license. */
+
+#include <errno.h>
+
+#include <skalibs/cdb.h>
+
+#include <tipidee/conf.h>
+
+#include <skalibs/posixishard.h>
+
+char const *tipidee_conf_get_string (tipidee_conf const *conf, char const *key)
+{
+ cdb_data data ;
+ if (!tipidee_conf_get(conf, key, &data)) return 0 ;
+ if (data.s[data.len-1]) { errno = EPROTO ; return 0 ; }
+ return data.s ;
+}