1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2021
4 * Samuel Dionne-Riel <samuel@dionne-riel.com>
5 */
6
7#include <command.h>
8#include <stdio.h>
9
10static int do_pause(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
11{
12	char *message = "Press any key to continue...";
13
14	if (argc == 2)
15		message = argv[1];
16
17	/* No newline, so it sticks to the bottom of the screen */
18	printf("%s", message);
19
20	/* Wait on "any" key... */
21	(void) getchar();
22
23	/* Since there was no newline, we need it now */
24	printf("\n");
25
26	return CMD_RET_SUCCESS;
27}
28
29U_BOOT_CMD(pause, 2, 1, do_pause,
30	"delay until user input",
31	"[prompt] - Wait until users presses any key. [prompt] can be used to customize the message.\n"
32);
33