VxWorks Reference Manual : Libraries
shellLib - shell execution routines
shellInit( ) - start the shell
shell( ) - the shell entry point
shellScriptAbort( ) - signal the shell to stop processing a script
shellHistory( ) - display or set the size of shell history
shellPromptSet( ) - change the shell prompt
shellOrigStdSet( ) - set the shell's default input/output/error file descriptors
shellLock( ) - lock access to the shell
This library contains the execution support routines for the VxWorks shell. It provides the basic programmer's interface to VxWorks. It is a C-expression interpreter, containing no built-in commands.
The nature, use, and syntax of the shell are more fully described in the "Target Shell" chapter of the VxWorks Programmer's Guide.
shellLib.h
shellLib, ledLib, VxWorks Programmer's Guide: Target Shell
shellInit( ) - start the shell
STATUS shellInit ( int stackSize, /* shell stack (0 = previous/default value) */ int arg /* argument to shell task */ )
This routine starts the shell task. If the configuration macro INCLUDE_SHELL is defined, shellInit( ) is called by the root task, usrRoot( ), in usrConfig.c.
OK or ERROR.
shellLib, VxWorks Programmer's Guide: Target Shell
shell( ) - the shell entry point
void shell ( BOOL interactive /* should be TRUE, except for a script */ )
This routine is the shell task. It is started with a single parameter that indicates whether this is an interactive shell to be used from a terminal or a socket, or a shell that executes a script.
Normally, the shell is spawned in interactive mode by the root task, usrRoot( ), when VxWorks starts up. After that, shell( ) is called only to execute scripts, or when the shell is restarted after an abort.
The shell gets its input from standard input and sends output to standard output. Both standard input and standard output are initially assigned to the console, but are redirected by telnetdTask( ) and rlogindTask( ).
The shell is not reentrant, since yacc does not generate a reentrant parser. Therefore, there can be only a single shell executing at one time.
N/A
shellLib, VxWorks Programmer's Guide: Target Shell
shellScriptAbort( ) - signal the shell to stop processing a script
void shellScriptAbort (void)
This routine signals the shell to abort processing a script file. It can be called from within a script if an error is detected.
N/A
shellLib, VxWorks Programmer's Guide: Target Shell
shellHistory( ) - display or set the size of shell history
void shellHistory ( int size /* 0 = display, >0 = set history to new size */ )
This routine displays shell history, or resets the default number of commands displayed by shell history to size. By default, history size is 20 commands. Shell history is actually maintained by ledLib.
N/A
shellLib, ledLib, h( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell
shellPromptSet( ) - change the shell prompt
void shellPromptSet ( char * newPrompt /* string to become new shell prompt */ )
This routine changes the shell prompt string to newPrompt.
N/A
shellLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell
shellOrigStdSet( ) - set the shell's default input/output/error file descriptors
void shellOrigStdSet ( int which, /* STD_IN, STD_OUT, STD_ERR */ int fd /* fd to be default */ )
This routine is called to change the shell's default standard input/output/error file descriptor. Normally, it is used only by the shell, rlogindTask( ), and telnetdTask( ). Values for which can be STD_IN, STD_OUT, or STD_ERR, as defined in vxWorks.h. Values for fd can be the file descriptor for any file or device.
N/A
shellLock( ) - lock access to the shell
BOOL shellLock ( BOOL request /* TRUE = lock, FALSE = unlock */ )
This routine locks or unlocks access to the shell. When locked, cooperating tasks, such as telnetdTask( ) and rlogindTask( ), will not take the shell.
TRUE if request is "lock" and the routine successfully locks the shell, otherwise FALSE. TRUE if request is "unlock" and the routine successfully unlocks the shell, otherwise FALSE.
shellLib, VxWorks Programmer's Guide: Target Shell