blob: ff948ee23aca2d3d34cfff9cda197f14fef1faa6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/* ISC license. */
#include <errno.h>
#include <string.h>
#include <skalibs/cdb.h>
#include <tipidee/conf.h>
#include <tipidee/log.h>
int tipidee_conf_get (tipidee_conf const *conf, char const *key, cdb_data *data)
{
size_t keylen = strlen(key) ;
if (keylen > TIPIDEE_CONF_KEY_MAXLEN) return (errno = EINVAL, 0) ;
switch (cdb_find(&conf->c, data, key, keylen))
{
case -1 : return (errno = EILSEQ, 0) ;
case 0 : return (errno = ENOENT, 0) ;
default : return 1 ;
}
}
|