*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> fparseln (3)              
Title
Content
Arch
Section
 

FPARSELN(3)

Contents


NAME    [Toc]    [Back]

     fparseln - return the next logical line from a stream

SYNOPSIS    [Toc]    [Back]

     #include <stdio.h>
     #include <util.h>

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

DESCRIPTION    [Toc]    [Back]

     The  fparseln() function returns a pointer to the next logical line from
     the stream referenced by stream.  This string is null terminated and 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
flags alter
     this behaviour.

     The meaning of the arguments is as follows:

     stream  The stream to read from.

     len     If not NULL, the length of the string is  stored  in
the memory location
 referenced by len.

     lineno   If  not  NULL,  the value of the memory location to
which lineno
             references is incremented by the number of lines actually read
             from the file.

     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 is as follows:

             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  indicates the beginning of a comment that extends
 until the end of the current line.

     flags   If non-zero, alter the operation of fparseln().  The
various
             flags, which may be OR'ed together, 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    [Toc]    [Back]

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

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

SEE ALSO    [Toc]    [Back]

      
      
     fgetln(3)

OpenBSD      3.6                         December     1,     1997
[ Back ]
 Similar pages
Name OS Title
setbuf IRIX assign buffering to a stream logical unit FORTRAN SYNOPSIS #include character *(BUFSIZ+8) buf intege
fgets FreeBSD get a line from a stream
fgetln OpenBSD get a line from a stream
fgets NetBSD get a line from a stream
fgets OpenBSD get a line from a stream
fgetln NetBSD get a line from a stream
gets FreeBSD get a line from a stream
fgetln FreeBSD get a line from a stream
gets NetBSD get a line from a stream
gets OpenBSD get a line from a stream
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service