|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| int | execv (const char *command, char *const argv[]) |
| | Execute command. More...
|
| |
| static int | split_command (char *command, char **tokens) |
| | Split command line into tokens. More...
|
| |
| static int | process_on_success (int rc) |
| | Process next command only if previous command succeeded. More...
|
| |
| static int | process_on_failure (int rc) |
| | Process next command only if previous command failed. More...
|
| |
| static int | process_always (int rc __unused) |
| | Process next command regardless of status from previous command. More...
|
| |
| static int | command_terminator (char **tokens, int(**process_next)(int rc)) |
| | Find command terminator. More...
|
| |
| void | shell_stop (int stop) |
| | Set shell stop state. More...
|
| |
| int | shell_stopped (int stop) |
| | Test and consume shell stop state. More...
|
| |
| static int | expand_tokens (int argc, char **tokens, char **argv) |
| | Expand settings within a token list. More...
|
| |
| static void | free_tokens (char **argv) |
| | Free an expanded token list. More...
|
| |
| int | system (const char *command) |
| | Execute command line. More...
|
| |
| char * | concat_args (char **args) |
| | Concatenate arguments. More...
|
| |
| static int | echo_exec (int argc, char **argv) |
| | "echo" command More...
|
| |
| | COMMAND (echo, echo_exec) |
| | "echo" command More...
|
| |
| static int | exit_exec (int argc, char **argv) |
| | "exit" command More...
|
| |
| | COMMAND (exit, exit_exec) |
| | "exit" command More...
|
| |
| static int | isset_exec (int argc, char **argv) |
| | "isset" command More...
|
| |
| | COMMAND (isset, isset_exec) |
| | "isset" command More...
|
| |
| static int | iseq_exec (int argc, char **argv) |
| | "iseq" command More...
|
| |
| | COMMAND (iseq, iseq_exec) |
| | "iseq" command More...
|
| |
| static int | sleep_exec (int argc, char **argv) |
| | "sleep" command More...
|
| |
| | COMMAND (sleep, sleep_exec) |
| | "sleep" command More...
|
| |
Command execution.
Definition in file exec.c.
| int execv |
( |
const char * |
command, |
|
|
char *const |
argv[] |
|
) |
| |
Execute command.
- Parameters
-
| command | Command name |
| argv | Argument list |
- Return values
-
Execute the named command. Unlike a traditional POSIX execv(), this function returns the exit status of the command.
Definition at line 60 of file exec.c.
66 for ( argc = 0 ; argv[argc] ; argc++ ) {}
91 rc =
cmd->exec ( argc, (
char ** ) argv );
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
int printf(const char *fmt,...)
Write a formatted string to the console.
#define ENOEXEC
Exec format error.
int errno
Global "last error" number.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
static void reset_getopt(void)
Reset getopt() internal state.
int strcmp(const char *first, const char *second)
Compare strings.
#define DBG(...)
Print a debugging message.
#define NULL
NULL pointer (VOID *)
struct bofm_section_header done
References cmd, COMMANDS, DBG, done, EINVAL, ENOEXEC, errno, for_each_table_entry, NULL, printf(), rc, reset_getopt(), and strcmp().
Referenced by system(), and time_exec().
| int system |
( |
const char * |
command | ) |
|
Execute command line.
- Parameters
-
- Return values
-
Execute the named command and arguments.
Definition at line 287 of file exec.c.
289 char *all_tokens[
count + 1 ];
290 int ( * process_next ) (
int rc );
299 if ( ! command_copy )
308 for ( tokens = all_tokens ; ; tokens += ( argc + 1 ) ) {
315 char *argv[ argc + 1 ];
336 if ( ! process_next )
344 free ( command_copy );
struct arbelprm_rc_send_wqe rc
static void free_tokens(char **argv)
Free an expanded token list.
static int expand_tokens(int argc, char **tokens, char **argv)
Expand settings within a token list.
#define ENOMEM
Not enough space.
Stop processing current command line.
static unsigned int count
Number of entries.
static void(* free)(struct refcnt *refcnt))
char * strdup(const char *src)
Duplicate string.
int shell_stopped(int stop)
Test and consume shell stop state.
static int command_terminator(char **tokens, int(**process_next)(int rc))
Find command terminator.
static int split_command(char *command, char **tokens)
Split command line into tokens.
#define NULL
NULL pointer (VOID *)
int execv(const char *command, char *const argv[])
Execute command.
References command_terminator(), count, ENOMEM, execv(), expand_tokens(), free, free_tokens(), NULL, rc, SHELL_STOP_COMMAND, shell_stopped(), split_command(), and strdup().
| char* concat_args |
( |
char ** |
args | ) |
|
Concatenate arguments.
- Parameters
-
| args | Argument list (NULL-terminated) |
- Return values
-
| string | Concatenated arguments |
The returned string is allocated with malloc(). The caller is responsible for eventually free()ing this string.
Definition at line 358 of file exec.c.
366 for ( arg = args ; *arg ; arg++ )
376 for ( arg = args ; *arg ; arg++ ) {
378 ( ( arg == args ) ?
"" :
" " ), *arg );
#define sprintf(buf, fmt,...)
Write a formatted string to a buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
void * zalloc(size_t size)
Allocate cleared memory.
size_t strlen(const char *src)
Get length of string.
#define NULL
NULL pointer (VOID *)
References assert(), len, NULL, sprintf, string, strlen(), and zalloc().
Referenced by dynui_exec(), echo_exec(), imgsingle_exec(), item_exec(), param_exec(), prompt_exec(), and set_value().