fparseln (3) Linux Manual Page
NAME
fparseln – return the next logical line from a stream
LIBRARY
Lb libbsd
SYNOPSIS
In bsd/stdio.h Ft char * Fo fparseln Fa FILE *stream size_t *len size_t *lineno Fa const char delim[3] int flags Fc
DESCRIPTION
The Fn fparseln function returns a pointer to the next logical line from the stream referenced by Fa stream . This string is NUL terminated and it is dynamically allocated on each invocation. It is the responsibility of the caller to free the pointer.
By default, if a character is escaped, both it and the preceding escape character will be present in the returned string. Various Fa flags alter this behaviour.
The meaning of the arguments is as follows:
Fastream- The stream to read from.
Falen- If not
NULLthe length of the string is stored in the memory location to which it points. Falineno- If not
NULLthe value of the memory location to which is pointed to, is incremented by the number of lines actually read from the file. Fadelim- Contains the escape, continuation, and comment characters. If a character is
NULthen processing for that character is disabled. IfNULLall characters default to values specified below. The contents of Fa delim is as follows:Fadelim[0]- The escape character, which defaults to
\is used to remove any special meaning from the next character. Fadelim[1]- The continuation character, which defaults to
\is used to indicate that the next line should be concatenated with the current one if this character is the last character on the current line and is not escaped. Fadelim[2]- The comment character, which defaults to
#if not escaped indicates the beginning of a comment that extends until the end of the current line.
Faflags- If non-zero, alter the operation of Fn fparseln . The various flags, which may be or
-edtogether, are:FPARSELN_UNESCCOMM- Remove escape preceding an escaped comment.
FPARSELN_UNESCCONT- Remove escape preceding an escaped continuation.
FPARSELN_UNESCESC- Remove escape preceding an escaped escape.
FPARSELN_UNESCREST- Remove escape preceding any other character.
FPARSELN_UNESCALL- All of the above.
RETURN VALUES
Upon successful completion a pointer to the parsed line is returned; otherwise, NULL is returned.
The Fn fparseln function uses internally fgetln(3), so all error conditions that apply to fgetln(3), apply to Fn fparseln . In addition Fn fparseln may set errno to Bq Er ENOMEM and return NULL if it runs out of memory.
SEE ALSO
fgetln(3)
HISTORY
The Fn fparseln function first appeared in Nx 1.4 .
