forked from bitcoin-core/btcdeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kerl.h
77 lines (68 loc) · 2.65 KB
/
kerl.h
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* This is improved by using the ax_lib_readline.m4 macro with automake.
To compile directly use -DNO_AUTOMAKE in call to gcc. */
#ifndef included_kerl_h_
#define included_kerl_h_
#ifdef HAVE_CONFIG_H
// TODO: fix this weird dependency
# include <config/bitcoin-config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <stdlib.h>
#include <string.h>
#ifdef NO_AUTOMAKE
# include <readline/readline.h>
# include <readline/history.h>
# define HAVE_LIBREADLINE
# define HAVE_READLINE_HISTORY
#else
# ifdef HAVE_LIBREADLINE
# if defined(HAVE_READLINE_READLINE_H)
# include <readline/readline.h>
# elif defined(HAVE_READLINE_H)
# include <readline.h>
# else /* !defined(HAVE_READLINE_H) */
char *readline ();
# endif /* !defined(HAVE_READLINE_H) */
extern char *cmdline;
# else /* !defined(HAVE_READLINE_READLINE_H) */
/* no readline */
# endif /* HAVE_LIBREADLINE */
# ifdef HAVE_READLINE_HISTORY
# if defined(HAVE_READLINE_HISTORY_H)
# include <readline/history.h>
# elif defined(HAVE_HISTORY_H)
# include <history.h>
# else /* !defined(HAVE_HISTORY_H) */
extern void add_history ();
extern int write_history ();
extern int read_history ();
# endif /* defined(HAVE_READLINE_HISTORY_H) */
/* no history */
# endif /* HAVE_READLINE_HISTORY */
#endif
typedef int (*kerl_bindable) (const char *arg);
typedef char *(*kerl_completor)(const char *text, int continued);
void kerl_register(const char *name, kerl_bindable func, const char *doc);
void kerl_register_help(const char *name);
void kerl_set_completor(const char *name, kerl_completor completor, int multi);
void kerl_run(const char *prompt);
void kerl_set_history_file(const char *path);
void kerl_set_repeat_on_empty(int flag);
void kerl_set_comment_char(char commentchar);
void kerl_register_fallback(kerl_bindable func);
int kerl_make_argcv(const char* argstring, size_t *argcOut, char*** argvOut);
int kerl_make_argcv_escape(const char* argstring, size_t *argcOut, char*** argvOut, char escape);
void kerl_free_argcv(size_t argc, char **argv);
int kerl_process_citation(const char* argstring, size_t* bytesOut, char** argsOut);
int kerl_more(size_t* capacity, size_t* position, char** argsOut, const char terminator);
/* sensitivity is used to skip certain inputs as sensitive, such as
password data or similar. enabling sensitivity incurs a slight
performance loss due to extra copying of strings */
void kerl_set_sensitive(int do_not_store_history);
void kerl_set_enable_sensitivity();
void kerl_set_enable_whitespaced_sensitivity();
#endif // included_kerl_h_