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