Go to the source code of this file.
Data Structures | |
struct | centry |
Defines | |
#define | SHELL_BUFLEN 80 |
#define | SHELL_MAXTOK 16 |
#define | SHELL_CMDSTK 8192 |
#define | SHELL_CMDPRIO 20 |
#define | SHELL_BANNER "\033[1;35m_______________________________________\n _ _ _____ ______ _ _ \n \\ \\ / /(_____)| ___ \\ | | | |\n \\ \\/ / _ | | | || | | |\n ) ( | | | | | || | | |\n / /\\ \\ _| |_ | | | || |___| |\n /_/ \\_\\(_____)|_| |_| \\______|\n---------------------------------------\033[0;39m\n" |
#define | SHELL_START "Welcome to the wonderful world of XINU!\n" |
#define | SHELL_EXIT "Shell closed.\n" |
#define | SHELL_PROMPT "xsh$ " |
#define | SHELL_SYNTAXERR "Syntax error.\n" |
#define | SHELL_CHILDERR "Cannot create.\n" |
#define | isEndOfLine(c) ((c) == '\0' || (c) == '\r' || (c) == '\n') |
#define | isQuote(c) ((c) == '"' || (c) == '\'') |
#define | isOtherSpecial(c) ((c) == '<' || (c) == '>' || (c) == '&') |
#define | isWhitespace(c) ((c) == ' ' || (c) == '\t') |
Functions | |
process | shell (ushort) |
short | lexan (char *, ushort, char *, char *[]) |
command | xsh_exit (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_gpiostat (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_help (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_kill (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_led (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_memstat (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_ps (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_reset (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_sleep (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_test (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_testsuite (ushort, ushort, ushort, ushort, char *[]) |
command | xsh_uartstat (ushort, ushort, ushort, ushort, char *[]) |
Variables | |
struct centry | commandtab [] |
ulong | ncommand |
Definition in file shell.h.
#define isEndOfLine | ( | c | ) | ((c) == '\0' || (c) == '\r' || (c) == '\n') |
#define isOtherSpecial | ( | c | ) | ((c) == '<' || (c) == '>' || (c) == '&') |
#define isQuote | ( | c | ) | ((c) == '"' || (c) == '\'') |
#define isWhitespace | ( | c | ) | ((c) == ' ' || (c) == '\t') |
#define SHELL_BANNER "\033[1;35m_______________________________________\n _ _ _____ ______ _ _ \n \\ \\ / /(_____)| ___ \\ | | | |\n \\ \\/ / _ | | | || | | |\n ) ( | | | | | || | | |\n / /\\ \\ _| |_ | | | || |___| |\n /_/ \\_\\(_____)|_| |_| \\______|\n---------------------------------------\033[0;39m\n" |
#define SHELL_BUFLEN 80 |
#define SHELL_CHILDERR "Cannot create.\n" |
#define SHELL_CMDPRIO 20 |
#define SHELL_CMDSTK 8192 |
#define SHELL_EXIT "Shell closed.\n" |
#define SHELL_MAXTOK 16 |
#define SHELL_START "Welcome to the wonderful world of XINU!\n" |
#define SHELL_SYNTAXERR "Syntax error.\n" |
short lexan | ( | char * | line, | |
ushort | linelen, | |||
char * | tokbuf, | |||
char * | tok[] | |||
) |
Ad hoc lexical analyzer to divide command line into tokens
*line | pointer to line to parse | |
linelen | length of line to parse | |
*tokbuf | buffer for tokens | |
*tok[] | array of pointers into token buffer |
Definition at line 20 of file lexan.c.
References isEndOfLine, isOtherSpecial, isQuote, isWhitespace, SHELL_MAXTOK, and SYSERR.
Referenced by shell().
process shell | ( | ushort | descrp | ) |
The XINU shell. Provides an interface to execute commands.
descrp | descriptor of device on which the shell is open |
Definition at line 40 of file shell.c.
References centry::builtin, control(), create(), FALSE, fprintf(), lexan(), centry::name, ncommand, NULL, OK, centry::procedure, read(), ready(), receive(), RESCHED_NO, RESCHED_YES, SHELL_BANNER, SHELL_BUFLEN, SHELL_CHILDERR, SHELL_CMDPRIO, SHELL_CMDSTK, SHELL_EXIT, SHELL_MAXTOK, SHELL_PROMPT, SHELL_START, SHELL_SYNTAXERR, sleep(), strcmp(), syscall, SYSERR, TRUE, TTY_IFLAG_ECHO, TTY_IOC_CBREAK, TTY_IOC_EOF, and TTY_IOC_SETIFLAG.
Referenced by main().
Shell command (exit) closes the shell.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 23 of file xsh_exit.c.
References fprintf(), getpid(), kill(), OK, SHELL_EXIT, sleep(), strncmp(), and SYSERR.
Shell command (gpiostat) provides information about the current status of the GPIO pins.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 24 of file xsh_gpiostat.c.
References gpio_csreg::control, gpio_csreg::enable, fprintf(), GPIO_BASE, GPIO_PIN_COUNT, gpio_csreg::input, OK, gpio_csreg::output, strncmp(), and SYSERR.
Shell command (help) provides a list of commands recognized by the shell, or displays help information for a particular command.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 24 of file xsh_help.c.
References commandtab, fprintf(), ncommand, OK, centry::procedure, strncmp(), and SYSERR.
Shell command (kill) terminates a process.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 24 of file xsh_kill.c.
References atol(), fprintf(), getpid(), kill(), NULLPROC, OK, sleep(), strncmp(), and SYSERR.
Shell command (led DESCRIPTOR STATE) turns a specified led on or off.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 23 of file xsh_led.c.
References fprintf(), GPIO1, GPIO_CTRL_LED_OFF, GPIO_CTRL_LED_ON, GPIO_LED_CISCOONG, GPIO_LED_CISCOWHT, GPIO_LED_DMZ, GPIO_LED_WLAN, OK, strncmp(), and SYSERR.
Shell command (gpiostat) provides memory use and free list information.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 30 of file xsh_memstat.c.
References _start(), end, fprintf(), freelist, KSEG0_BASE, memblock::length, memblock::next, NPROC, NULL, OK, PRFREE, proctab, strncmp(), and SYSERR.
Shell command (ps) outputs process table information.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 23 of file xsh_ps.c.
References fprintf(), pentry::name, NPROC, OK, pentry::parent, PRFREE, pentry::prio, proctab, pentry::state, pentry::stkbase, pentry::stklen, pentry::stkptr, strncmp(), and SYSERR.
Shell command (reset) performs a soft restart of the router.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 23 of file xsh_reset.c.
References fprintf(), GPIO_BASE, GPIO_BUT_RESET, gpio_csreg::input, OK, strncmp(), and SYSERR.
Shell command (sleep DELAY) delay for a given number of seconds.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
args | array of arguments |
Definition at line 22 of file xsh_sleep.c.
References atol(), fprintf(), OK, sleep(), strncmp(), and SYSERR.
Shell command (test) provides a mechanism for testing XINU features. The action and output varies depending on the feature currently being tested. This is not meant to serve as a permanent shell command for a particular action.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
args | array of arguments |
Definition at line 22 of file xsh_test.c.
References OK.
Shell command (testsuite) provides a menu of standard XINU component tests.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
args | array of arguments |
Definition at line 35 of file xsh_testsuite.c.
References atol(), fprintf(), NTESTS, OK, strncmp(), SYSERR, and testItem().
Shell command (uartstat UARTNUM) provides information about the current status of a UART.
stdin | descriptor of input device | |
stdout | descriptor of output device | |
stderr | descriptor of error device | |
nargs | number of arguments in args array | |
args | array of arguments |
Definition at line 28 of file xsh_uartstat.c.
References atol(), fprintf(), NUART, OK, strncmp(), SYSERR, and uartStat().
struct centry commandtab[] |
number of commands in table
Definition at line 33 of file shell.c.
Referenced by shell(), and xsh_help().