X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fres.c;h=7f30b8cb51ce073b5cfaf85f3a2957d38c63ec6d;hb=be32b4e5c154545c2b91b76144d6cbf1238f969a;hp=952b900627f23e8c620c65d52f97f6dc6ac4c88c;hpb=deff57cfa9d9b39c4a4f1c9b82a64c6e61d821a4;p=idzebra-moved-to-github.git diff --git a/util/res.c b/util/res.c index 952b900..7f30b8c 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.43 2005-06-14 20:28:54 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -26,10 +26,12 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #ifdef WIN32 #include -#else +#endif +#if HAVE_UNISTD_H #include #endif +#include #include struct res_entry { @@ -454,3 +456,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; +}