From 5dfea5617efaf86468fb37579fc52f0863fc42ad Mon Sep 17 00:00:00 2001 From: leitner Date: Thu, 25 Nov 2004 20:21:31 +0000 Subject: [PATCH] add buffer_putsaflush --- CHANGES | 1 + buffer.h | 2 ++ buffer/buffer_putsaflush.3 | 14 ++++++++++++++ buffer/buffer_putsaflush.c | 6 ++++++ stralloc.h | 3 +++ 5 files changed, 26 insertions(+) create mode 100644 buffer/buffer_putsaflush.3 create mode 100644 buffer/buffer_putsaflush.c diff --git a/CHANGES b/CHANGES index 2fb0ea6..ef4ff94 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ extend API To read line/token to stralloc to allow clearing the stralloc first. add stralloc_zero to clear a stralloc + add buffer_putsflush 0.20: add errmsg API diff --git a/buffer.h b/buffer.h index 4c6fd32..6037bb5 100644 --- a/buffer.h +++ b/buffer.h @@ -87,6 +87,8 @@ extern buffer *buffer_2; #ifdef STRALLOC_H /* write stralloc to buffer */ int buffer_putsa(buffer* b,stralloc* sa); +/* write stralloc to buffer and flush */ +int buffer_putsaflush(buffer* b,stralloc* sa); /* these "read token" functions return 0 if the token was complete or * EOF was hit or -1 on error. In contrast to the non-stralloc token diff --git a/buffer/buffer_putsaflush.3 b/buffer/buffer_putsaflush.3 new file mode 100644 index 0000000..bf797fd --- /dev/null +++ b/buffer/buffer_putsaflush.3 @@ -0,0 +1,14 @@ +.TH buffer_putsaflush 3 +.SH NAME +buffer_putsa \- write stralloc to buffer and flush +.SH SYNTAX +.nf +.B #include +.B #include + +int \fBbuffer_putsaflush\fP(buffer* \fIb\fR,const char* \fIx\fR); +.SH DESCRIPTION +buffer_putsaflush is equivalent to buffer_putflush(b,x.sa,x.len). + +.SH "SEE ALSO" +buffer_puts(3), buffer_flush(3), buffer(3) diff --git a/buffer/buffer_putsaflush.c b/buffer/buffer_putsaflush.c new file mode 100644 index 0000000..b3d2c54 --- /dev/null +++ b/buffer/buffer_putsaflush.c @@ -0,0 +1,6 @@ +#include "stralloc.h" +#include "buffer.h" + +int buffer_putsaflush(buffer* b,stralloc* sa) { + return buffer_putflush(b,sa->s,sa->len); +} diff --git a/stralloc.h b/stralloc.h index 38a1d21..802a7a5 100644 --- a/stralloc.h +++ b/stralloc.h @@ -116,6 +116,9 @@ int stralloc_chomp(stralloc* sa); #ifdef BUFFER_H /* write stralloc to buffer */ int buffer_putsa(buffer* b,stralloc* sa); +/* write stralloc to buffer and flush */ +int buffer_putsaflush(buffer* b,stralloc* sa); + /* these "read token" functions return 0 if the token was complete or * EOF was hit or -1 on error. In contrast to the non-stralloc token * functions, the separator is also put in the stralloc; use