#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
#include <gpxe/command.h>
#include <gpxe/shell.h>
Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static int | exit_exec (int argc, char **argv __unused) |
| "exit" command body | |
| static int | help_exec (int argc __unused, char **argv __unused) |
| "help" command body | |
| void | shell (void) |
| Start command shell. | |
Variables | |
| static const char | shell_prompt [] = "gPXE> " |
| The shell prompt string. | |
| static int | exit_flag = 0 |
| Flag set in order to exit shell. | |
| struct command exit_command | __command |
| "exit" command definition | |
Definition in file shell.c.
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static int exit_exec | ( | int | argc, | |
| char **argv | __unused | |||
| ) | [static] |
| static int help_exec | ( | int argc | __unused, | |
| char **argv | __unused | |||
| ) | [static] |
"help" command body
Definition at line 60 of file shell.c.
References COMMANDS, for_each_table_entry, command::name, and printf().
00060 { 00061 struct command *command; 00062 unsigned int hpos = 0; 00063 00064 printf ( "\nAvailable commands:\n\n" ); 00065 for_each_table_entry ( command, COMMANDS ) { 00066 hpos += printf ( " %s", command->name ); 00067 if ( hpos > ( 16 * 4 ) ) { 00068 printf ( "\n" ); 00069 hpos = 0; 00070 } else { 00071 while ( hpos % 16 ) { 00072 printf ( " " ); 00073 hpos++; 00074 } 00075 } 00076 } 00077 printf ( "\n\nType \"<command> --help\" for further information\n\n" ); 00078 return 0; 00079 }
| void shell | ( | void | ) |
Start command shell.
Definition at line 91 of file shell.c.
References exit_flag, free(), readline(), shell_prompt, and system().
Referenced by main().
00091 { 00092 char *line; 00093 00094 exit_flag = 0; 00095 while ( ! exit_flag ) { 00096 line = readline ( shell_prompt ); 00097 if ( line ) { 00098 system ( line ); 00099 free ( line ); 00100 } 00101 } 00102 }
const char shell_prompt[] = "gPXE> " [static] |
int exit_flag = 0 [static] |
Flag set in order to exit shell.
Definition at line 38 of file shell.c.
Referenced by exit_exec(), and shell().
1.5.7.1