blob: 866ec99c3c4388cde0e3d4470c60d03c041f54c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
/* ISC license. */
#include <errno.h>
#include <string.h>
#include <skalibs/cdb.h>
#include <skalibs/lolstdio.h>
#include <tipidee/conf.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) ;
LOLDEBUG("tipidee_conf_get: looking up %s", key) ;
switch (cdb_find(&conf->c, data, key, keylen))
{
case -1 : return (errno = EILSEQ, 0) ;
case 0 : return (errno = ENOENT, 0) ;
default : return 1 ;
}
}
|