---
name: "openpam_readlinev"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/openpam_readlinev"
---

# openpam\_readlinev(3)

read a line from a file and split it into words

## NAME

**openpam\_readlinev** – read a line from a file and split it into words

## SYNOPSIS

**#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*);

## DESCRIPTION

The **openpam\_readlinev**() function reads a line from a file, splits it into words according to the rules described in the [openpam\_readword(3)](/openpam_readword/3.md) 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.

## RETURN VALUES

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)](/free/3.md).

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:

- The end of the file was reached before any words were read; *errno* is zero, [ferror(3)](/ferror/3.md) returns zero, and [feof(3)](/feof/3.md) returns a non-zero value.

- The end of the file was reached while a quote or backslash escape was in effect; *errno* is set to EINVAL, [ferror(3)](/ferror/3.md) returns zero, and [feof(3)](/feof/3.md) returns a non-zero value.

- An error occurred while reading from the file; *errno* is non-zero, [ferror(3)](/ferror/3.md) returns a non-zero value and [feof(3)](/feof/3.md) returns zero.

- A [malloc(3)](/malloc/3.md) or [realloc(3)](/realloc/3.md) call failed; *errno* is set to ENOMEM, [ferror(3)](/ferror/3.md) returns a non-zero value, and [feof(3)](/feof/3.md) may or may not return a non-zero value.

## SEE ALSO

[openpam\_readline(3)](/openpam_readline/3.md), [openpam\_readword(3)](/openpam_readword/3.md), [pam(3)](/pam/3.md)

## STANDARDS

The **openpam\_readlinev**() function is an OpenPAM extension.

## AUTHORS

The **openpam\_readlinev**() function and this manual page were developed by Dag-Erling Smørgrav ⟨*des@des.dev*⟩.
