Offset 1, 1172 lines modifiedOffset 1, 1020 lines modified
1 .TH·EDITLINE·3·"August·15,·2021"·""1 .\"»    $NetBSD:·editline.3,v·1.101·2021/08/15·10:12:54·wiz·Exp·$
 2 .\"
 3 .\"·Copyright·(c)·1997-2014·The·NetBSD·Foundation,·Inc.
 4 .\"·All·rights·reserved.
 5 .\"
 6 .\"·This·file·was·contributed·to·The·NetBSD·Foundation·by·Luke·Mewburn.
 7 .\"
 8 .\"·Redistribution·and·use·in·source·and·binary·forms,·with·or·without
 9 .\"·modification,·are·permitted·provided·that·the·following·conditions
 10 .\"·are·met:
 11 .\"·1.·Redistributions·of·source·code·must·retain·the·above·copyright
 12 .\"····notice,·this·list·of·conditions·and·the·following·disclaimer.
 13 .\"·2.·Redistributions·in·binary·form·must·reproduce·the·above·copyright
 14 .\"····notice,·this·list·of·conditions·and·the·following·disclaimer·in·the
 15 .\"····documentation·and/or·other·materials·provided·with·the·distribution.
 16 .\"
 17 .\"·THIS·SOFTWARE·IS·PROVIDED·BY·THE·NETBSD·FOUNDATION,·INC.·AND·CONTRIBUTORS
 18 .\"·``AS·IS''·AND·ANY·EXPRESS·OR·IMPLIED·WARRANTIES,·INCLUDING,·BUT·NOT·LIMITED
 19 .\"·TO,·THE·IMPLIED·WARRANTIES·OF·MERCHANTABILITY·AND·FITNESS·FOR·A·PARTICULAR
 20 .\"·PURPOSE·ARE·DISCLAIMED.··IN·NO·EVENT·SHALL·THE·FOUNDATION·OR·CONTRIBUTORS
 21 .\"·BE·LIABLE·FOR·ANY·DIRECT,·INDIRECT,·INCIDENTAL,·SPECIAL,·EXEMPLARY,·OR
 22 .\"·CONSEQUENTIAL·DAMAGES·(INCLUDING,·BUT·NOT·LIMITED·TO,·PROCUREMENT·OF
 23 .\"·SUBSTITUTE·GOODS·OR·SERVICES;·LOSS·OF·USE,·DATA,·OR·PROFITS;·OR·BUSINESS
 24 .\"·INTERRUPTION)·HOWEVER·CAUSED·AND·ON·ANY·THEORY·OF·LIABILITY,·WHETHER·IN
 25 .\"·CONTRACT,·STRICT·LIABILITY,·OR·TORT·(INCLUDING·NEGLIGENCE·OR·OTHERWISE)
 26 .\"·ARISING·IN·ANY·WAY·OUT·OF·THE·USE·OF·THIS·SOFTWARE,·EVEN·IF·ADVISED·OF·THE
 27 .\"·POSSIBILITY·OF·SUCH·DAMAGE.
 28 .\"
 29 .Dd·August·15,·2021
 30 .Dt·EDITLINE·3
 31 .Os
2 .SH·NAME32 .Sh·NAME
3 \fBeditline\fP, 
4 \fBel_init\fP, 
5 \fBel_init_fd\fP, 
6 \fBel_end\fP, 
7 \fBel_reset\fP, 
8 \fBel_gets\fP, 
9 \fBel_wgets\fP, 
10 \fBel_getc\fP, 
11 \fBel_wgetc\fP, 
12 \fBel_push\fP, 
13 \fBel_wpush\fP, 
14 \fBel_parse\fP, 
15 \fBel_wparse\fP, 
16 \fBel_set\fP, 
17 \fBel_wset\fP, 
18 \fBel_get\fP, 
19 \fBel_wget\fP, 
20 \fBel_source\fP, 
21 \fBel_resize\fP, 
22 \fBel_cursor\fP, 
23 \fBel_line\fP, 
24 \fBel_wline\fP, 
25 \fBel_insertstr\fP, 
26 \fBel_winsertstr\fP, 
27 \fBel_deletestr\fP, 
28 \fBel_wdeletestr\fP, 
29 \fBhistory_init\fP, 
30 \fBhistory_winit\fP, 
31 \fBhistory_end\fP, 
32 \fBhistory_wend\fP, 
33 \fBhistory\fP, 
34 \fBhistory_w\fP, 
35 \fBtok_init\fP, 
36 \fBtok_winit\fP, 
37 \fBtok_end\fP, 
38 \fBtok_wend\fP, 
39 \fBtok_reset\fP, 
40 \fBtok_wreset\fP, 
41 \fBtok_line\fP, 
42 \fBtok_wline\fP, 
43 \fBtok_str\fP, 
44 \fBtok_wstr\fP33 .Nm·editline·,
 34 .Nm·el_init·,
 35 .Nm·el_init_fd·,
 36 .Nm·el_end·,
 37 .Nm·el_reset·,
 38 .Nm·el_gets·,
 39 .Nm·el_wgets·,
 40 .Nm·el_getc·,
 41 .Nm·el_wgetc·,
 42 .Nm·el_push·,
 43 .Nm·el_wpush·,
 44 .Nm·el_parse·,
 45 .Nm·el_wparse·,
 46 .Nm·el_set·,
 47 .Nm·el_wset·,
 48 .Nm·el_get·,
 49 .Nm·el_wget·,
 50 .Nm·el_source·,
 51 .Nm·el_resize·,
 52 .Nm·el_cursor·,
 53 .Nm·el_line·,
 54 .Nm·el_wline·,
 55 .Nm·el_insertstr·,
 56 .Nm·el_winsertstr·,
 57 .Nm·el_deletestr·,
 58 .Nm·el_wdeletestr·,
 59 .Nm·history_init·,
 60 .Nm·history_winit·,
 61 .Nm·history_end·,
 62 .Nm·history_wend·,
 63 .Nm·history·,
 64 .Nm·history_w·,
 65 .Nm·tok_init·,
 66 .Nm·tok_winit·,
 67 .Nm·tok_end·,
 68 .Nm·tok_wend·,
 69 .Nm·tok_reset·,
 70 .Nm·tok_wreset·,
 71 .Nm·tok_line·,
 72 .Nm·tok_wline·,
 73 .Nm·tok_str·,
 74 .Nm·tok_wstr
45 \-·line·editor,·history·and·tokenization·functions75 .Nd·line·editor,·history·and·tokenization·functions
46 .SH·LIBRARY76 .Sh·LIBRARY
47 Command·Line·Editor·Library·(libedit,·-ledit)77 .Lb·libedit
48 .SH·SYNOPSIS78 .Sh·SYNOPSIS
 79 .In·histedit.h
 80 .Ft·EditLine·*
 81 .Fn·el_init·"const·char·*prog"·"FILE·*fin"·"FILE·*fout"·"FILE·*ferr"
 82 .Ft·EditLine·*
 83 .Fn·el_init_fd·"const·char·*prog"·"FILE·*fin"·"FILE·*fout"·"FILE·*ferr"·"int·fdin"·"int·fdout"·"int·fderr"
 84 .Ft·void
 85 .Fn·el_end·"EditLine·*e"
 86 .Ft·void
 87 .Fn·el_reset·"EditLine·*e"
 88 .Ft·const·char·*
 89 .Fn·el_gets·"EditLine·*e"·"int·*count"
49 .PP 
50 \fB#include·<histedit.h>\fP 
51 .PP 
52 \fIEditLine·*\fP 
53 .br 
54 \fBel_init\fP(\fIconst·char·*prog\fP,·\fIFILE·*fin\fP,·\fIFILE·*fout\fP,·\fIFILE·*ferr\fP); 
55 .PP 
56 \fIEditLine·*\fP 
57 .br 
58 \fBel_init_fd\fP(\fIconst·char·*prog\fP,·\fIFILE·*fin\fP,·\fIFILE·*fout\fP,·\fIFILE·*ferr\fP,·\fIint·fdin\fP,·\fIint·fdout\fP,·\fIint·fderr\fP); 
59 .PP 
60 \fIvoid\fP 
61 .br 
62 \fBel_end\fP(\fIEditLine·*e\fP); 
63 .PP 
64 \fIvoid\fP 
65 .br 
66 \fBel_reset\fP(\fIEditLine·*e\fP); 
67 .PP 
68 \fIconst·char·*\fP 
69 .br 
70 \fBel_gets\fP(\fIEditLine·*e\fP,·\fIint·*count\fP); 
71 .PP 
72 \fIconst·wchar_t·*\fP90 .Ft·const·wchar_t·*
 91 .Fn·el_wgets·"EditLine·*e"·"int·*count"
 92 .Ft·int
 93 .Fn·el_getc·"EditLine·*e"·"char·*ch"
 94 .Ft·int
 95 .Fn·el_wgetc·"EditLine·*e"·"wchar_t·*wc"
 96 .Ft·void
 97 .Fn·el_push·"EditLine·*e"·"const·char·*mbs"
 98 .Ft·void
 99 .Fn·el_wpush·"EditLine·*e"·"const·wchar_t·*wcs"
 100 .Ft·int
 101 .Fn·el_parse·"EditLine·*e"·"int·argc"·"const·char·*argv[]"
 102 .Ft·int
 103 .Fn·el_wparse·"EditLine·*e"·"int·argc"·"const·wchar_t·*argv[]"
 104 .Ft·int
 105 .Fn·el_set·"EditLine·*e"·"int·op"·"..."
 106 .Ft·int
 107 .Fn·el_wset·"EditLine·*e"·"int·op"·"..."
 108 .Ft·int
 109 .Fn·el_get·"EditLine·*e"·"int·op"·"..."
 110 .Ft·int
 111 .Fn·el_wget·"EditLine·*e"·"int·op"·"..."
 112 .Ft·int
 113 .Fn·el_source·"EditLine·*e"·"const·char·*file"
 114 .Ft·void
 115 .Fn·el_resize·"EditLine·*e"
 116 .Ft·int
 117 .Fn·el_cursor·"EditLine·*e"·"int·count"
73 .br 
74 \fBel_wgets\fP(\fIEditLine·*e\fP,·\fIint·*count\fP); 
75 .PP 
76 \fIint\fP 
77 .br 
78 \fBel_getc\fP(\fIEditLine·*e\fP,·\fIchar·*ch\fP); 
79 .PP 
80 \fIint\fP 
81 .br 
82 \fBel_wgetc\fP(\fIEditLine·*e\fP,·\fIwchar_t·*wc\fP); 
83 .PP 
84 \fIvoid\fP 
85 .br 
86 \fBel_push\fP(\fIEditLine·*e\fP,·\fIconst·char·*mbs\fP); 
87 .PP 
88 \fIvoid\fP 
89 .br 
90 \fBel_wpush\fP(\fIEditLine·*e\fP,·\fIconst·wchar_t·*wcs\fP); 
91 .PP 
92 \fIint\fP 
93 .br 
94 \fBel_parse\fP(\fIEditLine·*e\fP,·\fIint·argc\fP,·\fIconst·char·*argv[]\fP); 
95 .PP 
96 \fIint\fP 
97 .br 
98 \fBel_wparse\fP(\fIEditLine·*e\fP,·\fIint·argc\fP,·\fIconst·wchar_t·*argv[]\fP); 
99 .PP 
100 \fIint\fP 
101 .br 
102 \fBel_set\fP(\fIEditLine·*e\fP,·\fIint·op\fP,·\fI...\fP); 
103 .PP 
104 \fIint\fP 
105 .br 
106 \fBel_wset\fP(\fIEditLine·*e\fP,·\fIint·op\fP,·\fI...\fP); 
107 .PP 
108 \fIint\fP 
109 .br 
110 \fBel_get\fP(\fIEditLine·*e\fP,·\fIint·op\fP,·\fI...\fP); 
111 .PP 
112 \fIint\fP 
113 .br 
114 \fBel_wget\fP(\fIEditLine·*e\fP,·\fIint·op\fP,·\fI...\fP); 
115 .PP 
116 \fIint\fP 
117 .br 
118 \fBel_source\fP(\fIEditLine·*e\fP,·\fIconst·char·*file\fP); 
119 .PP 
120 \fIvoid\fP 
121 .br 
122 \fBel_resize\fP(\fIEditLine·*e\fP); 
123 .PP 
124 \fIint\fP 
125 .br 
126 \fBel_cursor\fP(\fIEditLine·*e\fP,·\fIint·count\fP); 
127 .PP 
128 \fIconst·LineInfo·*\fP118 .Ft·const·LineInfo·*
 119 .Fn·el_line·"EditLine·*e"
129 .br 
130 \fBel_line\fP(\fIEditLine·*e\fP); 
131 .PP 
132 \fIconst·LineInfoW·*\fP120 .Ft·const·LineInfoW·*
 121 .Fn·el_wline·"EditLine·*e"
 122 .Ft·int
 123 .Fn·el_insertstr·"EditLine·*e"·"const·char·*str"
 124 .Ft·int
 125 .Fn·el_winsertstr·"EditLine·*e"·"const·wchar_t·*str"
 126 .Ft·void
 127 .Fn·el_deletestr·"EditLine·*e"·"int·count"
 128 .Ft·void
 129 .Fn·el_wdeletestr·"EditLine·*e"·"int·count"
 130 .Ft·History·*
 131 .Fn·history_init·void
 132 .Ft·HistoryW·*
 133 .Fn·history_winit·void
 134 .Ft·void
 135 .Fn·history_end·"History·*h"
 136 .Ft·void
 137 .Fn·history_wend·"HistoryW·*h"
 138 .Ft·int
 139 .Fn·history·"History·*h"·"HistEvent·*ev"·"int·op"·"..."
 140 .Ft·int
 141 .Fn·history_w·"HistoryW·*h"·"HistEventW·*ev"·"int·op"·"..."
 142 .Ft·Tokenizer·*
 143 .Fn·tok_init·"const·char·*IFS"
 144 .Ft·TokenizerW·*
 145 .Fn·tok_winit·"const·wchar_t·*IFS"
 146 .Ft·void
 147 .Fn·tok_end·"Tokenizer·*t"
 148 .Ft·void
 149 .Fn·tok_wend·"TokenizerW·*t"
 150 .Ft·void
 151 .Fn·tok_reset·"Tokenizer·*t"
 152 .Ft·void
 153 .Fn·tok_wreset·"TokenizerW·*t"
 154 .Ft·int
 155 .Fn·tok_line·"Tokenizer·*t"·"const·LineInfo·*li"·"int·*argc"·"const·char·**argv[]"·"int·*cursorc"·"int·*cursoro"
 156 .Ft·int
133 .br 
134 \fBel_wline\fP(\fIEditLine·*e\fP); 
135 .PP 
136 \fIint\fP 
137 .br 
138 \fBel_insertstr\fP(\fIEditLine·*e\fP,·\fIconst·char·*str\fP); 
139 .PP 
140 \fIint\fP 
141 .br 
142 \fBel_winsertstr\fP(\fIEditLine·*e\fP,·\fIconst·wchar_t·*str\fP); 
143 .PP 
144 \fIvoid\fP 
145 .br 
146 \fBel_deletestr\fP(\fIEditLine·*e\fP,·\fIint·count\fP); 
147 .PP 
148 \fIvoid\fP 
149 .br 
150 \fBel_wdeletestr\fP(\fIEditLine·*e\fP,·\fIint·count\fP); 
151 .PP 
152 \fIHistory·*\fP 
153 .br 
154 \fBhistory_init\fP(void·); 
155 .PP 
156 \fIHistoryW·*\fP 
157 .br 
158 \fBhistory_winit\fP(void·); 
159 .PP 
160 \fIvoid\fP 
161 .br 
162 \fBhistory_end\fP(\fIHistory·*h\fP); 
163 .PP 
164 \fIvoid\fP 
165 .br 
166 \fBhistory_wend\fP(\fIHistoryW·*h\fP); 
167 .PP 
168 \fIint\fP 
169 .br 
170 \fBhistory\fP(\fIHistory·*h\fP,·\fIHistEvent·*ev\fP,·\fIint·op\fP,·\fI...\fP); 
171 .PP 
172 \fIint\fP 
173 .br 
174 \fBhistory_w\fP(\fIHistoryW·*h\fP,·\fIHistEventW·*ev\fP,·\fIint·op\fP,·\fI...\fP); 
175 .PP 
176 \fITokenizer·*\fP 
177 .br 
178 \fBtok_init\fP(\fIconst·char·*IFS\fP); 
179 .PP 
180 \fITokenizerW·*\fP 
181 .br 
182 \fBtok_winit\fP(\fIconst·wchar_t·*IFS\fP); 
183 .PP 
184 \fIvoid\fP 
185 .br 
186 \fBtok_end\fP(\fITokenizer·*t\fP); 
187 .PP 
188 \fIvoid\fP 
189 .br 
190 \fBtok_wend\fP(\fITokenizerW·*t\fP); 
191 .PP 
192 \fIvoid\fP 
193 .br 
194 \fBtok_reset\fP(\fITokenizer·*t\fP); 
195 .PP 
196 \fIvoid\fP 
197 .br 
198 \fBtok_wreset\fP(\fITokenizerW·*t\fP); 
199 .PP 
200 \fIint\fP 
201 .br 
202 \fBtok_line\fP(\fITokenizer·*t\fP,·\fIconst·LineInfo·*li\fP,·\fIint·*argc\fP,·\fIconst·char·**argv[]\fP,·\fIint·*cursorc\fP,·\fIint·*cursoro\fP); 
203 .PP 
204 \fIint\fP 
205 .br 
206 \fBtok_wline\fP(\fITokenizerW·*t\fP,·\fIconst·LineInfoW·*li\fP,·\fIint·*argc\fP,·\fIconst·wchar_t·**argv[]\fP,·\fIint·*cursorc\fP,·\fIint·*cursoro\fP);157 .Fn·tok_wline·"TokenizerW·*t"·"const·LineInfoW·*li"·"int·*argc"·"const·wchar_t·**argv[]"·"int·*cursorc"·"int·*cursoro"
 158 .Ft·int
 159 .Fn·tok_str·"Tokenizer·*t"·"const·char·*str"·"int·*argc"·"const·char·**argv[]"
 160 .Ft·int
 161 .Fn·tok_wstr·"TokenizerW·*t"·"const·wchar_t·*str"·"int·*argc"·"const·wchar_t·**argv[]"
207 .PP 
208 \fIint\fP 
209 .br 
210 \fBtok_str\fP(\fITokenizer·*t\fP,·\fIconst·char·*str\fP,·\fIint·*argc\fP,·\fIconst·char·**argv[]\fP); 
211 .PP 
212 \fIint\fP 
213 .br 
214 \fBtok_wstr\fP(\fITokenizerW·*t\fP,·\fIconst·wchar_t·*str\fP,·\fIint·*argc\fP,·\fIconst·wchar_t·**argv[]\fP); 
215 .SH·DESCRIPTION162 .Sh·DESCRIPTION
216 The163 The
217 \fBeditline\fP164 .Nm
218 library·provides·generic·line·editing,·history·and·tokenization·functions,165 library·provides·generic·line·editing,·history·and·tokenization·functions,
219 similar·to·those·found·in166 similar·to·those·found·in
220 \fBsh\fP(1). 
 167 .Xr·sh·1·.
 168 .Pp
221 These·functions·are·available·in·the169 These·functions·are·available·in·the
222 \fBlibedit\fP170 .Nm·libedit
223 library·(which·needs·the171 library·(which·needs·the
224 \fBlibtermcap\fP172 .Nm·libtermcap
225 library).173 library).
226 Programs·should·be·linked·with174 Programs·should·be·linked·with
227 \fB\-ledit\fP·ltermcap·. 
 175 .Fl·ledit·ltermcap·.
 176 .Pp
228 The177 The
229 \fBeditline\fP178 .Nm
230 library·respects·the179 library·respects·the
231 .IR·LC_CTYPE180 .Ev·LC_CTYPE
232 locale·set·by·the·application·program·and·never·uses181 locale·set·by·the·application·program·and·never·uses
233 \fBsetlocale\fP(3)182 .Xr·setlocale·3
234 to·change·the·locale.183 to·change·the·locale.
235 .SH·LINE·EDITING·FUNCTIONS184 .Sh·LINE·EDITING·FUNCTIONS
236 The·line·editing·functions·use·a·common·data·structure,185 The·line·editing·functions·use·a·common·data·structure,
237 \fIEditLine\fP,186 .Fa·EditLine·,
238 which·is·created·by187 which·is·created·by
239 \fBel_init\fP()188 .Fn·el_init
240 or189 or
241 \fBel_init_fd\fP()190 .Fn·el_init_fd
242 and·freed·by191 and·freed·by
243 \fBel_end\fP(). 
 192 .Fn·el_end·.
 193 .Pp
244 The·wide-character·functions·behave·the·same·way·as·their·narrow194 The·wide-character·functions·behave·the·same·way·as·their·narrow
245 counterparts.195 counterparts.
 196 .Pp
246 The·following·functions·are·available:197 The·following·functions·are·available:
247 .TP 
248 \fBel_init\fP()198 .Bl·-tag·-width·4n
 199 .It·Fn·el_init
249 Initialize·the·line·editor,·and·return·a·data·structure200 Initialize·the·line·editor,·and·return·a·data·structure
250 to·be·used·by·all·other·line·editing·functions,·or201 to·be·used·by·all·other·line·editing·functions,·or
251 NULL202 .Dv·NULL
252 on·failure.203 on·failure.
253 \fIprog·\fP204 .Fa·prog
254 is·the·name·of·the·invoking·program,·used·when·reading·the205 is·the·name·of·the·invoking·program,·used·when·reading·the
255 \fBeditrc\fP(5)206 .Xr·editrc·5
256 file·to·determine·which·settings·to·use.207 file·to·determine·which·settings·to·use.
257 \fIfin\fP, 
258 \fIfout·\fP208 .Fa·fin·,
 209 .Fa·fout
259 and210 and
260 \fIferr·\fP211 .Fa·ferr
261 are·the·input,·output,·and·error·streams·(respectively)·to·use.212 are·the·input,·output,·and·error·streams·(respectively)·to·use.
262 In·this·documentation,·references·to213 In·this·documentation,·references·to
263 ``the·tty''214 .Dq·the·tty
264 are·actually·to·this·input/output·stream·combination.215 are·actually·to·this·input/output·stream·combination.
 216 .It·Fn·el_init_fd
265 .TP 
266 \fBel_init_fd\fP() 
267 Like217 Like
268 \fBel_init\fP()218 .Fn·el_init
269 but·allows·specifying·file·descriptors·for·the219 but·allows·specifying·file·descriptors·for·the
270 \fBstdio\fP(3)220 .Xr·stdio·3
271 corresponding·streams,·in·case·those·were·created·with221 corresponding·streams,·in·case·those·were·created·with
 222 .Xr·funopen·3·.
 223 .It·Fn·el_end
272 \fBfunopen\fP(3). 
273 .TP 
274 \fBel_end\fP() 
275 Clean·up·and·finish·with224 Clean·up·and·finish·with
276 \fIe\fP,225 .Fa·e·,
277 assumed·to·have·been·created·with226 assumed·to·have·been·created·with
278 \fBel_init\fP()227 .Fn·el_init
279 or228 or
 229 .Fn·el_init_fd·.
 230 .It·Fn·el_reset
280 \fBel_init_fd\fP(). 
281 .TP 
282 \fBel_reset\fP() 
283 Reset·the·tty·and·the·parser.231 Reset·the·tty·and·the·parser.
284 This·should·be·called·after·an·error·which·may·have·upset·the·tty's232 This·should·be·called·after·an·error·which·may·have·upset·the·tty's
285 state.233 state.
 234 .It·Fn·el_gets
286 .TP 
287 \fBel_gets\fP() 
288 Read·a·line·from·the·tty.235 Read·a·line·from·the·tty.
289 \fIcount·\fP236 .Fa·count
290 is·modified·to·contain·the·number·of·characters·read.237 is·modified·to·contain·the·number·of·characters·read.
291 Returns·the·line·read·if·successful,·or238 Returns·the·line·read·if·successful,·or
292 NULL239 .Dv·NULL
293 if·no·characters·were·read·or·if·an·error·occurred.240 if·no·characters·were·read·or·if·an·error·occurred.
294 If·an·error·occurred,241 If·an·error·occurred,
295 \fIcount·\fP242 .Fa·count
296 is·set·to·\-1·and243 is·set·to·\-1·and
297 errno244 .Dv·errno
298 contains·the·error·code·that·caused·it.245 contains·the·error·code·that·caused·it.
299 The·return·value·may·not·remain·valid·across·calls·to246 The·return·value·may·not·remain·valid·across·calls·to
300 \fBel_gets\fP()247 .Fn·el_gets
301 and·must·be·copied·if·the·data·is·to·be·retained.248 and·must·be·copied·if·the·data·is·to·be·retained.
 249 .It·Fn·el_wgetc
302 .TP 
303 \fBel_wgetc\fP() 
304 Read·a·wide·character·from·the·tty,·respecting·the·current·locale,250 Read·a·wide·character·from·the·tty,·respecting·the·current·locale,
305 or·from·the·input·queue·described·in251 or·from·the·input·queue·described·in
306 \fBeditline\fP(7)252 .Xr·editline·7
307 if·that·is·not·empty,·and·store·it·in253 if·that·is·not·empty,·and·store·it·in
308 \fIwc\fP.254 .Fa·wc·.
309 If·an·invalid·or·incomplete·character·is·found,·it·is·discarded,255 If·an·invalid·or·incomplete·character·is·found,·it·is·discarded,
310 \fIerrno\fP256 .Va·errno
311 is·set·to257 is·set·to
312 Er·EILSEQ·,258 .Er·EILSEQ·,
313 and·the·next·character·is·read·and·stored·in259 and·the·next·character·is·read·and·stored·in
314 \fIwc\fP.260 .Fa·wc·.
315 Returns·1·if·a·valid·character·was·read,·0·on·end·of·file,·or·\-1·on261 Returns·1·if·a·valid·character·was·read,·0·on·end·of·file,·or·\-1·on
316 \fBread\fP(2)262 .Xr·read·2
317 failure.263 failure.
318 In·the·latter·case,264 In·the·latter·case,
319 \fIerrno\fP265 .Va·errno
320 is·set·to·indicate·the·error.266 is·set·to·indicate·the·error.
 267 .It·Fn·el_getc
321 .TP 
322 \fBel_getc\fP() 
323 Read·a·wide·character·as·described·for268 Read·a·wide·character·as·described·for
324 \fBel_wgetc\fP()269 .Fn·el_wgetc
325 and·return·0·on·end·of·file·or·\-1·on·failure.270 and·return·0·on·end·of·file·or·\-1·on·failure.
326 If·the·wide·character·can·be·represented·as·a·single-byte·character,271 If·the·wide·character·can·be·represented·as·a·single-byte·character,
327 convert·it·with272 convert·it·with
328 \fBwctob\fP(3),273 .Xr·wctob·3·,
329 store·the·result·in274 store·the·result·in
330 \fIch\fP,275 .Fa·ch·,
331 and·return·1;·otherwise,·set276 and·return·1;·otherwise,·set
332 \fIerrno\fP277 .Va·errno
333 to278 to
334 Er·ERANGE279 .Er·ERANGE
335 and·return·\-1.280 and·return·\-1.
336 In·the·C·or·POSIX·locale,·this·simply·reads·a·byte,·but·for·any·other281 In·the·C·or·POSIX·locale,·this·simply·reads·a·byte,·but·for·any·other
337 locale,·including·UTF-8,·this·is·rarely·useful.282 locale,·including·UTF-8,·this·is·rarely·useful.
 283 .It·Fn·el_wpush
338 .TP 
339 \fBel_wpush\fP() 
340 Push·the·wide·character·string284 Push·the·wide·character·string
341 \fIwcs·\fP285 .Fa·wcs
342 back·onto·the·input·queue·described·in286 back·onto·the·input·queue·described·in
343 \fBeditline\fP(7).287 .Xr·editline·7·.
344 If·the·queue·overflows,·for·example·due·to·a·recursive·macro,288 If·the·queue·overflows,·for·example·due·to·a·recursive·macro,
345 or·if·an·error·occurs,·for·example·because289 or·if·an·error·occurs,·for·example·because
346 \fIwcs·\fP290 .Fa·wcs
347 is291 is
348 NULL292 .Dv·NULL
349 or·memory·allocation·fails,·the·function·beeps·at·the·user,293 or·memory·allocation·fails,·the·function·beeps·at·the·user,
350 but·does·not·report·the·problem·to·the·caller.294 but·does·not·report·the·problem·to·the·caller.
 295 .It·Fn·el_push
351 .TP 
352 \fBel_push\fP() 
353 Use·the·current·locale·to·convert·the·multibyte·string296 Use·the·current·locale·to·convert·the·multibyte·string
354 \fImbs·\fP297 .Fa·mbs
355 to·a·wide·character·string,·and·pass·the·result·to298 to·a·wide·character·string,·and·pass·the·result·to
 299 .Fn·el_wpush·.
 300 .It·Fn·el_parse
356 \fBel_wpush\fP(). 
357 .TP 
358 \fBel_parse\fP() 
359 Parses·the301 Parses·the
360 \fIargv·\fP302 .Fa·argv
361 array·(which·is303 array·(which·is
362 \fIargc·\fP304 .Fa·argc
363 elements·in·size)305 elements·in·size)
364 to·execute·builtin306 to·execute·builtin
365 \fBeditline\fP307 .Nm
366 commands.308 commands.
367 If·the·command·is·prefixed·with309 If·the·command·is·prefixed·with
368 ``prog·:''310 .Dq·prog·:
369 then311 then
370 \fBel_parse\fP()312 .Fn·el_parse
371 will·only·execute·the·command·if313 will·only·execute·the·command·if
372 ``prog''314 .Dq·prog
373 matches·the315 matches·the
374 \fIprog·\fP316 .Fa·prog
375 argument·supplied·to317 argument·supplied·to
376 \fBel_init\fP().318 .Fn·el_init·.
377 The·return·value·is319 The·return·value·is
378 \-1·if·the·command·is·unknown,320 \-1·if·the·command·is·unknown,
379 0·if·there·was·no·error·or321 0·if·there·was·no·error·or
380 ``prog''322 .Dq·prog
381 didn't·match,·or323 didn't·match,·or
382 1·if·the·command·returned·an·error.324 1·if·the·command·returned·an·error.
383 Refer·to325 Refer·to
384 \fBeditrc\fP(5)326 .Xr·editrc·5
385 for·more·information.327 for·more·information.
 328 .It·Fn·el_set
386 .TP 
387 \fBel_set\fP() 
388 Set329 Set
389 \fBeditline\fP330 .Nm
390 parameters.331 parameters.
391 \fIop·\fP332 .Fa·op
392 determines·which·parameter·to·set,·and·each·operation·has·its333 determines·which·parameter·to·set,·and·each·operation·has·its
393 own·parameter·list.334 own·parameter·list.
394 Returns·0·on·success,·\-1·on·failure.335 Returns·0·on·success,·\-1·on·failure.
 336 .Pp
395 The·following·values·for337 The·following·values·for
396 \fIop·\fP338 .Fa·op
397 are·supported,·along·with·the·required·argument·list:339 are·supported,·along·with·the·required·argument·list:
 340 .Bl·-tag·-width·4n
398 .RS 
399 .TP 
400 EL_PROMPT·,·\fIchar·*(*f)(EditLine·*)\fP341 .It·Dv·EL_PROMPT·,·Fa·"char·*(*f)(EditLine·*)"
401 Define·prompt·printing·function·as342 Define·prompt·printing·function·as
402 \fIf\fP,343 .Fa·f·,
403 which·is·to·return·a·string·that·contains·the·prompt.344 which·is·to·return·a·string·that·contains·the·prompt.
404 .TP 
405 EL_PROMPT_ESC·,·\fIchar·*(*f)(EditLine·*),·Fa·char·c\fP345 .It·Dv·EL_PROMPT_ESC·,·Fa·"char·*(*f)(EditLine·*)"·,·Fa·"char·c"
406 Same·as346 Same·as
407 EL_PROMPT·,347 .Dv·EL_PROMPT·,
408 but·the348 but·the
409 \fIc·\fP349 .Fa·c
410 argument·indicates·the·start/stop·literal·prompt·character.350 argument·indicates·the·start/stop·literal·prompt·character.
 351 .Pp
411 If·a·start/stop·literal·character·is·found·in·the·prompt,·the352 If·a·start/stop·literal·character·is·found·in·the·prompt,·the
412 character·itself353 character·itself
413 is·not·printed,·but·characters·after·it·are·printed·directly·to·the354 is·not·printed,·but·characters·after·it·are·printed·directly·to·the
414 terminal·without·affecting·the·state·of·the·current·line.355 terminal·without·affecting·the·state·of·the·current·line.
415 A·subsequent·second·start/stop·literal·character·ends·this·behavior.356 A·subsequent·second·start/stop·literal·character·ends·this·behavior.
416 This·is·typically·used·to·embed·literal·escape·sequences·that·change·the357 This·is·typically·used·to·embed·literal·escape·sequences·that·change·the
417 color/style·of·the·terminal·in·the·prompt.358 color/style·of·the·terminal·in·the·prompt.
418 Note·that·the·literal·escape·character·cannot·be·the·last·character·in·the359 Note·that·the·literal·escape·character·cannot·be·the·last·character·in·the
419 prompt,·as·the·escape·sequence·is·attached·to·the·next·character·in·the·prompt.360 prompt,·as·the·escape·sequence·is·attached·to·the·next·character·in·the·prompt.
420 0361 .Dv·0
421 unsets·it.362 unsets·it.
 363 .It·Dv·EL_REFRESH
422 .TP 
423 EL_REFRESH 
424 Re-display·the·current·line·on·the·next·terminal·line.364 Re-display·the·current·line·on·the·next·terminal·line.
425 .TP 
426 EL_RPROMPT·,·\fIchar·*(*f)(EditLine·*)\fP365 .It·Dv·EL_RPROMPT·,·Fa·"char·*(*f)(EditLine·*)"
427 Define·right·side·prompt·printing·function·as366 Define·right·side·prompt·printing·function·as
428 \fIf\fP,367 .Fa·f·,
429 which·is·to·return·a·string·that·contains·the·prompt.368 which·is·to·return·a·string·that·contains·the·prompt.
430 .TP 
431 EL_RPROMPT_ESC·,·\fIchar·*(*f)(EditLine·*),·Fa·char·c\fP369 .It·Dv·EL_RPROMPT_ESC·,·Fa·"char·*(*f)(EditLine·*)"·,·Fa·"char·c"
432 Define·the·right·prompt·printing·function·but·with·a·literal·escape·character.370 Define·the·right·prompt·printing·function·but·with·a·literal·escape·character.
433 .TP 
434 EL_TERMINAL·,·\fIconst·char·*type\fP371 .It·Dv·EL_TERMINAL·,·Fa·"const·char·*type"
435 Define·terminal·type·of·the·tty·to·be372 Define·terminal·type·of·the·tty·to·be
436 \fItype\fP,373 .Fa·type·,
437 or·to374 or·to
438 .IR·TERM375 .Ev·TERM
439 if376 if
440 \fItype·\fP377 .Fa·type
441 is378 is
442 NULL·.379 .Dv·NULL·.
443 .TP 
444 EL_EDITOR·,·\fIconst·char·*mode\fP380 .It·Dv·EL_EDITOR·,·Fa·"const·char·*mode"
445 Set·editing·mode·to381 Set·editing·mode·to
446 \fImode\fP,382 .Fa·mode·,
447 which·must·be·one·of383 which·must·be·one·of
448 ``emacs''384 .Dq·emacs
449 or385 or
 386 .Dq·vi·.
 387 .It·Dv·EL_SIGNAL·,·Fa·"int·flag"
450 ``vi''. 
451 .TP 
452 EL_SIGNAL·,·\fIint·flag\fP 
453 If388 If
454 \fIflag·\fP389 .Fa·flag
455 is·non-zero,390 is·non-zero,
456 \fBeditline\fP391 .Nm
457 will·install·its·own·signal·handler·for·the·following·signals·when392 will·install·its·own·signal·handler·for·the·following·signals·when
458 reading·command·input:393 reading·command·input:
459 SIGCONT·,394 .Dv·SIGCONT·,
460 SIGHUP·,395 .Dv·SIGHUP·,
461 SIGINT·,396 .Dv·SIGINT·,
462 SIGQUIT·,397 .Dv·SIGQUIT·,
463 SIGSTOP·,398 .Dv·SIGSTOP·,
464 SIGTERM·,399 .Dv·SIGTERM·,
465 SIGTSTP·,400 .Dv·SIGTSTP·,
466 and401 and
467 SIGWINCH·.402 .Dv·SIGWINCH·.
468 Otherwise,·the·current·signal·handlers·will·be·used.403 Otherwise,·the·current·signal·handlers·will·be·used.
469 .TP 
470 EL_BIND·,·\fIconst·char·*,·Fa·...,·Dv·NULL·\fP404 .It·Dv·EL_BIND·,·Fa·"const·char·*"·,·Fa·"..."·,·Dv·NULL
471 Perform·the405 Perform·the
472 \fBbind\fP406 .Ic·bind
473 builtin·command.407 builtin·command.
474 Refer·to408 Refer·to
475 \fBeditrc\fP(5)409 .Xr·editrc·5
476 for·more·information.410 for·more·information.
477 .TP 
478 EL_ECHOTC·,·\fIconst·char·*,·Fa·...,·Dv·NULL·\fP411 .It·Dv·EL_ECHOTC·,·Fa·"const·char·*"·,·Fa·"..."·,·Dv·NULL
479 Perform·the412 Perform·the
480 \fBechotc\fP413 .Ic·echotc
481 builtin·command.414 builtin·command.
482 Refer·to415 Refer·to
483 \fBeditrc\fP(5)416 .Xr·editrc·5
484 for·more·information.417 for·more·information.
485 .TP 
486 EL_SETTC·,·\fIconst·char·*,·Fa·...,·Dv·NULL·\fP418 .It·Dv·EL_SETTC·,·Fa·"const·char·*"·,·Fa·"..."·,·Dv·NULL
487 Perform·the419 Perform·the
488 \fBsettc\fP420 .Ic·settc
489 builtin·command.421 builtin·command.
490 Refer·to422 Refer·to
491 \fBeditrc\fP(5)423 .Xr·editrc·5
492 for·more·information.424 for·more·information.
493 .TP 
494 EL_SETTY·,·\fIconst·char·*,·Fa·...,·Dv·NULL·\fP425 .It·Dv·EL_SETTY·,·Fa·"const·char·*"·,·Fa·"..."·,·Dv·NULL
495 Perform·the426 Perform·the
496 \fBsetty\fP427 .Ic·setty
497 builtin·command.428 builtin·command.
498 Refer·to429 Refer·to
499 \fBeditrc\fP(5)430 .Xr·editrc·5
500 for·more·information.431 for·more·information.
501 .TP 
502 EL_TELLTC·,·\fIconst·char·*,·Fa·...,·Dv·NULL·\fP432 .It·Dv·EL_TELLTC·,·Fa·"const·char·*"·,·Fa·"..."·,·Dv·NULL
503 Perform·the433 Perform·the
504 \fBtelltc\fP434 .Ic·telltc
505 builtin·command.435 builtin·command.
506 Refer·to436 Refer·to
507 \fBeditrc\fP(5)437 .Xr·editrc·5
508 for·more·information.438 for·more·information.
509 .TP 
510 EL_ADDFN·,·\fIconst·char·*name,·Fa·const·char·*help,·\·\fP439 .It·Dv·EL_ADDFN·,·Fa·"const·char·*name"·,·Fa·"const·char·*help"·,·\
511 Fa·"unsigned·char·(*func)(EditLine·*e,·int·ch)"440 Fa·"unsigned·char·(*func)(EditLine·*e,·int·ch)"
512 Add·a·user·defined·function,441 Add·a·user·defined·function,
513 \fBfunc\fP(),442 .Fn·func·,
514 referred·to·as443 referred·to·as
515 \fIname·\fP444 .Fa·name
516 which·is·invoked·when·a·key·which·is·bound·to445 which·is·invoked·when·a·key·which·is·bound·to
517 \fIname·\fP446 .Fa·name
518 is·entered.447 is·entered.
519 \fIhelp·\fP448 .Fa·help
520 is·a·description·of449 is·a·description·of
521 \fIname\fP.450 .Fa·name·.
522 At·invocation·time,451 At·invocation·time,
523 \fIch·\fP452 .Fa·ch
524 is·the·key·which·caused·the·invocation.453 is·the·key·which·caused·the·invocation.
525 The·return·value·of454 The·return·value·of
526 \fBfunc\fP()455 .Fn·func
527 should·be·one·of:456 should·be·one·of:
 457 .Bl·-tag·-width·"CC_REDISPLAY"
 458 .It·Dv·CC_NORM
528 .RS 
529 .TP 
530 CC_NORM 
531 Add·a·normal·character.459 Add·a·normal·character.
 460 .It·Dv·CC_NEWLINE
532 .TP 
533 CC_NEWLINE 
534 End·of·line·was·entered.461 End·of·line·was·entered.
 462 .It·Dv·CC_EOF
535 .TP 
536 CC_EOF 
537 EOF·was·entered.463 EOF·was·entered.
 464 .It·Dv·CC_ARGHACK
538 .TP 
539 CC_ARGHACK 
540 Expecting·further·command·input·as·arguments,·do·nothing·visually.465 Expecting·further·command·input·as·arguments,·do·nothing·visually.
 466 .It·Dv·CC_REFRESH
541 .TP 
542 CC_REFRESH 
543 Refresh·display.467 Refresh·display.
544 .TP 
545 CC_REFRESH_BEEP468 .It·Dv·CC_REFRESH_BEEP
546 Refresh·display,·and·beep.469 Refresh·display,·and·beep.
 470 .It·Dv·CC_CURSOR
547 .TP 
548 CC_CURSOR 
549 Cursor·moved,·so·update·and·perform471 Cursor·moved,·so·update·and·perform
550 CC_REFRESH·.472 .Dv·CC_REFRESH·.
551 .TP 
552 CC_REDISPLAY473 .It·Dv·CC_REDISPLAY
553 Redisplay·entire·input·line.474 Redisplay·entire·input·line.
554 This·is·useful·if·a·key·binding·outputs·extra·information.475 This·is·useful·if·a·key·binding·outputs·extra·information.
 476 .It·Dv·CC_ERROR
555 .TP 
556 CC_ERROR 
557 An·error·occurred.477 An·error·occurred.
558 Beep,·and·flush·tty.478 Beep,·and·flush·tty.
 479 .It·Dv·CC_FATAL
559 .TP 
560 CC_FATAL 
561 Fatal·error,·reset·tty·to·known·state.480 Fatal·error,·reset·tty·to·known·state.
 481 .El
562 .RE 
563 .TP 
564 EL_HIST·,·\fIHistory·*(*func)(History·*,·int·op,·...),·\·\fP482 .It·Dv·EL_HIST·,·Fa·"History·*(*func)(History·*,·int·op,·...)"·,·\
565 Fa·"const·char·*ptr"483 Fa·"const·char·*ptr"
566 Defines·which·history·function·to·use,·which·is·usually484 Defines·which·history·function·to·use,·which·is·usually
567 \fBhistory\fP(). 
568 \fIptr·\fP485 .Fn·history·.
 486 .Fa·ptr
569 should·be·the·value·returned·by487 should·be·the·value·returned·by
 488 .Fn·history_init·.
 489 .It·Dv·EL_EDITMODE·,·Fa·"int·flag"
570 \fBhistory_init\fP(). 
571 .TP 
572 EL_EDITMODE·,·\fIint·flag\fP 
573 If490 If
574 \fIflag·\fP491 .Fa·flag
575 is·non-zero,492 is·non-zero,
576 editing·is·enabled·(the·default).493 editing·is·enabled·(the·default).
577 Note·that·this·is·only·an·indication,·and·does·not494 Note·that·this·is·only·an·indication,·and·does·not
578 affect·the·operation·of495 affect·the·operation·of
579 \fB.\fP496 .Nm·.
580 At·this·time,·it·is·the·caller's·responsibility·to497 At·this·time,·it·is·the·caller's·responsibility·to
581 check·this498 check·this
582 (using499 (using
583 \fBel_get\fP()·)500 .Fn·el_get·)
584 to·determine·if·editing·should·be·enabled·or·not.501 to·determine·if·editing·should·be·enabled·or·not.
 502 .It·Dv·EL_UNBUFFERED·,·Fa·"int·flag"
585 .TP 
586 EL_UNBUFFERED·,·\fIint·flag\fP 
587 If503 If
588 \fIflag·\fP504 .Fa·flag
589 is·zero,505 is·zero,
590 unbuffered·mode·is·disabled·(the·default).506 unbuffered·mode·is·disabled·(the·default).
591 In·unbuffered·mode,507 In·unbuffered·mode,
592 \fBel_gets\fP()508 .Fn·el_gets
593 will·return·immediately·after·processing·a·single·character.509 will·return·immediately·after·processing·a·single·character.
 510 .It·Dv·EL_SAFEREAD·,·Fa·"int·flag"
594 .TP 
595 EL_SAFEREAD·,·\fIint·flag\fP 
596 If·the511 If·the
597 \fIflag·\fP512 .Fa·flag
598 argument·is·non-zero,·then513 argument·is·non-zero,·then
599 \fBeditline\fP514 .Nm·editline
600 attempts·to·recover·from·read·errors,·ignoring·the·first·interrrupted515 attempts·to·recover·from·read·errors,·ignoring·the·first·interrrupted
601 error,·and·trying·to·reset·the·input·file·descriptor·to·reset·non-blocking·I/O.516 error,·and·trying·to·reset·the·input·file·descriptor·to·reset·non-blocking·I/O.
602 This·is·disabled·by·default,·and·desirable·only·when517 This·is·disabled·by·default,·and·desirable·only·when
603 \fBeditline\fP518 .Nm·editline
604 is·used·in·shell-like·applications.519 is·used·in·shell-like·applications.
 520 .It·Dv·EL_GETCFN·,·Fa·"el_rfunc_t·f"
605 .TP 
606 EL_GETCFN·,·\fIel_rfunc_t·f\fP 
607 Whenever·reading·a·character,·use·the·function521 Whenever·reading·a·character,·use·the·function
608 -ragged·-offset·indent·-compact522 .Bd·-ragged·-offset·indent·-compact
 523 .Ft·int
609 .PP 
610 \fIint\fP 
611 .br 
612 Fo·f524 .Fo·f
613 \fIEditLine·*e\fP 
614 \fIwchar_t·*wc\fP525 .Fa·"EditLine·*e"
 526 .Fa·"wchar_t·*wc"
615 Fc527 .Fc
 528 .Ed
616 which·stores·the·character·in529 which·stores·the·character·in
617 \fIwc·\fP530 .Fa·wc
618 and·returns·1·on·success,·0·on·end·of·file,·or·\-1·on·I/O·or·encoding531 and·returns·1·on·success,·0·on·end·of·file,·or·\-1·on·I/O·or·encoding
619 errors.532 errors.
620 Functions·internally·using·it·include533 Functions·internally·using·it·include
621 \fBel_wgets\fP(), 
622 \fBel_wgetc\fP(), 
623 \fBel_gets\fP(),534 .Fn·el_wgets·,
 535 .Fn·el_wgetc·,
 536 .Fn·el_gets·,
624 and537 and
625 \fBel_getc\fP().538 .Fn·el_getc·.
626 Initially,·a·builtin·function·is·installed,·and·replacing·it539 Initially,·a·builtin·function·is·installed,·and·replacing·it
627 is·discouraged·because·writing·such·a·function·is·very·error·prone.540 is·discouraged·because·writing·such·a·function·is·very·error·prone.
628 The·builtin·function·can·be·restored·at·any·time·by·passing·the541 The·builtin·function·can·be·restored·at·any·time·by·passing·the
629 special·value542 special·value
630 EL_BUILTIN_GETCFN543 .Dv·EL_BUILTIN_GETCFN
631 instead·of·a·function·pointer.544 instead·of·a·function·pointer.
 545 .It·Dv·EL_CLIENTDATA·,·Fa·"void·*data"
632 .TP 
633 EL_CLIENTDATA·,·\fIvoid·*data\fP 
634 Register546 Register
635 \fIdata·\fP547 .Fa·data
636 to·be·associated·with·this·EditLine·structure.548 to·be·associated·with·this·EditLine·structure.
637 It·can·be·retrieved·with·the·corresponding549 It·can·be·retrieved·with·the·corresponding
638 \fBel_get\fP();550 .Fn·el_get
639 call.551 call.
 552 .It·Dv·EL_SETFP·,·Fa·"int·fd"·,·Fa·"FILE·*fp"
640 .TP 
641 EL_SETFP·,·\fIint·fd,·Fa·FILE·*fp\fP 
642 Set·the·current553 Set·the·current
643 \fBeditline\fP554 .Nm·editline
644 file·pointer·for555 file·pointer·for
645 ``input'' 
646 \fIfd·\fP556 .Dq·input
 557 .Fa·fd
647 =558 =
648 0·, 
649 ``output'' 
650 \fIfd·\fP559 .Dv·0·,
 560 .Dq·output
 561 .Fa·fd
651 =562 =
652 1·,563 .Dv·1·,
653 or564 or
654 ``error'' 
655 \fIfd·\fP565 .Dq·error
 566 .Fa·fd
656 =567 =
657 2568 .Dv·2
658 from569 from
 570 .Fa·fp·.
 571 .El
 572 .It·Fn·el_get
659 \fIfp\fP. 
660 .RE 
661 .TP 
662 \fBel_get\fP() 
663 Get573 Get
664 \fBeditline\fP574 .Nm
665 parameters.575 parameters.
666 \fIop·\fP576 .Fa·op
667 determines·which·parameter·to·retrieve·into577 determines·which·parameter·to·retrieve·into
668 \fIresult\fP.578 .Fa·result·.
669 Returns·0·if·successful,·\-1·otherwise.579 Returns·0·if·successful,·\-1·otherwise.
 580 .Pp
670 The·following·values·for581 The·following·values·for
671 \fIop·\fP582 .Fa·op
672 are·supported,·along·with·actual·type·of583 are·supported,·along·with·actual·type·of
 584 .Fa·result·:
 585 .Bl·-tag·-width·4n
673 \fIresult·:·\fP 
674 .RS 
675 .TP 
676 EL_PROMPT·,·\fIchar·*(*f)(EditLine·*),·Fa·char·*c\fP586 .It·Dv·EL_PROMPT·,·Fa·"char·*(*f)(EditLine·*)"·,·Fa·"char·*c"
677 Set587 Set
678 \fIf·\fP588 .Fa·f
679 to·a·pointer·to·the·function·that·displays·the·prompt.589 to·a·pointer·to·the·function·that·displays·the·prompt.
680 If590 If
681 \fIc·\fP591 .Fa·c
682 is·not592 is·not
683 NULL·,593 .Dv·NULL·,
684 set·it·to·the·start/stop·literal·prompt·character.594 set·it·to·the·start/stop·literal·prompt·character.
685 .TP 
686 EL_RPROMPT·,·\fIchar·*(*f)(EditLine·*),·Fa·char·*c\fP595 .It·Dv·EL_RPROMPT·,·Fa·"char·*(*f)(EditLine·*)"·,·Fa·"char·*c"
687 Set596 Set
688 \fIf·\fP597 .Fa·f
689 to·a·pointer·to·the·function·that·displays·the·prompt.598 to·a·pointer·to·the·function·that·displays·the·prompt.
690 If599 If
691 \fIc·\fP600 .Fa·c
692 is·not601 is·not
693 NULL·,602 .Dv·NULL·,
694 set·it·to·the·start/stop·literal·prompt·character.603 set·it·to·the·start/stop·literal·prompt·character.
 604 .It·Dv·EL_EDITOR·,·Fa·"const·char·**n"
695 .TP 
696 EL_EDITOR·,·\fIconst·char·**n\fP 
697 Set·the·name·of·the·editor·in605 Set·the·name·of·the·editor·in
698 \fIn\fP,606 .Fa·n·,
699 which·will·be·one·of607 which·will·be·one·of
700 ``emacs''608 .Dq·emacs
701 or609 or
 610 .Dq·vi·.
702 ``vi''. 
703 .TP 
704 EL_GETTC·,·\fIconst·char·*name,·Fa·void·*value\fP611 .It·Dv·EL_GETTC·,·Fa·"const·char·*name"·,·Fa·"void·*value"
705 If612 If
706 \fIname·\fP613 .Fa·name
707 is·a·valid614 is·a·valid
708 \fBtermcap\fP(5)615 .Xr·termcap·5
709 capability·set616 capability·set
710 \fIvalue·\fP617 .Fa·value
711 to·the·current·value·of·that·capability.618 to·the·current·value·of·that·capability.
 619 .It·Dv·EL_SIGNAL·,·Fa·"int·*s"
712 .TP 
713 EL_SIGNAL·,·\fIint·*s\fP 
714 Set620 Set
715 \fIs·\fP621 .Fa·s
716 to·non-zero·if622 to·non-zero·if
717 \fBeditline\fP623 .Nm
718 has·installed·private·signal·handlers·(see624 has·installed·private·signal·handlers·(see
719 \fBel_get\fP()625 .Fn·el_get
720 above).626 above).
 627 .It·Dv·EL_EDITMODE·,·Fa·"int·*c"
721 .TP 
722 EL_EDITMODE·,·\fIint·*c\fP 
723 Set628 Set
724 \fIc·\fP629 .Fa·c
725 to·non-zero·if·editing·is·enabled.630 to·non-zero·if·editing·is·enabled.
 631 .It·Dv·EL_GETCFN·,·Fa·"el_rfunc_t·*f"
726 .TP 
727 EL_GETCFN·,·\fIel_rfunc_t·*f\fP 
728 Set632 Set
729 \fIf·\fP633 .Fa·f
730 to·a·pointer·to·the·function·that·reads·characters,·or·to634 to·a·pointer·to·the·function·that·reads·characters,·or·to
731 EL_BUILTIN_GETCFN635 .Dv·EL_BUILTIN_GETCFN
732 if·the·builtin·function·is·in·use.636 if·the·builtin·function·is·in·use.
733 .TP 
734 EL_CLIENTDATA·,·\fIvoid·**data\fP637 .It·Dv·EL_CLIENTDATA·,·Fa·"void·**data"
735 Set638 Set
736 \fIdata·\fP639 .Fa·data
737 to·the·previously·registered·client·data·set·by·an640 to·the·previously·registered·client·data·set·by·an
738 \fBel_set\fP()641 .Fn·el_set
739 call.642 call.
 643 .It·Dv·EL_UNBUFFERED·,·Fa·"int·*c"
740 .TP 
741 EL_UNBUFFERED·,·\fIint·*c\fP 
742 Set644 Set
743 \fIc·\fP645 .Fa·c
744 to·non-zero·if·unbuffered·mode·is·enabled.646 to·non-zero·if·unbuffered·mode·is·enabled.
 647 .It·Dv·EL_SAFEREAD·,·Fa·"int·*c"
745 .TP 
746 EL_SAFEREAD·,·\fIint·*c\fP 
747 Set648 Set
748 \fIc·\fP649 .Fa·c
749 to·non-zero·if·safe·read·is·set.650 to·non-zero·if·safe·read·is·set.
750 .TP 
751 EL_GETFP·,·\fIint·fd",·Fa·FILE·**fp\fP651 .It·Dv·EL_GETFP·,·Fa·"int·fd",·Fa·"FILE·**fp"
752 Set652 Set
753 \fIfp·\fP653 .Fa·fp
754 to·the·current654 to·the·current
755 \fBeditline\fP655 .Nm·editline
756 file·pointer·for656 file·pointer·for
757 ``input'' 
758 \fIfd·\fP657 .Dq·input
 658 .Fa·fd
759 =659 =
760 0·, 
761 ``output'' 
762 \fIfd·\fP660 .Dv·0·,
 661 .Dq·output
 662 .Fa·fd
763 =663 =
764 1·,664 .Dv·1·,
765 or665 or
766 ``error'' 
767 \fIfd·\fP666 .Dq·error
 667 .Fa·fd
768 =668 =
 669 .Dv·2·.
 670 .El
 671 .It·Fn·el_source
769 2·. 
770 .RE 
771 .TP 
772 \fBel_source\fP() 
773 Initialize672 Initialize
774 \fBeditline\fP673 .Nm
775 by·reading·the·contents·of674 by·reading·the·contents·of
776 \fIfile\fP. 
777 \fBel_parse\fP()675 .Fa·file·.
 676 .Fn·el_parse
778 is·called·for·each·line·in677 is·called·for·each·line·in
779 \fIfile\fP.678 .Fa·file·.
780 If679 If
781 \fIfile·\fP680 .Fa·file
782 is681 is
783 NULL·,682 .Dv·NULL·,
784 try683 try
785 \fI$EDITRC\fP684 .Pa·$EDITRC
786 and·if·that·is·not·set685 and·if·that·is·not·set
787 \fI$HOME/.editrc\fP.686 .Pa·$HOME/.editrc·.
788 Refer·to687 Refer·to
789 \fBeditrc\fP(5)688 .Xr·editrc·5
790 for·details·on·the·format·of689 for·details·on·the·format·of
791 \fIfile\fP. 
792 \fBel_source\fP()690 .Fa·file·.
 691 .Fn·el_source
793 returns·0·on·success·and·\-1·on·error.692 returns·0·on·success·and·\-1·on·error.
 693 .It·Fn·el_resize
794 .TP 
795 \fBel_resize\fP() 
796 Must·be·called·if·the·terminal·size·changes.694 Must·be·called·if·the·terminal·size·changes.
797 If695 If
798 EL_SIGNAL696 .Dv·EL_SIGNAL
799 has·been·set·with697 has·been·set·with
800 \fBel_set\fP(),698 .Fn·el_set·,
801 then·this·is·done·automatically.699 then·this·is·done·automatically.
802 Otherwise,·it's·the·responsibility·of·the·application·to·call700 Otherwise,·it's·the·responsibility·of·the·application·to·call
803 \fBel_resize\fP()701 .Fn·el_resize
804 on·the·appropriate·occasions.702 on·the·appropriate·occasions.
 703 .It·Fn·el_cursor
805 .TP 
806 \fBel_cursor\fP() 
807 Move·the·cursor·to·the·right·(if·positive)·or·to·the·left·(if·negative)704 Move·the·cursor·to·the·right·(if·positive)·or·to·the·left·(if·negative)
808 \fIcount·\fP705 .Fa·count
809 characters.706 characters.
810 Returns·the·resulting·offset·of·the·cursor·from·the·beginning·of·the·line.707 Returns·the·resulting·offset·of·the·cursor·from·the·beginning·of·the·line.
 708 .It·Fn·el_line
811 .TP 
812 \fBel_line\fP() 
813 Return·the·editing·information·for·the·current·line·in·a709 Return·the·editing·information·for·the·current·line·in·a
814 \fILineInfo·\fP710 .Fa·LineInfo
815 structure,·which·is·defined·as·follows:711 structure,·which·is·defined·as·follows:
 712 .Bd·-literal
816 typedef·struct·lineinfo·{713 typedef·struct·lineinfo·{
817 .br 
818 ····const·char·*buffer;····/*·address·of·buffer·*/714 ····const·char·*buffer;····/*·address·of·buffer·*/
819 .br 
820 ····const·char·*cursor;····/*·address·of·cursor·*/715 ····const·char·*cursor;····/*·address·of·cursor·*/
821 .br 
822 ····const·char·*lastchar;··/*·address·of·last·character·*/716 ····const·char·*lastchar;··/*·address·of·last·character·*/
823 .br 
824 }·LineInfo;717 }·LineInfo;
825 .br 
  
826 \fIbuffer·\fP718 .Ed
 719 .Pp
 720 .Fa·buffer
827 is·not·NUL·terminated.721 is·not·NUL·terminated.
828 This·function·may·be·called·after722 This·function·may·be·called·after
829 \fBel_gets\fP()723 .Fn·el_gets
830 to·obtain·the724 to·obtain·the
831 \fILineInfo·\fP725 .Fa·LineInfo
832 structure·pertaining·to·line·returned·by·that·function,726 structure·pertaining·to·line·returned·by·that·function,
833 and·from·within·user·defined·functions·added·with727 and·from·within·user·defined·functions·added·with
834 EL_ADDFN·.728 .Dv·EL_ADDFN·.
 729 .It·Fn·el_insertstr
835 .TP 
836 \fBel_insertstr\fP() 
837 Insert730 Insert
838 \fIstr·\fP731 .Fa·str
839 into·the·line·at·the·cursor.732 into·the·line·at·the·cursor.
840 Returns·\-1·if733 Returns·\-1·if
841 \fIstr·\fP734 .Fa·str
842 is·empty·or·won't·fit,·and·0·otherwise.735 is·empty·or·won't·fit,·and·0·otherwise.
 736 .It·Fn·el_deletestr
843 .TP 
844 \fBel_deletestr\fP() 
845 Delete737 Delete
846 \fIcount·\fP738 .Fa·count
847 characters·before·the·cursor.739 characters·before·the·cursor.
 740 .El
848 .SH·HISTORY·LIST·FUNCTIONS741 .Sh·HISTORY·LIST·FUNCTIONS
849 The·history·functions·use·a·common·data·structure,742 The·history·functions·use·a·common·data·structure,
850 \fIHistory\fP,743 .Fa·History·,
851 which·is·created·by744 which·is·created·by
852 \fBhistory_init\fP()745 .Fn·history_init
853 and·freed·by746 and·freed·by
854 \fBhistory_end\fP(). 
 747 .Fn·history_end·.
 748 .Pp
855 The·following·functions·are·available:749 The·following·functions·are·available:
856 .TP 
857 \fBhistory_init\fP()750 .Bl·-tag·-width·4n
 751 .It·Fn·history_init
858 Initialize·the·history·list,·and·return·a·data·structure752 Initialize·the·history·list,·and·return·a·data·structure
859 to·be·used·by·all·other·history·list·functions,·or753 to·be·used·by·all·other·history·list·functions,·or
860 NULL754 .Dv·NULL
861 on·failure.755 on·failure.
 756 .It·Fn·history_end
862 .TP 
863 \fBhistory_end\fP() 
864 Clean·up·and·finish·with757 Clean·up·and·finish·with
865 \fIh\fP,758 .Fa·h·,
866 assumed·to·have·been·created·with759 assumed·to·have·been·created·with
 760 .Fn·history_init·.
 761 .It·Fn·history
867 \fBhistory_init\fP(). 
868 .TP 
869 \fBhistory\fP() 
870 Perform·operation762 Perform·operation
871 \fIop·\fP763 .Fa·op
872 on·the·history·list,·with·optional·arguments·as·needed·by·the764 on·the·history·list,·with·optional·arguments·as·needed·by·the
873 operation.765 operation.
874 \fIev·\fP766 .Fa·ev
875 is·changed·accordingly·to·operation.767 is·changed·accordingly·to·operation.
876 The·following·values·for768 The·following·values·for
877 \fIop·\fP769 .Fa·op
878 are·supported,·along·with·the·required·argument·list:770 are·supported,·along·with·the·required·argument·list:
 771 .Bl·-tag·-width·4n
 772 .It·Dv·H_SETSIZE·,·Fa·"int·size"
879 .RS 
880 .TP 
881 H_SETSIZE·,·\fIint·size\fP 
882 Set·size·of·history·to773 Set·size·of·history·to
883 \fIsize·\fP774 .Fa·size
884 elements.775 elements.
 776 .It·Dv·H_GETSIZE
885 .TP 
886 H_GETSIZE 
887 Get·number·of·events·currently·in·history.777 Get·number·of·events·currently·in·history.
 778 .It·Dv·H_END
888 .TP 
889 H_END 
890 Cleans·up·and·finishes·with779 Cleans·up·and·finishes·with
891 \fIh\fP,780 .Fa·h·,
892 assumed·to·be·created·with781 assumed·to·be·created·with
 782 .Fn·history_init·.
 783 .It·Dv·H_CLEAR
893 \fBhistory_init\fP(). 
894 .TP 
895 H_CLEAR 
896 Clear·the·history.784 Clear·the·history.
897 .TP 
898 H_FUNC·,·\fIvoid·*ptr,·Fa·history_gfun_t·first,·\·\fP785 .It·Dv·H_FUNC·,·Fa·"void·*ptr"·,·Fa·"history_gfun_t·first"·,·\
899 Fa·"history_gfun_t·next"·,·Fa·"history_gfun_t·last"·,·\786 Fa·"history_gfun_t·next"·,·Fa·"history_gfun_t·last"·,·\
900 Fa·"history_gfun_t·prev"·,·Fa·"history_gfun_t·curr"·,·\787 Fa·"history_gfun_t·prev"·,·Fa·"history_gfun_t·curr"·,·\
901 Fa·"history_sfun_t·set"·,·Fa·"history_vfun_t·clear"·,·\788 Fa·"history_sfun_t·set"·,·Fa·"history_vfun_t·clear"·,·\
902 Fa·"history_efun_t·enter"·,·Fa·"history_efun_t·add"789 Fa·"history_efun_t·enter"·,·Fa·"history_efun_t·add"
903 Define·functions·to·perform·various·history·operations.790 Define·functions·to·perform·various·history·operations.
904 \fIptr·\fP791 .Fa·ptr
905 is·the·argument·given·to·a·function·when·it's·invoked.792 is·the·argument·given·to·a·function·when·it's·invoked.
 793 .It·Dv·H_FIRST
906 .TP 
907 H_FIRST 
908 Return·the·first·element·in·the·history.794 Return·the·first·element·in·the·history.
 795 .It·Dv·H_LAST
909 .TP 
910 H_LAST 
911 Return·the·last·element·in·the·history.796 Return·the·last·element·in·the·history.
 797 .It·Dv·H_PREV
912 .TP 
913 H_PREV 
914 Return·the·previous·element·in·the·history.798 Return·the·previous·element·in·the·history.
915 It·is·newer·than·the·current·one.799 It·is·newer·than·the·current·one.
 800 .It·Dv·H_NEXT
916 .TP 
917 H_NEXT 
918 Return·the·next·element·in·the·history.801 Return·the·next·element·in·the·history.
919 It·is·older·than·the·current·one.802 It·is·older·than·the·current·one.
 803 .It·Dv·H_CURR
920 .TP 
921 H_CURR 
922 Return·the·current·element·in·the·history.804 Return·the·current·element·in·the·history.
 805 .It·Dv·H_SET·,·Fa·"int·position"
923 .TP 
924 H_SET·,·\fIint·position\fP 
925 Set·the·cursor·to·point·to·the·requested·element.806 Set·the·cursor·to·point·to·the·requested·element.
 807 .It·Dv·H_ADD·,·Fa·"const·char·*str"
926 .TP 
927 H_ADD·,·\fIconst·char·*str\fP 
928 Append808 Append
929 \fIstr·\fP809 .Fa·str
930 to·the·current·element·of·the·history,·or·perform·the810 to·the·current·element·of·the·history,·or·perform·the
931 H_ENTER811 .Dv·H_ENTER
932 operation·with·argument812 operation·with·argument
933 \fIstr·\fP813 .Fa·str
934 if·there·is·no·current·element.814 if·there·is·no·current·element.
 815 .It·Dv·H_APPEND·,·Fa·"const·char·*str"
935 .TP 
936 H_APPEND·,·\fIconst·char·*str\fP 
937 Append816 Append
938 \fIstr·\fP817 .Fa·str
939 to·the·last·new·element·of·the·history.818 to·the·last·new·element·of·the·history.
 819 .It·Dv·H_ENTER·,·Fa·"const·char·*str"
940 .TP 
941 H_ENTER·,·\fIconst·char·*str\fP 
942 Add820 Add
943 \fIstr·\fP821 .Fa·str
944 as·a·new·element·to·the·history·and,·if·necessary,822 as·a·new·element·to·the·history·and,·if·necessary,
945 removing·the·oldest·entry·to·keep·the·list·to·the·created·size.823 removing·the·oldest·entry·to·keep·the·list·to·the·created·size.
946 If824 If
947 H_SETUNIQUE825 .Dv·H_SETUNIQUE
948 has·been·called·with·a·non-zero·argument,·the·element826 has·been·called·with·a·non-zero·argument,·the·element
949 will·not·be·entered·into·the·history·if·its·contents·match827 will·not·be·entered·into·the·history·if·its·contents·match
950 the·ones·of·the·current·history·element.828 the·ones·of·the·current·history·element.
951 If·the·element·is·entered829 If·the·element·is·entered
952 \fBhistory\fP()830 .Fn·history
953 returns·1;·if·it·is·ignored·as·a·duplicate·returns·0.831 returns·1;·if·it·is·ignored·as·a·duplicate·returns·0.
954 Finally832 Finally
955 \fBhistory\fP()833 .Fn·history
956 returns·\-1·if·an·error·occurred.834 returns·\-1·if·an·error·occurred.
957 .TP 
958 H_PREV_STR·,·\fIconst·char·*str\fP835 .It·Dv·H_PREV_STR·,·Fa·"const·char·*str"
959 Return·the·closest·previous·event·that·starts·with836 Return·the·closest·previous·event·that·starts·with
 837 .Fa·str·.
960 \fIstr\fP. 
961 .TP 
962 H_NEXT_STR·,·\fIconst·char·*str\fP838 .It·Dv·H_NEXT_STR·,·Fa·"const·char·*str"
963 Return·the·closest·next·event·that·starts·with839 Return·the·closest·next·event·that·starts·with
 840 .Fa·str·.
 841 .It·Dv·H_PREV_EVENT·,·Fa·"int·e"
964 \fIstr\fP. 
965 .TP 
966 H_PREV_EVENT·,·\fIint·e\fP 
967 Return·the·previous·event·numbered842 Return·the·previous·event·numbered
 843 .Fa·e·.
 844 .It·Dv·H_NEXT_EVENT·,·Fa·"int·e"
968 \fIe\fP. 
969 .TP 
970 H_NEXT_EVENT·,·\fIint·e\fP 
971 Return·the·next·event·numbered845 Return·the·next·event·numbered
 846 .Fa·e·.
 847 .It·Dv·H_LOAD·,·Fa·"const·char·*file"
972 \fIe\fP. 
973 .TP 
974 H_LOAD·,·\fIconst·char·*file\fP 
975 Load·the·history·list·stored·in848 Load·the·history·list·stored·in
 849 .Fa·file·.
 850 .It·Dv·H_SAVE·,·Fa·"const·char·*file"
976 \fIfile\fP. 
977 .TP 
978 H_SAVE·,·\fIconst·char·*file\fP 
979 Save·the·history·list·to851 Save·the·history·list·to
 852 .Fa·file·.
 853 .It·Dv·H_SAVE_FP·,·Fa·"FILE·*fp"
980 \fIfile\fP. 
981 .TP 
982 H_SAVE_FP·,·\fIFILE·*fp\fP 
983 Save·the·history·list·to·the·opened854 Save·the·history·list·to·the·opened
 855 .Ft·FILE
984 .PP 
985 \fIFILE\fP 
986 .br 
987 pointer856 pointer
 857 .Fa·fp·.
988 \fIfp\fP. 
989 .TP 
990 H_NSAVE_FP·,·\fIsize_t·n,·Fa·FILE·*fp\fP858 .It·Dv·H_NSAVE_FP·,·Fa·"size_t·n"·,·Fa·"FILE·*fp"
991 Save·the·last859 Save·the·last
 860 .Ft·n
992 .PP 
993 \fIn\fP 
994 .br 
995 history·entries·to·the·opened861 history·entries·to·the·opened
 862 .Ft·FILE
996 .PP 
997 \fIFILE\fP 
998 .br 
999 pointer863 pointer
 864 .Fa·fp·.
 865 .It·Dv·H_SETUNIQUE·,·Fa·"int·unique"
1000 \fIfp\fP. 
1001 .TP 
1002 H_SETUNIQUE·,·\fIint·unique\fP 
1003 Set·flag·that·adjacent·identical·event·strings·should·not·be·entered866 Set·flag·that·adjacent·identical·event·strings·should·not·be·entered
1004 into·the·history.867 into·the·history.
1005 .TP 
1006 H_GETUNIQUE868 .It·Dv·H_GETUNIQUE
1007 Retrieve·the·current·setting·if·adjacent·identical·elements·should869 Retrieve·the·current·setting·if·adjacent·identical·elements·should
1008 be·entered·into·the·history.870 be·entered·into·the·history.
 871 .It·Dv·H_DEL·,·Fa·"int·e"
1009 .TP 
1010 H_DEL·,·\fIint·e\fP 
1011 Delete·the·event·numbered872 Delete·the·event·numbered
1012 \fIe\fP.873 .Fa·e·.
1013 This·function·is·only·provided·for874 This·function·is·only·provided·for
1014 \fBreadline\fP875 .Nm·readline
1015 compatibility.876 compatibility.
1016 The·caller·is·responsible·for·free'ing·the·string·in·the·returned877 The·caller·is·responsible·for·free'ing·the·string·in·the·returned
1017 \fIHistEvent\fP. 
1018 .RE 
  
1019 \fBhistory\fP();878 .Fa·HistEvent·.
 879 .El
 880 .Pp
 881 .Fn·history
1020 returns·>=·0·if·the·operation882 returns·>=·0·if·the·operation
1021 \fIop·\fP883 .Fa·op
1022 succeeds.884 succeeds.
1023 Otherwise,·\-1·is·returned·and885 Otherwise,·\-1·is·returned·and
1024 \fIev·\fP886 .Fa·ev
1025 is·updated·to·contain·more·details·about·the·error.887 is·updated·to·contain·more·details·about·the·error.
 888 .El
1026 .SH·TOKENIZATION·FUNCTIONS889 .Sh·TOKENIZATION·FUNCTIONS
1027 The·tokenization·functions·use·a·common·data·structure,890 The·tokenization·functions·use·a·common·data·structure,
1028 \fITokenizer\fP,891 .Fa·Tokenizer·,
1029 which·is·created·by892 which·is·created·by
1030 \fBtok_init\fP()893 .Fn·tok_init
1031 and·freed·by894 and·freed·by
1032 \fBtok_end\fP(). 
 895 .Fn·tok_end·.
 896 .Pp
1033 The·following·functions·are·available:897 The·following·functions·are·available:
1034 .TP 
1035 \fBtok_init\fP()898 .Bl·-tag·-width·4n
 899 .It·Fn·tok_init
1036 Initialize·the·tokenizer,·and·return·a·data·structure900 Initialize·the·tokenizer,·and·return·a·data·structure
1037 to·be·used·by·all·other·tokenizer·functions.901 to·be·used·by·all·other·tokenizer·functions.
1038 \fIIFS·\fP902 .Fa·IFS
1039 contains·the·Input·Field·Separators,·which·defaults·to903 contains·the·Input·Field·Separators,·which·defaults·to
1040 <space·,> 
1041 <tab·,>904 .Aq·space·,
 905 .Aq·tab·,
1042 and906 and
1043 <newline>907 .Aq·newline
1044 if908 if
1045 NULL·.909 .Dv·NULL·.
 910 .It·Fn·tok_end
1046 .TP 
1047 \fBtok_end\fP() 
1048 Clean·up·and·finish·with911 Clean·up·and·finish·with
1049 \fIt\fP,912 .Fa·t·,
1050 assumed·to·have·been·created·with913 assumed·to·have·been·created·with
 914 .Fn·tok_init·.
 915 .It·Fn·tok_reset
1051 \fBtok_init\fP(). 
1052 .TP 
1053 \fBtok_reset\fP() 
1054 Reset·the·tokenizer·state.916 Reset·the·tokenizer·state.
1055 Use·after·a·line·has·been·successfully·tokenized917 Use·after·a·line·has·been·successfully·tokenized
1056 by918 by
1057 \fBtok_line\fP()919 .Fn·tok_line
1058 or920 or
1059 \fBtok_str\fP()921 .Fn·tok_str
1060 and·before·a·new·line·is·to·be·tokenized.922 and·before·a·new·line·is·to·be·tokenized.
 923 .It·Fn·tok_line
1061 .TP 
1062 \fBtok_line\fP() 
1063 Tokenize924 Tokenize
1064 \fIli\fP,925 .Fa·li·,
1065 If·successful,·modify:926 If·successful,·modify:
1066 \fIargv·\fP927 .Fa·argv
1067 to·contain·the·words,928 to·contain·the·words,
1068 \fIargc·\fP929 .Fa·argc
1069 to·contain·the·number·of·words,930 to·contain·the·number·of·words,
1070 \fIcursorc·\fP931 .Fa·cursorc
1071 (if·not932 (if·not
1072 NULL·)933 .Dv·NULL·)
1073 to·contain·the·index·of·the·word·containing·the·cursor,934 to·contain·the·index·of·the·word·containing·the·cursor,
1074 and935 and
1075 \fIcursoro·\fP936 .Fa·cursoro
1076 (if·not937 (if·not
1077 NULL·)938 .Dv·NULL·)
1078 to·contain·the·offset·within939 to·contain·the·offset·within
1079 \fIargv[cursorc]·\fP940 .Fa·argv[cursorc]
1080 of·the·cursor.941 of·the·cursor.
 942 .Pp
1081 Returns943 Returns
1082 0·if·successful,944 0·if·successful,
1083 \-1·for·an·internal·error,945 \-1·for·an·internal·error,
1084 1·for·an·unmatched·single·quote,946 1·for·an·unmatched·single·quote,
1085 2·for·an·unmatched·double·quote,947 2·for·an·unmatched·double·quote,
1086 and948 and
1087 3·for·a·backslash·quoted949 3·for·a·backslash·quoted
1088 <newline·.>950 .Aq·newline·.
1089 A·positive·exit·code·indicates·that·another·line·should·be·read951 A·positive·exit·code·indicates·that·another·line·should·be·read
1090 and·tokenization·attempted·again.952 and·tokenization·attempted·again.
1091 .TP 
1092 \fBtok_str\fP()953 .
 954 .It·Fn·tok_str
1093 A·simpler·form·of955 A·simpler·form·of
1094 \fBtok_line\fP(;·) 
1095 \fIstr·\fP956 .Fn·tok_line·;
 957 .Fa·str
1096 is·a·NUL·terminated·string·to·tokenize.958 is·a·NUL·terminated·string·to·tokenize.
 959 .El
 960 .
 961 .\"XXX.Sh·EXAMPLES
 962 .\"XXX:·provide·some·examples
1097 .SH·SEE·ALSO963 .Sh·SEE·ALSO
1098 \fBsh\fP(1), 
1099 \fBsignal\fP(3), 
1100 \fBtermcap\fP(3), 
1101 \fBeditrc\fP(5), 
1102 \fBtermcap\fP(5), 
1103 \fBeditline\fP(7)964 .Xr·sh·1·,
 965 .Xr·signal·3·,
 966 .Xr·termcap·3·,
 967 .Xr·editrc·5·,
 968 .Xr·termcap·5·,
 969 .Xr·editline·7
1104 .SH·HISTORY970 .Sh·HISTORY
1105 The971 The
1106 \fBeditline\fP972 .Nm
1107 library·first·appeared·in973 library·first·appeared·in
1108 Bx·4.4·.974 .Bx·4.4·.
1109 CC_REDISPLAY975 .Dv·CC_REDISPLAY
1110 appeared·in976 appeared·in
1111 Nx·1.3·.977 .Nx·1.3·.
1112 CC_REFRESH_BEEP·,978 .Dv·CC_REFRESH_BEEP·,
1113 EL_EDITMODE979 .Dv·EL_EDITMODE
1114 and·the·readline·emulation·appeared·in980 and·the·readline·emulation·appeared·in
1115 Nx·1.4·.981 .Nx·1.4·.
1116 EL_RPROMPT982 .Dv·EL_RPROMPT
1117 appeared·in983 appeared·in
1118 Nx·1.5·.984 .Nx·1.5·.
1119 .SH·AUTHORS985 .Sh·AUTHORS
  
1120 -nosplit986 .An·-nosplit
1121 The987 The
1122 \fBeditline\fP988 .Nm
1123 library·was·written·by989 library·was·written·by
  
1124 Christos·Zoulas·.990 .An·Christos·Zoulas·.
  
1125 Luke·Mewburn991 .An·Luke·Mewburn
1126 wrote·this·manual·and·implemented992 wrote·this·manual·and·implemented
1127 CC_REDISPLAY·,993 .Dv·CC_REDISPLAY·,
1128 CC_REFRESH_BEEP·,994 .Dv·CC_REFRESH_BEEP·,
1129 EL_EDITMODE·,995 .Dv·EL_EDITMODE·,
1130 and996 and
1131 EL_RPROMPT·.997 .Dv·EL_RPROMPT·.
  
1132 Jaromir·Dolecek998 .An·Jaromir·Dolecek
1133 implemented·the·readline·emulation.999 implemented·the·readline·emulation.
  
1134 Johny·Mattsson1000 .An·Johny·Mattsson
1135 implemented·wide-character·support.1001 implemented·wide-character·support.
1136 .SH·BUGS1002 .Sh·BUGS
1137 At·this·time,·it·is·the·responsibility·of·the·caller·to1003 At·this·time,·it·is·the·responsibility·of·the·caller·to
1138 check·the·result·of·the1004 check·the·result·of·the
1139 EL_EDITMODE1005 .Dv·EL_EDITMODE
1140 operation·of1006 operation·of
1141 \fBel_get\fP()1007 .Fn·el_get
1142 (after·an1008 (after·an
1143 \fBel_source\fP()1009 .Fn·el_source
1144 or1010 or
1145 \fBel_parse\fP()·)1011 .Fn·el_parse·)
1146 to·determine·if1012 to·determine·if
1147 \fBeditline\fP1013 .Nm
1148 should·be·used·for·further·input.1014 should·be·used·for·further·input.
1149 I.e.,1015 I.e.,
1150 EL_EDITMODE1016 .Dv·EL_EDITMODE
1151 is·purely·an·indication·of·the·result·of·the·most·recent1017 is·purely·an·indication·of·the·result·of·the·most·recent
1152 \fBeditrc\fP(5) 
1153 \fBedit\fP1018 .Xr·editrc·5
 1019 .Ic·edit
1154 command.1020 command.