aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r--src/bin/psql/startup.c127
1 files changed, 2 insertions, 125 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 17fdeb7288a..8f249e90570 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,14 +3,11 @@
*
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.148 2008/05/16 17:17:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.149 2008/07/01 00:08:18 momjian Exp $
*/
#include "postgres_fe.h"
#include <sys/types.h>
-#ifdef USE_SSL
-#include <openssl/ssl.h>
-#endif
#ifndef WIN32
#include <unistd.h>
@@ -78,7 +75,6 @@ struct adhoc_opts
bool single_txn;
};
-static int parse_version(const char *versionString);
static void parse_psql_options(int argc, char *argv[],
struct adhoc_opts * options);
static void process_psqlrc(char *argv0);
@@ -86,14 +82,6 @@ static void process_psqlrc_file(char *filename);
static void showVersion(void);
static void EstablishVariableSpace(void);
-#ifdef USE_SSL
-static void printSSLInfo(void);
-#endif
-
-#ifdef WIN32
-static void checkWin32Codepage(void);
-#endif
-
/*
*
* main
@@ -296,49 +284,9 @@ main(int argc, char *argv[])
if (!options.no_psqlrc)
process_psqlrc(argv[0]);
+ connection_warnings();
if (!pset.quiet && !pset.notty)
- {
- int client_ver = parse_version(PG_VERSION);
-
- if (pset.sversion != client_ver)
- {
- const char *server_version;
- char server_ver_str[16];
-
- /* Try to get full text form, might include "devel" etc */
- server_version = PQparameterStatus(pset.db, "server_version");
- if (!server_version)
- {
- snprintf(server_ver_str, sizeof(server_ver_str),
- "%d.%d.%d",
- pset.sversion / 10000,
- (pset.sversion / 100) % 100,
- pset.sversion % 100);
- server_version = server_ver_str;
- }
-
- printf(_("%s (%s, server %s)\n"),
- pset.progname, PG_VERSION, server_version);
- }
- else
- printf("%s (%s)\n", pset.progname, PG_VERSION);
-
- if (pset.sversion / 100 != client_ver / 100)
- printf(_("WARNING: %s version %d.%d, server version %d.%d.\n"
- " Some psql features might not work.\n"),
- pset.progname, client_ver / 10000, (client_ver / 100) % 100,
- pset.sversion / 10000, (pset.sversion / 100) % 100);
-
-#ifdef WIN32
- checkWin32Codepage();
-#endif
-#ifdef USE_SSL
- printSSLInfo();
-#endif
-
printf(_("Type \"help\" for help.\n\n"));
- }
-
if (!pset.notty)
initializeInput(options.no_readline ? 0 : 1);
if (options.action_string) /* -f - was used */
@@ -358,29 +306,6 @@ main(int argc, char *argv[])
/*
- * Convert a version string into a number.
- */
-static int
-parse_version(const char *versionString)
-{
- int cnt;
- int vmaj,
- vmin,
- vrev;
-
- cnt = sscanf(versionString, "%d.%d.%d", &vmaj, &vmin, &vrev);
-
- if (cnt < 2)
- return -1;
-
- if (cnt == 2)
- vrev = 0;
-
- return (100 * vmaj + vmin) * 100 + vrev;
-}
-
-
-/*
* Parse command line options
*/
@@ -684,54 +609,6 @@ showVersion(void)
/*
- * printSSLInfo
- *
- * Prints information about the current SSL connection, if SSL is in use
- */
-#ifdef USE_SSL
-static void
-printSSLInfo(void)
-{
- int sslbits = -1;
- SSL *ssl;
-
- ssl = PQgetssl(pset.db);
- if (!ssl)
- return; /* no SSL */
-
- SSL_get_cipher_bits(ssl, &sslbits);
- printf(_("SSL connection (cipher: %s, bits: %i)\n"),
- SSL_get_cipher(ssl), sslbits);
-}
-#endif
-
-
-/*
- * checkWin32Codepage
- *
- * Prints a warning when win32 console codepage differs from Windows codepage
- */
-#ifdef WIN32
-static void
-checkWin32Codepage(void)
-{
- unsigned int wincp,
- concp;
-
- wincp = GetACP();
- concp = GetConsoleCP();
- if (wincp != concp)
- {
- printf(_("WARNING: Console code page (%u) differs from Windows code page (%u)\n"
- " 8-bit characters might not work correctly. See psql reference\n"
- " page \"Notes for Windows users\" for details.\n"),
- concp, wincp);
- }
-}
-#endif
-
-
-/*
* Assign hooks for psql variables.
*
* This isn't an amazingly good place for them, but neither is anywhere else.