SYNTAX

       #include "getln.h"

       int getln(&ss,&sa,&match,sep);
       int getln2(&ss,&sa,&cont,&clen,sep);

       substdio ss;
       stralloc sa;
       int match;
       int sep;
       char *cont;
       unsigned int clen;


DESCRIPTION

       getln reads a line of characters, terminated by a sep character, from
       ss.  It returns the line in sa and sets match to 1.  If getln sees end-
       of-input before it sees sep, it returns the partial line in sa and sets
       match to 0.

       getln2 reads a line of characters, terminated by a sep character, from
       ss.  The line is returned in two pieces. The first piece is stored in
       sa.  The second piece is cont, a pointer to clen characters inside the
       ss buffer. The second piece must be copied somewhere else before ss is
       used again.  If getln2 sees end-of-input before it sees sep, it sets
       clen to 0 and does not set cont.  It puts the partial line into sa.


RETURN CODES

       getln normally returns 0.  If it runs out of memory, or encounters an
       error from ss, it returns -1, setting errno appropriately.

       getln2 normally returns 0.  If it runs out of memory, or encounters an
       error from ss, it returns -1, setting errno appropriately.


CREDITS

       The getln and getln2 man page were taken from Bruce Guenther and
       originally published by Dan Bernstein for qmail-1.03.


SEE ALSO

       stralloc(3)



                                       3                         glibs:(getln)

Man(1) output converted with man2html