summaryrefslogtreecommitdiff
path: root/mysql-client/mysql/downstream/readline.h
blob: 15402001f281bb1589b9c68a41c8bdb01dd096a9 (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
56
57
58
59
/* file      : mysql/downstream/readline.h
 * license   : GPLv2 with Universal FOSS Exception; see accompanying LICENSE file
 */

#ifndef MYSQL_DOWNSTREAM_READLINE_H
#define MYSQL_DOWNSTREAM_READLINE_H

/*
 * Reduced implementation of the libedit library based on libisocline.
 *
 * Specially, only the basic line editing functionality is supported (no
 * completion, history, etc).
 */
#ifdef __cplusplus
extern "C" {
#endif

/*
 * Thin wrapper around libisocline's ic_readline().
 */
char*
readline (const char* prompt);

/*
 * Reading function stubs.
 */
typedef char** rl_completion_func_t (const char*, int, int);
typedef char*  rl_compentry_func_t (const char*, int);
typedef int    rl_command_func_t (int, int);
typedef char*  rl_compentry_func_t (const char*, int);

int    rl_insert (int, int);
int    rl_add_defun (const char*, rl_command_func_t*, int);
char** rl_completion_matches (const char*, rl_compentry_func_t*);

extern char*                 rl_readline_name;
extern rl_completion_func_t* rl_attempted_completion_function;
extern rl_compentry_func_t*  rl_completion_entry_function;

/*
 * Hstory function stubs.
 */
typedef struct _hist_entry {
  const char *line;
  const char *data;
} HIST_ENTRY;

int         add_history (const char*);
int         read_history (const char*);
int         write_history (const char*);
HIST_ENTRY* history_get (int);

extern int history_length;

#ifdef __cplusplus
}
#endif

#endif /* MYSQL_DOWNSTREAM_READLINE_H */