summaryrefslogtreecommitdiff
path: root/include/cli_readline.h
blob: 0ce28a5532e8be3a7baa8fda9ea474d5fac117e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * (C) Copyright 2014-2016 Leo C. <erbl259-lmu@yahoo.de>
 *
 * (C) Copyright 2014 Google, Inc
 * Simon Glass <sjg@chromium.org>
 *
 * SPDX-License-Identifier:	GPL-2.0
 */

#ifndef CLI_READLINE_H
#define CLI_READLINE_H

#include "common.h"
#include <stdbool.h>

extern char console_buffer[];	/* console I/O buffer	*/

/**
 * cli_readline() - read a line into the console_buffer
 *
 * This is a convenience function which calls cli_readline_into_buffer().
 *
 * @prompt: Prompt to display
 * @enable_history: Use history buffer if true
 * @return command line length excluding terminator, or -ve on error
 */
int cli_readline(const FLASH char *const prompt, bool enable_history);

/**
 * readline_into_buffer() - read a line into a buffer
 *
 * Display the prompt, then read a command line into @buffer. The
 * maximum line length is CONFIG_SYS_CBSIZE including a \0 terminator, which
 * will always be added.
 *
 * The command is echoed as it is typed. Command editing is supported.
 * Tab auto-complete is supported if CONFIG_AUTO_COMPLETE is defined.
 * If CONFIG_BOOT_RETRY_TIME is defined, then a timeout will be applied.
 *
 * If CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0,
 * time out when time goes past endtime (timebase time in ticks).
 *
 * @prompt:	Prompt to display
 * @buffer:	Place to put the line that is entered
 * @timeout:	Timeout in milliseconds, 0 if none
 * @return command line length excluding terminator, or -ve on error: of the
 * timeout is exceeded (either CONFIG_BOOT_RETRY_TIME or the timeout
 * parameter), then -2 is returned. If a break is detected (Ctrl-C) then
 * -1 is returned.
 */
//int cli_readline_into_buffer(const char *const prompt, char *buffer,
//			int timeout, bool enable_history);


#endif /* CLI_READLINE_H */