OPENPAM_READLINEV(3) | MidnightBSD Library Functions Manual | OPENPAM_READLINEV(3) |
openpam_readlinev
—
read a line from a file and split it into words
#include
<sys/types.h>
#include <stdio.h>
#include <security/pam_appl.h>
#include
<security/openpam.h>
char **
openpam_readlinev
(FILE
*f, int *lineno,
int *lenp);
The
openpam_readlinev
()
function reads a line from a file, splits it into words according to the
rules described in the
openpam_readword(3)
manual page, and returns a list of those words.
If lineno is not
NULL
, the integer variable it points to is
incremented every time a newline character is read. This includes quoted or
escaped newline characters and the newline character at the end of the
line.
If lenp is not NULL
,
the number of words on the line is stored in the variable to which it
points.
If successful, the openpam_readlinev
()
function returns a pointer to a dynamically allocated array of pointers to
individual dynamically allocated NUL-terminated strings, each containing a
single word, in the order in which they were encountered on the line. The
array is terminated by a NULL
pointer.
The caller is responsible for freeing both the array and the individual strings by passing each of them to free(3).
If the end of the line was reached before any words were read,
openpam_readlinev
() returns a pointer to a
dynamically allocated array containing a single NULL
pointer.
The openpam_readlinev
() function can fail
and return NULL
for one of four reasons:
EINVAL
,
ferror(3) returns zero,
and feof(3) returns a
non-zero value.ENOMEM
,
ferror(3) returns a
non-zero value, and
feof(3) may or may not
return a non-zero value.The openpam_readlinev
() function is an
OpenPAM extension.
The openpam_readlinev
() function and this
manual page were developed by Dag-Erling
Smørgrav
<des@des.no>.
February 24, 2019 | midnightbsd-3.1 |