1 .\" $NetBSD: fparseln.3,v 1.5 2014/01/07 13:34:11 njoly Exp $
3 .\" Copyright (c) 1997 Christos Zoulas. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 .Nd return the next logical line from a stream
37 .Fa "FILE *stream" "size_t *len" "size_t *lineno"
38 .Fa "const char delim[3]" "int flags"
44 returns a pointer to the next logical line from the stream referenced by
48 terminated and it is dynamically allocated on each invocation.
49 It is the responsibility of the caller to free the pointer.
51 By default, if a character is escaped, both it and the preceding escape
52 character will be present in the returned string.
57 The meaning of the arguments is as follows:
58 .Bl -tag -width "lineno"
60 The stream to read from.
64 the length of the string is stored in the memory location to which it
69 the value of the memory location to which is pointed to, is incremented
70 by the number of lines actually read from the file.
72 Contains the escape, continuation, and comment characters.
75 then processing for that character is disabled.
78 all characters default to values specified below.
82 .Bl -tag -width "delim[0]"
84 The escape character, which defaults to
86 is used to remove any special meaning from the next character.
88 The continuation character, which defaults to
90 is used to indicate that the next line should be concatenated with the
91 current one if this character is the last character on the current line
94 The comment character, which defaults to
96 if not escaped indicates the beginning of a comment that extends until the
97 end of the current line.
100 If non-zero, alter the operation of
102 The various flags, which may be
105 .Bl -tag -width "FPARSELN_UNESCCOMM"
106 .It Dv FPARSELN_UNESCCOMM
107 Remove escape preceding an escaped comment.
108 .It Dv FPARSELN_UNESCCONT
109 Remove escape preceding an escaped continuation.
110 .It Dv FPARSELN_UNESCESC
111 Remove escape preceding an escaped escape.
112 .It Dv FPARSELN_UNESCREST
113 Remove escape preceding any other character.
114 .It Dv FPARSELN_UNESCALL
119 Upon successful completion a pointer to the parsed line is returned;
126 function uses internally
128 so all error conditions that apply to
140 if it runs out of memory.
146 function first appeared in