summaryrefslogtreecommitdiffstats
path: root/src/bin/psql/input.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
commit293913568e6a7a86fd1479e1cff8e2ecb58d6568 (patch)
treefc3b469a3ec5ab71b36ea97cc7aaddb838423a0c /src/bin/psql/input.h
parentInitial commit. (diff)
downloadpostgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.tar.xz
postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.zip
Adding upstream version 16.2.upstream/16.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/psql/input.h')
-rw-r--r--src/bin/psql/input.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/bin/psql/input.h b/src/bin/psql/input.h
new file mode 100644
index 0000000..ca948f3
--- /dev/null
+++ b/src/bin/psql/input.h
@@ -0,0 +1,51 @@
+/*
+ * psql - the PostgreSQL interactive terminal
+ *
+ * Copyright (c) 2000-2023, PostgreSQL Global Development Group
+ *
+ * src/bin/psql/input.h
+ */
+#ifndef INPUT_H
+#define INPUT_H
+
+/*
+ * If some other file needs to have access to readline/history, include this
+ * file and save yourself all this work.
+ *
+ * USE_READLINE is what to conditionalize readline-dependent code on.
+ */
+#ifdef HAVE_LIBREADLINE
+#define USE_READLINE 1
+
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#if defined(HAVE_READLINE_HISTORY_H)
+#include <readline/history.h>
+#endif
+#elif defined(HAVE_EDITLINE_READLINE_H)
+#include <editline/readline.h>
+#if defined(HAVE_EDITLINE_HISTORY_H)
+#include <editline/history.h>
+#endif
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#if defined(HAVE_HISTORY_H)
+#include <history.h>
+#endif
+#endif /* HAVE_READLINE_READLINE_H, etc */
+#endif /* HAVE_LIBREADLINE */
+
+#include "pqexpbuffer.h"
+
+
+extern char *gets_interactive(const char *prompt, PQExpBuffer query_buf);
+extern char *gets_fromFile(FILE *source);
+
+extern void initializeInput(int flags);
+
+extern bool printHistory(const char *fname, unsigned short int pager);
+
+extern void pg_append_history(const char *s, PQExpBuffer history_buf);
+extern void pg_send_history(PQExpBuffer history_buf);
+
+#endif /* INPUT_H */