1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 01:32:47 +02:00

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>
This commit is contained in:
Simon Glass
2023-10-01 19:13:11 -06:00
committed by Tom Rini
parent fedd372976
commit be5c2edd10
2 changed files with 75 additions and 55 deletions

View File

@@ -8,6 +8,7 @@
#define __CLI_H
#include <stdbool.h>
#include <linux/types.h>
/**
* struct cli_ch_state - state information for reading cmdline characters
@@ -24,6 +25,19 @@ struct cli_ch_state {
bool emitting;
};
/**
* 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
*