From: Adam Dickmeiss Date: Fri, 24 Jan 2014 12:08:52 +0000 (+0100) Subject: Add wrbuf_sha1_puts X-Git-Tag: v5.0.13~39 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=053367cbe356fb3ce0def34b065dae589d700daf;p=yaz-moved-to-github.git Add wrbuf_sha1_puts --- diff --git a/include/yaz/wrbuf.h b/include/yaz/wrbuf.h index 8664c36..e7629d0 100644 --- a/include/yaz/wrbuf.h +++ b/include/yaz/wrbuf.h @@ -285,6 +285,16 @@ void wrbuf_iconv_json_puts(WRBUF b, yaz_iconv_t cd, const char *strz); YAZ_EXPORT int wrbuf_sha1_write(WRBUF b, const char *cp, size_t sz, int hexit); +/** \brief writes SHA1 text to WRBUF + \param b result + \param cp C-string + \param hexit 1=hex mode; 0=binary + \returns 0 if successful + \returns -1 on error +*/ +YAZ_EXPORT +int wrbuf_sha1_puts(WRBUF b, const char *cp, int hexit); + YAZ_END_CDECL #endif diff --git a/src/wrbuf_sha1.c b/src/wrbuf_sha1.c index 9412d1d..5627f6e 100644 --- a/src/wrbuf_sha1.c +++ b/src/wrbuf_sha1.c @@ -50,6 +50,11 @@ int wrbuf_sha1_write(WRBUF b, const char *cp, size_t sz, int hexit) #endif } +int wrbuf_sha1_puts(WRBUF b, const char *cp, int hexit) +{ + return wrbuf_sha1_write(b, cp, strlen(cp), hexit); +} + /* * Local variables: * c-basic-offset: 4