4 editline \- command-line editing library with history
7 char *readline(char *\fIprompt\fP)
11 is a library that provides an line-editing interface with text recall.
12 It is intended to be compatible with the
14 library provided by the Free Software Foundation, but much smaller.
15 The bulk of this manual page describes the user interface.
19 routine returns a line of text with the trailing newline removed.
20 The data is returned in a buffer allocated with
22 so the space should be released with
24 when the calling program is done with it.
25 Before accepting input from the user, the specified
27 is displayed on the terminal.
29 Each line returned is copied to the internal history list, unless it happens
30 to be equal to the previous line.
32 A program that uses this library provides a simple emacs-like editing
33 interface to its users.
34 A line may be edited before it is sent to the calling program by typing either
35 control characters or escape sequences.
36 A control character, shown as a caret followed by a letter, is typed by
37 holding down the ``control'' key while the letter is typed.
38 For example, ``^A'' is a control-A.
39 An escape sequence is entered by typing the ``escape'' key followed by one or
41 The escape key is abbreviated as ``ESC.''
42 Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
43 is not the same as ``ESC\ f''.
45 An editing command may be typed anywhere on the line, not just at the
47 In addition, a return may also be typed anywhere on the line, not just at
50 Most editing commands may be given a repeat count,
55 To enter a repeat count, type the escape key, the number, and then
56 the command to execute.
57 For example, ``ESC\ 4\ ^f'' moves forward four characters.
58 If a command may be given a repeat count then the text ``[n]'' is given at the
59 end of its description.
61 The following control characters are accepted:
65 ^A Move to the beginning of the line
66 ^B Move left (backwards) [n]
67 ^D Delete character [n]
68 ^E Move to end of line
69 ^F Move right (forwards) [n]
71 ^H Delete character before cursor (backspace key) [n]
72 ^I Complete filename (tab key); see below
73 ^J Done with line (return key)
74 ^K Kill to end of line (or column [n])
76 ^M Done with line (alternate return key)
77 ^N Get next line from history [n]
78 ^P Get previous line from history [n]
79 ^R Search backward (forward if [n]) through history for text;
80 \& must start line if text begins with an uparrow
81 ^T Transpose characters
82 ^V Insert next character, even if it is an edit command
84 ^X^X Exchange current location and mark
85 ^Y Yank back last killed text
86 ^[ Start an escape sequence (escape key)
87 ^]c Move forward to next character ``c''
88 ^? Delete character before cursor (delete key) [n]
92 The following escape sequences are provided.
96 ESC\ ^H Delete previous word (backspace key) [n]
97 ESC\ DEL Delete previous word (delete key) [n]
98 ESC\ SP Set the mark (space key); see ^X^X and ^Y above
99 ESC\ \. Get the last (or [n]'th) word from previous line
100 ESC\ \? Show possible completions; see below
101 ESC\ < Move to start of history
102 ESC\ > Move to end of history
103 ESC\ b Move backward a word [n]
104 ESC\ d Delete word under cursor [n]
105 ESC\ f Move forward a word [n]
106 ESC\ l Make word lowercase [n]
107 ESC\ m Toggle if 8bit chars display normally or with ``M\-'' prefix
108 ESC\ u Make word uppercase [n]
109 ESC\ y Yank back last killed text
110 ESC\ v Show library version
111 ESC\ w Make area up to mark yankable
112 ESC\ nn Set repeat count to the number nn
113 ESC\ C Read from environment variable ``_C_'', where C is
114 \& an uppercase letter
120 library has a small macro facility.
121 If you type the escape key followed by an uppercase letter,
123 then the contents of the environment variable
125 are read in as if you had typed them at the keyboard.
126 For example, if the variable
128 contains the following:
130 ^A^Kecho '^V^[[H^V^[[2J'^M
132 Then typing ``ESC L'' will move to the beginning of the line, kill the
133 entire line, enter the echo command needed to clear the terminal (if your
134 terminal is like a VT-100), and send the line back to the shell.
138 library also does filename completion.
139 Suppose the root directory has the following files in it:
147 If you type ``rm\ /v'' and then the tab key.
149 will then finish off as much of the name as possible by adding ``munix''.
150 Because the name is not unique, it will then beep.
151 If you type the escape key and a question mark, it will display the
153 If you then type a period and a tab, the library will finish off the filename
157 .RI "rm /v[TAB]" munix .TAB old
160 The tab key is shown by ``[TAB]'' and the automatically-entered text
162 .SH "BUGS AND LIMITATIONS"
163 Doesn't know how to handle multiple lines.
165 Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
166 and Rich $alz <rsalz@osf.org>.
167 Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
169 .\" $PchId: editline.3,v 1.3 1996/02/22 21:18:51 philip Exp $