NAME

inbuf_readline -- read line from an input buffer

SYNOPSIS

   #include <afblib/inbuf_readline.h>

   char* inbuf_readline(inbuf* ibuf);

DESCRIPTION

inbuf_readline reads a sequence of characters from the given input buffer until a line terminator (LF) or end of file is encountered. In case of success, a pointer to a character string containing the read line (without the terminating newline) is returned that was allocated through malloc. It is the responsibility of the caller to free this character string as soon as it is no longer required.

In case of errors, 0 is returned. If a read error is encountered while some input was already gathered, a pointer to the partially read input is provided. If no memory is available, 0 is always returned, even if some input was already read.

AUTHOR

Andreas F. Borchert