1 .\" $NetBSD: fparseln.3,v 1.7 1999/07/02 15:49:12 simonb Exp $
2 .\" $FreeBSD: src/lib/libutil/fparseln.3,v 1.5.2.4 2001/12/17 10:08:32 ru Exp $
3 .\" $DragonFly: src/lib/libutil/fparseln.3,v 1.3 2006/03/26 22:56:56 swildner Exp $
5 .\" Copyright (c) 1997 Christos Zoulas. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by Christos Zoulas.
18 .\" 4. The name of the author may not be used to endorse or promote products
19 .\" derived from this software without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 .Nd return the next logical line from a stream
46 .Fa "FILE *stream" "size_t *len" "size_t *lineno"
47 .Fa "const char delim[3]" "int flags"
53 returns a pointer to the next logical line from the stream referenced by
57 terminated and it is dynamically allocated on each invocation.
59 responsibility of the caller to free the pointer.
61 By default, if a character is escaped, both it and the preceding escape
62 character will be present in the returned string.
67 The meaning of the arguments is as follows:
68 .Bl -tag -width "lineno"
70 The stream to read from.
74 the length of the string is stored in the memory location to which it
79 the value of the memory location to which is pointed to, is incremented
80 by the number of lines actually read from the file.
82 Contains the escape, continuation, and comment characters.
85 then processing for that character is disabled.
88 all characters default to values specified below.
92 .Bl -tag -width "delim[0]"
94 The escape character, which defaults to
96 is used to remove any special meaning from the next character.
98 The continuation character, which defaults to
100 is used to indicate that the next line should be concatenated with the
101 current one if this character is the last character on the current line
104 The comment character, which defaults to
106 if not escaped indicates the beginning of a comment that extends until the
107 end of the current line.
110 If non-zero, alter the operation of
112 The various flags, which may be
115 .Bl -tag -width "FPARSELN_UNESCCOMM"
116 .It Dv FPARSELN_UNESCCOMM
117 Remove escape preceding an escaped comment.
118 .It Dv FPARSELN_UNESCCONT
119 Remove escape preceding an escaped continuation.
120 .It Dv FPARSELN_UNESCESC
121 Remove escape preceding an escaped escape.
122 .It Dv FPARSELN_UNESCREST
123 Remove escape preceding any other character.
124 .It Dv FPARSELN_UNESCALL
129 Upon successful completion a pointer to the parsed line is returned;
136 function uses internally
138 so all error conditions that apply to
150 if it runs out of memory.
156 function first appeared in