FPARSELN(3)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

✨ NAME ✨

fparseln β€” return the next logical line from a stream. periodt. Also hi bestie, this manual page is FPARSELN(3) from the Library Functions Manual πŸ’….

🧚 LIBRARY 🧚

System Utilities Library (libutil, -lutil). iconic little library moment.

🌈 SYNOPSIS 🌈

#include <stdio.h>
#include <libutil.h>

char *
fparseln(FILE *stream, size_t *len, size_t *lineno, const char delim[3],
    int flags);

🫢 DESCRIPTION 🫢

Okay so fparseln() hands you a pointer to the next logical line from the stream referenced by stream. This string is NUL terminated, and it is dynamically allocated on each invocation. not me forgetting to free it β€” it is the responsibility of the caller to free the pointer, bestie.

By default, if a character is escaped, both it and the preceding escape character will be present in the returned string. Various flags alter this behaviour β€” slay.

πŸ’– the argument lore

  • stream β€” the stream to read from. like, the actual input vibe.
  • len β€” if not NULL, the length of the string is stored in the memory location to which it points.
  • lineno β€” if not NULL, the value of the memory location to which it points is incremented by the number of lines actually read from the file. lowkey useful.
  • delim β€” contains the escape, continuation, and comment characters. If a character is NUL, then processing for that character is disabled. If NULL, all characters default to values specified below. The contents of delim are:
    • delim[0] β€” the escape character, which defaults to \, is used to remove any special meaning from the next character.
    • delim[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.
    • delim[2] β€” the comment character, which defaults to #; if not escaped, it indicates the beginning of a comment that extends until the end of the current line.
  • flags β€” if non-zero, alters the operation of fparseln(). These flags may be or-ed together, and they 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. the whole combo meal, iykyk.

πŸ¦‹ RETURN VALUES πŸ¦‹

Upon successful completion, a pointer to the parsed line is returned; otherwise, NULL is returned. no cap.

The fparseln() function uses internally fgetln(3), so all error conditions that apply to fgetln(3) apply to fparseln(). In addition, fparseln() may set errno to ENOMEM and return NULL if it runs out of memory. 😭

πŸŽ€ SEE ALSO πŸŽ€

πŸ‘‘ HISTORY πŸ‘‘

The fparseln() function first appeared in NetBSD 1.4 and FreeBSD 4.0. iconic behavior.


πŸ“ okay that’s the whole page, bestie. source/version and date vibes: Debian, December 1, 1997, FPARSELN(3). bye!! 🫢
πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms