]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de> | |
3 | * | |
4 | * (C) Copyright 2014 Google, Inc | |
5 | * Simon Glass <sjg@chromium.org> | |
6 | * | |
7 | * SPDX-License-Identifier: GPL-2.0 | |
8 | */ | |
9 | ||
10 | #ifndef CLI_READLINE_H | |
11 | #define CLI_READLINE_H | |
12 | ||
13 | #include "common.h" | |
14 | #include <stdbool.h> | |
15 | ||
16 | extern char console_buffer[]; /* console I/O buffer */ | |
17 | ||
18 | /** | |
19 | * cli_readline() - read a line into the console_buffer | |
20 | * | |
21 | * This is a convenience function which calls cli_readline_into_buffer(). | |
22 | * | |
23 | * @prompt: Prompt to display | |
24 | * @enable_history: Use history buffer if true | |
25 | * @return command line length excluding terminator, or -ve on error | |
26 | */ | |
27 | int cli_readline(const FLASH char *const prompt, bool enable_history); | |
28 | ||
29 | /** | |
30 | * readline_into_buffer() - read a line into a buffer | |
31 | * | |
32 | * Display the prompt, then read a command line into @buffer. The | |
33 | * maximum line length is CONFIG_SYS_CBSIZE including a \0 terminator, which | |
34 | * will always be added. | |
35 | * | |
36 | * The command is echoed as it is typed. Command editing is supported. | |
37 | * Tab auto-complete is supported if CONFIG_AUTO_COMPLETE is defined. | |
38 | * If CONFIG_BOOT_RETRY_TIME is defined, then a timeout will be applied. | |
39 | * | |
40 | * If CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0, | |
41 | * time out when time goes past endtime (timebase time in ticks). | |
42 | * | |
43 | * @prompt: Prompt to display | |
44 | * @buffer: Place to put the line that is entered | |
45 | * @timeout: Timeout in milliseconds, 0 if none | |
46 | * @return command line length excluding terminator, or -ve on error: of the | |
47 | * timeout is exceeded (either CONFIG_BOOT_RETRY_TIME or the timeout | |
48 | * parameter), then -2 is returned. If a break is detected (Ctrl-C) then | |
49 | * -1 is returned. | |
50 | */ | |
51 | //int cli_readline_into_buffer(const char *const prompt, char *buffer, | |
52 | // int timeout, bool enable_history); | |
53 | ||
54 | ||
55 | #endif /* CLI_READLINE_H */ |