From 17c382d1c9d7236c101418060758d2296cc5e17e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 5 Aug 2023 11:51:25 +0000 Subject: Initial commit Signed-off-by: Laurent Bercot --- src/libtipidee/tipidee_conf_get_string.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/libtipidee/tipidee_conf_get_string.c (limited to 'src/libtipidee/tipidee_conf_get_string.c') 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 + +#include + +#include + +#include + +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 ; +} -- cgit v1.3.1