*** src/bin/psql/psql.c.orig	Sat Jun  5 09:00:38 1999
--- src/bin/psql/psql.c	Sun Jun 13 10:34:05 1999
***************
*** 2875,2880 ****
--- 2875,2887 ----
  		pqsignal(SIGINT, handle_sigint);		/* control-C => cancel */
  #ifdef USE_READLINE
  		settings.useReadline = 1;
+ 		{
+ 			/*
+ 			 * Set the application name, used for parsing .inputrc -- dz
+ 			 */
+ 			char *progname = rindex(argv[0], SEP_CHAR);
+ 			rl_readline_name = (progname ? progname : argv[0]);
+ 		}
  #endif
  	}
  #ifdef PSQL_ALWAYS_GET_PASSWORDS

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+

Sun, 13 Jun 1999 22:01:16 +0200 (MEST)
Massimo Dal Zotto <dz@cs.unitn.it>
new patch
Massimo Dal Zotto <dz@cs.unitn.it> writes:
> + 			char *progname = rindex(argv[0], SEP_CHAR);
> + 			rl_readline_name = (progname ? progname : argv[0]);

1. rindex => strrchr, please.

2. Shouldn't that be (progname ? progname+1 : argv[0]) ?

			regards, tom lane

Sun, 13 Jun 1999 16:26:42 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] new patch 
> 
> Massimo Dal Zotto <dz@cs.unitn.it> writes:
> > + 			char *progname = rindex(argv[0], SEP_CHAR);
> > + 			rl_readline_name = (progname ? progname : argv[0]);
> 
> 1. rindex => strrchr, please.
> 
> 2. Shouldn't that be (progname ? progname+1 : argv[0]) ?
> 
> 			regards, tom lane
> 

Yes, I had already added the +1, but for same obscure reason it worked
also with the original code, so I didn't notice the bug in my first test.
I suspect that the readline uses only the basename of the argument.
Ok also for strrchr, this is the final patch:

*** src/bin/psql/psql.c.orig	Sat Jun  5 09:00:38 1999
--- src/bin/psql/psql.c	Mon Jun 14 09:04:15 1999
***************
*** 2875,2880 ****
--- 2875,2887 ----
  		pqsignal(SIGINT, handle_sigint);		/* control-C => cancel */
  #ifdef USE_READLINE
  		settings.useReadline = 1;
+ 		{
+ 			/*
+ 			 * Set the application name, used for parsing .inputrc -- dz
+ 			 */
+ 			char *progname = strrchr(argv[0], SEP_CHAR);
+ 			rl_readline_name = (progname ? progname+1 : argv[0]);
+ 		}
  #endif
  	}
  #ifdef PSQL_ALWAYS_GET_PASSWORDS


-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+

Mon, 14 Jun 1999 22:55:03 +0200 (MET DST)
Massimo Dal Zotto <dz@cs.unitn.it>
Re: [HACKERS] new patch
Applied.

[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> > 
> > Massimo Dal Zotto <dz@cs.unitn.it> writes:
> > > + 			char *progname = rindex(argv[0], SEP_CHAR);
> > > + 			rl_readline_name = (progname ? progname : argv[0]);
> > 
> > 1. rindex => strrchr, please.
> > 
> > 2. Shouldn't that be (progname ? progname+1 : argv[0]) ?
> > 
> > 			regards, tom lane
> > 
> 
> Yes, I had already added the +1, but for same obscure reason it worked
> also with the original code, so I didn't notice the bug in my first test.
> I suspect that the readline uses only the basename of the argument.
> Ok also for strrchr, this is the final patch:
> 
> *** src/bin/psql/psql.c.orig	Sat Jun  5 09:00:38 1999
> --- src/bin/psql/psql.c	Mon Jun 14 09:04:15 1999
> ***************
> *** 2875,2880 ****
> --- 2875,2887 ----
>   		pqsignal(SIGINT, handle_sigint);		/* control-C => cancel */
>   #ifdef USE_READLINE
>   		settings.useReadline = 1;
> + 		{
> + 			/*
> + 			 * Set the application name, used for parsing .inputrc -- dz
> + 			 */
> + 			char *progname = strrchr(argv[0], SEP_CHAR);
> + 			rl_readline_name = (progname ? progname+1 : argv[0]);
> + 		}
>   #endif
>   	}
>   #ifdef PSQL_ALWAYS_GET_PASSWORDS
> 
> 
> -- 
> Massimo Dal Zotto
> 
> +----------------------------------------------------------------------+
> |  Massimo Dal Zotto               email: dz@cs.unitn.it               |
> |  Via Marconi, 141                phone: ++39-0461534251              |
> |  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
> |  Italy                             pgp: finger dz@tango.cs.unitn.it  |
> +----------------------------------------------------------------------+
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 19 Jul 1999 12:45:51 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] new patch