]> Git Repo - qemu.git/blob - include/qemu/readline.h
Merge remote-tracking branch 'otubo/seccomp' into staging
[qemu.git] / include / qemu / readline.h
1 #ifndef READLINE_H
2 #define READLINE_H
3
4 #define READLINE_CMD_BUF_SIZE 4095
5 #define READLINE_MAX_CMDS 64
6 #define READLINE_MAX_COMPLETIONS 256
7
8 typedef void ReadLinePrintfFunc(void *opaque, const char *fmt, ...);
9 typedef void ReadLineFlushFunc(void *opaque);
10 typedef void ReadLineFunc(void *opaque, const char *str,
11                           void *readline_opaque);
12 typedef void ReadLineCompletionFunc(void *opaque,
13                                     const char *cmdline);
14
15 typedef struct ReadLineState {
16     char cmd_buf[READLINE_CMD_BUF_SIZE + 1];
17     int cmd_buf_index;
18     int cmd_buf_size;
19
20     char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1];
21     int last_cmd_buf_index;
22     int last_cmd_buf_size;
23
24     int esc_state;
25     int esc_param;
26
27     char *history[READLINE_MAX_CMDS];
28     int hist_entry;
29
30     ReadLineCompletionFunc *completion_finder;
31     char *completions[READLINE_MAX_COMPLETIONS];
32     int nb_completions;
33     int completion_index;
34
35     ReadLineFunc *readline_func;
36     void *readline_opaque;
37     int read_password;
38     char prompt[256];
39
40     ReadLinePrintfFunc *printf_func;
41     ReadLineFlushFunc *flush_func;
42     void *opaque;
43 } ReadLineState;
44
45 void readline_add_completion(ReadLineState *rs, const char *str);
46 void readline_set_completion_index(ReadLineState *rs, int completion_index);
47
48 const char *readline_get_history(ReadLineState *rs, unsigned int index);
49
50 void readline_handle_byte(ReadLineState *rs, int ch);
51
52 void readline_start(ReadLineState *rs, const char *prompt, int read_password,
53                     ReadLineFunc *readline_func, void *readline_opaque);
54 void readline_restart(ReadLineState *rs);
55 void readline_show_prompt(ReadLineState *rs);
56
57 ReadLineState *readline_init(ReadLinePrintfFunc *printf_func,
58                              ReadLineFlushFunc *flush_func,
59                              void *opaque,
60                              ReadLineCompletionFunc *completion_finder);
61
62 #endif /* !READLINE_H */
This page took 0.036423 seconds and 4 git commands to generate.