history.3 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. .\"
  2. .\" MAN PAGE COMMENTS to
  3. .\"
  4. .\" Chet Ramey
  5. .\" Information Network Services
  6. .\" Case Western Reserve University
  7. .\" chet.ramey@case.edu
  8. .\"
  9. .\" Last Change: Fri Jul 17 09:43:01 EDT 2020
  10. .\"
  11. .TH HISTORY 3 "2020 July 17" "GNU History 8.1"
  12. .\"
  13. .\" File Name macro. This used to be `.PN', for Path Name,
  14. .\" but Sun doesn't seem to like that very much.
  15. .\"
  16. .de FN
  17. \fI\|\\$1\|\fP
  18. ..
  19. .ds lp \fR\|(\fP
  20. .ds rp \fR\|)\fP
  21. .\" FnN return-value fun-name N arguments
  22. .de Fn1
  23. \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp
  24. .br
  25. ..
  26. .de Fn2
  27. .if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp
  28. .if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp
  29. .br
  30. ..
  31. .de Fn3
  32. .if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp
  33. .if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp
  34. .br
  35. ..
  36. .de Vb
  37. \fI\\$1\fP \fB\\$2\fP
  38. .br
  39. ..
  40. .SH NAME
  41. history \- GNU History Library
  42. .SH COPYRIGHT
  43. .if t The GNU History Library is Copyright \(co 1989-2020 by the Free Software Foundation, Inc.
  44. .if n The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc.
  45. .SH DESCRIPTION
  46. Many programs read input from the user a line at a time. The GNU
  47. History library is able to keep track of those lines, associate arbitrary
  48. data with each line, and utilize information from previous lines in
  49. composing new ones.
  50. .PP
  51. .SH "HISTORY EXPANSION"
  52. The history library supports a history expansion feature that
  53. is identical to the history expansion in
  54. .BR bash.
  55. This section describes what syntax features are available.
  56. .PP
  57. History expansions introduce words from the history list into
  58. the input stream, making it easy to repeat commands, insert the
  59. arguments to a previous command into the current input line, or
  60. fix errors in previous commands quickly.
  61. .PP
  62. History expansion is usually performed immediately after a complete line
  63. is read.
  64. It takes place in two parts.
  65. The first is to determine which line from the history list
  66. to use during substitution.
  67. The second is to select portions of that line for inclusion into
  68. the current one.
  69. The line selected from the history is the \fIevent\fP,
  70. and the portions of that line that are acted upon are \fIwords\fP.
  71. Various \fImodifiers\fP are available to manipulate the selected words.
  72. The line is broken into words in the same fashion as \fBbash\fP
  73. does when reading input,
  74. so that several words that would otherwise be separated
  75. are considered one word when surrounded by quotes (see the
  76. description of \fBhistory_tokenize()\fP below).
  77. History expansions are introduced by the appearance of the
  78. history expansion character, which is \^\fB!\fP\^ by default.
  79. Only backslash (\^\fB\e\fP\^) and single quotes can quote
  80. the history expansion character.
  81. .SS Event Designators
  82. An event designator is a reference to a command line entry in the
  83. history list.
  84. Unless the reference is absolute, events are relative to the current
  85. position in the history list.
  86. .PP
  87. .PD 0
  88. .TP
  89. .B !
  90. Start a history substitution, except when followed by a
  91. .BR blank ,
  92. newline, = or (.
  93. .TP
  94. .B !\fIn\fR
  95. Refer to command line
  96. .IR n .
  97. .TP
  98. .B !\-\fIn\fR
  99. Refer to the current command minus
  100. .IR n .
  101. .TP
  102. .B !!
  103. Refer to the previous command. This is a synonym for `!\-1'.
  104. .TP
  105. .B !\fIstring\fR
  106. Refer to the most recent command
  107. preceding the current position in the history list
  108. starting with
  109. .IR string .
  110. .TP
  111. .B !?\fIstring\fR\fB[?]\fR
  112. Refer to the most recent command
  113. preceding the current position in the history list
  114. containing
  115. .IR string .
  116. The trailing \fB?\fP may be omitted if
  117. .I string
  118. is followed immediately by a newline.
  119. If \fIstring\fP is missing, the string from the most recent search is used;
  120. it is an error if there is no previous search string.
  121. .TP
  122. .B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u
  123. Quick substitution. Repeat the last command, replacing
  124. .I string1
  125. with
  126. .IR string2 .
  127. Equivalent to
  128. ``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
  129. (see \fBModifiers\fP below).
  130. .TP
  131. .B !#
  132. The entire command line typed so far.
  133. .PD
  134. .SS Word Designators
  135. Word designators are used to select desired words from the event.
  136. A
  137. .B :
  138. separates the event specification from the word designator.
  139. It may be omitted if the word designator begins with a
  140. .BR ^ ,
  141. .BR $ ,
  142. .BR * ,
  143. .BR \- ,
  144. or
  145. .BR % .
  146. Words are numbered from the beginning of the line,
  147. with the first word being denoted by 0 (zero).
  148. Words are inserted into the current line separated by single spaces.
  149. .PP
  150. .PD 0
  151. .TP
  152. .B 0 (zero)
  153. The zeroth word. For the shell, this is the command
  154. word.
  155. .TP
  156. .I n
  157. The \fIn\fRth word.
  158. .TP
  159. .B ^
  160. The first argument. That is, word 1.
  161. .TP
  162. .B $
  163. The last word. This is usually the last argument, but will expand to the
  164. zeroth word if there is only one word in the line.
  165. .TP
  166. .B %
  167. The first word matched by the most recent `?\fIstring\fR?' search,
  168. if the search string begins with a character that is part of a word.
  169. .TP
  170. .I x\fB\-\fPy
  171. A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
  172. .TP
  173. .B *
  174. All of the words but the zeroth. This is a synonym
  175. for `\fI1\-$\fP'. It is not an error to use
  176. .B *
  177. if there is just one
  178. word in the event; the empty string is returned in that case.
  179. .TP
  180. .B x*
  181. Abbreviates \fIx\-$\fP.
  182. .TP
  183. .B x\-
  184. Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
  185. If \fBx\fP is missing, it defaults to 0.
  186. .PD
  187. .PP
  188. If a word designator is supplied without an event specification, the
  189. previous command is used as the event.
  190. .SS Modifiers
  191. After the optional word designator, there may appear a sequence of
  192. one or more of the following modifiers, each preceded by a `:'.
  193. These modify, or edit, the word or words selected from the history event.
  194. .PP
  195. .PD 0
  196. .PP
  197. .TP
  198. .B h
  199. Remove a trailing file name component, leaving only the head.
  200. .TP
  201. .B t
  202. Remove all leading file name components, leaving the tail.
  203. .TP
  204. .B r
  205. Remove a trailing suffix of the form \fI.xxx\fP, leaving the
  206. basename.
  207. .TP
  208. .B e
  209. Remove all but the trailing suffix.
  210. .TP
  211. .B p
  212. Print the new command but do not execute it.
  213. .TP
  214. .B q
  215. Quote the substituted words, escaping further substitutions.
  216. .TP
  217. .B x
  218. Quote the substituted words as with
  219. .BR q ,
  220. but break into words at
  221. .B blanks
  222. and newlines.
  223. The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one
  224. supplied is used.
  225. .TP
  226. .B s/\fIold\fP/\fInew\fP/
  227. Substitute
  228. .I new
  229. for the first occurrence of
  230. .I old
  231. in the event line.
  232. Any character may be used as the delimiter in place of /.
  233. The final delimiter is optional if it is the last character of the
  234. event line.
  235. The delimiter may be quoted in
  236. .I old
  237. and
  238. .I new
  239. with a single backslash. If & appears in
  240. .IR new ,
  241. it is replaced by
  242. .IR old .
  243. A single backslash will quote the &.
  244. If
  245. .I old
  246. is null, it is set to the last
  247. .I old
  248. substituted, or, if no previous history substitutions took place,
  249. the last
  250. .I string
  251. in a
  252. .B !?\fIstring\fR\fB[?]\fR
  253. search.
  254. If
  255. .I new
  256. is null, each matching
  257. .I old
  258. is deleted.
  259. .TP
  260. .B &
  261. Repeat the previous substitution.
  262. .TP
  263. .B g
  264. Cause changes to be applied over the entire event line. This is
  265. used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR')
  266. or `\fB:&\fP'. If used with
  267. `\fB:s\fP', any delimiter can be used
  268. in place of /, and the final delimiter is optional
  269. if it is the last character of the event line.
  270. An \fBa\fP may be used as a synonym for \fBg\fP.
  271. .TP
  272. .B G
  273. Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word
  274. in the event line.
  275. .PD
  276. .SH "PROGRAMMING WITH HISTORY FUNCTIONS"
  277. This section describes how to use the History library in other programs.
  278. .SS Introduction to History
  279. A programmer using the History library has available functions
  280. for remembering lines on a history list, associating arbitrary data
  281. with a line, removing lines from the list, searching through the list
  282. for a line containing an arbitrary text string, and referencing any line
  283. in the list directly. In addition, a history \fIexpansion\fP function
  284. is available which provides for a consistent user interface across
  285. different programs.
  286. .PP
  287. The user using programs written with the History library has the
  288. benefit of a consistent user interface with a set of well-known
  289. commands for manipulating the text of previous lines and using that text
  290. in new commands. The basic history manipulation commands are
  291. identical to
  292. the history substitution provided by \fBbash\fP.
  293. .PP
  294. The programmer can also use the readline library, which
  295. includes some history manipulation by default, and has the added
  296. advantage of command line editing.
  297. .PP
  298. Before declaring any functions using any functionality the History
  299. library provides in other code, an application writer should include
  300. the file
  301. .FN <readline/history.h>
  302. in any file that uses the
  303. History library's features. It supplies extern declarations for all
  304. of the library's public functions and variables, and declares all of
  305. the public data structures.
  306. .SS History Storage
  307. The history list is an array of history entries. A history entry is
  308. declared as follows:
  309. .PP
  310. .Vb "typedef void *" histdata_t;
  311. .PP
  312. .nf
  313. typedef struct _hist_entry {
  314. char *line;
  315. char *timestamp;
  316. histdata_t data;
  317. } HIST_ENTRY;
  318. .fi
  319. .PP
  320. The history list itself might therefore be declared as
  321. .PP
  322. .Vb "HIST_ENTRY **" the_history_list;
  323. .PP
  324. The state of the History library is encapsulated into a single structure:
  325. .PP
  326. .nf
  327. /*
  328. * A structure used to pass around the current state of the history.
  329. */
  330. typedef struct _hist_state {
  331. HIST_ENTRY **entries; /* Pointer to the entries themselves. */
  332. int offset; /* The location pointer within this array. */
  333. int length; /* Number of elements within this array. */
  334. int size; /* Number of slots allocated to this array. */
  335. int flags;
  336. } HISTORY_STATE;
  337. .fi
  338. .PP
  339. If the flags member includes \fBHS_STIFLED\fP, the history has been
  340. stifled.
  341. .SH "History Functions"
  342. This section describes the calling sequence for the various functions
  343. exported by the GNU History library.
  344. .SS Initializing History and State Management
  345. This section describes functions used to initialize and manage
  346. the state of the History library when you want to use the history
  347. functions in your program.
  348. .Fn1 void using_history void
  349. Begin a session in which the history functions might be used. This
  350. initializes the interactive variables.
  351. .Fn1 "HISTORY_STATE *" history_get_history_state void
  352. Return a structure describing the current state of the input history.
  353. .Fn1 void history_set_history_state "HISTORY_STATE *state"
  354. Set the state of the history list according to \fIstate\fP.
  355. .SS History List Management
  356. These functions manage individual entries on the history list, or set
  357. parameters managing the list itself.
  358. .Fn1 void add_history "const char *string"
  359. Place \fIstring\fP at the end of the history list. The associated data
  360. field (if any) is set to \fBNULL\fP.
  361. If the maximum number of history entries has been set using
  362. \fBstifle_history()\fP, and the new number of history entries would exceed
  363. that maximum, the oldest history entry is removed.
  364. .Fn1 void add_history_time "const char *string"
  365. Change the time stamp associated with the most recent history entry to
  366. \fIstring\fP.
  367. .Fn1 "HIST_ENTRY *" remove_history "int which"
  368. Remove history entry at offset \fIwhich\fP from the history. The
  369. removed element is returned so you can free the line, data,
  370. and containing structure.
  371. .Fn1 "histdata_t" free_history_entry "HIST_ENTRY *histent"
  372. Free the history entry \fIhistent\fP and any history library private
  373. data associated with it. Returns the application-specific data
  374. so the caller can dispose of it.
  375. .Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data"
  376. Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP.
  377. This returns the old entry so the caller can dispose of any
  378. application-specific data. In the case
  379. of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned.
  380. .Fn1 void clear_history "void"
  381. Clear the history list by deleting all the entries.
  382. .Fn1 void stifle_history "int max"
  383. Stifle the history list, remembering only the last \fImax\fP entries.
  384. The history list will contain only \fImax\fP entries at a time.
  385. .Fn1 int unstifle_history "void"
  386. Stop stifling the history. This returns the previously-set
  387. maximum number of history entries (as set by \fBstifle_history()\fP).
  388. history was stifled. The value is positive if the history was
  389. stifled, negative if it wasn't.
  390. .Fn1 int history_is_stifled "void"
  391. Returns non-zero if the history is stifled, zero if it is not.
  392. .SS Information About the History List
  393. These functions return information about the entire history list or
  394. individual list entries.
  395. .Fn1 "HIST_ENTRY **" history_list "void"
  396. Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the
  397. current input history. Element 0 of this list is the beginning of time.
  398. If there is no history, return \fBNULL\fP.
  399. .Fn1 int where_history "void"
  400. Returns the offset of the current history element.
  401. .Fn1 "HIST_ENTRY *" current_history "void"
  402. Return the history entry at the current position, as determined by
  403. \fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP
  404. pointer.
  405. .Fn1 "HIST_ENTRY *" history_get "int offset"
  406. Return the history entry at position \fIoffset\fP.
  407. The range of valid values of \fIoffset\fP starts at \fBhistory_base\fP
  408. and ends at \fBhistory_length\fP \- 1.
  409. If there is no entry there, or if \fIoffset\fP is outside the valid
  410. range, return a \fBNULL\fP pointer.
  411. .Fn1 "time_t" history_get_time "HIST_ENTRY *"
  412. Return the time stamp associated with the history entry passed as the argument.
  413. .Fn1 int history_total_bytes "void"
  414. Return the number of bytes that the primary history entries are using.
  415. This function returns the sum of the lengths of all the lines in the
  416. history.
  417. .SS Moving Around the History List
  418. These functions allow the current index into the history list to be
  419. set or changed.
  420. .Fn1 int history_set_pos "int pos"
  421. Set the current history offset to \fIpos\fP, an absolute index
  422. into the list.
  423. Returns 1 on success, 0 if \fIpos\fP is less than zero or greater
  424. than the number of history entries.
  425. .Fn1 "HIST_ENTRY *" previous_history "void"
  426. Back up the current history offset to the previous history entry, and
  427. return a pointer to that entry. If there is no previous entry, return
  428. a \fBNULL\fP pointer.
  429. .Fn1 "HIST_ENTRY *" next_history "void"
  430. If the current history offset refers to a valid history entry,
  431. increment the current history offset.
  432. If the possibly-incremented history offset refers to a valid history
  433. entry, return a pointer to that entry;
  434. otherwise, return a \fBNULL\fP pointer.
  435. .SS Searching the History List
  436. These functions allow searching of the history list for entries containing
  437. a specific string. Searching may be performed both forward and backward
  438. from the current history position. The search may be \fIanchored\fP,
  439. meaning that the string must match at the beginning of the history entry.
  440. .Fn2 int history_search "const char *string" "int direction"
  441. Search the history for \fIstring\fP, starting at the current history offset.
  442. If \fIdirection\fP is less than 0, then the search is through
  443. previous entries, otherwise through subsequent entries.
  444. If \fIstring\fP is found, then
  445. the current history index is set to that history entry, and the value
  446. returned is the offset in the line of the entry where
  447. \fIstring\fP was found. Otherwise, nothing is changed, and a -1 is
  448. returned.
  449. .Fn2 int history_search_prefix "const char *string" "int direction"
  450. Search the history for \fIstring\fP, starting at the current history
  451. offset. The search is anchored: matching lines must begin with
  452. \fIstring\fP. If \fIdirection\fP is less than 0, then the search is
  453. through previous entries, otherwise through subsequent entries.
  454. If \fIstring\fP is found, then the
  455. current history index is set to that entry, and the return value is 0.
  456. Otherwise, nothing is changed, and a -1 is returned.
  457. .Fn3 int history_search_pos "const char *string" "int direction" "int pos"
  458. Search for \fIstring\fP in the history list, starting at \fIpos\fP, an
  459. absolute index into the list. If \fIdirection\fP is negative, the search
  460. proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute
  461. index of the history element where \fIstring\fP was found, or -1 otherwise.
  462. .SS Managing the History File
  463. The History library can read the history from and write it to a file.
  464. This section documents the functions for managing a history file.
  465. .Fn1 int read_history "const char *filename"
  466. Add the contents of \fIfilename\fP to the history list, a line at a time.
  467. If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP.
  468. Returns 0 if successful, or \fBerrno\fP if not.
  469. .Fn3 int read_history_range "const char *filename" "int from" "int to"
  470. Read a range of lines from \fIfilename\fP, adding them to the history list.
  471. Start reading at line \fIfrom\fP and end at \fIto\fP.
  472. If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than
  473. \fIfrom\fP, then read until the end of the file. If \fIfilename\fP is
  474. \fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful,
  475. or \fBerrno\fP if not.
  476. .Fn1 int write_history "const char *filename"
  477. Write the current history to \fIfilename\fP, overwriting \fIfilename\fP
  478. if necessary.
  479. If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP.
  480. Returns 0 on success, or \fBerrno\fP on a read or write error.
  481. .Fn2 int append_history "int nelements" "const char *filename"
  482. Append the last \fInelements\fP of the history list to \fIfilename\fP.
  483. If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP.
  484. Returns 0 on success, or \fBerrno\fP on a read or write error.
  485. .Fn2 int history_truncate_file "const char *filename" "int nlines"
  486. Truncate the history file \fIfilename\fP, leaving only the last
  487. \fInlines\fP lines.
  488. If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated.
  489. Returns 0 on success, or \fBerrno\fP on failure.
  490. .SS History Expansion
  491. These functions implement history expansion.
  492. .Fn2 int history_expand "char *string" "char **output"
  493. Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer
  494. to a string. Returns:
  495. .RS
  496. .PD 0
  497. .TP
  498. 0
  499. If no expansions took place (or, if the only change in
  500. the text was the removal of escape characters preceding the history expansion
  501. character);
  502. .TP
  503. 1
  504. if expansions did take place;
  505. .TP
  506. -1
  507. if there was an error in expansion;
  508. .TP
  509. 2
  510. if the returned line should be displayed, but not executed,
  511. as with the \fB:p\fP modifier.
  512. .PD
  513. .RE
  514. If an error occurred in expansion, then \fIoutput\fP contains a descriptive
  515. error message.
  516. .Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar"
  517. Returns the text of the history event beginning at \fIstring\fP +
  518. \fI*cindex\fP. \fI*cindex\fP is modified to point to after the event
  519. specifier. At function entry, \fIcindex\fP points to the index into
  520. \fIstring\fP where the history event specification begins. \fIqchar\fP
  521. is a character that is allowed to end the event specification in addition
  522. to the ``normal'' terminating characters.
  523. .Fn1 "char **" history_tokenize "const char *string"
  524. Return an array of tokens parsed out of \fIstring\fP, much as the
  525. shell might.
  526. The tokens are split on the characters in the
  527. \fBhistory_word_delimiters\fP variable,
  528. and shell quoting conventions are obeyed.
  529. .Fn3 "char *" history_arg_extract "int first" "int last" "const char *string"
  530. Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP
  531. arguments present in \fIstring\fP. Arguments are split using
  532. \fBhistory_tokenize()\fP.
  533. .SS History Variables
  534. This section describes the externally-visible variables exported by
  535. the GNU History Library.
  536. .Vb int history_base
  537. The logical offset of the first entry in the history list.
  538. .Vb int history_length
  539. The number of entries currently stored in the history list.
  540. .Vb int history_max_entries
  541. The maximum number of history entries. This must be changed using
  542. \fBstifle_history()\fP.
  543. .Vb int history_write_timestamps
  544. If non-zero, timestamps are written to the history file, so they can be
  545. preserved between sessions. The default value is 0, meaning that
  546. timestamps are not saved.
  547. The current timestamp format uses the value of \fIhistory_comment_char\fP
  548. to delimit timestamp entries in the history file. If that variable does
  549. not have a value (the default), timestamps will not be written.
  550. .Vb char history_expansion_char
  551. The character that introduces a history event. The default is \fB!\fP.
  552. Setting this to 0 inhibits history expansion.
  553. .Vb char history_subst_char
  554. The character that invokes word substitution if found at the start of
  555. a line. The default is \fB^\fP.
  556. .Vb char history_comment_char
  557. During tokenization, if this character is seen as the first character
  558. of a word, then it and all subsequent characters up to a newline are
  559. ignored, suppressing history expansion for the remainder of the line.
  560. This is disabled by default.
  561. .Vb "char *" history_word_delimiters
  562. The characters that separate tokens for \fBhistory_tokenize()\fP.
  563. The default value is \fB"\ \et\en()<>;&|"\fP.
  564. .Vb "char *" history_no_expand_chars
  565. The list of characters which inhibit history expansion if found immediately
  566. following \fBhistory_expansion_char\fP. The default is space, tab, newline,
  567. \fB\er\fP, and \fB=\fP.
  568. .Vb "char *" history_search_delimiter_chars
  569. The list of additional characters which can delimit a history search
  570. string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of
  571. a substring search. The default is empty.
  572. .Vb int history_quotes_inhibit_expansion
  573. If non-zero, double-quoted words are not scanned for the history expansion
  574. character or the history comment character. The default value is 0.
  575. .Vb "rl_linebuf_func_t *" history_inhibit_expansion_function
  576. This should be set to the address of a function that takes two arguments:
  577. a \fBchar *\fP (\fIstring\fP)
  578. and an \fBint\fP index into that string (\fIi\fP).
  579. It should return a non-zero value if the history expansion starting at
  580. \fIstring[i]\fP should not be performed; zero if the expansion should
  581. be done.
  582. It is intended for use by applications like \fBbash\fP that use the history
  583. expansion character for additional purposes.
  584. By default, this variable is set to \fBNULL\fP.
  585. .SH FILES
  586. .PD 0
  587. .TP
  588. .FN ~/.history
  589. Default filename for reading and writing saved history
  590. .PD
  591. .SH "SEE ALSO"
  592. .PD 0
  593. .TP
  594. \fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey
  595. .TP
  596. \fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
  597. .TP
  598. \fIbash\fP(1)
  599. .TP
  600. \fIreadline\fP(3)
  601. .PD
  602. .SH AUTHORS
  603. Brian Fox, Free Software Foundation
  604. .br
  605. bfox@gnu.org
  606. .PP
  607. Chet Ramey, Case Western Reserve University
  608. .br
  609. chet.ramey@case.edu
  610. .SH BUG REPORTS
  611. If you find a bug in the
  612. .B history
  613. library, you should report it. But first, you should
  614. make sure that it really is a bug, and that it appears in the latest
  615. version of the
  616. .B history
  617. library that you have.
  618. .PP
  619. Once you have determined that a bug actually exists, mail a
  620. bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
  621. If you have a fix, you are welcome to mail that
  622. as well! Suggestions and `philosophical' bug reports may be mailed
  623. to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
  624. newsgroup
  625. .BR gnu.bash.bug .
  626. .PP
  627. Comments and bug reports concerning
  628. this manual page should be directed to
  629. .IR chet.ramey@case.edu .