root / readline.h @ 68f6dc7e
History | View | Annotate | Download (1.5 kB)
1 | 376253ec | aliguori | #ifndef READLINE_H
|
---|---|---|---|
2 | 376253ec | aliguori | #define READLINE_H
|
3 | 376253ec | aliguori | |
4 | 376253ec | aliguori | #include "qemu-common.h" |
5 | 376253ec | aliguori | |
6 | 4c36ba32 | aliguori | #define READLINE_CMD_BUF_SIZE 4095 |
7 | 4c36ba32 | aliguori | #define READLINE_MAX_CMDS 64 |
8 | 4c36ba32 | aliguori | #define READLINE_MAX_COMPLETIONS 256 |
9 | 4c36ba32 | aliguori | |
10 | 376253ec | aliguori | typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque); |
11 | 4c36ba32 | aliguori | typedef void ReadLineCompletionFunc(const char *cmdline); |
12 | 4c36ba32 | aliguori | |
13 | 4c36ba32 | aliguori | typedef struct ReadLineState { |
14 | 4c36ba32 | aliguori | char cmd_buf[READLINE_CMD_BUF_SIZE + 1]; |
15 | 4c36ba32 | aliguori | int cmd_buf_index;
|
16 | 4c36ba32 | aliguori | int cmd_buf_size;
|
17 | 4c36ba32 | aliguori | |
18 | 4c36ba32 | aliguori | char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1]; |
19 | 4c36ba32 | aliguori | int last_cmd_buf_index;
|
20 | 4c36ba32 | aliguori | int last_cmd_buf_size;
|
21 | 4c36ba32 | aliguori | |
22 | 4c36ba32 | aliguori | int esc_state;
|
23 | 4c36ba32 | aliguori | int esc_param;
|
24 | 376253ec | aliguori | |
25 | 4c36ba32 | aliguori | char *history[READLINE_MAX_CMDS];
|
26 | 4c36ba32 | aliguori | int hist_entry;
|
27 | 376253ec | aliguori | |
28 | 4c36ba32 | aliguori | ReadLineCompletionFunc *completion_finder; |
29 | 4c36ba32 | aliguori | char *completions[READLINE_MAX_COMPLETIONS];
|
30 | 4c36ba32 | aliguori | int nb_completions;
|
31 | 4c36ba32 | aliguori | int completion_index;
|
32 | 376253ec | aliguori | |
33 | 4c36ba32 | aliguori | ReadLineFunc *readline_func; |
34 | 4c36ba32 | aliguori | void *readline_opaque;
|
35 | 4c36ba32 | aliguori | int read_password;
|
36 | 4c36ba32 | aliguori | char prompt[256]; |
37 | 4c36ba32 | aliguori | Monitor *mon; |
38 | 4c36ba32 | aliguori | } ReadLineState; |
39 | 376253ec | aliguori | |
40 | 4c36ba32 | aliguori | void readline_add_completion(ReadLineState *rs, const char *str); |
41 | 4c36ba32 | aliguori | void readline_set_completion_index(ReadLineState *rs, int completion_index); |
42 | 4c36ba32 | aliguori | |
43 | 4c36ba32 | aliguori | const char *readline_get_history(ReadLineState *rs, unsigned int index); |
44 | 4c36ba32 | aliguori | |
45 | 4c36ba32 | aliguori | void readline_handle_byte(ReadLineState *rs, int ch); |
46 | 4c36ba32 | aliguori | |
47 | 4c36ba32 | aliguori | void readline_start(ReadLineState *rs, const char *prompt, int read_password, |
48 | 376253ec | aliguori | ReadLineFunc *readline_func, void *opaque);
|
49 | 2724b180 | aliguori | void readline_restart(ReadLineState *rs);
|
50 | 4c36ba32 | aliguori | void readline_show_prompt(ReadLineState *rs);
|
51 | 4c36ba32 | aliguori | |
52 | 4c36ba32 | aliguori | ReadLineState *readline_init(Monitor *mon, |
53 | 4c36ba32 | aliguori | ReadLineCompletionFunc *completion_finder); |
54 | 376253ec | aliguori | |
55 | 376253ec | aliguori | #endif /* !READLINE_H */ |