3 <meta name="generator" content="groff -Thtml, see www.gnu.org">
4 <meta name="Content-Style" content="text/css">
5 <title>pgetline</title>
9 <h1 align=center>pgetline</h1>
10 <a href="#NAME">NAME</a><br>
11 <a href="#SYNOPSIS">SYNOPSIS</a><br>
12 <a href="#DESCRIPTION">DESCRIPTION</a><br>
13 <a href="#AUTHOR">AUTHOR</a><br>
14 <a href="#LICENSE">LICENSE</a><br>
15 <a href="#VERSION">VERSION</a><br>
16 <a href="#SEE ALSO">SEE ALSO</a><br>
19 <!-- Creator : groff version 1.17.2 -->
20 <!-- CreationDate: Fri May 3 14:57:22 2002 -->
23 <table width="100%" border=0 rules="none" frame="void"
24 cols="2" cellspacing="0" cellpadding="0">
25 <tr valign="top" align="left">
26 <td width="10%"></td><td width="90%">
27 pgetline, pgetlinex, pgetlinec - read a line from a file, optionally removing comments</td></table>
28 <a name="SYNOPSIS"></a>
31 <table width="100%" border=0 rules="none" frame="void"
32 cols="2" cellspacing="0" cellpadding="0">
33 <tr valign="top" align="left">
34 <td width="10%"></td><td width="90%">
35 <pre><b>#include <pstring.h>
37 char *pgetline (pool, FILE *fp, char *line);
38 char *pgetlinex (pool, FILE *fp, char *line, const char *comment_set, int flags);
39 #define pgetlinec(p,fp,line) pgetlinex ((p), (fp), (line),</b> <i>#",</i><b>0)"
40 </b></pre></td></table>
41 <a name="DESCRIPTION"></a>
44 <table width="100%" border=0 rules="none" frame="void"
45 cols="2" cellspacing="0" cellpadding="0">
46 <tr valign="top" align="left">
47 <td width="10%"></td><td width="90%">
48 <b>pgetline</b> reads a single line from a file and returns
49 it. It allocates enough space to read lines of arbitrary'
50 and '0) are length. Line ending characters (' automatically
51 removed from the end of the line.</td></table>
53 <table width="100%" border=0 rules="none" frame="void"
54 cols="2" cellspacing="0" cellpadding="0">
55 <tr valign="top" align="left">
56 <td width="10%"></td><td width="90%">
57 The <b>pool</b> argument is a pool for allocating the line.
58 The <b>fp</b> argument is the C <b>FILE</b> pointer. The
59 <b>line</b> argument is a pointer to a string allocated in
60 pool which will be reallocated and filled with the contents
61 of the line. You may pass <b>line</b> as <b>NULL</b> to get
62 a newly allocated buffer.</td></table>
64 <table width="100%" border=0 rules="none" frame="void"
65 cols="2" cellspacing="0" cellpadding="0">
66 <tr valign="top" align="left">
67 <td width="10%"></td><td width="90%">
68 Use <b>pgetline</b> in one of the following two
71 <table width="100%" border=0 rules="none" frame="void"
72 cols="2" cellspacing="0" cellpadding="0">
73 <tr valign="top" align="left">
74 <td width="10%"></td><td width="90%">
75 <b>line = pgetline (pool, fp, line);</b></td></table>
77 <table width="100%" border=0 rules="none" frame="void"
78 cols="2" cellspacing="0" cellpadding="0">
79 <tr valign="top" align="left">
80 <td width="10%"></td><td width="90%">
83 <table width="100%" border=0 rules="none" frame="void"
84 cols="2" cellspacing="0" cellpadding="0">
85 <tr valign="top" align="left">
86 <td width="10%"></td><td width="90%">
87 <b>line = pgetline (pool, fp, NULL);</b></td></table>
89 <table width="100%" border=0 rules="none" frame="void"
90 cols="2" cellspacing="0" cellpadding="0">
91 <tr valign="top" align="left">
92 <td width="10%"></td><td width="90%">
93 <b>pgetlinex</b> is a more advanced function which reads a
94 line from a file, optionally removing comments,
95 concatenating together lines which have been split with a
96 backslash, and ignoring blank lines. <b>pgetlinex</b> (and
97 the related macro <b>pgetlinec</b>) are very useful for
98 reading lines of input from a configuration
101 <table width="100%" border=0 rules="none" frame="void"
102 cols="2" cellspacing="0" cellpadding="0">
103 <tr valign="top" align="left">
104 <td width="10%"></td><td width="90%">
105 The <b>pool</b> argument is a pool for allocating the line.
106 The <b>fp</b> argument is the C <b>FILE</b> pointer. The
107 <b>line</b> argument is a buffer allocated in pool which
108 will be reallocated and filled with the result.
109 <b>comment_set</b> is the set of possible comment characters
110 -- eg. <b>"#!"</b> to allow either <b>#</b> or
111 <b>!</b> to be used to introduce comments. <b>flags</b> is
112 zero or more of the following flags OR-ed
113 together:</td></table>
115 <table width="100%" border=0 rules="none" frame="void"
116 cols="2" cellspacing="0" cellpadding="0">
117 <tr valign="top" align="left">
118 <td width="10%"></td><td width="90%">
119 <b>PGETL_NO_CONCAT</b>: Don't concatenate lines which have
120 been split with trailing backslash characters.</td></table>
122 <table width="100%" border=0 rules="none" frame="void"
123 cols="2" cellspacing="0" cellpadding="0">
124 <tr valign="top" align="left">
125 <td width="10%"></td><td width="90%">
126 <b>PGETL_INLINE_COMMENTS</b>: Treat everything following a
127 comment character as a comment. The default is to only allow
128 comments which appear on a line on their own.</td></table>
130 <table width="100%" border=0 rules="none" frame="void"
131 cols="2" cellspacing="0" cellpadding="0">
132 <tr valign="top" align="left">
133 <td width="10%"></td><td width="90%">
134 <b>pgetlinec</b> is a helper macro which calls
135 <b>pgetlinex</b> with <b>comment_set == "#"</b>
136 and <b>flags == 0</b>.</td></table>
137 <a name="AUTHOR"></a>
140 <table width="100%" border=0 rules="none" frame="void"
141 cols="2" cellspacing="0" cellpadding="0">
142 <tr valign="top" align="left">
143 <td width="10%"></td><td width="90%">
144 Richard Jones <rich@annexia.org></td></table>
145 <a name="LICENSE"></a>
148 <table width="100%" border=0 rules="none" frame="void"
149 cols="2" cellspacing="0" cellpadding="0">
150 <tr valign="top" align="left">
151 <td width="10%"></td><td width="90%">
152 GNU LGPL (see http://www.gnu.org/)</td></table>
153 <a name="VERSION"></a>
156 <table width="100%" border=0 rules="none" frame="void"
157 cols="2" cellspacing="0" cellpadding="0">
158 <tr valign="top" align="left">
159 <td width="10%"></td><td width="90%">
160 c2lib-1.2.13</td></table>
161 <a name="SEE ALSO"></a>
164 <table width="100%" border=0 rules="none" frame="void"
165 cols="2" cellspacing="0" cellpadding="0">
166 <tr valign="top" align="left">
167 <td width="10%"></td><td width="90%">
168 <b>pmatch(3)</b>.</td></table>