X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fres.c;h=4714c68b0d980e78ac7678a5d4d496abeed7555c;hb=5368365d44ba3ecb0d6d5755aa8419e6be4ebc66;hp=952b900627f23e8c620c65d52f97f6dc6ac4c88c;hpb=deff57cfa9d9b39c4a4f1c9b82a64c6e61d821a4;p=idzebra-moved-to-github.git diff --git a/util/res.c b/util/res.c index 952b900..4714c68 100644 --- a/util/res.c +++ b/util/res.c @@ -1,4 +1,4 @@ -/* $Id: res.c,v 1.40 2005-03-30 09:25:25 adam Exp $ +/* $Id: res.c,v 1.42 2005-06-13 10:27:52 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -30,6 +30,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #endif +#include #include struct res_entry { @@ -454,3 +455,14 @@ int res_write (Res r) return 0; } +ZEBRA_RES res_get_int(Res r, const char *name, int *val) +{ + const char *cp = res_get(r, name); + if (cp) + { + if (sscanf(cp, "%d", val) == 1) + return ZEBRA_OK; + yaz_log(YLOG_WARN, "Expected integer for resource %s", name); + } + return ZEBRA_FAIL; +}