diff options
Diffstat (limited to 'man/getln.3')
-rw-r--r-- | man/getln.3 | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/man/getln.3 b/man/getln.3 new file mode 100644 index 0000000..bb4ae7c --- /dev/null +++ b/man/getln.3 @@ -0,0 +1,102 @@ +.TH glibs: getln 3 +.SH NAME +getln \ - read one line of data +.SH SYNTAX +.B #include \(dqgetln.h\(dq + +int \fBgetln\fP(&buffer_0,&sa,&match,sep); +.br +int \fBgetln2\fP(&buffer_0,&sa,&cont,&clen,sep); + +buffer \fIbuffer_0\fR; +.br +stralloc \fIsa\fR; +.br +int \fImatch\fR; +.br +int \fIsep\fR; +.br +char *\fIcont\fR; +.br +unsigned int \fIclen\fR; +.SH DESCRIPTION +.B getln +reads a line of characters, terminated by a sep character, from +.IR buffer_0 . +It returns the line in +.I sa +and sets match to +.IR 1 . +If +.B getln +sees end-of-input before it sees +.IR sep , +it returns the partial line in +.I sa +and sets match to +.IR 0 . + +.B getln2 +reads a line of characters, terminated by a +.I sep +character, from +.IR buffer_0 . +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 +is used again. +If +.B getln2 +sees end-of-input before it sees +.IR sep , +it sets +.I clen +to +.I 0 +and does not set +.IR cont . +It puts the partial line into +.IR sa. +.SH "RETURN CODES" +.B getln +normally returns +.IR 0 . +If it runs out of memory, or encounters an error from +.IR ss , +it returns +.IR -1 , +setting +.I errno +appropriately. + +.B getln2 +normally returns +.IR 0 . +If it runs out of memory, or encounters an error from +.IR ss , +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 +and +.B getln2 +man page were taken from Bruce Guenther and +originally published by Dan Bernstein for qmail-1.03. +.SH SEE ALSO +stralloc(3) |