mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 10:26:10 +01: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:
		| @@ -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 | ||||
|  * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user