Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: Patch to ch...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 47 of 55 Topic 3628 of 4098
Post > Topic >>

Re: Patch to change psql default banner v6

by bruce@[EMAIL PROTECTED] (Bruce Momjian) May 15, 2008 at 03:21 PM

--ELM1210879297-23997-1_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="US-ASCII"

Alvaro Herrera wrote:
> 
> I'm OK with thisG but please move the printSSLInfo() call just before
> echoing the help line.

Oh, good catch, moved.  I also moved the Win32 code page message up too.
Patch attached.

I hacked up an example that shows both SSL and Win32 code page messages:

	$ psql test
	psql (8.4devel)
	        SSL connection (cipher: 2343, bits: 512)
	        WARNING: Console code page (323) differs from Windows code page
(2323)
	                 8-bit characters might not work correctly. See psql
reference
	                 page "Notes for Windows users" for details.
	Type "help" for help.
	
	test=>

With major version mismatches it looks like this:

	$ psql test
	psql (8.4devel)
	        SSL connection (cipher: 2343, bits: 512)
	        WARNING: Console code page (323) differs from Windows code page
(2323)
	                 8-bit characters might not work correctly. See psql
reference
	                 page "Notes for Windows users" for details.
		WARNING: psql version 8.4.0, server version 8.3.1.
			 Some psql features might not work.
	Type "help" for help.
	
	test=>

By indenting those messages the 'help' message still stands out. 
Adjustments?

-- 
  Bruce Momjian  <bruce@[EMAIL PROTECTED]
>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

--ELM1210879297-23997-1_
Content-Transfer-Encoding: 7bit
Content-Type: text/x-diff
Content-Disposition: inline; filename="/pgpatches/help"

Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/help.c,v
retrieving revision 1.127
diff -c -c -r1.127 help.c
*** src/bin/psql/help.c	14 May 2008 15:30:22 -0000	1.127
--- src/bin/psql/help.c	15 May 2008 19:17:27 -0000
***************
*** 170,182 ****
  	 */
  	fprintf(output, _("General\n"));
  	fprintf(output, _("  \\copyright     show PostgreSQL usage and
distribution terms\n"));
  	fprintf(output, _("  \\h [NAME]      help on syntax of SQL commands, *
for all commands\n"));
  	fprintf(output, _("  \\q             quit psql\n"));
  	fprintf(output, "\n");
  
  	fprintf(output, _("Query Buffer\n"));
  	fprintf(output, _("  \\e [FILE]      edit the query buffer (or file)
with external editor\n"));
- 	fprintf(output, _("  \\g [FILE]      send query buffer to server (and
results to file or |pipe)\n"));
  	fprintf(output, _("  \\p             show the contents of the query
buffer\n"));
  	fprintf(output, _("  \\r             reset (clear) the query
buffer\n"));
  #ifdef USE_READLINE
--- 170,182 ----
  	 */
  	fprintf(output, _("General\n"));
  	fprintf(output, _("  \\copyright     show PostgreSQL usage and
distribution terms\n"));
+ 	fprintf(output, _("  \\g [FILE] or ; execute query (and send results to
file or |pipe)\n"));
  	fprintf(output, _("  \\h [NAME]      help on syntax of SQL commands, *
for all commands\n"));
  	fprintf(output, _("  \\q             quit psql\n"));
  	fprintf(output, "\n");
  
  	fprintf(output, _("Query Buffer\n"));
  	fprintf(output, _("  \\e [FILE]      edit the query buffer (or file)
with external editor\n"));
  	fprintf(output, _("  \\p             show the contents of the query
buffer\n"));
  	fprintf(output, _("  \\r             reset (clear) the query
buffer\n"));
  #ifdef USE_READLINE
Index: src/bin/psql/mainloop.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/mainloop.c,v
retrieving revision 1.90
diff -c -c -r1.90 mainloop.c
*** src/bin/psql/mainloop.c	5 Apr 2008 03:40:15 -0000	1.90
--- src/bin/psql/mainloop.c	15 May 2008 19:17:27 -0000
***************
*** 177,186 ****
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char)
line[4])))
  		{
  			free(line);
! 			puts(_("You are using psql, the command-line interface to
PostgreSQL."));
! 			puts(_("Enter SQL commands, or type \\? for a list of backslash
options."));
! 			puts(_("Use \\h for SQL command help."));
! 			puts(_("Use \\q to quit."));
  			fflush(stdout);
  			continue;
  		}
--- 177,189 ----
  			(line[4] == '\0' || line[4] == ';' || isspace((unsigned char)
line[4])))
  		{
  			free(line);
! 			puts(_("\nYou are using psql, the command-line interface to
PostgreSQL."));
! 			puts(_("\t\\? for psql help"));
! 			puts(_("\t\\h or \\help for SQL help\n"));
! 			puts(_("\t\\g or \";\" to execute a query"));
! 			puts(_("\t\\q to quit psql\n"));
! 			puts(_("\t\\copyright to view the copyright\n"));
! 
  			fflush(stdout);
  			continue;
  		}
Index: src/bin/psql/startup.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.147
diff -c -c -r1.147 startup.c
*** src/bin/psql/startup.c	8 May 2008 17:04:26 -0000	1.147
--- src/bin/psql/startup.c	15 May 2008 19:17:27 -0000
***************
*** 300,305 ****
--- 300,312 ----
  		{
  			int			client_ver = parse_version(PG_VERSION);
  
+ #ifdef USE_SSL
+ 			printSSLInfo();
+ #endif
+ #ifdef WIN32
+ 			checkWin32Codepage();
+ #endif
+ 
  			if (pset.sversion != client_ver)
  			{
  				const char *server_version;
***************
*** 317,349 ****
  					server_version = server_ver_str;
  				}
  
! 				printf(_("Welcome to %s %s (server %s), the PostgreSQL interactive
terminal.\n\n"),
! 					   pset.progname, PG_VERSION, server_version);
  			}
  			else
! 				printf(_("Welcome to %s %s, the PostgreSQL interactive
terminal.\n\n"),
! 					   pset.progname, PG_VERSION);
! 
! 			printf(_("Type:  \\copyright for distribution terms\n"
! 					 "       \\h for help with SQL commands\n"
! 					 "       \\? for help with psql commands\n"
! 				  "       \\g or terminate with semicolon to execute query\n"
! 					 "       \\q to quit\n\n"));
  
  			if (pset.sversion / 100 != client_ver / 100)
! 				printf(_("WARNING:  You are connected to a server with major version
%d.%d,\n"
! 						 "but your %s client is major version %d.%d.  Some backslash
commands,\n"
! 						 "such as \\d, might not work properly.\n\n"),
! 					   pset.sversion / 10000, (pset.sversion / 100) % 100,
! 					   pset.progname,
! 					   client_ver / 10000, (client_ver / 100) % 100);
  
! #ifdef USE_SSL
! 			printSSLInfo();
! #endif
! #ifdef WIN32
! 			checkWin32Codepage();
! #endif
  		}
  
  		if (!pset.notty)
--- 324,342 ----
  					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(_("\tWARNING: %s version %d.%d, server version %d.%d.\n"
! 					 "\t         Some psql features might not work.\n"),
! 					pset.progname, client_ver / 10000, (client_ver / 100) % 100,
! 					pset.sversion / 10000, (pset.sversion / 100) % 100);
  
! 			printf(_("Type \"help\" for help.\n\n"));
  		}
  
  		if (!pset.notty)
***************
*** 707,713 ****
  		return;					/* no SSL */
  
  	SSL_get_cipher_bits(ssl, &sslbits);
! 	printf(_("SSL connection (cipher: %s, bits: %i)\n\n"),
  		   SSL_get_cipher(ssl), sslbits);
  }
  #endif
--- 700,706 ----
  		return;					/* no SSL */
  
  	SSL_get_cipher_bits(ssl, &sslbits);
! 	printf(_("\tSSL connection (cipher: %s, bits: %i)\n"),
  		   SSL_get_cipher(ssl), sslbits);
  }
  #endif
***************
*** 729,737 ****
  	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\n"),
  			   concp, wincp);
  	}
  }
--- 722,730 ----
  	concp = GetConsoleCP();
  	if (wincp != concp)
  	{
! 		printf(_("\tWARNING: Console code page (%u) differs from Windows code
page (%u)\n"
! 				 "\t         8-bit characters might not work correctly. See psql
reference\n"
! 			     "\t         page \"Notes for Windows users\" for details.\n"),
  			   concp, wincp);
  	}
  }

--ELM1210879297-23997-1_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

--ELM1210879297-23997-1_--
 




 55 Posts in Topic:
Patch to change psql default banner
jd@[EMAIL PROTECTED] (&q  2008-04-23 14:41:20 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-04-23 17:52:43 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-04-23 22:30:41 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 19:28:01 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 19:34:00 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-14 19:48:41 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 20:14:23 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-14 17:52:47 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-14 21:22:03 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 21:43:56 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-14 21:53:27 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 21:59:23 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-14 19:08:09 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 22:21:46 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-14 19:28:49 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-14 22:32:15 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-14 19:41:19 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 02:48:35 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 08:43:24 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 10:43:24 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-15 07:51:13 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 11:46:41 
Re: Patch to change psql default banner v6
andrew@[EMAIL PROTECTED]   2008-05-15 11:54:47 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-15 12:09:25 
Re: Patch to change psql default banner v6
rm_pg@[EMAIL PROTECTED]   2008-05-15 10:20:53 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 14:31:32 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 14:37:14 
Re: Patch to change psql default banner v6
daveg@[EMAIL PROTECTED]   2008-05-15 13:26:50 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 17:17:40 
Re: Patch to change psql default banner v6
david@[EMAIL PROTECTED]   2008-05-15 15:06:26 
Re: Patch to change psql default banner v6
andrew@[EMAIL PROTECTED]   2008-05-15 18:55:31 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 18:57:12 
Re: Patch to change psql default banner v6
david@[EMAIL PROTECTED]   2008-05-15 16:03:20 
Re: Patch to change psql default banner v6
david@[EMAIL PROTECTED]   2008-05-15 16:02:50 
Re: Patch to change psql default banner v6
andrew@[EMAIL PROTECTED]   2008-05-15 21:02:16 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-15 21:14:41 
Re: Patch to change psql default banner v6
andrew@[EMAIL PROTECTED]   2008-05-15 21:22:18 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 23:52:30 
Re: Patch to change psql default banner v6
guillaume@[EMAIL PROTECTE  2008-05-19 19:48:27 
Re: Patch to change psql default banner v6
bryce2@[EMAIL PROTECTED]   2008-05-20 08:23:03 
Re: Patch to change psql default banner v6
guillaume@[EMAIL PROTECTE  2008-05-20 22:23:19 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-07-02 23:38:29 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-15 20:33:22 
Re: Patch to change psql default banner v6
jd@[EMAIL PROTECTED] (&q  2008-05-15 09:02:47 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 12:12:36 
Re: Patch to change psql default banner v6
alvherre@[EMAIL PROTECTED  2008-05-15 14:37:47 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 15:21:37 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-15 15:46:21 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-15 15:52:52 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-05-16 13:18:00 
Re: Patch to change psql default banner v6
david@[EMAIL PROTECTED]   2008-05-15 22:38:38 
Re: Patch to change psql default banner v6
bruce@[EMAIL PROTECTED]   2008-06-30 20:09:08 
Re: Patch to change psql default banner v6
tgl@[EMAIL PROTECTED] (T  2008-05-16 01:22:55 
Re: Patch to change psql default banner v6
david@[EMAIL PROTECTED]   2008-05-15 22:08:41 
Re: Patch to change psql default banner v6
stark@[EMAIL PROTECTED]   2008-05-15 23:41:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 20:58:41 CDT 2008.