summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
Diffstat (limited to 'man')
-rw-r--r--man/buffer.310
-rw-r--r--man/getln.338
-rw-r--r--man/getoptb.32
3 files changed, 28 insertions, 22 deletions
diff --git a/man/buffer.3 b/man/buffer.3
index 2d4d0d2..331c32e 100644
--- a/man/buffer.3
+++ b/man/buffer.3
@@ -31,9 +31,9 @@ int \fBbuffer_flush\fP(buffer *\fIb\fR);
.br
int \fBbuffer_copy\fP(buffer *\fIbo\fR,buffer *\fIbi\fR);
-int \fBbuffer_unixread\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
+ssize_t \fBbuffer_unixread\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
.br
-int \fBbuffer_unixwrite\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
+ssize_t \fBbuffer_unixwrite\fP(int \fIfd\fR,char *\fIbuf\fR,size_t \fIlen\fR);
.SH DESCRIPTION
.B buffer.h
describes a generic buffer interface that can be used for
@@ -111,13 +111,17 @@ fills all available space with data before calling
copies one buffer to other one.
The output buffer needs to have at least the
preallocated size of the input buffer.
+
.B buffer_unixread
and
.B buffer_unixwrite
perform the same operation like standard Unix
.B read
or
-.BR write.
+.B write
+however provide the function return signature
+.IR ssize_t
+required to be used with the buffer interface.
.SH MACROS
Apart from this basic usage, some helpful macro
definitions are provided:
diff --git a/man/getln.3 b/man/getln.3
index bb4ae7c..01f8b89 100644
--- a/man/getln.3
+++ b/man/getln.3
@@ -4,11 +4,11 @@ getln \ - read one line of data
.SH SYNTAX
.B #include \(dqgetln.h\(dq
-int \fBgetln\fP(&buffer_0,&sa,&match,sep);
+int \fBgetln\fP(&buf,&sa,&match,sep);
.br
-int \fBgetln2\fP(&buffer_0,&sa,&cont,&clen,sep);
+int \fBgetln2\fP(&buf,&sa,&cont,&clen,sep);
-buffer \fIbuffer_0\fR;
+buffer \fIbuf\fR;
.br
stralloc \fIsa\fR;
.br
@@ -22,7 +22,7 @@ unsigned int \fIclen\fR;
.SH DESCRIPTION
.B getln
reads a line of characters, terminated by a sep character, from
-.IR buffer_0 .
+.IR buf .
It returns the line in
.I sa
and sets match to
@@ -39,18 +39,18 @@ and sets match to
.B getln2
reads a line of characters, terminated by a
.I sep
-character, from
-.IR buffer_0 .
+character from
+.IR buf .
The line is returned in two pieces. The first piece is stored in
.IR sa .
The second piece is
.IR cont ,
a pointer to
.I clen
-characters inside the
-.I buffer_0
-buffer. The second piece must be copied somewhere else before
-.I ss
+characters inside
+.IR buf .
+The second piece must be copied somewhere else before
+.I sa
is used again.
If
.B getln2
@@ -64,12 +64,19 @@ and does not set
.IR cont .
It puts the partial line into
.IR sa.
+.SH "BUFFER"
+.I buf
+can be a pre-allocated buffer like
+.I buffer_0
+reading from
+.I STDIN
+or any other explicitly generated buffer on a given file descriptor.
.SH "RETURN CODES"
.B getln
normally returns
.IR 0 .
If it runs out of memory, or encounters an error from
-.IR ss ,
+.IR sa ,
it returns
.IR -1 ,
setting
@@ -80,17 +87,12 @@ appropriately.
normally returns
.IR 0 .
If it runs out of memory, or encounters an error from
-.IR ss ,
+.IR sa ,
it returns
.IR -1 ,
setting
.I errno
appropriately.
-.SH NOTE
-The input buffer
-.I buffer_0
-is already pre-allocated.
-It can be used without initialization as synonym for STDIN.
.SH CREDITS
The
.B getln
@@ -99,4 +101,4 @@ and
man page were taken from Bruce Guenther and
originally published by Dan Bernstein for qmail-1.03.
.SH SEE ALSO
-stralloc(3)
+stralloc(3), buffer(3).
diff --git a/man/getoptb.3 b/man/getoptb.3
index f3e329b..1c5522a 100644
--- a/man/getoptb.3
+++ b/man/getoptb.3
@@ -5,7 +5,7 @@ getoptb \- get option character from command line
.B #include \(dqgetoptb.h\(dq
.SH DESCRIPTION
Qlib's
-.B getopt
+.B getoptb
is a replacement for the standard Unix
.B getopt
library, based on