about summary refs log tree commit diff
path: root/src/cache/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache/conf.c')
-rw-r--r--src/cache/conf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cache/conf.c b/src/cache/conf.c
index 209fdc3..c2f3d6b 100644
--- a/src/cache/conf.c
+++ b/src/cache/conf.c
@@ -27,6 +27,15 @@ int conf_get (cdb const *c, char const *key, cdb_data *data)
   return conf_getb(c, key, strlen(key), data) ;
 }
 
+int conf_get_uint16 (cdb const *c, char const *key, uint16_t *value)
+{
+  cdb_data data ;
+  if (!conf_get(conf, key, &data)) return 0 ;
+  if (data.len != 2) return (errno = EPROTO, 0) ;
+  uint16_unpack_big(data.s, value) ;
+  return 1 ;
+}
+
 int conf_get_uint32 (cdb const *c, char const *key, uint32_t *value)
 {
   cdb_data data ;