VxWorks Reference Manual : Libraries

shellLib

NAME

shellLib - shell execution routines

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

DESCRIPTION

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.

INCLUDE FILES

shellLib.h

SEE ALSO

shellLib, ledLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

shellInit( )

NAME

shellInit( ) - start the shell

SYNOPSIS

STATUS shellInit
    (
    int stackSize, /* shell stack (0 = previous/default value) */
    int arg        /* argument to shell task */
    )

DESCRIPTION

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.

RETURNS

OK or ERROR.

SEE ALSO

shellLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

shell( )

NAME

shell( ) - the shell entry point

SYNOPSIS

void shell
    (
    BOOL interactive /* should be TRUE, except for a script */
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

shellLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

shellScriptAbort( )

NAME

shellScriptAbort( ) - signal the shell to stop processing a script

SYNOPSIS


void shellScriptAbort (void)

DESCRIPTION

This routine signals the shell to abort processing a script file. It can be called from within a script if an error is detected.

RETURNS

N/A

SEE ALSO

shellLib, VxWorks Programmer's Guide: Target Shell


Libraries : Routines

shellHistory( )

NAME

shellHistory( ) - display or set the size of shell history

SYNOPSIS

void shellHistory
    (
    int size /* 0 = display, >0 = set history to new size */
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

shellLib, ledLib, h( ), VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

shellPromptSet( )

NAME

shellPromptSet( ) - change the shell prompt

SYNOPSIS

void shellPromptSet
    (
    char * newPrompt /* string to become new shell prompt */
    )

DESCRIPTION

This routine changes the shell prompt string to newPrompt.

RETURNS

N/A

SEE ALSO

shellLib, VxWorks Programmer's Guide: Target Shell, windsh, Tornado User's Guide: Shell


Libraries : Routines

shellOrigStdSet( )

NAME

shellOrigStdSet( ) - set the shell's default input/output/error file descriptors

SYNOPSIS

void shellOrigStdSet
    (
    int which, /* STD_IN, STD_OUT, STD_ERR */
    int fd     /* fd to be default */
    )

DESCRIPTION

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.

RETURNS

N/A

SEE ALSO

shellLib


Libraries : Routines

shellLock( )

NAME

shellLock( ) - lock access to the shell

SYNOPSIS

BOOL shellLock
    (
    BOOL request /* TRUE = lock, FALSE = unlock */
    )

DESCRIPTION

This routine locks or unlocks access to the shell. When locked, cooperating tasks, such as telnetdTask( ) and rlogindTask( ), will not take the shell.

RETURNS

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.

SEE ALSO

shellLib, VxWorks Programmer's Guide: Target Shell