summaryrefslogtreecommitdiff
path: root/src/libtipidee/tipidee_conf_get_string.c
blob: 0ea93cd2dbe1d7682584c6270111133765b7aa7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 ;
}