Index: doc/src/sgml/libpq.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/libpq.sgml,v
retrieving revision 1.160
diff -c -c -r1.160 libpq.sgml
*** doc/src/sgml/libpq.sgml	17 Aug 2004 16:54:46 -0000	1.160
--- doc/src/sgml/libpq.sgml	18 Aug 2004 23:54:05 -0000
***************
*** 136,142 ****
        likely to fail if <application>libpq</application> is passed a host name
        that is not the name of the machine at <literal>hostaddr</>.)  Also,
        <literal>host</> rather than <literal>hostaddr</> is used to identify
!       the connection in <filename>$HOME/.pgpass</>.
       </para>
       <para>
        Without either a host name or host address,
--- 136,143 ----
        likely to fail if <application>libpq</application> is passed a host name
        that is not the name of the machine at <literal>hostaddr</>.)  Also,
        <literal>host</> rather than <literal>hostaddr</> is used to identify
!       the connection in <filename>$HOME/.pgpass</> (or 
!       <filename>%USERPROFILE%/.pgpass</> on Win32).
       </para>
       <para>
        Without either a host name or host address,
Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.281
diff -c -c -r1.281 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	18 Aug 2004 02:59:11 -0000	1.281
--- src/interfaces/libpq/fe-connect.c	18 Aug 2004 23:54:19 -0000
***************
*** 3093,3099 ****
  {
  	FILE	   *fp;
  	char	   *pgpassfile;
! 	char	   home[MAXPGPATH];
  	struct stat stat_buf;
  
  #define LINELEN NAMEDATALEN*5
--- 3093,3099 ----
  {
  	FILE	   *fp;
  	char	   *pgpassfile;
! 	char	   *home;
  	struct stat stat_buf;
  
  #define LINELEN NAMEDATALEN*5
***************
*** 3111,3120 ****
  	if (port == NULL)
  		port = DEF_PGPORT_STR;
  
! 	/* Look for it in the home dir */
! 	if (!get_home_path(home))
  		return NULL;
! 
  	pgpassfile = malloc(strlen(home) + 1 + strlen(PGPASSFILE) + 1);
  	if (!pgpassfile)
  	{
--- 3111,3123 ----
  	if (port == NULL)
  		port = DEF_PGPORT_STR;
  
! 	/*
! 	 *	Look for it in the home dir.
! 	 *	We don't use get_home_path() so we don't pull path.c into our library.
! 	 */
! 	if (!(home = getenv(HOMEDIR)))
  		return NULL;
! 	
  	pgpassfile = malloc(strlen(home) + 1 + strlen(PGPASSFILE) + 1);
  	if (!pgpassfile)
  	{
***************
*** 3122,3128 ****
--- 3125,3135 ----
  		return NULL;
  	}
  
+ #ifndef WIN32
  	sprintf(pgpassfile, "%s/%s", home, PGPASSFILE);
+ #else
+ 	sprintf(pgpassfile, "%s\\%s", home, PGPASSFILE);
+ #endif
  
  	/* If password file cannot be opened, ignore it. */
  	if (stat(pgpassfile, &stat_buf) == -1)
