projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implemented wrbuf_puts.
[yaz-moved-to-github.git]
/
util
/
wrbuf.c
diff --git
a/util/wrbuf.c
b/util/wrbuf.c
index
4cfc8d8
..
5f84565
100644
(file)
--- a/
util/wrbuf.c
+++ b/
util/wrbuf.c
@@
-4,7
+4,13
@@
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: wrbuf.c,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: wrbuf.c,v $
- * Revision 1.5 1999-08-27 09:40:32 adam
+ * Revision 1.7 1999-11-03 09:05:56 adam
+ * Implemented wrbuf_puts.
+ *
+ * Revision 1.6 1999/10/28 11:36:40 adam
+ * wrbuf_write allows zero buffer length.
+ *
+ * Revision 1.5 1999/08/27 09:40:32 adam
* Renamed logf function to yaz_log. Removed VC++ project files.
*
* Revision 1.4 1998/02/11 11:53:36 adam
* Renamed logf function to yaz_log. Removed VC++ project files.
*
* Revision 1.4 1998/02/11 11:53:36 adam
@@
-74,9
+80,18
@@
int wrbuf_grow(WRBUF b, int minsize)
int wrbuf_write(WRBUF b, const char *buf, int size)
{
int wrbuf_write(WRBUF b, const char *buf, int size)
{
+ if (size <= 0)
+ return 0;
if (b->pos + size >= b->size)
wrbuf_grow(b, size);
memcpy(b->buf + b->pos, buf, size);
b->pos += size;
return 0;
}
if (b->pos + size >= b->size)
wrbuf_grow(b, size);
memcpy(b->buf + b->pos, buf, size);
b->pos += size;
return 0;
}
+
+int wrbuf_puts(WRBUF b, const char *buf)
+{
+ wrbuf_write(b, buf, strlen(buf)+1); /* '\0'-terminate as well */
+ (b->pos)--; /* don't include '\0' in count */
+ return 0;
+}