[1mSYNTAX[0m
[1m#include "getln.h"[0m
int [1mgetln[22m(&buffer_0,&sa,&match,sep);
int [1mgetln2[22m(&buffer_0,&sa,&cont,&clen,sep);
buffer [4mbuffer_0[24m;
stralloc [4msa[24m;
int [4mmatch[24m;
int [4msep[24m;
char *[4mcont[24m;
unsigned int [4mclen[24m;
[1mDESCRIPTION[0m
[1mgetln [22mreads a line of characters, terminated by a sep character, from
[4mbuffer_0[24m. It returns the line in [4msa[24m and sets match to [4m1[24m. If [1mgetln[0m
sees end-of-input before it sees [4msep[24m, it returns the partial line in [4msa[0m
and sets match to [4m0[24m.
[1mgetln2 [22mreads a line of characters, terminated by a [4msep[24m character, from
[4mbuffer_0[24m. The line is returned in two pieces. The first piece is
stored in [4msa[24m. The second piece is [4mcont[24m, a pointer to [4mclen[24m characters
inside the [4mbuffer_0[24m buffer. The second piece must be copied somewhere
else before [4mss[24m is used again. If [1mgetln2 [22msees end-of-input before it
sees [4msep[24m, it sets [4mclen[24m to [4m0[24m and does not set [4mcont[24m. It puts the partial
line into [4msa.[0m
[1mRETURN CODES[0m
[1mgetln [22mnormally returns [4m0[24m. If it runs out of memory, or encounters an
error from [4mss[24m, it returns [4m-1[24m, setting [4merrno[24m appropriately.
[1mgetln2 [22mnormally returns [4m0[24m. If it runs out of memory, or encounters an
error from [4mss[24m, it returns [4m-1[24m, setting [4merrno[24m appropriately.
[1mNOTE[0m
The input buffer [4mbuffer_0[24m is already pre-allocated. It can be used
without initialization as synonym for STDIN.
[1mCREDITS[0m
The [1mgetln [22mand [1mgetln2 [22mman page were taken from Bruce Guenther and origiā
nally published by Dan Bernstein for qmail-1.03.
[1mSEE ALSO[0m
stralloc(3)
3 glibs:(getln)
Man(1) output converted with
man2html