Age Owner Branch data TLA Line data Source code
1 : : /*
2 : : * psql - the PostgreSQL interactive terminal
3 : : *
4 : : * Copyright (c) 2000-2026, PostgreSQL Global Development Group
5 : : *
6 : : * src/bin/psql/input.h
7 : : */
8 : : #ifndef INPUT_H
9 : : #define INPUT_H
10 : :
11 : : /*
12 : : * If some other file needs to have access to readline/history, include this
13 : : * file and save yourself all this work.
14 : : *
15 : : * USE_READLINE is what to conditionalize readline-dependent code on.
16 : : */
17 : : #ifdef HAVE_LIBREADLINE
18 : : #define USE_READLINE 1
19 : :
20 : : /*
21 : : * Readline headers trigger a lot of warnings with our preferred compiler flags
22 : : * (at least -Wstrict-prototypes is known to be problematic). The system_header
23 : : * pragma hides warnings from within the rest of this file, if supported.
24 : : */
25 : : #ifdef HAVE_PRAGMA_GCC_SYSTEM_HEADER
26 : : #pragma GCC system_header
27 : : #endif
28 : :
29 : : #if defined(HAVE_READLINE_READLINE_H)
30 : : #include <readline/readline.h>
31 : : #if defined(HAVE_READLINE_HISTORY_H)
32 : : #include <readline/history.h>
33 : : #endif
34 : : #elif defined(HAVE_EDITLINE_READLINE_H)
35 : : #include <editline/readline.h>
36 : : #if defined(HAVE_EDITLINE_HISTORY_H)
37 : : #include <editline/history.h>
38 : : #endif
39 : : #elif defined(HAVE_READLINE_H)
40 : : #include <readline.h>
41 : : #if defined(HAVE_HISTORY_H)
42 : : #include <history.h>
43 : : #endif
44 : : #endif /* HAVE_READLINE_READLINE_H, etc */
45 : : #endif /* HAVE_LIBREADLINE */
46 : :
47 : : #include "pqexpbuffer.h"
48 : :
49 : :
3789 tgl@sss.pgh.pa.us 50 [ + - ]:GIC 67 : extern char *gets_interactive(const char *prompt, PQExpBuffer query_buf);
51 [ + + ]: 628233 : extern char *gets_fromFile(FILE *source);
52 : :
53 [ + - ]: 3 : extern void initializeInput(int flags);
54 : :
3789 tgl@sss.pgh.pa.us 55 [ # # ]:UIC 0 : extern bool printHistory(const char *fname, unsigned short int pager);
56 : :
3789 tgl@sss.pgh.pa.us 57 [ + - ]:GIC 61 : extern void pg_append_history(const char *s, PQExpBuffer history_buf);
58 : 292 : extern void pg_send_history(PQExpBuffer history_buf);
59 : :
60 : : #endif /* INPUT_H */
|