]>
git.proxmox.com Git - mirror_qemu.git/blob - include/qemu/readline.h
4 #define READLINE_CMD_BUF_SIZE 4095
5 #define READLINE_MAX_CMDS 64
6 #define READLINE_MAX_COMPLETIONS 256
8 typedef void G_GNUC_PRINTF(2, 3) ReadLinePrintfFunc(void *opaque
,
10 typedef void ReadLineFlushFunc(void *opaque
);
11 typedef void ReadLineFunc(void *opaque
, const char *str
,
12 void *readline_opaque
);
13 typedef void ReadLineCompletionFunc(void *opaque
,
16 typedef struct ReadLineState
{
17 char cmd_buf
[READLINE_CMD_BUF_SIZE
+ 1];
21 char last_cmd_buf
[READLINE_CMD_BUF_SIZE
+ 1];
22 int last_cmd_buf_index
;
23 int last_cmd_buf_size
;
28 char *history
[READLINE_MAX_CMDS
];
31 ReadLineCompletionFunc
*completion_finder
;
32 char *completions
[READLINE_MAX_COMPLETIONS
];
36 ReadLineFunc
*readline_func
;
37 void *readline_opaque
;
41 ReadLinePrintfFunc
*printf_func
;
42 ReadLineFlushFunc
*flush_func
;
46 void readline_add_completion(ReadLineState
*rs
, const char *str
);
47 void readline_add_completion_of(ReadLineState
*rs
,
48 const char *pfx
, const char *str
);
49 void readline_set_completion_index(ReadLineState
*rs
, int completion_index
);
51 const char *readline_get_history(ReadLineState
*rs
, unsigned int index
);
53 void readline_handle_byte(ReadLineState
*rs
, int ch
);
55 void readline_start(ReadLineState
*rs
, const char *prompt
, int read_password
,
56 ReadLineFunc
*readline_func
, void *readline_opaque
);
57 void readline_restart(ReadLineState
*rs
);
58 void readline_show_prompt(ReadLineState
*rs
);
60 ReadLineState
*readline_init(ReadLinePrintfFunc
*printf_func
,
61 ReadLineFlushFunc
*flush_func
,
63 ReadLineCompletionFunc
*completion_finder
);
64 void readline_free(ReadLineState
*rs
);
66 #endif /* READLINE_H */