LwSHELL
- group LWSHELL
Lightweight shell.
Defines
-
LWSHELL_ARRAYSIZE(x)
Get size of statically allocated array.
- Parameters
x – [in] Object to get array size of
- Returns
Number of elements in array
-
lwshell_parse_int(str)
Parse input string as
integer
- Parameters
str – [in] String to parse
- Returns
String parsed as integer
-
lwshell_parse_double(str)
Parse input string as
double
- Parameters
str – [in] String to parse
- Returns
String parsed as
double
-
lwshell_parse_long(str)
Parse input string as
long
- Parameters
str – [in] String to parse
- Returns
String parsed as
long
-
lwshell_parse_long_long(str)
Parse input string as
long long
- Parameters
str – [in] String to parse
- Returns
String parsed as
long long
Typedefs
-
typedef int32_t (*lwshell_cmd_fn)(int32_t argc, char **argv)
Command function prototype.
- Param argc
[in] Number of arguments
- Param argv
[in] Pointer to arguments
- Return
0
on success,-1
otherwise
-
typedef void (*lwshell_output_fn)(const char *str, struct lwshell *lw)
Callback function for character output.
- Param str
[in] String to output
- Param lw
[in] LwSHELL instance
Enums
Functions
-
lwshellr_t lwshell_init(void)
Initialize shell interface.
- Returns
lwshellOK on success, member of lwshellr_t otherwise
-
lwshellr_t lwshell_set_output_fn(lwshell_output_fn out_fn)
Set output function to use to print data from library to user.
- Parameters
out_fn – [in] Output function to print library data. Set to
NULL
to disable the feature- Returns
lwshellOK on success, member of lwshellr_t otherwise
-
lwshellr_t lwshell_register_cmd(const char *cmd_name, lwshell_cmd_fn cmd_fn, const char *desc)
Register new command to shell.
- Parameters
cmd_name – [in] Command name. This one is used when entering shell command
cmd_fn – [in] Function to call on command match
desc – [in] Custom command description
- Returns
lwshellOK on success, member of lwshellr_t otherwise
-
lwshellr_t lwshell_input(const void *in_data, size_t len)
Input data to shell processing.
- Parameters
in_data – [in] Input data to process
len – [in] Length of data for input
- Returns
lwshellOK on success, member of lwshellr_t otherwise
-
struct lwshell_t
- #include <lwshell.h>
LwSHELL main structure.
-
LWSHELL_ARRAYSIZE(x)