Index: doc/src/sgml/libpq.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/libpq.sgml,v
retrieving revision 1.104
diff -c -c -r1.104 libpq.sgml
*** doc/src/sgml/libpq.sgml	6 Jan 2003 22:48:16 -0000	1.104
--- doc/src/sgml/libpq.sgml	7 Jan 2003 04:06:52 -0000
***************
*** 1,5 ****
  <!--
! $Header: /cvsroot/pgsql-server/doc/src/sgml/libpq.sgml,v 1.104 2003/01/06 22:48:16 momjian Exp $
  -->
  
   <chapter id="libpq">
--- 1,5 ----
  <!--
! $Header: /cvsroot/pgsql-server/doc/src/sgml/libpq.sgml,v 1.103 2002/12/13 05:49:10 momjian Exp $
  -->
  
   <chapter id="libpq">
***************
*** 206,211 ****
--- 206,224 ----
        Set to 1 to require SSL connection to the backend. <application>Libpq</>
        will then refuse to connect if the server does not support
        SSL. Set to 0 (default) to negotiate with server.
+      </para>
+      </listitem>
+     </varlistentry>
+ 
+     <varlistentry>
+      <term><literal>service</literal></term>
+      <listitem>
+      <para>
+       Service name to use for additional parameters.  It specifies a service
+       name in pg_service.conf that holds additional connection parameters.
+       This allows applications to specify only a service name so connection parameters 
+       can be centrally maintained.  See <literal>pg_service.conf.sample</> for
+       information on how to set up the file.
       </para>
       </listitem>
      </varlistentry>
Index: src/backend/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/Makefile,v
retrieving revision 1.90
diff -c -c -r1.90 Makefile
*** src/backend/Makefile	6 Jan 2003 03:18:26 -0000	1.90
--- src/backend/Makefile	7 Jan 2003 04:06:52 -0000
***************
*** 140,147 ****
  		> $(srcdir)/libpq/pg_hba.conf.sample.no_ipv6
  	$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample.no_ipv6 $(DESTDIR)$(datadir)/pg_hba.conf.sample
  endif
  	$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
! 	$(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
  
  install-bin: postgres $(POSTGRES_IMP) installdirs
  	$(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
--- 140,148 ----
  		> $(srcdir)/libpq/pg_hba.conf.sample.no_ipv6
  	$(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample.no_ipv6 $(DESTDIR)$(datadir)/pg_hba.conf.sample
  endif
+ 	$(INSTALL_DATA) $(srcdir)/libpq/pg_service.conf.sample $(DESTDIR)$(datadir)/pg_service.conf.sample
  	$(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample $(DESTDIR)$(datadir)/pg_ident.conf.sample
!         $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample $(DESTDIR)$(datadir)/postgresql.conf.sample
  
  install-bin: postgres $(POSTGRES_IMP) installdirs
  	$(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
***************
*** 179,186 ****
  endif
  	$(MAKE) -C catalog uninstall-data
  	rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
  	      $(DESTDIR)$(datadir)/pg_ident.conf.sample \
! 	      $(DESTDIR)$(datadir)/postgresql.conf.sample
  
  
  ##########################################################################
--- 180,188 ----
  endif
  	$(MAKE) -C catalog uninstall-data
  	rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
+ 	      $(DESTDIR)$(datadir)/pg_service.conf.sample \
  	      $(DESTDIR)$(datadir)/pg_ident.conf.sample \
!               $(DESTDIR)$(datadir)/postgresql.conf.sample
  
  
  ##########################################################################
Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.218
diff -c -c -r1.218 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	6 Jan 2003 22:48:16 -0000	1.218
--- src/interfaces/libpq/fe-connect.c	7 Jan 2003 04:07:00 -0000
***************
*** 2338,2351 ****
  			return 1;
  		}
  
! 		/* As default, set the database name to the name of the service */
  		for (i = 0; options[i].keyword; i++)
  			if (strcmp(options[i].keyword, "dbname") == 0)
! 			{
! 				if (options[i].val != NULL)
! 					free(options[i].val);
! 				options[i].val = strdup(service);
! 			}
  
  		while ((line = fgets(buf, MAXBUFSIZE - 1, f)) != NULL)
  		{
--- 2338,2348 ----
  			return 1;
  		}
  
! 		/* If not already set, set the database name to the name of the service */
  		for (i = 0; options[i].keyword; i++)
  			if (strcmp(options[i].keyword, "dbname") == 0)
! 				if (options[i].val == NULL)
! 					options[i].val = strdup(service);
  
  		while ((line = fgets(buf, MAXBUFSIZE - 1, f)) != NULL)
  		{
