|
CardSight 0.1.0
C API reference for the CardSight firmware and application
|
The command line on the console: commands are registered in a linker section, the shell splits a line and calls the matching one. More...
Go to the source code of this file.
Data Structures | |
| struct | shell_cmd |
| One command registered in the .shell_cmd linker section. More... | |
Macros | |
| #define | SHELL_CMD(name, help, fn) |
| Register a shell command. | |
Functions | |
| int | shell_exec (char *line) |
| Run a command line. | |
The command line on the console: commands are registered in a linker section, the shell splits a line and calls the matching one.
| #define SHELL_CMD | ( | name, | |
| help, | |||
| fn ) |
Register a shell command.
Places a static struct shell_cmd in the .shell_cmd section, keeps it despite not being referenced, and uses name both as the command word and as the symbol suffix.
| name | Command word, e.g. mycmd. |
| help | One-line description shown by the help command. |
| fn | Handler with the signature int fn(int argc, char **argv). |
| int shell_exec | ( | char * | line | ) |
Run a command line.
Splits line at spaces and tabs in place, at most eight words, then calls the command whose name matches the first word. An unknown command prints a hint and returns -1.
| [in,out] | line | NUL-terminated line; modified by the splitting. |