diff options
author | Simon Glass | 2023-10-01 19:13:11 -0600 |
---|---|---|
committer | Tom Rini | 2023-10-11 15:43:54 -0400 |
commit | be5c2edd10cc0c5c1b938fc03bc7e7c35801a0bd (patch) | |
tree | 4477b6b420aba2946cbe9f12335c2f6c3a65a5e1 /include/cli.h | |
parent | fedd372976f499afb71f854f401cf3a4432ab8ec (diff) |
cli: Convert cread_line() to use a struct for the main vars
We want to reuse the editing code elsewhere. As a first step, move the
common variables into a struct. This will allow us to eventually put the
contents of the inner loop in a function, so it can be called from
elsewhere.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/cli.h')
-rw-r--r-- | include/cli.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/cli.h b/include/cli.h index ac09c80c784..1bc1ab8035c 100644 --- a/include/cli.h +++ b/include/cli.h @@ -8,6 +8,7 @@ #define __CLI_H #include <stdbool.h> +#include <linux/types.h> /** * struct cli_ch_state - state information for reading cmdline characters @@ -25,6 +26,19 @@ struct cli_ch_state { }; /** + * struct cli_line_state - state of the line editor + * + * @num: Current cursor position, where 0 is the start + * @eol_num: Number of characters in the buffer + * @insert: true if in 'insert' mode + */ +struct cli_line_state { + uint num; + uint eol_num; + bool insert; +}; + +/** * Go into the command loop * * This will return if we get a timeout waiting for a command. See |