3
3
*
4
4
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.148 2008/05/16 17:17:00 momjian Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.149 2008/07/01 00:08:18 momjian Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
10
10
#include <sys/types.h>
11
- #ifdef USE_SSL
12
- #include <openssl/ssl.h>
13
- #endif
14
11
15
12
#ifndef WIN32
16
13
#include <unistd.h>
@@ -78,22 +75,13 @@ struct adhoc_opts
78
75
bool single_txn ;
79
76
};
80
77
81
- static int parse_version (const char * versionString );
82
78
static void parse_psql_options (int argc , char * argv [],
83
79
struct adhoc_opts * options );
84
80
static void process_psqlrc (char * argv0 );
85
81
static void process_psqlrc_file (char * filename );
86
82
static void showVersion (void );
87
83
static void EstablishVariableSpace (void );
88
84
89
- #ifdef USE_SSL
90
- static void printSSLInfo (void );
91
- #endif
92
-
93
- #ifdef WIN32
94
- static void checkWin32Codepage (void );
95
- #endif
96
-
97
85
/*
98
86
*
99
87
* main
@@ -296,49 +284,9 @@ main(int argc, char *argv[])
296
284
if (!options .no_psqlrc )
297
285
process_psqlrc (argv [0 ]);
298
286
287
+ connection_warnings ();
299
288
if (!pset .quiet && !pset .notty )
300
- {
301
- int client_ver = parse_version (PG_VERSION );
302
-
303
- if (pset .sversion != client_ver )
304
- {
305
- const char * server_version ;
306
- char server_ver_str [16 ];
307
-
308
- /* Try to get full text form, might include "devel" etc */
309
- server_version = PQparameterStatus (pset .db , "server_version" );
310
- if (!server_version )
311
- {
312
- snprintf (server_ver_str , sizeof (server_ver_str ),
313
- "%d.%d.%d" ,
314
- pset .sversion / 10000 ,
315
- (pset .sversion / 100 ) % 100 ,
316
- pset .sversion % 100 );
317
- server_version = server_ver_str ;
318
- }
319
-
320
- printf (_ ("%s (%s, server %s)\n" ),
321
- pset .progname , PG_VERSION , server_version );
322
- }
323
- else
324
- printf ("%s (%s)\n" , pset .progname , PG_VERSION );
325
-
326
- if (pset .sversion / 100 != client_ver / 100 )
327
- printf (_ ("WARNING: %s version %d.%d, server version %d.%d.\n"
328
- " Some psql features might not work.\n" ),
329
- pset .progname , client_ver / 10000 , (client_ver / 100 ) % 100 ,
330
- pset .sversion / 10000 , (pset .sversion / 100 ) % 100 );
331
-
332
- #ifdef WIN32
333
- checkWin32Codepage ();
334
- #endif
335
- #ifdef USE_SSL
336
- printSSLInfo ();
337
- #endif
338
-
339
289
printf (_ ("Type \"help\" for help.\n\n" ));
340
- }
341
-
342
290
if (!pset .notty )
343
291
initializeInput (options .no_readline ? 0 : 1 );
344
292
if (options .action_string ) /* -f - was used */
@@ -357,29 +305,6 @@ main(int argc, char *argv[])
357
305
}
358
306
359
307
360
- /*
361
- * Convert a version string into a number.
362
- */
363
- static int
364
- parse_version (const char * versionString )
365
- {
366
- int cnt ;
367
- int vmaj ,
368
- vmin ,
369
- vrev ;
370
-
371
- cnt = sscanf (versionString , "%d.%d.%d" , & vmaj , & vmin , & vrev );
372
-
373
- if (cnt < 2 )
374
- return -1 ;
375
-
376
- if (cnt == 2 )
377
- vrev = 0 ;
378
-
379
- return (100 * vmaj + vmin ) * 100 + vrev ;
380
- }
381
-
382
-
383
308
/*
384
309
* Parse command line options
385
310
*/
@@ -683,54 +608,6 @@ showVersion(void)
683
608
684
609
685
610
686
- /*
687
- * printSSLInfo
688
- *
689
- * Prints information about the current SSL connection, if SSL is in use
690
- */
691
- #ifdef USE_SSL
692
- static void
693
- printSSLInfo (void )
694
- {
695
- int sslbits = -1 ;
696
- SSL * ssl ;
697
-
698
- ssl = PQgetssl (pset .db );
699
- if (!ssl )
700
- return ; /* no SSL */
701
-
702
- SSL_get_cipher_bits (ssl , & sslbits );
703
- printf (_ ("SSL connection (cipher: %s, bits: %i)\n" ),
704
- SSL_get_cipher (ssl ), sslbits );
705
- }
706
- #endif
707
-
708
-
709
- /*
710
- * checkWin32Codepage
711
- *
712
- * Prints a warning when win32 console codepage differs from Windows codepage
713
- */
714
- #ifdef WIN32
715
- static void
716
- checkWin32Codepage (void )
717
- {
718
- unsigned int wincp ,
719
- concp ;
720
-
721
- wincp = GetACP ();
722
- concp = GetConsoleCP ();
723
- if (wincp != concp )
724
- {
725
- printf (_ ("WARNING: Console code page (%u) differs from Windows code page (%u)\n"
726
- " 8-bit characters might not work correctly. See psql reference\n"
727
- " page \"Notes for Windows users\" for details.\n" ),
728
- concp , wincp );
729
- }
730
- }
731
- #endif
732
-
733
-
734
611
/*
735
612
* Assign hooks for psql variables.
736
613
*
0 commit comments