RTEMS 6.1-rc4
|
Instantatiate a new terminal shell. More...
#include <stdio.h>
#include <time.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/shell.h>
#include <rtems/shellconfig.h>
#include <rtems/console.h>
#include "internal.h"
#include <termios.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <pwd.h>
#include <pthread.h>
#include <assert.h>
Data Structures | |
struct | rtems_shell_env_key_handle |
Typedefs | |
typedef struct rtems_shell_env_key_handle | rtems_shell_env_key_handle |
Functions | |
void | rtems_shell_init_environment (void) |
rtems_shell_env_t * | rtems_shell_get_current_env (void) |
void | rtems_shell_dup_current_env (rtems_shell_env_t *copy) |
bool | rtems_shell_run_main_loop (rtems_shell_env_t *shell_env, bool interactive, FILE *line_editor_output) |
Runs the shell main loop. | |
bool | rtems_shell_main_loop (rtems_shell_env_t *shell_env) |
rtems_status_code | rtems_shell_init (const char *task_name, size_t task_stacksize, rtems_task_priority task_priority, const char *devname, bool forever, bool wait, rtems_shell_login_check_t login_check) |
rtems_status_code | rtems_shell_script (const char *task_name, size_t task_stacksize, rtems_task_priority task_priority, const char *input, const char *output, bool output_append, bool wait, bool echo) |
Variables | |
const rtems_shell_env_t | rtems_global_shell_env |
Instantatiate a new terminal shell.
rtems_status_code rtems_shell_init | ( | const char * | task_name, |
size_t | task_stacksize, | ||
rtems_task_priority | task_priority, | ||
const char * | devname, | ||
bool | forever, | ||
bool | wait, | ||
rtems_shell_login_check_t | login_check | ||
) |
Initialise the shell creating tasks to login and run the shell sessions.
task_name | Name of the shell task. |
task_stacksize | The size of the stack. If 0 the default size is used. |
task_priority | The priority the shell runs at. |
forever | Repeat logins. |
wait | Caller should block until shell exits. |
login_check | User login check function, NULL disables login checks. |
bool rtems_shell_run_main_loop | ( | rtems_shell_env_t * | shell_env, |
bool | interactive, | ||
FILE * | line_editor_output | ||
) |
Runs the shell main loop.
The caller shall initialize the shell environment. It is recommended that the caller duplicates the current shell environment using rtems_shell_dup_current_env() and then performs the required customization. Shell commands will use the stdin, stdout, and stderr file streams set up by the caller.
interactive | indicates if the shell main loop interfaces with an interactive user. For an interactive user, a welcome message using "/etc/motd" is presented and command prompt is displayed. | |
[in,out] | line_editor_output | is the optional line editor output file stream. It may be NULL, to disable the line editor output. |
rtems_status_code rtems_shell_script | ( | const char * | task_name, |
size_t | task_stacksize, | ||
rtems_task_priority | task_priority, | ||
const char * | input, | ||
const char * | output, | ||
bool | output_append, | ||
bool | wait, | ||
bool | echo | ||
) |
Run a shell script creating a shell tasks to execute the command under.
task_name | Name of the shell task. |
task_stacksize | The size of the stack. If 0 the default size is used. |
task_priority | The priority the shell runs at. |
input | The file of commands. Can be 'stdin' to use stdin. |
output | The output file to write commands to. Can be 'stdout', 'stderr' or '/dev/null'. |
output_append | Append the output to the file or truncate the file. Create if it does not exist. |
wait | Wait for the script to finish. |
const rtems_shell_env_t rtems_global_shell_env |