VxWorks Reference Manual : Libraries
ledLib - line-editing library
ledOpen( ) - create a new line-editor ID
ledClose( ) - discard the line-editor ID
ledRead( ) - read a line with line-editing
ledControl( ) - change the line-editor ID parameters
This library provides a line-editing layer on top of a tty device. The shell uses this interface for its history-editing features.
The shell history mechanism is similar to the UNIX Korn shell history facility, with a built-in line-editor similar to UNIX vi that allows previously typed commands to be edited. The command h( ) displays the 20 most recent commands typed into the shell; old commands fall off the top as new ones are entered.
To edit a command, type ESC to enter edit mode, and use the commands listed below. The ESC key switches the shell to edit mode. The RETURN key always gives the line to the shell from either editing or input mode.
The following list is a summary of the commands available in edit mode.
Movement and search commands: nG - Go to command number n. /s - Search for string s backward in history. ?s - Search for string s forward in history. n - Repeat last search. N - Repeat last search in opposite direction. nk - Get nth previous shell command in history. n- - Same as "k". nj - Get nth next shell command in history. n+ - Same as "j". nh - Move left n characters. CTRL-H - Same as "h". nl - Move right n characters. SPACE - Same as "l". nw - Move n words forward. nW - Move n blank-separated words forward. ne - Move to end of the nth next word. nE - Move to end of the nth next blank-separated word. nb - Move back n words. nB - Move back n blank-separated words. fc - Find character c, searching forward. Fc - Find character c, searching backward. ^ - Move cursor to first non-blank character in line. $ - Go to end of line. 0 - Go to beginning of line.
Insert commands (input is expected until an ESC is typed): a - Append. A - Append at end of line. c SPACE - Change character. cl - Change character. cw - Change word. cc - Change entire line. c$ - Change everything from cursor to end of line. C - Same as "c$". S - Same as "cc". i - Insert. I - Insert at beginning of line. R - Type over characters.
Editing commands: nrc - Replace the following n characters with c. nx - Delete n characters starting at cursor. nX - Delete n characters to the left of the cursor. d SPACE - Delete character. dl - Delete character. dw - Delete word. dd - Delete entire line. d$ - Delete everything from cursor to end of line. D - Same as "d$". p - Put last deletion after the cursor. P - Put last deletion before the cursor. u - Undo last command. ~ - Toggle case, lower to upper or vice versa. The default value for n is 1.
Special commands: CTRL-U - Delete line and leave edit mode. CTRL-L - Redraw line. CTRL-D - Complete symbol name. RETURN - Give line to shell and leave edit mode.
Since the shell toggles between raw mode and line mode, type-ahead can be lost. The ESC, redraw, and non-printable characters are built-in. The EOF, backspace, and line-delete are not imported well from tyLib. Instead, tyLib should supply and/or support these characters via ioctl( ).
Some commands do not take counts as users might expect. For example, "ni" will not insert whatever was entered n times.
ledLib.h
ledLib, VxWorks Programmer's Guide: Shell
ledOpen( ) - create a new line-editor ID
int ledOpen ( int inFd, /* low-level device input fd */ int outFd, /* low-level device output fd */ int histSize /* size of history list */ )
This routine creates the ID that is used by ledRead( ), ledClose( ), and ledControl( ). Storage is allocated for up to histSize previously read lines.
The line-editor ID, or ERROR if the routine runs out of memory.
ledLib, ledRead( ), ledClose( ), ledControl( )
ledClose( ) - discard the line-editor ID
STATUS ledClose ( int led_id /* ID returned by ledOpen */ )
This routine frees resources allocated by ledOpen( ). The low-level input/output file descriptors are not closed.
OK.
ledRead( ) - read a line with line-editing
int ledRead ( int led_id, /* ID returned by ledOpen */ char * string, /* where to return line */ int maxBytes /* maximum number of chars to read */ )
This routine handles line-editing and history substitutions. If the low-level input file descriptor is not in OPT_LINE mode, only an ordinary read( ) routine will be performed.
The number of characters read, or EOF.
ledControl( ) - change the line-editor ID parameters
void ledControl ( int led_id, /* ID returned by ledOpen */ int inFd, /* new input fd (NONE = no change) */ int outFd, /* new output fd (NONE = no change) */ int histSize /* new history list size (NONE = no change), (0 = display) */ )
This routine changes the input/output file descriptor and the size of the history list.
N/A