| 1 | /* |
| 2 | * psql - the PostgreSQL interactive terminal |
| 3 | * |
| 4 | * Copyright (c) 2000-2019, 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 | #if defined(HAVE_READLINE_READLINE_H) |
| 21 | #include <readline/readline.h> |
| 22 | #if defined(HAVE_READLINE_HISTORY_H) |
| 23 | #include <readline/history.h> |
| 24 | #endif |
| 25 | #elif defined(HAVE_EDITLINE_READLINE_H) |
| 26 | #include <editline/readline.h> |
| 27 | #if defined(HAVE_EDITLINE_HISTORY_H) |
| 28 | #include <editline/history.h> |
| 29 | #endif |
| 30 | #elif defined(HAVE_READLINE_H) |
| 31 | #include <readline.h> |
| 32 | #if defined(HAVE_HISTORY_H) |
| 33 | #include <history.h> |
| 34 | #endif |
| 35 | #endif /* HAVE_READLINE_READLINE_H, etc */ |
| 36 | #endif /* HAVE_LIBREADLINE */ |
| 37 | |
| 38 | #include "pqexpbuffer.h" |
| 39 | |
| 40 | |
| 41 | extern char *gets_interactive(const char *prompt, PQExpBuffer query_buf); |
| 42 | extern char *gets_fromFile(FILE *source); |
| 43 | |
| 44 | extern void initializeInput(int flags); |
| 45 | |
| 46 | extern bool printHistory(const char *fname, unsigned short int ); |
| 47 | |
| 48 | extern void pg_append_history(const char *s, PQExpBuffer history_buf); |
| 49 | extern void pg_send_history(PQExpBuffer history_buf); |
| 50 | |
| 51 | #endif /* INPUT_H */ |
| 52 | |