Debian Codegraph @

doc/history.html

raw
1 <!DOCTYPE html>
2 <html>
3 <!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <!-- This document describes the GNU History library
7 (version 8.3, 30 December 2024),
8 a programming tool that provides a consistent user interface for
9 recalling lines of previously typed input.
10
11 Copyright © 1988-2025 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with no
16 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
17 A copy of the license is included in the section entitled
18 "GNU Free Documentation License".
19 -->
20 <title>GNU History Library</title>
21
22 <meta name="description" content="GNU History Library">
23 <meta name="keywords" content="GNU History Library">
24 <meta name="resource-type" content="document">
25 <meta name="distribution" content="global">
26 <meta name="Generator" content="makeinfo">
27 <meta name="viewport" content="width=device-width,initial-scale=1">
28
29 <link href="#Top" rel="start" title="Top">
30 <link href="#Concept-Index" rel="index" title="Concept Index">
31 <link href="#SEC_Contents" rel="contents" title="Table of Contents">
32 <link href="#Using-History-Interactively" rel="next" title="Using History Interactively">
33 <style type="text/css">
34 <!--
35 a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
36 a.summary-letter-printindex {text-decoration: none}
37 div.center {text-align:center}
38 div.display {margin-left: 3.2em}
39 div.example {margin-left: 3.2em}
40 pre.display-preformatted {font-family: inherit}
41 span:hover a.copiable-link {visibility: visible}
42 strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
43 td.printindex-index-entry {vertical-align: top}
44 td.printindex-index-section {vertical-align: top; padding-left: 1em}
45 th.entries-header-printindex {text-align:left}
46 th.sections-header-printindex {text-align:left; padding-left: 1em}
47 ul.toc-numbered-mark {list-style: none}
48 -->
49 </style>
50
51
52 </head>
53
54 <body lang="en">
55
56
57
58
59
60
61
62
63
64 <div class="top-level-extent" id="Top">
65 <div class="nav-panel">
66 <p>
67 Next: <a href="#Using-History-Interactively" accesskey="n" rel="next">Using History Interactively</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
68 </div>
69 <h1 class="top" id="GNU-History-Library"><span>GNU History Library<a class="copiable-link" href="#GNU-History-Library"> &para;</a></span></h1>
70
71 <p>This document describes the GNU History library, a programming tool that
72 provides a consistent user interface for recalling lines of previously
73 typed input.
74 </p>
75
76
77
78 <div class="element-contents" id="SEC_Contents">
79 <h2 class="contents-heading">Table of Contents</h2>
80
81 <div class="contents">
82
83 <ul class="toc-numbered-mark">
84 <li><a id="toc-Using-History-Interactively-1" href="#Using-History-Interactively">1 Using History Interactively</a>
85 <ul class="toc-numbered-mark">
86 <li><a id="toc-History-Expansion-1" href="#History-Interaction">1.1 History Expansion</a>
87 <ul class="toc-numbered-mark">
88 <li><a id="toc-Event-Designators-1" href="#Event-Designators">1.1.1 Event Designators</a></li>
89 <li><a id="toc-Word-Designators-1" href="#Word-Designators">1.1.2 Word Designators</a></li>
90 <li><a id="toc-Modifiers-1" href="#Modifiers">1.1.3 Modifiers</a></li>
91 </ul></li>
92 </ul></li>
93 <li><a id="toc-Programming-with-GNU-History-1" href="#Programming-with-GNU-History">2 Programming with GNU History</a>
94 <ul class="toc-numbered-mark">
95 <li><a id="toc-Introduction-to-History-1" href="#Introduction-to-History">2.1 Introduction to History</a></li>
96 <li><a id="toc-History-Storage-1" href="#History-Storage">2.2 History Storage</a></li>
97 <li><a id="toc-History-Functions-1" href="#History-Functions">2.3 History Functions</a>
98 <ul class="toc-numbered-mark">
99 <li><a id="toc-Initializing-History-and-State-Management-1" href="#Initializing-History-and-State-Management">2.3.1 Initializing History and State Management</a></li>
100 <li><a id="toc-History-List-Management-1" href="#History-List-Management">2.3.2 History List Management</a></li>
101 <li><a id="toc-Information-About-the-History-List-1" href="#Information-About-the-History-List">2.3.3 Information About the History List</a></li>
102 <li><a id="toc-Moving-Around-the-History-List-1" href="#Moving-Around-the-History-List">2.3.4 Moving Around the History List</a></li>
103 <li><a id="toc-Searching-the-History-List-1" href="#Searching-the-History-List">2.3.5 Searching the History List</a></li>
104 <li><a id="toc-Managing-the-History-File-1" href="#Managing-the-History-File">2.3.6 Managing the History File</a></li>
105 <li><a id="toc-History-Expansion-2" href="#History-Expansion">2.3.7 History Expansion</a></li>
106 </ul></li>
107 <li><a id="toc-History-Variables-1" href="#History-Variables">2.4 History Variables</a></li>
108 <li><a id="toc-History-Programming-Example-1" href="#History-Programming-Example">2.5 History Programming Example</a></li>
109 </ul></li>
110 <li><a id="toc-GNU-Free-Documentation-License-1" href="#GNU-Free-Documentation-License">Appendix A GNU Free Documentation License</a></li>
111 <li><a id="toc-Concept-Index-1" href="#Concept-Index" rel="index">Appendix B Concept Index</a></li>
112 <li><a id="toc-Function-and-Variable-Index-1" href="#Function-and-Variable-Index" rel="index">Appendix C Function and Variable Index</a></li>
113 </ul>
114 </div>
115 </div>
116 <hr>
117 <div class="chapter-level-extent" id="Using-History-Interactively">
118 <div class="nav-panel">
119 <p>
120 Next: <a href="#Programming-with-GNU-History" accesskey="n" rel="next">Programming with GNU History</a>, Previous: <a href="#Top" accesskey="p" rel="prev">GNU History Library</a>, Up: <a href="#Top" accesskey="u" rel="up">GNU History Library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
121 </div>
122 <h2 class="chapter" id="Using-History-Interactively-1"><span>1 Using History Interactively<a class="copiable-link" href="#Using-History-Interactively-1"> &para;</a></span></h2>
123
124
125 <p>This chapter describes how to use the <small class="sc">GNU</small> History Library
126 interactively, from a user&rsquo;s standpoint.
127 It should be considered a user&rsquo;s guide.
128 For information on using the <small class="sc">GNU</small> History Library in your own programs,
129 see <a class="pxref" href="#Programming-with-GNU-History">Programming with GNU History</a>.
130 </p>
131
132
133 <ul class="mini-toc">
134 <li><a href="#History-Interaction" accesskey="1">History Expansion</a></li>
135 </ul>
136 <hr>
137 <div class="section-level-extent" id="History-Interaction">
138 <div class="nav-panel">
139 <p>
140 Up: <a href="#Using-History-Interactively" accesskey="u" rel="up">Using History Interactively</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
141 </div>
142 <h3 class="section" id="History-Expansion-1"><span>1.1 History Expansion<a class="copiable-link" href="#History-Expansion-1"> &para;</a></span></h3>
143 <a class="index-entry-id" id="index-history-expansion"></a>
144
145 <p>The History library
146 provides a history expansion feature that is similar
147 to the history expansion provided by <code class="code">csh</code>
148 (also referred to as history substitution where appropriate).
149 This section describes the syntax used to manipulate the
150 history information.
151 </p>
152
153 <p>History expansions introduce words from the history list into
154 the input stream, making it easy to repeat commands, insert the
155 arguments to a previous command into the current input line, or
156 fix errors in previous commands quickly.
157 </p>
158
159 <p>History expansion takes place in two parts.
160 The first is to determine
161 which entry from the history list should be used during substitution.
162 The second is to select portions of that entry to include into the
163 current one.
164 </p>
165 <p>The entry selected from the history is called the <em class="dfn">event</em>,
166 and the portions of that entry that are acted upon are <em class="dfn">words</em>.
167 Various <em class="dfn">modifiers</em> are available to manipulate the selected words.
168 The entry is split into words in the same fashion that Bash
169 does when reading input,
170 so that several words surrounded by quotes are considered one word.
171 The <em class="dfn">event designator</em> selects the event, the optional
172 <em class="dfn">word designator</em> selects words from the event, and
173 various optional <em class="dfn">modifiers</em> are available to manipulate the
174 selected words.
175 </p>
176 <p>History expansions are introduced by the appearance of the
177 history expansion character, which is &lsquo;<samp class="samp">!</samp>&rsquo; by default.
178 History expansions may appear anywhere in the input, but do not nest.
179 </p>
180 <p>History expansion implements shell-like quoting conventions:
181 a backslash can be used to remove the special handling for the next character;
182 single quotes enclose verbatim sequences of characters, and can be used to
183 inhibit history expansion;
184 and characters enclosed within double quotes may be subject to history
185 expansion, since backslash can escape the history expansion character,
186 but single quotes may not, since they are not treated specially within
187 double quotes.
188 </p>
189
190 <p>There is a special abbreviation for substitution, active when the
191 <var class="var">quick substitution</var> character
192 (default &lsquo;<samp class="samp">^</samp>&rsquo;)
193 is the first character on the line.
194 It selects the previous history list entry, using an event designator
195 equivalent to <code class="code">!!</code>,
196 and substitutes one string for another in that entry.
197 It is described below (see <a class="pxref" href="#Event-Designators">Event Designators</a>).
198 This is the only history expansion that does not begin with the history
199 expansion character.
200 </p>
201
202
203 <ul class="mini-toc">
204 <li><a href="#Event-Designators" accesskey="1">Event Designators</a></li>
205 <li><a href="#Word-Designators" accesskey="2">Word Designators</a></li>
206 <li><a href="#Modifiers" accesskey="3">Modifiers</a></li>
207 </ul>
208 <hr>
209 <div class="subsection-level-extent" id="Event-Designators">
210 <div class="nav-panel">
211 <p>
212 Next: <a href="#Word-Designators" accesskey="n" rel="next">Word Designators</a>, Up: <a href="#History-Interaction" accesskey="u" rel="up">History Expansion</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
213 </div>
214 <h4 class="subsection" id="Event-Designators-1"><span>1.1.1 Event Designators<a class="copiable-link" href="#Event-Designators-1"> &para;</a></span></h4>
215 <a class="index-entry-id" id="index-event-designators"></a>
216
217 <p>An event designator is a reference to an entry in the history list.
218 The event designator consists of the portion of the word beginning
219 with the history expansion character, and ending with the word designator
220 if one is present, or the end of the word.
221 Unless the reference is absolute, events are relative to the current
222 position in the history list.
223 <a class="index-entry-id" id="index-history-events"></a>
224 </p>
225 <dl class="table">
226 <dt><code class="code">!</code></dt>
227 <dd><p>Start a history substitution, except when followed by a space, tab,
228 the end of the line, or &lsquo;<samp class="samp">=</samp>&rsquo;.
229 </p>
230 </dd>
231 <dt><code class="code">!<var class="var">n</var></code></dt>
232 <dd><p>Refer to history list entry <var class="var">n</var>.
233 </p>
234 </dd>
235 <dt><code class="code">!-<var class="var">n</var></code></dt>
236 <dd><p>Refer to the history entry minus <var class="var">n</var>.
237 </p>
238 </dd>
239 <dt><code class="code">!!</code></dt>
240 <dd><p>Refer to the previous entry.
241 This is a synonym for &lsquo;<samp class="samp">!-1</samp>&rsquo;.
242 </p>
243 </dd>
244 <dt><code class="code">!<var class="var">string</var></code></dt>
245 <dd><p>Refer to the most recent command
246 preceding the current position in the history list
247 starting with <var class="var">string</var>.
248 </p>
249 </dd>
250 <dt><code class="code">!?<var class="var">string</var>[?]</code></dt>
251 <dd><p>Refer to the most recent command
252 preceding the current position in the history list
253 containing <var class="var">string</var>.
254 The trailing
255 &lsquo;<samp class="samp">?</samp>&rsquo; may be omitted if the <var class="var">string</var> is followed immediately by
256 a newline.
257 If <var class="var">string</var> is missing, this uses
258 the string from the most recent search;
259 it is an error if there is no previous search string.
260 </p>
261 </dd>
262 <dt><code class="code">^<var class="var">string1</var>^<var class="var">string2</var>^</code></dt>
263 <dd><p>Quick Substitution.
264 Repeat the last command, replacing <var class="var">string1</var> with <var class="var">string2</var>.
265 Equivalent to <code class="code">!!:s^<var class="var">string1</var>^<var class="var">string2</var>^</code>.
266 </p>
267 </dd>
268 <dt><code class="code">!#</code></dt>
269 <dd><p>The entire command line typed so far.
270 </p>
271 </dd>
272 </dl>
273
274 <hr>
275 </div>
276 <div class="subsection-level-extent" id="Word-Designators">
277 <div class="nav-panel">
278 <p>
279 Next: <a href="#Modifiers" accesskey="n" rel="next">Modifiers</a>, Previous: <a href="#Event-Designators" accesskey="p" rel="prev">Event Designators</a>, Up: <a href="#History-Interaction" accesskey="u" rel="up">History Expansion</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
280 </div>
281 <h4 class="subsection" id="Word-Designators-1"><span>1.1.2 Word Designators<a class="copiable-link" href="#Word-Designators-1"> &para;</a></span></h4>
282
283 <p>Word designators are used to select desired words from the event.
284 They are optional; if the word designator isn&rsquo;t supplied, the history
285 expansion uses the entire event.
286 A &lsquo;<samp class="samp">:</samp>&rsquo; separates the event specification from the word designator.
287 It may be omitted if the word designator begins with a &lsquo;<samp class="samp">^</samp>&rsquo;, &lsquo;<samp class="samp">$</samp>&rsquo;,
288 &lsquo;<samp class="samp">*</samp>&rsquo;, &lsquo;<samp class="samp">-</samp>&rsquo;, or &lsquo;<samp class="samp">%</samp>&rsquo;.
289 Words are numbered from the beginning of the line,
290 with the first word being denoted by 0 (zero).
291 That first word is usually the command word, and the arguments begin
292 with the second word.
293 Words are inserted into the current line separated by single spaces.
294 </p>
295 <p>For example,
296 </p>
297 <dl class="table">
298 <dt><code class="code">!!</code></dt>
299 <dd><p>designates the preceding command.
300 When you type this, the preceding command is repeated in toto.
301 </p>
302 </dd>
303 <dt><code class="code">!!:$</code></dt>
304 <dd><p>designates the last word of the preceding command.
305 This may be shortened to <code class="code">!$</code>.
306 </p>
307 </dd>
308 <dt><code class="code">!fi:2</code></dt>
309 <dd><p>designates the second argument of the most recent command starting with
310 the letters <code class="code">fi</code>.
311 </p></dd>
312 </dl>
313
314 <p>Here are the word designators:
315 </p>
316 <dl class="table">
317 <dt><code class="code">0 (zero)</code></dt>
318 <dd><p>The <code class="code">0</code>th word.
319 For the shell, and many other, applications, this is the command word.
320 </p>
321 </dd>
322 <dt><code class="code"><var class="var">n</var></code></dt>
323 <dd><p>The <var class="var">n</var>th word.
324 </p>
325 </dd>
326 <dt><code class="code">^</code></dt>
327 <dd><p>The first argument: word 1.
328 </p>
329 </dd>
330 <dt><code class="code">$</code></dt>
331 <dd><p>The last word.
332 This is usually the last argument, but expands to the
333 zeroth word if there is only one word in the line.
334 </p>
335 </dd>
336 <dt><code class="code">%</code></dt>
337 <dd><p>The first word matched by the most recent &lsquo;<samp class="samp">?<var class="var">string</var>?</samp>&rsquo; search,
338 if the search string begins with a character that is part of a word.
339 By default, searches begin at the end of each line and proceed to the
340 beginning, so the first word matched is the one closest to the end of
341 the line.
342 </p>
343 </dd>
344 <dt><code class="code"><var class="var">x</var>-<var class="var">y</var></code></dt>
345 <dd><p>A range of words; &lsquo;<samp class="samp">-<var class="var">y</var></samp>&rsquo; abbreviates &lsquo;<samp class="samp">0-<var class="var">y</var></samp>&rsquo;.
346 </p>
347 </dd>
348 <dt><code class="code">*</code></dt>
349 <dd><p>All of the words, except the <code class="code">0</code>th.
350 This is a synonym for &lsquo;<samp class="samp">1-$</samp>&rsquo;.
351 It is not an error to use &lsquo;<samp class="samp">*</samp>&rsquo; if there is just one word in the event;
352 it expands to the empty string in that case.
353 </p>
354 </dd>
355 <dt><code class="code"><var class="var">x</var>*</code></dt>
356 <dd><p>Abbreviates &lsquo;<samp class="samp"><var class="var">x</var>-$</samp>&rsquo;.
357 </p>
358 </dd>
359 <dt><code class="code"><var class="var">x</var>-</code></dt>
360 <dd><p>Abbreviates &lsquo;<samp class="samp"><var class="var">x</var>-$</samp>&rsquo; like &lsquo;<samp class="samp"><var class="var">x</var>*</samp>&rsquo;, but omits the last word.
361 If &lsquo;<samp class="samp">x</samp>&rsquo; is missing, it defaults to 0.
362 </p>
363 </dd>
364 </dl>
365
366 <p>If a word designator is supplied without an event specification, the
367 previous command is used as the event, equivalent to <code class="code">!!</code>.
368 </p>
369 <hr>
370 </div>
371 <div class="subsection-level-extent" id="Modifiers">
372 <div class="nav-panel">
373 <p>
374 Previous: <a href="#Word-Designators" accesskey="p" rel="prev">Word Designators</a>, Up: <a href="#History-Interaction" accesskey="u" rel="up">History Expansion</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
375 </div>
376 <h4 class="subsection" id="Modifiers-1"><span>1.1.3 Modifiers<a class="copiable-link" href="#Modifiers-1"> &para;</a></span></h4>
377
378 <p>After the optional word designator, you can add a sequence of one or more
379 of the following modifiers, each preceded by a &lsquo;<samp class="samp">:</samp>&rsquo;.
380 These modify, or edit, the word or words selected from the history event.
381 </p>
382 <dl class="table">
383 <dt><code class="code">h</code></dt>
384 <dd><p>Remove a trailing filename component, leaving only the head.
385 </p>
386 </dd>
387 <dt><code class="code">t</code></dt>
388 <dd><p>Remove all leading filename components, leaving the tail.
389 </p>
390 </dd>
391 <dt><code class="code">r</code></dt>
392 <dd><p>Remove a trailing suffix of the form &lsquo;<samp class="samp">.<var class="var">suffix</var></samp>&rsquo;, leaving
393 the basename.
394 </p>
395 </dd>
396 <dt><code class="code">e</code></dt>
397 <dd><p>Remove all but the trailing suffix.
398 </p>
399 </dd>
400 <dt><code class="code">p</code></dt>
401 <dd><p>Print the new command but do not execute it.
402 </p>
403
404 </dd>
405 <dt><code class="code">s/<var class="var">old</var>/<var class="var">new</var>/</code></dt>
406 <dd><p>Substitute <var class="var">new</var> for the first occurrence of <var class="var">old</var> in the
407 event line.
408 Any character may be used as the delimiter in place of &lsquo;<samp class="samp">/</samp>&rsquo;.
409 The delimiter may be quoted in <var class="var">old</var> and <var class="var">new</var>
410 with a single backslash.
411 If &lsquo;<samp class="samp">&amp;</samp>&rsquo; appears in <var class="var">new</var>, it is replaced with <var class="var">old</var>.
412 A single backslash quotes the &lsquo;<samp class="samp">&amp;</samp>&rsquo; in <var class="var">old</var> and <var class="var">new</var>.
413 If <var class="var">old</var> is null, it is set to the last <var class="var">old</var>
414 substituted, or, if no previous history substitutions took place,
415 the last <var class="var">string</var>
416 in a !?<var class="var">string</var><code class="code">[?]</code>
417 search.
418 If <var class="var">new</var> is null, each matching <var class="var">old</var> is deleted.
419 The final delimiter is optional if it is the last
420 character on the input line.
421 </p>
422 </dd>
423 <dt><code class="code">&amp;</code></dt>
424 <dd><p>Repeat the previous substitution.
425 </p>
426 </dd>
427 <dt><code class="code">g</code></dt>
428 <dt><code class="code">a</code></dt>
429 <dd><p>Cause changes to be applied over the entire event line.
430 This is used in conjunction with
431 &lsquo;<samp class="samp">s</samp>&rsquo;, as in <code class="code">gs/<var class="var">old</var>/<var class="var">new</var>/</code>,
432 or with &lsquo;<samp class="samp">&amp;</samp>&rsquo;.
433 </p>
434 </dd>
435 <dt><code class="code">G</code></dt>
436 <dd><p>Apply the following &lsquo;<samp class="samp">s</samp>&rsquo; or &lsquo;<samp class="samp">&amp;</samp>&rsquo; modifier once to each word
437 in the event.
438 </p>
439 </dd>
440 </dl>
441
442 <hr>
443 </div>
444 </div>
445 </div>
446 <div class="chapter-level-extent" id="Programming-with-GNU-History">
447 <div class="nav-panel">
448 <p>
449 Next: <a href="#GNU-Free-Documentation-License" accesskey="n" rel="next">GNU Free Documentation License</a>, Previous: <a href="#Using-History-Interactively" accesskey="p" rel="prev">Using History Interactively</a>, Up: <a href="#Top" accesskey="u" rel="up">GNU History Library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
450 </div>
451 <h2 class="chapter" id="Programming-with-GNU-History-1"><span>2 Programming with GNU History<a class="copiable-link" href="#Programming-with-GNU-History-1"> &para;</a></span></h2>
452
453 <p>This chapter describes how to interface programs that you write
454 with the <small class="sc">GNU</small> History Library.
455 It should be considered a technical guide.
456 For information on the interactive use of <small class="sc">GNU</small> History,
457 see <a class="pxref" href="#Using-History-Interactively">Using History Interactively</a>.
458 </p>
459
460 <ul class="mini-toc">
461 <li><a href="#Introduction-to-History" accesskey="1">Introduction to History</a></li>
462 <li><a href="#History-Storage" accesskey="2">History Storage</a></li>
463 <li><a href="#History-Functions" accesskey="3">History Functions</a></li>
464 <li><a href="#History-Variables" accesskey="4">History Variables</a></li>
465 <li><a href="#History-Programming-Example" accesskey="5">History Programming Example</a></li>
466 </ul>
467 <hr>
468 <div class="section-level-extent" id="Introduction-to-History">
469 <div class="nav-panel">
470 <p>
471 Next: <a href="#History-Storage" accesskey="n" rel="next">History Storage</a>, Up: <a href="#Programming-with-GNU-History" accesskey="u" rel="up">Programming with GNU History</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
472 </div>
473 <h3 class="section" id="Introduction-to-History-1"><span>2.1 Introduction to History<a class="copiable-link" href="#Introduction-to-History-1"> &para;</a></span></h3>
474
475 <p>Many programs read input from the user a line at a time.
476 The <small class="sc">GNU</small> History library is able to keep track of those lines,
477 associate arbitrary data with each line, and utilize information from
478 previous lines when composing new ones.
479 </p>
480 <p>A programmer using the History library can use functions
481 to save commands on a history list,
482 associate arbitrary data with history list entries,
483 remove entries from the list,
484 search through the list for a line containing an arbitrary text string,
485 reference any entry in the list directly,
486 and read and write the history list from and to a file.
487 In addition, a history <em class="dfn">expansion</em> function
488 is available which provides for a consistent user interface across
489 different programs.
490 </p>
491 <p>Someone using programs written with the History library has the
492 benefit of a consistent user interface with a set of well-known
493 commands for manipulating the text of previous lines and using that text
494 in new commands.
495 The basic history manipulation commands are similar to
496 the history substitution provided by <code class="code">csh</code>.
497 </p>
498 <p>The programmer can also use the Readline library, which
499 includes some history manipulation by default, and has the added
500 advantage of command line editing.
501 </p>
502 <p>Before declaring any functions using any functionality the History
503 library provides in other code, an application writer should include
504 the file <code class="code">&lt;readline/history.h&gt;</code> in any file that uses the
505 History library&rsquo;s features.
506 It supplies declarations for all of the library&rsquo;s
507 public functions and variables,
508 and declares all of the public data structures.
509 </p>
510 <hr>
511 </div>
512 <div class="section-level-extent" id="History-Storage">
513 <div class="nav-panel">
514 <p>
515 Next: <a href="#History-Functions" accesskey="n" rel="next">History Functions</a>, Previous: <a href="#Introduction-to-History" accesskey="p" rel="prev">Introduction to History</a>, Up: <a href="#Programming-with-GNU-History" accesskey="u" rel="up">Programming with GNU History</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
516 </div>
517 <h3 class="section" id="History-Storage-1"><span>2.2 History Storage<a class="copiable-link" href="#History-Storage-1"> &para;</a></span></h3>
518
519 <p>The history list is an array of history entries.
520 A history entry is declared as follows:
521 </p>
522 <div class="example">
523 <pre class="example-preformatted">typedef void *histdata_t;
524
525 typedef struct _hist_entry {
526 char *line;
527 char *timestamp;
528 histdata_t data;
529 } HIST_ENTRY;
530 </pre></div>
531
532 <p>The history list itself might therefore be declared as
533 </p>
534 <div class="example">
535 <pre class="example-preformatted">HIST_ENTRY **the_history_list;
536 </pre></div>
537
538 <p>The state of the History library is encapsulated into a single structure:
539 </p>
540 <div class="example">
541 <pre class="example-preformatted">/*
542 * A structure used to pass around the current state of the history.
543 */
544 typedef struct _hist_state {
545 HIST_ENTRY **entries; /* Pointer to the entries themselves. */
546 int offset; /* The location pointer within this array. */
547 int length; /* Number of elements within this array. */
548 int size; /* Number of slots allocated to this array. */
549 int flags;
550 } HISTORY_STATE;
551 </pre></div>
552
553 <p>If the flags member includes <code class="code">HS_STIFLED</code>, the history has been
554 stifled (limited to a maximum number of entries).
555 </p>
556 <hr>
557 </div>
558 <div class="section-level-extent" id="History-Functions">
559 <div class="nav-panel">
560 <p>
561 Next: <a href="#History-Variables" accesskey="n" rel="next">History Variables</a>, Previous: <a href="#History-Storage" accesskey="p" rel="prev">History Storage</a>, Up: <a href="#Programming-with-GNU-History" accesskey="u" rel="up">Programming with GNU History</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
562 </div>
563 <h3 class="section" id="History-Functions-1"><span>2.3 History Functions<a class="copiable-link" href="#History-Functions-1"> &para;</a></span></h3>
564
565 <p>This section describes the calling sequence for the various functions
566 exported by the <small class="sc">GNU</small> History library.
567 </p>
568
569 <ul class="mini-toc">
570 <li><a href="#Initializing-History-and-State-Management" accesskey="1">Initializing History and State Management</a></li>
571 <li><a href="#History-List-Management" accesskey="2">History List Management</a></li>
572 <li><a href="#Information-About-the-History-List" accesskey="3">Information About the History List</a></li>
573 <li><a href="#Moving-Around-the-History-List" accesskey="4">Moving Around the History List</a></li>
574 <li><a href="#Searching-the-History-List" accesskey="5">Searching the History List</a></li>
575 <li><a href="#Managing-the-History-File" accesskey="6">Managing the History File</a></li>
576 <li><a href="#History-Expansion" accesskey="7">History Expansion</a></li>
577 </ul>
578 <hr>
579 <div class="subsection-level-extent" id="Initializing-History-and-State-Management">
580 <div class="nav-panel">
581 <p>
582 Next: <a href="#History-List-Management" accesskey="n" rel="next">History List Management</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
583 </div>
584 <h4 class="subsection" id="Initializing-History-and-State-Management-1"><span>2.3.1 Initializing History and State Management<a class="copiable-link" href="#Initializing-History-and-State-Management-1"> &para;</a></span></h4>
585
586 <p>This section describes functions used to initialize and manage
587 the state of the History library when you want to use the history
588 functions in your program.
589 </p>
590 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
591 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-using_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">using_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-using_005fhistory"> &para;</a></span></dt>
592 <dd><p>Begin a session that will use the history functions.
593 This initializes the interactive variables.
594 </p></dd></dl>
595
596 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
597 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fget_005fhistory_005fstate"><span class="category-def">Function: </span><span><code class="def-type">HISTORY_STATE *</code> <strong class="def-name">history_get_history_state</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-history_005fget_005fhistory_005fstate"> &para;</a></span></dt>
598 <dd><p>Return a structure describing the current state of the input history.
599 </p></dd></dl>
600
601 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
602 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fset_005fhistory_005fstate"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">history_set_history_state</strong> <code class="def-code-arguments">(HISTORY_STATE *state)</code><a class="copiable-link" href="#index-history_005fset_005fhistory_005fstate"> &para;</a></span></dt>
603 <dd><p>Set the state of the history list according to <var class="var">state</var>.
604 </p></dd></dl>
605
606 <hr>
607 </div>
608 <div class="subsection-level-extent" id="History-List-Management">
609 <div class="nav-panel">
610 <p>
611 Next: <a href="#Information-About-the-History-List" accesskey="n" rel="next">Information About the History List</a>, Previous: <a href="#Initializing-History-and-State-Management" accesskey="p" rel="prev">Initializing History and State Management</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
612 </div>
613 <h4 class="subsection" id="History-List-Management-1"><span>2.3.2 History List Management<a class="copiable-link" href="#History-List-Management-1"> &para;</a></span></h4>
614
615 <p>These functions manage individual entries on the history list, or set
616 parameters managing the list itself.
617 </p>
618 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
619 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-add_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">add_history</strong> <code class="def-code-arguments">(const char *string)</code><a class="copiable-link" href="#index-add_005fhistory"> &para;</a></span></dt>
620 <dd><p>Add <var class="var">string</var> to the end of the history list, and
621 set the associated data field (if any) to <code class="code">NULL</code>.
622 If the maximum number of history entries has been set using
623 <code class="code">stifle_history()</code>, and the new number of history entries
624 would exceed that maximum, this removes the oldest history entry.
625 </p></dd></dl>
626
627 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
628 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-add_005fhistory_005ftime"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">add_history_time</strong> <code class="def-code-arguments">(const char *string)</code><a class="copiable-link" href="#index-add_005fhistory_005ftime"> &para;</a></span></dt>
629 <dd><p>Change the time stamp associated with the most recent history entry to
630 <var class="var">string</var>.
631 </p></dd></dl>
632
633 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
634 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-remove_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">remove_history</strong> <code class="def-code-arguments">(int which)</code><a class="copiable-link" href="#index-remove_005fhistory"> &para;</a></span></dt>
635 <dd><p>Remove the history entry at offset <var class="var">which</var> from the history list.
636 This returns the removed element so you can free the line, data,
637 and containing structure.
638 Since the data is private to your application, the History library
639 doesn&rsquo;t know how to free it, if necessary.
640 </p></dd></dl>
641
642 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
643 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-free_005fhistory_005fentry"><span class="category-def">Function: </span><span><code class="def-type">histdata_t</code> <strong class="def-name">free_history_entry</strong> <code class="def-code-arguments">(HIST_ENTRY *histent)</code><a class="copiable-link" href="#index-free_005fhistory_005fentry"> &para;</a></span></dt>
644 <dd><p>Free the history entry <var class="var">histent</var> and any history library private
645 data associated with it.
646 Returns the application-specific data
647 so the caller can dispose of it.
648 </p></dd></dl>
649
650 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
651 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-replace_005fhistory_005fentry"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">replace_history_entry</strong> <code class="def-code-arguments">(int which, const char *line, histdata_t data)</code><a class="copiable-link" href="#index-replace_005fhistory_005fentry"> &para;</a></span></dt>
652 <dd><p>Make the history entry at offset <var class="var">which</var> have <var class="var">line</var> and <var class="var">data</var>.
653 This returns the old entry so the caller can dispose of any
654 application-specific data.
655 In the case of an invalid <var class="var">which</var>, this returns <code class="code">NULL</code>.
656 </p></dd></dl>
657
658 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
659 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-clear_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">clear_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-clear_005fhistory"> &para;</a></span></dt>
660 <dd><p>Clear the history list by deleting all the entries.
661 </p></dd></dl>
662
663 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
664 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-stifle_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">stifle_history</strong> <code class="def-code-arguments">(int max)</code><a class="copiable-link" href="#index-stifle_005fhistory"> &para;</a></span></dt>
665 <dd><p>Stifle the history list, remembering only the last <var class="var">max</var> entries.
666 The history list will contain only <var class="var">max</var> entries at a time.
667 </p></dd></dl>
668
669 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
670 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-unstifle_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">unstifle_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-unstifle_005fhistory"> &para;</a></span></dt>
671 <dd><p>Stop stifling the history.
672 This returns the previously-set maximum number of history
673 entries (as set by <code class="code">stifle_history()</code>).
674 The value is positive if the history was stifled, negative if it wasn&rsquo;t.
675 </p></dd></dl>
676
677 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
678 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fis_005fstifled"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_is_stifled</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-history_005fis_005fstifled"> &para;</a></span></dt>
679 <dd><p>Returns non-zero if the history is stifled, zero if it is not.
680 </p></dd></dl>
681
682 <hr>
683 </div>
684 <div class="subsection-level-extent" id="Information-About-the-History-List">
685 <div class="nav-panel">
686 <p>
687 Next: <a href="#Moving-Around-the-History-List" accesskey="n" rel="next">Moving Around the History List</a>, Previous: <a href="#History-List-Management" accesskey="p" rel="prev">History List Management</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
688 </div>
689 <h4 class="subsection" id="Information-About-the-History-List-1"><span>2.3.3 Information About the History List<a class="copiable-link" href="#Information-About-the-History-List-1"> &para;</a></span></h4>
690
691 <p>These functions return information about the entire history list or
692 individual list entries.
693 </p>
694 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
695 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005flist"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY **</code> <strong class="def-name">history_list</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-history_005flist"> &para;</a></span></dt>
696 <dd><p>Return a <code class="code">NULL</code> terminated array of <code class="code">HIST_ENTRY *</code> which is the
697 current input history.
698 Element 0 of this list is the beginning of time.
699 Return <code class="code">NULL</code> if there is no history.
700 </p></dd></dl>
701
702 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
703 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-where_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">where_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-where_005fhistory"> &para;</a></span></dt>
704 <dd><p>Return the offset of the current history entry.
705 </p></dd></dl>
706
707 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
708 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-current_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">current_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-current_005fhistory"> &para;</a></span></dt>
709 <dd><p>Return the history entry at the current position, as determined by
710 <code class="code">where_history()</code>.
711 If there is no entry there, return <code class="code">NULL</code>.
712 </p></dd></dl>
713
714 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
715 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fget"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">history_get</strong> <code class="def-code-arguments">(int offset)</code><a class="copiable-link" href="#index-history_005fget"> &para;</a></span></dt>
716 <dd><p>Return the history entry at position <var class="var">offset</var>.
717 The range of valid
718 values of <var class="var">offset</var> starts at <code class="code">history_base</code> and ends at
719 <var class="var">history_length</var> - 1 (see <a class="pxref" href="#History-Variables">History Variables</a>).
720 If there is no entry there, or if <var class="var">offset</var> is outside the valid
721 range, return <code class="code">NULL</code>.
722 </p></dd></dl>
723
724 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
725 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fget_005ftime"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">history_get_time</strong> <code class="def-code-arguments">(HIST_ENTRY *entry)</code><a class="copiable-link" href="#index-history_005fget_005ftime"> &para;</a></span></dt>
726 <dd><p>Return the time stamp associated with the history entry <var class="var">entry</var>.
727 If the timestamp is missing or invalid, return 0.
728 </p></dd></dl>
729
730 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
731 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005ftotal_005fbytes"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_total_bytes</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-history_005ftotal_005fbytes"> &para;</a></span></dt>
732 <dd><p>Return the number of bytes that the primary history entries are using.
733 This function returns the sum of the lengths of all the lines in the
734 history.
735 </p></dd></dl>
736
737 <hr>
738 </div>
739 <div class="subsection-level-extent" id="Moving-Around-the-History-List">
740 <div class="nav-panel">
741 <p>
742 Next: <a href="#Searching-the-History-List" accesskey="n" rel="next">Searching the History List</a>, Previous: <a href="#Information-About-the-History-List" accesskey="p" rel="prev">Information About the History List</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
743 </div>
744 <h4 class="subsection" id="Moving-Around-the-History-List-1"><span>2.3.4 Moving Around the History List<a class="copiable-link" href="#Moving-Around-the-History-List-1"> &para;</a></span></h4>
745
746 <p>These functions allow the current index into the history list to be
747 set or changed.
748 </p>
749 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
750 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fset_005fpos"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_set_pos</strong> <code class="def-code-arguments">(int pos)</code><a class="copiable-link" href="#index-history_005fset_005fpos"> &para;</a></span></dt>
751 <dd><p>Set the current history offset to <var class="var">pos</var>, an absolute index
752 into the list.
753 Returns 1 on success, 0 if <var class="var">pos</var> is less than zero or greater
754 than the number of history entries.
755 </p></dd></dl>
756
757 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
758 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-previous_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">previous_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-previous_005fhistory"> &para;</a></span></dt>
759 <dd><p>Back up the current history offset to the previous history entry, and
760 return a pointer to that entry.
761 If there is no previous entry, return <code class="code">NULL</code>.
762 </p></dd></dl>
763
764 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
765 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-next_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">HIST_ENTRY *</code> <strong class="def-name">next_history</strong> <code class="def-code-arguments">(void)</code><a class="copiable-link" href="#index-next_005fhistory"> &para;</a></span></dt>
766 <dd><p>If the current history offset refers to a valid history entry,
767 increment the current history offset.
768 If the possibly-incremented history offset refers to a valid history
769 entry, return a pointer to that entry;
770 otherwise, return <code class="code">NULL</code>.
771 </p></dd></dl>
772
773 <hr>
774 </div>
775 <div class="subsection-level-extent" id="Searching-the-History-List">
776 <div class="nav-panel">
777 <p>
778 Next: <a href="#Managing-the-History-File" accesskey="n" rel="next">Managing the History File</a>, Previous: <a href="#Moving-Around-the-History-List" accesskey="p" rel="prev">Moving Around the History List</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
779 </div>
780 <h4 class="subsection" id="Searching-the-History-List-1"><span>2.3.5 Searching the History List<a class="copiable-link" href="#Searching-the-History-List-1"> &para;</a></span></h4>
781 <a class="index-entry-id" id="index-History-Searching"></a>
782
783 <p>These functions search the history list for entries containing
784 a specific string.
785 Searching may be performed both forward and backward
786 from the current history position.
787 The search may be <em class="dfn">anchored</em>,
788 meaning that the string must match at the beginning of a history entry.
789 <a class="index-entry-id" id="index-anchored-search"></a>
790 </p>
791 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
792 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fsearch"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_search</strong> <code class="def-code-arguments">(const char *string, int direction)</code><a class="copiable-link" href="#index-history_005fsearch"> &para;</a></span></dt>
793 <dd><p>Search the history for <var class="var">string</var>, starting at the current history offset.
794 If <var class="var">direction</var> is less than 0, then the search is through
795 previous entries, otherwise through subsequent entries.
796 If <var class="var">string</var> is found, then the current history index is set to
797 that history entry, and <code class="code">history_search</code>
798 returns the offset in the line of the entry where
799 <var class="var">string</var> was found.
800 Otherwise, nothing is changed, and this returns -1.
801 </p></dd></dl>
802
803 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
804 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fsearch_005fprefix"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_search_prefix</strong> <code class="def-code-arguments">(const char *string, int direction)</code><a class="copiable-link" href="#index-history_005fsearch_005fprefix"> &para;</a></span></dt>
805 <dd><p>Search the history for <var class="var">string</var>, starting at the current history
806 offset.
807 The search is anchored: matching history entries must begin with <var class="var">string</var>.
808 If <var class="var">direction</var> is less than 0, then the search is
809 through previous entries, otherwise through subsequent entries.
810 If <var class="var">string</var> is found, then the current history index is set to
811 that entry, and the return value is 0.
812 Otherwise, nothing is changed, and this returns -1.
813 </p></dd></dl>
814
815 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
816 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fsearch_005fpos"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_search_pos</strong> <code class="def-code-arguments">(const char *string, int direction, int pos)</code><a class="copiable-link" href="#index-history_005fsearch_005fpos"> &para;</a></span></dt>
817 <dd><p>Search for <var class="var">string</var> in the history list, starting at <var class="var">pos</var>, an
818 absolute index into the list.
819 If <var class="var">direction</var> is negative, the search
820 proceeds backward from <var class="var">pos</var>, otherwise forward.
821 Returns the index in the history list
822 of the history element where <var class="var">string</var> was
823 found, or -1 otherwise.
824 </p></dd></dl>
825
826 <hr>
827 </div>
828 <div class="subsection-level-extent" id="Managing-the-History-File">
829 <div class="nav-panel">
830 <p>
831 Next: <a href="#History-Expansion" accesskey="n" rel="next">History Expansion</a>, Previous: <a href="#Searching-the-History-List" accesskey="p" rel="prev">Searching the History List</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
832 </div>
833 <h4 class="subsection" id="Managing-the-History-File-1"><span>2.3.6 Managing the History File<a class="copiable-link" href="#Managing-the-History-File-1"> &para;</a></span></h4>
834
835 <p>The History library can read the history from and write it to a file.
836 This section documents the functions for managing a history file.
837 </p>
838 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
839 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-read_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">read_history</strong> <code class="def-code-arguments">(const char *filename)</code><a class="copiable-link" href="#index-read_005fhistory"> &para;</a></span></dt>
840 <dd><p>Add the contents of <var class="var">filename</var> to the history list, one entry
841 at a time.
842 If <var class="var">filename</var> is <code class="code">NULL</code>, this reads from <samp class="file">~/.history</samp>,
843 if it exists.
844 This attempts to determine whether the history file includes timestamp
845 information, and assigns timestamps to the history entries it reads
846 if so.
847 Returns 0 if successful, or <code class="code">errno</code> if not.
848 </p></dd></dl>
849
850 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
851 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-read_005fhistory_005frange"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">read_history_range</strong> <code class="def-code-arguments">(const char *filename, int from, int to)</code><a class="copiable-link" href="#index-read_005fhistory_005frange"> &para;</a></span></dt>
852 <dd><p>Read a range of lines from <var class="var">filename</var>, adding them to the history list.
853 Start reading at line <var class="var">from</var> and end at <var class="var">to</var>.
854 If <var class="var">from</var> is zero, start at the beginning.
855 If <var class="var">to</var> is less than <var class="var">from</var>, this reads until the end of the file.
856 This attempts to determine whether the history file includes timestamp
857 information, and assigns timestamps to the history entries it reads
858 if so.
859 If <var class="var">filename</var> is <code class="code">NULL</code>, this reads from <samp class="file">~/.history</samp>,
860 if it exists.
861 Returns 0 if successful, or <code class="code">errno</code> if not.
862 </p></dd></dl>
863
864 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
865 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-write_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">write_history</strong> <code class="def-code-arguments">(const char *filename)</code><a class="copiable-link" href="#index-write_005fhistory"> &para;</a></span></dt>
866 <dd><p>Write the current history to <var class="var">filename</var>, overwriting <var class="var">filename</var>
867 if necessary.
868 This writes timestamp information if the
869 <code class="code">history_write_timestamps</code> variable is set to a non-zero value.
870 If <var class="var">filename</var> is <code class="code">NULL</code>, then write the history list to
871 <samp class="file">~/.history</samp>.
872 Returns 0 on success, or <code class="code">errno</code> on a read or write error.
873 </p></dd></dl>
874
875 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
876 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-append_005fhistory"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">append_history</strong> <code class="def-code-arguments">(int nelements, const char *filename)</code><a class="copiable-link" href="#index-append_005fhistory"> &para;</a></span></dt>
877 <dd><p>Append the last <var class="var">nelements</var> of the history list to <var class="var">filename</var>.
878 This writes timestamp information if the
879 <code class="code">history_write_timestamps</code> variable is set to a non-zero value.
880 If <var class="var">filename</var> is <code class="code">NULL</code>, then append to <samp class="file">~/.history</samp>.
881 Returns 0 on success, or <code class="code">errno</code> on a read or write error.
882 </p></dd></dl>
883
884 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
885 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005ftruncate_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_truncate_file</strong> <code class="def-code-arguments">(const char *filename, int nlines)</code><a class="copiable-link" href="#index-history_005ftruncate_005ffile"> &para;</a></span></dt>
886 <dd><p>Truncate the history file <var class="var">filename</var>, leaving only the last
887 <var class="var">nlines</var> lines.
888 If <var class="var">filename</var> is <code class="code">NULL</code>, this truncates <samp class="file">~/.history</samp>.
889 Returns 0 on success, or <code class="code">errno</code> on failure.
890 </p></dd></dl>
891
892 <hr>
893 </div>
894 <div class="subsection-level-extent" id="History-Expansion">
895 <div class="nav-panel">
896 <p>
897 Previous: <a href="#Managing-the-History-File" accesskey="p" rel="prev">Managing the History File</a>, Up: <a href="#History-Functions" accesskey="u" rel="up">History Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
898 </div>
899 <h4 class="subsection" id="History-Expansion-2"><span>2.3.7 History Expansion<a class="copiable-link" href="#History-Expansion-2"> &para;</a></span></h4>
900
901 <p>These functions implement history expansion.
902 </p>
903 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
904 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005fexpand"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">history_expand</strong> <code class="def-code-arguments">(const char *string, char **output)</code><a class="copiable-link" href="#index-history_005fexpand"> &para;</a></span></dt>
905 <dd><p>Expand <var class="var">string</var>, placing the result into <var class="var">output</var>, a pointer
906 to a string (see <a class="pxref" href="#History-Interaction">History Expansion</a>).
907 Returns:
908 </p><dl class="table">
909 <dt><code class="code">0</code></dt>
910 <dd><p>If no expansions took place (or, if the only change in
911 the text was the removal of escape characters preceding the history expansion
912 character);
913 </p></dd>
914 <dt><code class="code">1</code></dt>
915 <dd><p>if expansions did take place;
916 </p></dd>
917 <dt><code class="code">-1</code></dt>
918 <dd><p>if there was an error in expansion;
919 </p></dd>
920 <dt><code class="code">2</code></dt>
921 <dd><p>if the returned line should be displayed, but not executed,
922 as with the <code class="code">:p</code> modifier (see <a class="pxref" href="#Modifiers">Modifiers</a>).
923 </p></dd>
924 </dl>
925
926 <p>If an error occurred during expansion,
927 then <var class="var">output</var> contains a descriptive error message.
928 </p></dd></dl>
929
930 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
931 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-get_005fhistory_005fevent"><span class="category-def">Function: </span><span><code class="def-type">char *</code> <strong class="def-name">get_history_event</strong> <code class="def-code-arguments">(const char *string, int *cindex, int qchar)</code><a class="copiable-link" href="#index-get_005fhistory_005fevent"> &para;</a></span></dt>
932 <dd><p>Returns the text of the history event beginning at <var class="var">string</var> +
933 <var class="var">*cindex</var>.
934 Modifies <var class="var">*cindex</var> to point to after the event specifier.
935 At function entry, <var class="var">cindex</var> points to the index into <var class="var">string</var>
936 where the history event specification begins.
937 <var class="var">qchar</var>
938 is a character that is allowed to end the event specification in addition
939 to the &ldquo;normal&rdquo; terminating characters.
940 </p></dd></dl>
941
942 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
943 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005ftokenize"><span class="category-def">Function: </span><span><code class="def-type">char **</code> <strong class="def-name">history_tokenize</strong> <code class="def-code-arguments">(const char *string)</code><a class="copiable-link" href="#index-history_005ftokenize"> &para;</a></span></dt>
944 <dd><p>Return an array of tokens parsed out of <var class="var">string</var>, much as the
945 shell might.
946 The tokens are split on the characters in the
947 <var class="var">history_word_delimiters</var> variable,
948 and shell quoting conventions are obeyed as described below.
949 </p></dd></dl>
950
951 <dl class="first-deftypefn first-deftypefun-alias-first-deftypefn">
952 <dt class="deftypefn deftypefun-alias-deftypefn" id="index-history_005farg_005fextract"><span class="category-def">Function: </span><span><code class="def-type">char *</code> <strong class="def-name">history_arg_extract</strong> <code class="def-code-arguments">(int first, int last, const char *string)</code><a class="copiable-link" href="#index-history_005farg_005fextract"> &para;</a></span></dt>
953 <dd><p>Extract a string segment consisting of the <var class="var">first</var> through <var class="var">last</var>
954 arguments present in <var class="var">string</var>.
955 This splits <var class="var">string</var> into arguments using <code class="code">history_tokenize</code>.
956 </p></dd></dl>
957
958 <hr>
959 </div>
960 </div>
961 <div class="section-level-extent" id="History-Variables">
962 <div class="nav-panel">
963 <p>
964 Next: <a href="#History-Programming-Example" accesskey="n" rel="next">History Programming Example</a>, Previous: <a href="#History-Functions" accesskey="p" rel="prev">History Functions</a>, Up: <a href="#Programming-with-GNU-History" accesskey="u" rel="up">Programming with GNU History</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
965 </div>
966 <h3 class="section" id="History-Variables-1"><span>2.4 History Variables<a class="copiable-link" href="#History-Variables-1"> &para;</a></span></h3>
967
968 <p>This section describes the externally-visible variables exported by
969 the <small class="sc">GNU</small> History Library.
970 </p>
971 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
972 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fbase"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_base</strong><a class="copiable-link" href="#index-history_005fbase"> &para;</a></span></dt>
973 <dd><p>The logical offset of the first entry in the history list.
974 </p></dd></dl>
975
976 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
977 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005flength"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_length</strong><a class="copiable-link" href="#index-history_005flength"> &para;</a></span></dt>
978 <dd><p>The number of entries currently stored in the history list.
979 </p></dd></dl>
980
981 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
982 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fmax_005fentries"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_max_entries</strong><a class="copiable-link" href="#index-history_005fmax_005fentries"> &para;</a></span></dt>
983 <dd><p>The maximum number of history entries.
984 This must be changed using <code class="code">stifle_history()</code>.
985 </p></dd></dl>
986
987 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
988 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fwrite_005ftimestamps"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_write_timestamps</strong><a class="copiable-link" href="#index-history_005fwrite_005ftimestamps"> &para;</a></span></dt>
989 <dd><p>If non-zero, timestamps are written to the history file, so they can be
990 preserved between sessions.
991 The default value is 0, meaning that timestamps are not saved.
992 </p>
993 <p>The current timestamp format uses the value of <var class="var">history_comment_char</var>
994 to delimit timestamp entries in the history file.
995 If that variable does not have a value (the default),
996 the history library will not write timestamps.
997 </p></dd></dl>
998
999 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1000 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fexpansion_005fchar"><span class="category-def">Variable: </span><span><code class="def-type">char</code> <strong class="def-name">history_expansion_char</strong><a class="copiable-link" href="#index-history_005fexpansion_005fchar"> &para;</a></span></dt>
1001 <dd><p>The character that introduces a history event.
1002 The default is &lsquo;<samp class="samp">!</samp>&rsquo;.
1003 Setting this to 0 inhibits history expansion.
1004 </p></dd></dl>
1005
1006 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1007 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fsubst_005fchar"><span class="category-def">Variable: </span><span><code class="def-type">char</code> <strong class="def-name">history_subst_char</strong><a class="copiable-link" href="#index-history_005fsubst_005fchar"> &para;</a></span></dt>
1008 <dd><p>The character that invokes word substitution if found at the start of
1009 a line.
1010 The default is &lsquo;<samp class="samp">^</samp>&rsquo;.
1011 </p></dd></dl>
1012
1013 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1014 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fcomment_005fchar"><span class="category-def">Variable: </span><span><code class="def-type">char</code> <strong class="def-name">history_comment_char</strong><a class="copiable-link" href="#index-history_005fcomment_005fchar"> &para;</a></span></dt>
1015 <dd><p>During tokenization, if this character appears as the first character
1016 of a word, then it and all subsequent characters up to a newline are
1017 ignored, suppressing history expansion for the remainder of the line.
1018 This is disabled by default.
1019 </p></dd></dl>
1020
1021 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1022 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fword_005fdelimiters"><span class="category-def">Variable: </span><span><code class="def-type">char *</code> <strong class="def-name">history_word_delimiters</strong><a class="copiable-link" href="#index-history_005fword_005fdelimiters"> &para;</a></span></dt>
1023 <dd><p>The characters that separate tokens for <code class="code">history_tokenize()</code>.
1024 The default value is <code class="code">&quot; \t\n()&lt;&gt;;&amp;|&quot;</code>.
1025 </p></dd></dl>
1026
1027 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1028 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fsearch_005fdelimiter_005fchars"><span class="category-def">Variable: </span><span><code class="def-type">char *</code> <strong class="def-name">history_search_delimiter_chars</strong><a class="copiable-link" href="#index-history_005fsearch_005fdelimiter_005fchars"> &para;</a></span></dt>
1029 <dd><p>The list of additional characters which can delimit a history search
1030 string, in addition to space, TAB, &lsquo;<samp class="samp">:</samp>&rsquo; and &lsquo;<samp class="samp">?</samp>&rsquo; in the case of
1031 a substring search.
1032 The default is empty.
1033 </p></dd></dl>
1034
1035 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1036 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fno_005fexpand_005fchars"><span class="category-def">Variable: </span><span><code class="def-type">char *</code> <strong class="def-name">history_no_expand_chars</strong><a class="copiable-link" href="#index-history_005fno_005fexpand_005fchars"> &para;</a></span></dt>
1037 <dd><p>The list of characters which inhibit history expansion if found immediately
1038 following <var class="var">history_expansion_char</var>.
1039 The default is space, tab, newline, carriage return, and &lsquo;<samp class="samp">=</samp>&rsquo;.
1040 </p></dd></dl>
1041
1042 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1043 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fquotes_005finhibit_005fexpansion"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_quotes_inhibit_expansion</strong><a class="copiable-link" href="#index-history_005fquotes_005finhibit_005fexpansion"> &para;</a></span></dt>
1044 <dd><p>If non-zero, the history expansion code implements shell-like quoting:
1045 single-quoted words are not scanned for the history expansion
1046 character or the history comment character, and double-quoted words may
1047 have history expansion performed, since single quotes are not special
1048 within double quotes.
1049 The default value is 0.
1050 </p></dd></dl>
1051
1052 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1053 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005fquoting_005fstate"><span class="category-def">Variable: </span><span><code class="def-type">int</code> <strong class="def-name">history_quoting_state</strong><a class="copiable-link" href="#index-history_005fquoting_005fstate"> &para;</a></span></dt>
1054 <dd><p>An application may set this variable to indicate that the current line
1055 being expanded is subject to existing quoting.
1056 If set to &lsquo;<samp class="samp">'</samp>&rsquo;,
1057 history expansion assumes that the line is single-quoted and
1058 inhibit expansion until it reads an unquoted closing single quote;
1059 if set to &lsquo;<samp class="samp">&quot;</samp>&rsquo;,
1060 history expansion assumes the line is double quoted
1061 until it reads an unquoted closing double quote.
1062 If set to 0, the default,
1063 history expansion assumes the line is not quoted and
1064 treats quote characters within the line as described above.
1065 This is only effective if <var class="var">history_quotes_inhibit_expansion</var> is set.
1066 This is intended for use by applications like Bash which allow
1067 quoted strings to span multiple lines.
1068 </p></dd></dl>
1069
1070 <dl class="first-deftypevr first-deftypevar-alias-first-deftypevr">
1071 <dt class="deftypevr deftypevar-alias-deftypevr" id="index-history_005finhibit_005fexpansion_005ffunction"><span class="category-def">Variable: </span><span><code class="def-type">rl_linebuf_func_t *</code> <strong class="def-name">history_inhibit_expansion_function</strong><a class="copiable-link" href="#index-history_005finhibit_005fexpansion_005ffunction"> &para;</a></span></dt>
1072 <dd><p>This should be set to the address of a function that takes two arguments:
1073 a <code class="code">char *</code> (<var class="var">string</var>)
1074 and an <code class="code">int</code> index into that string (<var class="var">i</var>).
1075 It should return a non-zero value if the history expansion starting at
1076 <var class="var">string[i]</var> should not be performed; zero if the expansion should
1077 be done.
1078 It is intended for use by applications like Bash that use the history
1079 expansion character for additional purposes.
1080 By default, this variable is set to <code class="code">NULL</code>.
1081 </p></dd></dl>
1082
1083 <hr>
1084 </div>
1085 <div class="section-level-extent" id="History-Programming-Example">
1086 <div class="nav-panel">
1087 <p>
1088 Previous: <a href="#History-Variables" accesskey="p" rel="prev">History Variables</a>, Up: <a href="#Programming-with-GNU-History" accesskey="u" rel="up">Programming with GNU History</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
1089 </div>
1090 <h3 class="section" id="History-Programming-Example-1"><span>2.5 History Programming Example<a class="copiable-link" href="#History-Programming-Example-1"> &para;</a></span></h3>
1091
1092 <p>The following program demonstrates simple use of the <small class="sc">GNU</small> History Library.
1093 </p>
1094 <div class="example smallexample">
1095 <pre class="example-preformatted">#include &lt;stdio.h&gt;
1096 #include &lt;readline/history.h&gt;
1097
1098 int
1099 main (int argc, char **argv)
1100 {
1101 char line[1024], *t;
1102 int len, done = 0;
1103
1104 line[0] = 0;
1105
1106 using_history ();
1107 while (!done)
1108 {
1109 printf (&quot;history$ &quot;);
1110 fflush (stdout);
1111 t = fgets (line, sizeof (line) - 1, stdin);
1112 if (t &amp;&amp; *t)
1113 {
1114 len = strlen (t);
1115 if (t[len - 1] == '\n')
1116 t[len - 1] = '\0';
1117 }
1118
1119 if (!t)
1120 strcpy (line, &quot;quit&quot;);
1121
1122 if (line[0])
1123 {
1124 char *expansion;
1125 int result;
1126
1127 result = history_expand (line, &amp;expansion);
1128 if (result)
1129 fprintf (stderr, &quot;%s\n&quot;, expansion);
1130
1131 if (result &lt; 0 || result == 2)
1132 {
1133 free (expansion);
1134 continue;
1135 }
1136
1137 add_history (expansion);
1138 strncpy (line, expansion, sizeof (line) - 1);
1139 free (expansion);
1140 }
1141
1142 if (strcmp (line, &quot;quit&quot;) == 0)
1143 done = 1;
1144 else if (strcmp (line, &quot;save&quot;) == 0)
1145 write_history (&quot;history_file&quot;);
1146 else if (strcmp (line, &quot;read&quot;) == 0)
1147 read_history (&quot;history_file&quot;);
1148 else if (strcmp (line, &quot;list&quot;) == 0)
1149 {
1150 register HIST_ENTRY **the_list;
1151 register int i;
1152
1153 the_list = history_list ();
1154 if (the_list)
1155 for (i = 0; the_list[i]; i++)
1156 printf (&quot;%d: %s\n&quot;, i + history_base, the_list[i]-&gt;line);
1157 }
1158 else if (strncmp (line, &quot;delete&quot;, 6) == 0)
1159 {
1160 int which;
1161 if ((sscanf (line + 6, &quot;%d&quot;, &amp;which)) == 1)
1162 {
1163 HIST_ENTRY *entry = remove_history (which);
1164 if (!entry)
1165 fprintf (stderr, &quot;No such entry %d\n&quot;, which);
1166 else
1167 {
1168 free (entry-&gt;line);
1169 free (entry);
1170 }
1171 }
1172 else
1173 {
1174 fprintf (stderr, &quot;non-numeric arg given to `delete'\n&quot;);
1175 }
1176 }
1177 }
1178 }
1179 </pre></div>
1180
1181 <hr>
1182 </div>
1183 </div>
1184 <div class="appendix-level-extent" id="GNU-Free-Documentation-License">
1185 <div class="nav-panel">
1186 <p>
1187 Next: <a href="#Concept-Index" accesskey="n" rel="next">Concept Index</a>, Previous: <a href="#Programming-with-GNU-History" accesskey="p" rel="prev">Programming with GNU History</a>, Up: <a href="#Top" accesskey="u" rel="up">GNU History Library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
1188 </div>
1189 <h2 class="appendix" id="GNU-Free-Documentation-License-1"><span>Appendix A GNU Free Documentation License<a class="copiable-link" href="#GNU-Free-Documentation-License-1"> &para;</a></span></h2>
1190
1191 <div class="center">Version 1.3, 3 November 2008
1192 </div>
1193
1194 <div class="display">
1195 <pre class="display-preformatted">Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
1196 <a class="uref" href="http://fsf.org/">http://fsf.org/</a>
1197
1198 Everyone is permitted to copy and distribute verbatim copies
1199 of this license document, but changing it is not allowed.
1200 </pre></div>
1201
1202 <ol class="enumerate" start="0">
1203 <li> PREAMBLE
1204
1205 <p>The purpose of this License is to make a manual, textbook, or other
1206 functional and useful document <em class="dfn">free</em> in the sense of freedom: to
1207 assure everyone the effective freedom to copy and redistribute it,
1208 with or without modifying it, either commercially or noncommercially.
1209 Secondarily, this License preserves for the author and publisher a way
1210 to get credit for their work, while not being considered responsible
1211 for modifications made by others.
1212 </p>
1213 <p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
1214 works of the document must themselves be free in the same sense. It
1215 complements the GNU General Public License, which is a copyleft
1216 license designed for free software.
1217 </p>
1218 <p>We have designed this License in order to use it for manuals for free
1219 software, because free software needs free documentation: a free
1220 program should come with manuals providing the same freedoms that the
1221 software does. But this License is not limited to software manuals;
1222 it can be used for any textual work, regardless of subject matter or
1223 whether it is published as a printed book. We recommend this License
1224 principally for works whose purpose is instruction or reference.
1225 </p>
1226 </li><li> APPLICABILITY AND DEFINITIONS
1227
1228 <p>This License applies to any manual or other work, in any medium, that
1229 contains a notice placed by the copyright holder saying it can be
1230 distributed under the terms of this License. Such a notice grants a
1231 world-wide, royalty-free license, unlimited in duration, to use that
1232 work under the conditions stated herein. The &ldquo;Document&rdquo;, below,
1233 refers to any such manual or work. Any member of the public is a
1234 licensee, and is addressed as &ldquo;you&rdquo;. You accept the license if you
1235 copy, modify or distribute the work in a way requiring permission
1236 under copyright law.
1237 </p>
1238 <p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
1239 Document or a portion of it, either copied verbatim, or with
1240 modifications and/or translated into another language.
1241 </p>
1242 <p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section
1243 of the Document that deals exclusively with the relationship of the
1244 publishers or authors of the Document to the Document&rsquo;s overall
1245 subject (or to related matters) and contains nothing that could fall
1246 directly within that overall subject. (Thus, if the Document is in
1247 part a textbook of mathematics, a Secondary Section may not explain
1248 any mathematics.) The relationship could be a matter of historical
1249 connection with the subject or with related matters, or of legal,
1250 commercial, philosophical, ethical or political position regarding
1251 them.
1252 </p>
1253 <p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
1254 are designated, as being those of Invariant Sections, in the notice
1255 that says that the Document is released under this License. If a
1256 section does not fit the above definition of Secondary then it is not
1257 allowed to be designated as Invariant. The Document may contain zero
1258 Invariant Sections. If the Document does not identify any Invariant
1259 Sections then there are none.
1260 </p>
1261 <p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
1262 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
1263 the Document is released under this License. A Front-Cover Text may
1264 be at most 5 words, and a Back-Cover Text may be at most 25 words.
1265 </p>
1266 <p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
1267 represented in a format whose specification is available to the
1268 general public, that is suitable for revising the document
1269 straightforwardly with generic text editors or (for images composed of
1270 pixels) generic paint programs or (for drawings) some widely available
1271 drawing editor, and that is suitable for input to text formatters or
1272 for automatic translation to a variety of formats suitable for input
1273 to text formatters. A copy made in an otherwise Transparent file
1274 format whose markup, or absence of markup, has been arranged to thwart
1275 or discourage subsequent modification by readers is not Transparent.
1276 An image format is not Transparent if used for any substantial amount
1277 of text. A copy that is not &ldquo;Transparent&rdquo; is called &ldquo;Opaque&rdquo;.
1278 </p>
1279 <p>Examples of suitable formats for Transparent copies include plain
1280 <small class="sc">ASCII</small> without markup, Texinfo input format, LaTeX input
1281 format, <abbr class="acronym">SGML</abbr> or <abbr class="acronym">XML</abbr> using a publicly available
1282 <abbr class="acronym">DTD</abbr>, and standard-conforming simple <abbr class="acronym">HTML</abbr>,
1283 PostScript or <abbr class="acronym">PDF</abbr> designed for human modification. Examples
1284 of transparent image formats include <abbr class="acronym">PNG</abbr>, <abbr class="acronym">XCF</abbr> and
1285 <abbr class="acronym">JPG</abbr>. Opaque formats include proprietary formats that can be
1286 read and edited only by proprietary word processors, <abbr class="acronym">SGML</abbr> or
1287 <abbr class="acronym">XML</abbr> for which the <abbr class="acronym">DTD</abbr> and/or processing tools are
1288 not generally available, and the machine-generated <abbr class="acronym">HTML</abbr>,
1289 PostScript or <abbr class="acronym">PDF</abbr> produced by some word processors for
1290 output purposes only.
1291 </p>
1292 <p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
1293 plus such following pages as are needed to hold, legibly, the material
1294 this License requires to appear in the title page. For works in
1295 formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
1296 the text near the most prominent appearance of the work&rsquo;s title,
1297 preceding the beginning of the body of the text.
1298 </p>
1299 <p>The &ldquo;publisher&rdquo; means any person or entity that distributes copies
1300 of the Document to the public.
1301 </p>
1302 <p>A section &ldquo;Entitled XYZ&rdquo; means a named subunit of the Document whose
1303 title either is precisely XYZ or contains XYZ in parentheses following
1304 text that translates XYZ in another language. (Here XYZ stands for a
1305 specific section name mentioned below, such as &ldquo;Acknowledgements&rdquo;,
1306 &ldquo;Dedications&rdquo;, &ldquo;Endorsements&rdquo;, or &ldquo;History&rdquo;.) To &ldquo;Preserve the Title&rdquo;
1307 of such a section when you modify the Document means that it remains a
1308 section &ldquo;Entitled XYZ&rdquo; according to this definition.
1309 </p>
1310 <p>The Document may include Warranty Disclaimers next to the notice which
1311 states that this License applies to the Document. These Warranty
1312 Disclaimers are considered to be included by reference in this
1313 License, but only as regards disclaiming warranties: any other
1314 implication that these Warranty Disclaimers may have is void and has
1315 no effect on the meaning of this License.
1316 </p>
1317 </li><li> VERBATIM COPYING
1318
1319 <p>You may copy and distribute the Document in any medium, either
1320 commercially or noncommercially, provided that this License, the
1321 copyright notices, and the license notice saying this License applies
1322 to the Document are reproduced in all copies, and that you add no other
1323 conditions whatsoever to those of this License. You may not use
1324 technical measures to obstruct or control the reading or further
1325 copying of the copies you make or distribute. However, you may accept
1326 compensation in exchange for copies. If you distribute a large enough
1327 number of copies you must also follow the conditions in section 3.
1328 </p>
1329 <p>You may also lend copies, under the same conditions stated above, and
1330 you may publicly display copies.
1331 </p>
1332 </li><li> COPYING IN QUANTITY
1333
1334 <p>If you publish printed copies (or copies in media that commonly have
1335 printed covers) of the Document, numbering more than 100, and the
1336 Document&rsquo;s license notice requires Cover Texts, you must enclose the
1337 copies in covers that carry, clearly and legibly, all these Cover
1338 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
1339 the back cover. Both covers must also clearly and legibly identify
1340 you as the publisher of these copies. The front cover must present
1341 the full title with all words of the title equally prominent and
1342 visible. You may add other material on the covers in addition.
1343 Copying with changes limited to the covers, as long as they preserve
1344 the title of the Document and satisfy these conditions, can be treated
1345 as verbatim copying in other respects.
1346 </p>
1347 <p>If the required texts for either cover are too voluminous to fit
1348 legibly, you should put the first ones listed (as many as fit
1349 reasonably) on the actual cover, and continue the rest onto adjacent
1350 pages.
1351 </p>
1352 <p>If you publish or distribute Opaque copies of the Document numbering
1353 more than 100, you must either include a machine-readable Transparent
1354 copy along with each Opaque copy, or state in or with each Opaque copy
1355 a computer-network location from which the general network-using
1356 public has access to download using public-standard network protocols
1357 a complete Transparent copy of the Document, free of added material.
1358 If you use the latter option, you must take reasonably prudent steps,
1359 when you begin distribution of Opaque copies in quantity, to ensure
1360 that this Transparent copy will remain thus accessible at the stated
1361 location until at least one year after the last time you distribute an
1362 Opaque copy (directly or through your agents or retailers) of that
1363 edition to the public.
1364 </p>
1365 <p>It is requested, but not required, that you contact the authors of the
1366 Document well before redistributing any large number of copies, to give
1367 them a chance to provide you with an updated version of the Document.
1368 </p>
1369 </li><li> MODIFICATIONS
1370
1371 <p>You may copy and distribute a Modified Version of the Document under
1372 the conditions of sections 2 and 3 above, provided that you release
1373 the Modified Version under precisely this License, with the Modified
1374 Version filling the role of the Document, thus licensing distribution
1375 and modification of the Modified Version to whoever possesses a copy
1376 of it. In addition, you must do these things in the Modified Version:
1377 </p>
1378 <ol class="enumerate" type="A" start="1">
1379 <li> Use in the Title Page (and on the covers, if any) a title distinct
1380 from that of the Document, and from those of previous versions
1381 (which should, if there were any, be listed in the History section
1382 of the Document). You may use the same title as a previous version
1383 if the original publisher of that version gives permission.
1384
1385 </li><li> List on the Title Page, as authors, one or more persons or entities
1386 responsible for authorship of the modifications in the Modified
1387 Version, together with at least five of the principal authors of the
1388 Document (all of its principal authors, if it has fewer than five),
1389 unless they release you from this requirement.
1390
1391 </li><li> State on the Title page the name of the publisher of the
1392 Modified Version, as the publisher.
1393
1394 </li><li> Preserve all the copyright notices of the Document.
1395
1396 </li><li> Add an appropriate copyright notice for your modifications
1397 adjacent to the other copyright notices.
1398
1399 </li><li> Include, immediately after the copyright notices, a license notice
1400 giving the public permission to use the Modified Version under the
1401 terms of this License, in the form shown in the Addendum below.
1402
1403 </li><li> Preserve in that license notice the full lists of Invariant Sections
1404 and required Cover Texts given in the Document&rsquo;s license notice.
1405
1406 </li><li> Include an unaltered copy of this License.
1407
1408 </li><li> Preserve the section Entitled &ldquo;History&rdquo;, Preserve its Title, and add
1409 to it an item stating at least the title, year, new authors, and
1410 publisher of the Modified Version as given on the Title Page. If
1411 there is no section Entitled &ldquo;History&rdquo; in the Document, create one
1412 stating the title, year, authors, and publisher of the Document as
1413 given on its Title Page, then add an item describing the Modified
1414 Version as stated in the previous sentence.
1415
1416 </li><li> Preserve the network location, if any, given in the Document for
1417 public access to a Transparent copy of the Document, and likewise
1418 the network locations given in the Document for previous versions
1419 it was based on. These may be placed in the &ldquo;History&rdquo; section.
1420 You may omit a network location for a work that was published at
1421 least four years before the Document itself, or if the original
1422 publisher of the version it refers to gives permission.
1423
1424 </li><li> For any section Entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;, Preserve
1425 the Title of the section, and preserve in the section all the
1426 substance and tone of each of the contributor acknowledgements and/or
1427 dedications given therein.
1428
1429 </li><li> Preserve all the Invariant Sections of the Document,
1430 unaltered in their text and in their titles. Section numbers
1431 or the equivalent are not considered part of the section titles.
1432
1433 </li><li> Delete any section Entitled &ldquo;Endorsements&rdquo;. Such a section
1434 may not be included in the Modified Version.
1435
1436 </li><li> Do not retitle any existing section to be Entitled &ldquo;Endorsements&rdquo; or
1437 to conflict in title with any Invariant Section.
1438
1439 </li><li> Preserve any Warranty Disclaimers.
1440 </li></ol>
1441
1442 <p>If the Modified Version includes new front-matter sections or
1443 appendices that qualify as Secondary Sections and contain no material
1444 copied from the Document, you may at your option designate some or all
1445 of these sections as invariant. To do this, add their titles to the
1446 list of Invariant Sections in the Modified Version&rsquo;s license notice.
1447 These titles must be distinct from any other section titles.
1448 </p>
1449 <p>You may add a section Entitled &ldquo;Endorsements&rdquo;, provided it contains
1450 nothing but endorsements of your Modified Version by various
1451 parties&mdash;for example, statements of peer review or that the text has
1452 been approved by an organization as the authoritative definition of a
1453 standard.
1454 </p>
1455 <p>You may add a passage of up to five words as a Front-Cover Text, and a
1456 passage of up to 25 words as a Back-Cover Text, to the end of the list
1457 of Cover Texts in the Modified Version. Only one passage of
1458 Front-Cover Text and one of Back-Cover Text may be added by (or
1459 through arrangements made by) any one entity. If the Document already
1460 includes a cover text for the same cover, previously added by you or
1461 by arrangement made by the same entity you are acting on behalf of,
1462 you may not add another; but you may replace the old one, on explicit
1463 permission from the previous publisher that added the old one.
1464 </p>
1465 <p>The author(s) and publisher(s) of the Document do not by this License
1466 give permission to use their names for publicity for or to assert or
1467 imply endorsement of any Modified Version.
1468 </p>
1469 </li><li> COMBINING DOCUMENTS
1470
1471 <p>You may combine the Document with other documents released under this
1472 License, under the terms defined in section 4 above for modified
1473 versions, provided that you include in the combination all of the
1474 Invariant Sections of all of the original documents, unmodified, and
1475 list them all as Invariant Sections of your combined work in its
1476 license notice, and that you preserve all their Warranty Disclaimers.
1477 </p>
1478 <p>The combined work need only contain one copy of this License, and
1479 multiple identical Invariant Sections may be replaced with a single
1480 copy. If there are multiple Invariant Sections with the same name but
1481 different contents, make the title of each such section unique by
1482 adding at the end of it, in parentheses, the name of the original
1483 author or publisher of that section if known, or else a unique number.
1484 Make the same adjustment to the section titles in the list of
1485 Invariant Sections in the license notice of the combined work.
1486 </p>
1487 <p>In the combination, you must combine any sections Entitled &ldquo;History&rdquo;
1488 in the various original documents, forming one section Entitled
1489 &ldquo;History&rdquo;; likewise combine any sections Entitled &ldquo;Acknowledgements&rdquo;,
1490 and any sections Entitled &ldquo;Dedications&rdquo;. You must delete all
1491 sections Entitled &ldquo;Endorsements.&rdquo;
1492 </p>
1493 </li><li> COLLECTIONS OF DOCUMENTS
1494
1495 <p>You may make a collection consisting of the Document and other documents
1496 released under this License, and replace the individual copies of this
1497 License in the various documents with a single copy that is included in
1498 the collection, provided that you follow the rules of this License for
1499 verbatim copying of each of the documents in all other respects.
1500 </p>
1501 <p>You may extract a single document from such a collection, and distribute
1502 it individually under this License, provided you insert a copy of this
1503 License into the extracted document, and follow this License in all
1504 other respects regarding verbatim copying of that document.
1505 </p>
1506 </li><li> AGGREGATION WITH INDEPENDENT WORKS
1507
1508 <p>A compilation of the Document or its derivatives with other separate
1509 and independent documents or works, in or on a volume of a storage or
1510 distribution medium, is called an &ldquo;aggregate&rdquo; if the copyright
1511 resulting from the compilation is not used to limit the legal rights
1512 of the compilation&rsquo;s users beyond what the individual works permit.
1513 When the Document is included in an aggregate, this License does not
1514 apply to the other works in the aggregate which are not themselves
1515 derivative works of the Document.
1516 </p>
1517 <p>If the Cover Text requirement of section 3 is applicable to these
1518 copies of the Document, then if the Document is less than one half of
1519 the entire aggregate, the Document&rsquo;s Cover Texts may be placed on
1520 covers that bracket the Document within the aggregate, or the
1521 electronic equivalent of covers if the Document is in electronic form.
1522 Otherwise they must appear on printed covers that bracket the whole
1523 aggregate.
1524 </p>
1525 </li><li> TRANSLATION
1526
1527 <p>Translation is considered a kind of modification, so you may
1528 distribute translations of the Document under the terms of section 4.
1529 Replacing Invariant Sections with translations requires special
1530 permission from their copyright holders, but you may include
1531 translations of some or all Invariant Sections in addition to the
1532 original versions of these Invariant Sections. You may include a
1533 translation of this License, and all the license notices in the
1534 Document, and any Warranty Disclaimers, provided that you also include
1535 the original English version of this License and the original versions
1536 of those notices and disclaimers. In case of a disagreement between
1537 the translation and the original version of this License or a notice
1538 or disclaimer, the original version will prevail.
1539 </p>
1540 <p>If a section in the Document is Entitled &ldquo;Acknowledgements&rdquo;,
1541 &ldquo;Dedications&rdquo;, or &ldquo;History&rdquo;, the requirement (section 4) to Preserve
1542 its Title (section 1) will typically require changing the actual
1543 title.
1544 </p>
1545 </li><li> TERMINATION
1546
1547 <p>You may not copy, modify, sublicense, or distribute the Document
1548 except as expressly provided under this License. Any attempt
1549 otherwise to copy, modify, sublicense, or distribute it is void, and
1550 will automatically terminate your rights under this License.
1551 </p>
1552 <p>However, if you cease all violation of this License, then your license
1553 from a particular copyright holder is reinstated (a) provisionally,
1554 unless and until the copyright holder explicitly and finally
1555 terminates your license, and (b) permanently, if the copyright holder
1556 fails to notify you of the violation by some reasonable means prior to
1557 60 days after the cessation.
1558 </p>
1559 <p>Moreover, your license from a particular copyright holder is
1560 reinstated permanently if the copyright holder notifies you of the
1561 violation by some reasonable means, this is the first time you have
1562 received notice of violation of this License (for any work) from that
1563 copyright holder, and you cure the violation prior to 30 days after
1564 your receipt of the notice.
1565 </p>
1566 <p>Termination of your rights under this section does not terminate the
1567 licenses of parties who have received copies or rights from you under
1568 this License. If your rights have been terminated and not permanently
1569 reinstated, receipt of a copy of some or all of the same material does
1570 not give you any rights to use it.
1571 </p>
1572 </li><li> FUTURE REVISIONS OF THIS LICENSE
1573
1574 <p>The Free Software Foundation may publish new, revised versions
1575 of the GNU Free Documentation License from time to time. Such new
1576 versions will be similar in spirit to the present version, but may
1577 differ in detail to address new problems or concerns. See
1578 <a class="uref" href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
1579 </p>
1580 <p>Each version of the License is given a distinguishing version number.
1581 If the Document specifies that a particular numbered version of this
1582 License &ldquo;or any later version&rdquo; applies to it, you have the option of
1583 following the terms and conditions either of that specified version or
1584 of any later version that has been published (not as a draft) by the
1585 Free Software Foundation. If the Document does not specify a version
1586 number of this License, you may choose any version ever published (not
1587 as a draft) by the Free Software Foundation. If the Document
1588 specifies that a proxy can decide which future versions of this
1589 License can be used, that proxy&rsquo;s public statement of acceptance of a
1590 version permanently authorizes you to choose that version for the
1591 Document.
1592 </p>
1593 </li><li> RELICENSING
1594
1595 <p>&ldquo;Massive Multiauthor Collaboration Site&rdquo; (or &ldquo;MMC Site&rdquo;) means any
1596 World Wide Web server that publishes copyrightable works and also
1597 provides prominent facilities for anybody to edit those works. A
1598 public wiki that anybody can edit is an example of such a server. A
1599 &ldquo;Massive Multiauthor Collaboration&rdquo; (or &ldquo;MMC&rdquo;) contained in the
1600 site means any set of copyrightable works thus published on the MMC
1601 site.
1602 </p>
1603 <p>&ldquo;CC-BY-SA&rdquo; means the Creative Commons Attribution-Share Alike 3.0
1604 license published by Creative Commons Corporation, a not-for-profit
1605 corporation with a principal place of business in San Francisco,
1606 California, as well as future copyleft versions of that license
1607 published by that same organization.
1608 </p>
1609 <p>&ldquo;Incorporate&rdquo; means to publish or republish a Document, in whole or
1610 in part, as part of another Document.
1611 </p>
1612 <p>An MMC is &ldquo;eligible for relicensing&rdquo; if it is licensed under this
1613 License, and if all works that were first published under this License
1614 somewhere other than this MMC, and subsequently incorporated in whole
1615 or in part into the MMC, (1) had no cover texts or invariant sections,
1616 and (2) were thus incorporated prior to November 1, 2008.
1617 </p>
1618 <p>The operator of an MMC Site may republish an MMC contained in the site
1619 under CC-BY-SA on the same site at any time before August 1, 2009,
1620 provided the MMC is eligible for relicensing.
1621 </p>
1622 </li></ol>
1623
1624 <h3 class="heading" id="ADDENDUM_003a-How-to-use-this-License-for-your-documents"><span>ADDENDUM: How to use this License for your documents<a class="copiable-link" href="#ADDENDUM_003a-How-to-use-this-License-for-your-documents"> &para;</a></span></h3>
1625
1626 <p>To use this License in a document you have written, include a copy of
1627 the License in the document and put the following copyright and
1628 license notices just after the title page:
1629 </p>
1630 <div class="example smallexample">
1631 <div class="group"><pre class="example-preformatted"> Copyright (C) <var class="var">year</var> <var class="var">your name</var>.
1632 Permission is granted to copy, distribute and/or modify this document
1633 under the terms of the GNU Free Documentation License, Version 1.3
1634 or any later version published by the Free Software Foundation;
1635 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
1636 Texts. A copy of the license is included in the section entitled ``GNU
1637 Free Documentation License''.
1638 </pre></div></div>
1639
1640 <p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
1641 replace the &ldquo;with&hellip;Texts.&rdquo; line with this:
1642 </p>
1643 <div class="example smallexample">
1644 <div class="group"><pre class="example-preformatted"> with the Invariant Sections being <var class="var">list their titles</var>, with
1645 the Front-Cover Texts being <var class="var">list</var>, and with the Back-Cover Texts
1646 being <var class="var">list</var>.
1647 </pre></div></div>
1648
1649 <p>If you have Invariant Sections without Cover Texts, or some other
1650 combination of the three, merge those two alternatives to suit the
1651 situation.
1652 </p>
1653 <p>If your document contains nontrivial examples of program code, we
1654 recommend releasing these examples in parallel under your choice of
1655 free software license, such as the GNU General Public License,
1656 to permit their use in free software.
1657 </p>
1658
1659
1660 <hr>
1661 </div>
1662 <div class="appendix-level-extent" id="Concept-Index">
1663 <div class="nav-panel">
1664 <p>
1665 Next: <a href="#Function-and-Variable-Index" accesskey="n" rel="next">Function and Variable Index</a>, Previous: <a href="#GNU-Free-Documentation-License" accesskey="p" rel="prev">GNU Free Documentation License</a>, Up: <a href="#Top" accesskey="u" rel="up">GNU History Library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
1666 </div>
1667 <h2 class="appendix" id="Concept-Index-1"><span>Appendix B Concept Index<a class="copiable-link" href="#Concept-Index-1"> &para;</a></span></h2>
1668 <div class="printindex cp-printindex">
1669 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; </th><td><a class="summary-letter-printindex" href="#Concept-Index_cp_letter-A"><b>A</b></a>
1670 &nbsp;
1671 <a class="summary-letter-printindex" href="#Concept-Index_cp_letter-E"><b>E</b></a>
1672 &nbsp;
1673 <a class="summary-letter-printindex" href="#Concept-Index_cp_letter-H"><b>H</b></a>
1674 &nbsp;
1675 </td></tr></table>
1676 <table class="cp-entries-printindex" border="0">
1677 <tr><td></td><th class="entries-header-printindex">Index Entry</th><th class="sections-header-printindex">Section</th></tr>
1678 <tr><td colspan="3"><hr></td></tr>
1679 <tr><th id="Concept-Index_cp_letter-A">A</th></tr>
1680 <tr><td></td><td class="printindex-index-entry"><a href="#index-anchored-search">anchored search</a></td><td class="printindex-index-section"><a href="#Searching-the-History-List">Searching the History List</a></td></tr>
1681 <tr><td colspan="3"><hr></td></tr>
1682 <tr><th id="Concept-Index_cp_letter-E">E</th></tr>
1683 <tr><td></td><td class="printindex-index-entry"><a href="#index-event-designators">event designators</a></td><td class="printindex-index-section"><a href="#Event-Designators">Event Designators</a></td></tr>
1684 <tr><td colspan="3"><hr></td></tr>
1685 <tr><th id="Concept-Index_cp_letter-H">H</th></tr>
1686 <tr><td></td><td class="printindex-index-entry"><a href="#index-history-events">history events</a></td><td class="printindex-index-section"><a href="#Event-Designators">Event Designators</a></td></tr>
1687 <tr><td></td><td class="printindex-index-entry"><a href="#index-history-expansion">history expansion</a></td><td class="printindex-index-section"><a href="#History-Interaction">History Interaction</a></td></tr>
1688 <tr><td></td><td class="printindex-index-entry"><a href="#index-History-Searching">History Searching</a></td><td class="printindex-index-section"><a href="#Searching-the-History-List">Searching the History List</a></td></tr>
1689 <tr><td colspan="3"><hr></td></tr>
1690 </table>
1691 <table class="cp-letters-footer-printindex"><tr><th>Jump to: &nbsp; </th><td><a class="summary-letter-printindex" href="#Concept-Index_cp_letter-A"><b>A</b></a>
1692 &nbsp;
1693 <a class="summary-letter-printindex" href="#Concept-Index_cp_letter-E"><b>E</b></a>
1694 &nbsp;
1695 <a class="summary-letter-printindex" href="#Concept-Index_cp_letter-H"><b>H</b></a>
1696 &nbsp;
1697 </td></tr></table>
1698 </div>
1699
1700 <hr>
1701 </div>
1702 <div class="appendix-level-extent" id="Function-and-Variable-Index">
1703 <div class="nav-panel">
1704 <p>
1705 Previous: <a href="#Concept-Index" accesskey="p" rel="prev">Concept Index</a>, Up: <a href="#Top" accesskey="u" rel="up">GNU History Library</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
1706 </div>
1707 <h2 class="appendix" id="Function-and-Variable-Index-1"><span>Appendix C Function and Variable Index<a class="copiable-link" href="#Function-and-Variable-Index-1"> &para;</a></span></h2>
1708 <div class="printindex vr-printindex">
1709 <table class="vr-letters-header-printindex"><tr><th>Jump to: &nbsp; </th><td><a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-A"><b>A</b></a>
1710 &nbsp;
1711 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-C"><b>C</b></a>
1712 &nbsp;
1713 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-F"><b>F</b></a>
1714 &nbsp;
1715 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-G"><b>G</b></a>
1716 &nbsp;
1717 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-H"><b>H</b></a>
1718 &nbsp;
1719 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-N"><b>N</b></a>
1720 &nbsp;
1721 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-P"><b>P</b></a>
1722 &nbsp;
1723 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-R"><b>R</b></a>
1724 &nbsp;
1725 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-S"><b>S</b></a>
1726 &nbsp;
1727 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-U"><b>U</b></a>
1728 &nbsp;
1729 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-W"><b>W</b></a>
1730 &nbsp;
1731 </td></tr></table>
1732 <table class="vr-entries-printindex" border="0">
1733 <tr><td></td><th class="entries-header-printindex">Index Entry</th><th class="sections-header-printindex">Section</th></tr>
1734 <tr><td colspan="3"><hr></td></tr>
1735 <tr><th id="Function-and-Variable-Index_vr_letter-A">A</th></tr>
1736 <tr><td></td><td class="printindex-index-entry"><a href="#index-add_005fhistory"><code>add_history</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1737 <tr><td></td><td class="printindex-index-entry"><a href="#index-add_005fhistory_005ftime"><code>add_history_time</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1738 <tr><td></td><td class="printindex-index-entry"><a href="#index-append_005fhistory"><code>append_history</code></a></td><td class="printindex-index-section"><a href="#Managing-the-History-File">Managing the History File</a></td></tr>
1739 <tr><td colspan="3"><hr></td></tr>
1740 <tr><th id="Function-and-Variable-Index_vr_letter-C">C</th></tr>
1741 <tr><td></td><td class="printindex-index-entry"><a href="#index-clear_005fhistory"><code>clear_history</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1742 <tr><td></td><td class="printindex-index-entry"><a href="#index-current_005fhistory"><code>current_history</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1743 <tr><td colspan="3"><hr></td></tr>
1744 <tr><th id="Function-and-Variable-Index_vr_letter-F">F</th></tr>
1745 <tr><td></td><td class="printindex-index-entry"><a href="#index-free_005fhistory_005fentry"><code>free_history_entry</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1746 <tr><td colspan="3"><hr></td></tr>
1747 <tr><th id="Function-and-Variable-Index_vr_letter-G">G</th></tr>
1748 <tr><td></td><td class="printindex-index-entry"><a href="#index-get_005fhistory_005fevent"><code>get_history_event</code></a></td><td class="printindex-index-section"><a href="#History-Expansion">History Expansion</a></td></tr>
1749 <tr><td colspan="3"><hr></td></tr>
1750 <tr><th id="Function-and-Variable-Index_vr_letter-H">H</th></tr>
1751 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005farg_005fextract"><code>history_arg_extract</code></a></td><td class="printindex-index-section"><a href="#History-Expansion">History Expansion</a></td></tr>
1752 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fbase"><code>history_base</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1753 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fcomment_005fchar"><code>history_comment_char</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1754 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fexpand"><code>history_expand</code></a></td><td class="printindex-index-section"><a href="#History-Expansion">History Expansion</a></td></tr>
1755 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fexpansion_005fchar"><code>history_expansion_char</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1756 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fget"><code>history_get</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1757 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fget_005fhistory_005fstate"><code>history_get_history_state</code></a></td><td class="printindex-index-section"><a href="#Initializing-History-and-State-Management">Initializing History and State Management</a></td></tr>
1758 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fget_005ftime"><code>history_get_time</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1759 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005finhibit_005fexpansion_005ffunction"><code>history_inhibit_expansion_function</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1760 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fis_005fstifled"><code>history_is_stifled</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1761 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005flength"><code>history_length</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1762 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005flist"><code>history_list</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1763 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fmax_005fentries"><code>history_max_entries</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1764 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fno_005fexpand_005fchars"><code>history_no_expand_chars</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1765 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fquotes_005finhibit_005fexpansion"><code>history_quotes_inhibit_expansion</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1766 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fquoting_005fstate"><code>history_quoting_state</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1767 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fsearch"><code>history_search</code></a></td><td class="printindex-index-section"><a href="#Searching-the-History-List">Searching the History List</a></td></tr>
1768 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fsearch_005fdelimiter_005fchars"><code>history_search_delimiter_chars</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1769 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fsearch_005fpos"><code>history_search_pos</code></a></td><td class="printindex-index-section"><a href="#Searching-the-History-List">Searching the History List</a></td></tr>
1770 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fsearch_005fprefix"><code>history_search_prefix</code></a></td><td class="printindex-index-section"><a href="#Searching-the-History-List">Searching the History List</a></td></tr>
1771 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fset_005fhistory_005fstate"><code>history_set_history_state</code></a></td><td class="printindex-index-section"><a href="#Initializing-History-and-State-Management">Initializing History and State Management</a></td></tr>
1772 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fset_005fpos"><code>history_set_pos</code></a></td><td class="printindex-index-section"><a href="#Moving-Around-the-History-List">Moving Around the History List</a></td></tr>
1773 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fsubst_005fchar"><code>history_subst_char</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1774 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005ftokenize"><code>history_tokenize</code></a></td><td class="printindex-index-section"><a href="#History-Expansion">History Expansion</a></td></tr>
1775 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005ftotal_005fbytes"><code>history_total_bytes</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1776 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005ftruncate_005ffile"><code>history_truncate_file</code></a></td><td class="printindex-index-section"><a href="#Managing-the-History-File">Managing the History File</a></td></tr>
1777 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fword_005fdelimiters"><code>history_word_delimiters</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1778 <tr><td></td><td class="printindex-index-entry"><a href="#index-history_005fwrite_005ftimestamps"><code>history_write_timestamps</code></a></td><td class="printindex-index-section"><a href="#History-Variables">History Variables</a></td></tr>
1779 <tr><td colspan="3"><hr></td></tr>
1780 <tr><th id="Function-and-Variable-Index_vr_letter-N">N</th></tr>
1781 <tr><td></td><td class="printindex-index-entry"><a href="#index-next_005fhistory"><code>next_history</code></a></td><td class="printindex-index-section"><a href="#Moving-Around-the-History-List">Moving Around the History List</a></td></tr>
1782 <tr><td colspan="3"><hr></td></tr>
1783 <tr><th id="Function-and-Variable-Index_vr_letter-P">P</th></tr>
1784 <tr><td></td><td class="printindex-index-entry"><a href="#index-previous_005fhistory"><code>previous_history</code></a></td><td class="printindex-index-section"><a href="#Moving-Around-the-History-List">Moving Around the History List</a></td></tr>
1785 <tr><td colspan="3"><hr></td></tr>
1786 <tr><th id="Function-and-Variable-Index_vr_letter-R">R</th></tr>
1787 <tr><td></td><td class="printindex-index-entry"><a href="#index-read_005fhistory"><code>read_history</code></a></td><td class="printindex-index-section"><a href="#Managing-the-History-File">Managing the History File</a></td></tr>
1788 <tr><td></td><td class="printindex-index-entry"><a href="#index-read_005fhistory_005frange"><code>read_history_range</code></a></td><td class="printindex-index-section"><a href="#Managing-the-History-File">Managing the History File</a></td></tr>
1789 <tr><td></td><td class="printindex-index-entry"><a href="#index-remove_005fhistory"><code>remove_history</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1790 <tr><td></td><td class="printindex-index-entry"><a href="#index-replace_005fhistory_005fentry"><code>replace_history_entry</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1791 <tr><td colspan="3"><hr></td></tr>
1792 <tr><th id="Function-and-Variable-Index_vr_letter-S">S</th></tr>
1793 <tr><td></td><td class="printindex-index-entry"><a href="#index-stifle_005fhistory"><code>stifle_history</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1794 <tr><td colspan="3"><hr></td></tr>
1795 <tr><th id="Function-and-Variable-Index_vr_letter-U">U</th></tr>
1796 <tr><td></td><td class="printindex-index-entry"><a href="#index-unstifle_005fhistory"><code>unstifle_history</code></a></td><td class="printindex-index-section"><a href="#History-List-Management">History List Management</a></td></tr>
1797 <tr><td></td><td class="printindex-index-entry"><a href="#index-using_005fhistory"><code>using_history</code></a></td><td class="printindex-index-section"><a href="#Initializing-History-and-State-Management">Initializing History and State Management</a></td></tr>
1798 <tr><td colspan="3"><hr></td></tr>
1799 <tr><th id="Function-and-Variable-Index_vr_letter-W">W</th></tr>
1800 <tr><td></td><td class="printindex-index-entry"><a href="#index-where_005fhistory"><code>where_history</code></a></td><td class="printindex-index-section"><a href="#Information-About-the-History-List">Information About the History List</a></td></tr>
1801 <tr><td></td><td class="printindex-index-entry"><a href="#index-write_005fhistory"><code>write_history</code></a></td><td class="printindex-index-section"><a href="#Managing-the-History-File">Managing the History File</a></td></tr>
1802 <tr><td colspan="3"><hr></td></tr>
1803 </table>
1804 <table class="vr-letters-footer-printindex"><tr><th>Jump to: &nbsp; </th><td><a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-A"><b>A</b></a>
1805 &nbsp;
1806 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-C"><b>C</b></a>
1807 &nbsp;
1808 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-F"><b>F</b></a>
1809 &nbsp;
1810 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-G"><b>G</b></a>
1811 &nbsp;
1812 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-H"><b>H</b></a>
1813 &nbsp;
1814 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-N"><b>N</b></a>
1815 &nbsp;
1816 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-P"><b>P</b></a>
1817 &nbsp;
1818 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-R"><b>R</b></a>
1819 &nbsp;
1820 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-S"><b>S</b></a>
1821 &nbsp;
1822 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-U"><b>U</b></a>
1823 &nbsp;
1824 <a class="summary-letter-printindex" href="#Function-and-Variable-Index_vr_letter-W"><b>W</b></a>
1825 &nbsp;
1826 </td></tr></table>
1827 </div>
1828
1829 </div>
1830 </div>
1831
1832
1833
1834 </body>
1835 </html>