diff --git a/buffer/buffer_fromsa.3 b/buffer/buffer_fromsa.3 index 30b51dd..6d2c274 100644 --- a/buffer/buffer_fromsa.3 +++ b/buffer/buffer_fromsa.3 @@ -16,4 +16,4 @@ particular, do not call stralloc_free on it! Reading data from the buffer will not change the stralloc. .SH "SEE ALSO" -buffer_init(3), buffer(3) +buffer_tosa(3), buffer_init(3), buffer(3) diff --git a/buffer/buffer_tosa.3 b/buffer/buffer_tosa.3 new file mode 100644 index 0000000..243e62b --- /dev/null +++ b/buffer/buffer_tosa.3 @@ -0,0 +1,19 @@ +.TH buffer_tosa 3 +.SH NAME +buffer_tosa \- initialize buffer for writing to stralloc +.SH SYNTAX +.B #include + +int \fBbuffer_tosa\fR(buffer* \fIb\fR,stralloc* \fIsa\fR); +.SH DESCRIPTION +buffer_tosa makes a virtual write buffer from a stralloc. The buffer +writing functions will append data to the stralloc until the stralloc +fails to allocate more memory. You still need to flush the buffer. + +Note that in the end the stralloc will have allocated more memory than +is needed to hold the actual contents. The waste is 1024 bytes. +.SH "RETURN VALUE" +buffer_tosa returns 0 if everything was fine, -1 if it failed to +allocate space for the initial data in the stralloc. +.SH "SEE ALSO" +buffer_tosa(3), buffer_init(3), buffer(3)