[PATCH v1 1/2] cmd: exit: add continue on key press command
Simon Glass
sjg at chromium.org
Mon Jan 23 23:25:41 CET 2023
On Mon, 23 Jan 2023 at 13:04, Svyatoslav Ryhel <clamor95 at gmail.com> wrote:
>
> This command stops performing script until any
> key is pressed. It is useful for keeping logs
> on screen until user decides to continue.
>
> Co-developed-by: Jonas Schwöbel <jonasschwoebel at yahoo.de>
> Signed-off-by: Jonas Schwöbel <jonasschwoebel at yahoo.de>
> Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
> ---
> cmd/exit.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
Please add a file in doc/usage/cmd
Also how about a test?
> diff --git a/cmd/exit.c b/cmd/exit.c
> index 7bf241ec73..673b4b6be7 100644
> --- a/cmd/exit.c
> +++ b/cmd/exit.c
> @@ -7,6 +7,17 @@
> #include <common.h>
> #include <command.h>
>
> +static int do_continue(struct cmd_tbl *cmdtp, int flag, int argc,
> + char *const argv[])
> +{
> + while (true) {
> + if (getchar())
> + break;
> + }
> +
> + return 0;
> +}
> +
> static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc,
> char *const argv[])
> {
> @@ -19,6 +30,12 @@ static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc,
> return -r - 2;
> }
>
> +U_BOOT_CMD(
> + continue, 1, 0, do_continue,
> + "continue script on key pressed",
> + ""
> +);
> +
> U_BOOT_CMD(
> exit, 2, 1, do_exit,
> "exit script",
> --
> 2.25.1
>
Regards,
Simon
More information about the U-Boot
mailing list