editline.3: Update man page slightly and fix example formatting.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2015-02-01 14:58:17 +01:00
parent b00453554f
commit e4b1078234

View File

@ -28,7 +28,7 @@ when the calling program is done with it.
Each line returned is copied to the internal history list, unless it happens Each line returned is copied to the internal history list, unless it happens
to be equal to the previous line. This is configurable if you are building editline to be equal to the previous line. This is configurable if you are building editline
from source. from source.
.SS "User Interface" .SS User Interface
A program that uses this library provides a simple emacs-like editing interface to A program that uses this library provides a simple emacs-like editing interface to
its users. A line may be edited before it is sent to the calling program by typing its users. A line may be edited before it is sent to the calling program by typing
either control characters or escape sequences. A control character, shown as a caret either control characters or escape sequences. A control character, shown as a caret
@ -121,9 +121,11 @@ are read in as if you had typed them at the keyboard.
For example, if the variable For example, if the variable
.I _L_ .I _L_
contains the following: contains the following:
.PP
.RS .RS
^A^Kecho '^V^[[H^V^[[2J'^M ^A^Kecho '^V^[[H^V^[[2J'^M
.RE .RE
.PP
Then typing ``ESC L'' will move to the beginning of the line, kill the Then typing ``ESC L'' will move to the beginning of the line, kill the
entire line, enter the echo command needed to clear the terminal (if your entire line, enter the echo command needed to clear the terminal (if your
terminal is like a VT-100), and send the line back to the shell. terminal is like a VT-100), and send the line back to the shell.
@ -132,6 +134,7 @@ The
.I editline .I editline
library also does filename completion. library also does filename completion.
Suppose the root directory has the following files in it: Suppose the root directory has the following files in it:
.PP
.RS .RS
.nf .nf
.ta \w'core 'u .ta \w'core 'u
@ -139,6 +142,7 @@ bin vmunix
core vmunix.old core vmunix.old
.fi .fi
.RE .RE
.PP
If you type ``rm\ /v'' and then the tab key. If you type ``rm\ /v'' and then the tab key.
.I Editline .I Editline
will then finish off as much of the name as possible by adding ``munix''. will then finish off as much of the name as possible by adding ``munix''.
@ -147,48 +151,50 @@ If you type the escape key and a question mark, it will display the
two choices. two choices.
If you then type a period and a tab, the library will finish off the filename If you then type a period and a tab, the library will finish off the filename
for you: for you:
.PP
.RS .RS
.nf .nf
.RI "rm /v[TAB]" munix ".[TAB]" old .RI "rm /v[TAB]" munix ".[TAB]" old
.fi .fi
.RE .RE
.PP
The tab key is shown by ``[TAB]'' and the automatically-entered text The tab key is shown by ``[TAB]'' and the automatically-entered text
is shown in italics. is shown in italics.
.SH USAGE
.SH "USAGE"
To include To include
.I readline() .I readline()
in your program, simply call it as you do any other function. Just make sure to link in your program, simply call it as you do any other function. Just make sure to link
your program with libeditline. your program with libeditline.
.SS Example
.SS "Example"
The following brief example lets you enter a line and edit it, then displays it. The following brief example lets you enter a line and edit it, then displays it.
.nf .nf
.B "#include <stdlib.h>"
.B "" .B ""
.B "extern char *readline(char *prompt);" .B #include <stdlib.h>
.B "" .B ""
.B "int main (void)" .B extern char *readline(char *prompt);
.B "{"
.B " char *p;"
.B "" .B ""
.B " while ((p = readline(``CLI> '')) != NULL) {" .B int main (void)
.B " printf(\"%s\n\", p);" .B {
.B " free(p);" .RS
.B " }" .B char *p;
.B "" .B ""
.B " return 0;" .B while ((p = readline("CLI>"))) {
.B "}" .RS
.B puts(p);
.B free(p);
.RE
.B }
.B ""
.B return 0;
.RE
.B }
.fi .fi
.SH BUGS AND LIMITATIONS
.SH "BUGS AND LIMITATIONS" Does not handle multiple lines or unicode characters well. See the TODO
Doesn't know how to handle multiple lines or unicode characters well. See the TODO
file in the distribution if you want to help out. file in the distribution if you want to help out.
.SH AUTHORS .SH AUTHORS
The original editline library was created by Simmule R. Turner and Rich $alz. It is The original editline library was created by Simmule R. Turner and Rich
now maintained in several forks: Heimdal, Festival speech tools, Mozilla, Google $alz. It now exists in several forks: Heimdal, Festival speech tools,
Gadgets for Linux, and many other places. The original manual page was made by DaviD Mozilla, Google Gadgets for Linux, and many other places. The original
W. Sanderson. This version was made by Joachim Nilsson <troglobit@gmail.com>. manual page was made by David W. Sanderson. Currently maintained by
Joachim Nilsson at http://github.com/troglobit/editline