aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/settings.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/settings.h')
-rw-r--r--src/bin/psql/settings.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h
new file mode 100644
index 00000000000..6ceefd8b44f
--- /dev/null
+++ b/src/bin/psql/settings.h
@@ -0,0 +1,57 @@
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <libpq-fe.h>
+#include <c.h>
+
+#include "variables.h"
+#include "print.h"
+
+#define DEFAULT_FIELD_SEP "|"
+#define DEFAULT_EDITOR "/bin/vi"
+
+#define DEFAULT_PROMPT1 "%/%R%# "
+#define DEFAULT_PROMPT2 "%/%R%# "
+#define DEFAULT_PROMPT3 ">> "
+
+
+typedef struct _psqlSettings
+{
+ PGconn *db; /* connection to backend */
+ FILE *queryFout; /* where to send the query results */
+ bool queryFoutPipe; /* queryFout is from a popen() */
+
+ printQueryOpt popt;
+ VariableSpace vars; /* "shell variable" repository */
+
+ char *gfname; /* one-shot file output argument for \g */
+
+ bool notty; /* stdin or stdout is not a tty (as determined on startup) */
+ bool useReadline; /* use libreadline routines */
+ bool useHistory;
+ bool getPassword; /* prompt the user for a username and
+ password */
+ FILE * cur_cmd_source; /* describe the status of the current main loop */
+ bool cur_cmd_interactive;
+
+ bool has_client_encoding; /* was PGCLIENTENCODING set on startup? */
+} PsqlSettings;
+
+
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
+
+#define EXIT_BADCONN 2
+
+#define EXIT_USER 3
+
+#endif