Unknown | 175 lines | 174 code | 1 blank | 0 comment | 0 complexity | c4c680b618e21e095e83efed1f5087ee MD5 | raw file
1.TH EDITLINE 3 2.SH NAME 3editline \- command-line editing library with history 4.SH SYNOPSIS 5.nf 6.B "char *" 7.B "readline(prompt)" 8.B " char *prompt;" 9 10.B "void" 11.B "add_history(line)" 12.B " char *line;" 13.fi 14.SH DESCRIPTION 15.I Editline 16is a library that provides an line-editing interface with text recall. 17It is intended to be compatible with the 18.I readline 19library provided by the Free Software Foundation, but much smaller. 20The bulk of this manual page describes the user interface. 21.PP 22The 23.I readline 24routine returns a line of text with the trailing newline removed. 25The data is returned in a buffer allocated with 26.IR malloc (3), 27so the space should be released with 28.IR free (3) 29when the calling program is done with it. 30Before accepting input from the user, the specified 31.I prompt 32is displayed on the terminal. 33.PP 34The 35.I add_history 36routine makes a copy of the specified 37.I line 38and adds it to the internal history list. 39.SS "User Interface" 40A program that uses this library provides a simple emacs-like editing 41interface to its users. 42A line may be edited before it is sent to the calling program by typing either 43control characters or escape sequences. 44A control character, shown as a caret followed by a letter, is typed by 45holding down the ``control'' key while the letter is typed. 46For example, ``^A'' is a control-A. 47An escape sequence is entered by typing the ``escape'' key followed by one or 48more characters. 49The escape key is abbreviated as ``ESC.'' 50Note that unlike control keys, case matters in escape sequences; ``ESC\ F'' 51is not the same as ``ESC\ f''. 52.PP 53An editing command may be typed anywhere on the line, not just at the 54beginning. 55In addition, a return may also be typed anywhere on the line, not just at 56the end. 57.PP 58Most editing commands may be given a repeat count, 59.IR n , 60where 61.I n 62is a number. 63To enter a repeat count, type the escape key, the number, and then 64the command to execute. 65For example, ``ESC\ 4\ ^f'' moves forward four characters. 66If a command may be given a repeat count then the text ``[n]'' is given at the 67end of its description. 68.PP 69The following control characters are accepted: 70.RS 71.nf 72.ta \w'ESC DEL 'u 73^A Move to the beginning of the line 74^B Move left (backwards) [n] 75^D Delete character [n] 76^E Move to end of line 77^F Move right (forwards) [n] 78^G Ring the bell 79^H Delete character before cursor (backspace key) [n] 80^I Complete filename (tab key); see below 81^J Done with line (return key) 82^K Kill to end of line (or column [n]) 83^L Redisplay line 84^M Done with line (alternate return key) 85^N Get next line from history [n] 86^P Get previous line from history [n] 87^R Search backward (forward if [n]) through history for text; 88\& must start line if text begins with an uparrow 89^T Transpose characters 90^V Insert next character, even if it is an edit command 91^W Wipe to the mark 92^X^X Exchange current location and mark 93^Y Yank back last killed text 94^[ Start an escape sequence (escape key) 95^]c Move forward to next character ``c'' 96^? Delete character before cursor (delete key) [n] 97.fi 98.RE 99.PP 100The following escape sequences are provided. 101.RS 102.nf 103.ta \w'ESC DEL 'u 104ESC\ ^H Delete previous word (backspace key) [n] 105ESC\ DEL Delete previous word (delete key) [n] 106ESC\ SP Set the mark (space key); see ^X^X and ^Y above 107ESC\ \. Get the last (or [n]'th) word from previous line 108ESC\ \? Show possible completions; see below 109ESC\ < Move to start of history 110ESC\ > Move to end of history 111ESC\ b Move backward a word [n] 112ESC\ d Delete word under cursor [n] 113ESC\ f Move forward a word [n] 114ESC\ l Make word lowercase [n] 115ESC\ m Toggle if 8bit chars display normally or with ``M\-'' prefix 116ESC\ u Make word uppercase [n] 117ESC\ y Yank back last killed text 118ESC\ v Show library version 119ESC\ w Make area up to mark yankable 120ESC\ nn Set repeat count to the number nn 121ESC\ C Read from environment variable ``_C_'', where C is 122\& an uppercase letter 123.fi 124.RE 125.PP 126The 127.I editline 128library has a small macro facility. 129If you type the escape key followed by an uppercase letter, 130.IR C , 131then the contents of the environment variable 132.I _C_ 133are read in as if you had typed them at the keyboard. 134For example, if the variable 135.I _L_ 136contains the following: 137.RS 138^A^Kecho '^V^[[H^V^[[2J'^M 139.RE 140Then typing ``ESC L'' will move to the beginning of the line, kill the 141entire line, enter the echo command needed to clear the terminal (if your 142terminal is like a VT-100), and send the line back to the shell. 143.PP 144The 145.I editline 146library also does filename completion. 147Suppose the root directory has the following files in it: 148.RS 149.nf 150.ta \w'core 'u 151bin vmunix 152core vmunix.old 153.fi 154.RE 155If you type ``rm\ /v'' and then the tab key. 156.I Editline 157will then finish off as much of the name as possible by adding ``munix''. 158Because the name is not unique, it will then beep. 159If you type the escape key and a question mark, it will display the 160two choices. 161If you then type a period and a tab, the library will finish off the filename 162for you: 163.RS 164.nf 165.RI "rm /v[TAB]" munix .TAB old 166.fi 167.RE 168The tab key is shown by ``[TAB]'' and the automatically-entered text 169is shown in italics. 170.SH "BUGS AND LIMITATIONS" 171Cannot handle lines more than 80 columns. 172.SH AUTHORS 173Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy> 174and Rich $alz <email@example.com>. 175Original manual page by DaviD W. Sanderson <firstname.lastname@example.org>.