Index: doc/src/sgml/ref/initdb.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v
retrieving revision 1.35
diff -c -r1.35 initdb.sgml
*** doc/src/sgml/ref/initdb.sgml	21 Jun 2005 04:02:31 -0000	1.35
--- doc/src/sgml/ref/initdb.sgml	25 Jan 2006 13:47:19 -0000
***************
*** 235,240 ****
--- 235,252 ----
        </listitem>
       </varlistentry>
  
+     <variablelist>
+      <varlistentry>
+       <term><option>--q</option></term>
+       <term><option>--quiet</option></term>
+       <listitem>
+        <para>
+ 	Supresses the messages generated by <command>initdb</command>. Only warning
+ 	and error messages are displayed.
+        </para>
+       </listitem>
+      </varlistentry>
+ 
       <varlistentry>
        <term><option>-L <replaceable class="parameter">directory</replaceable></option></term>
        <listitem>
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.106
diff -c -r1.106 initdb.c
*** src/bin/initdb/initdb.c	5 Jan 2006 10:07:46 -0000	1.106
--- src/bin/initdb/initdb.c	25 Jan 2006 13:47:36 -0000
***************
*** 95,100 ****
--- 95,101 ----
  static bool debug = false;
  static bool noclean = false;
  static bool show_setting = false;
+ static bool quiet;
  
  
  /* internal vars */
***************
*** 1120,1128 ****
  		        test_max_fsm,
          		ok_buffers = 0;
  	  
! 
! 	printf(_("selecting default max_connections ... "));
! 	fflush(stdout);
  
  	for (i = 0; i < connslen; i++)
  	{
--- 1121,1131 ----
  		        test_max_fsm,
          		ok_buffers = 0;
  	  
! 	if (!quiet)
! 	{
! 		printf(_("selecting default max_connections ... "));
! 		fflush(stdout);
! 	}
  
  	for (i = 0; i < connslen; i++)
  	{
***************
*** 1150,1159 ****
  		i = connslen - 1;
  	n_connections = trial_conns[i];
  
! 	printf("%d\n", n_connections);
  
! 	printf(_("selecting default shared_buffers/max_fsm_pages ... "));
! 	fflush(stdout);
  
  	for (i = 0; i < bufslen; i++)
  	{
--- 1153,1168 ----
  		i = connslen - 1;
  	n_connections = trial_conns[i];
  
! 	if (!quiet)
! 	{
! 		printf("%d\n", n_connections);
! 	}
  
! 	if (!quiet)
! 	{
! 		printf(_("selecting default shared_buffers/max_fsm_pages ... "));
! 		fflush(stdout);
! 	}
  
  	for (i = 0; i < bufslen; i++)
  	{
***************
*** 1181,1187 ****
  	n_buffers = test_buffs;
  	n_fsm_pages = FSM_FOR_BUFS(n_buffers);
  
! 	printf("%d/%d\n", n_buffers, n_fsm_pages);
  }
  
  /*
--- 1190,1199 ----
  	n_buffers = test_buffs;
  	n_fsm_pages = FSM_FOR_BUFS(n_buffers);
  
! 	if (!quiet)
! 	{
! 		printf("%d/%d\n", n_buffers, n_fsm_pages);
! 	}
  }
  
  /*
***************
*** 1194,1202 ****
  	char		repltok[100];
  	char		path[MAXPGPATH];
  
! 	fputs(_("creating configuration files ... "), stdout);
! 	fflush(stdout);
! 
  	/* postgresql.conf */
  
  	conflines = readfile(conf_file);
--- 1206,1216 ----
  	char		repltok[100];
  	char		path[MAXPGPATH];
  
! 	if (!quiet)
! 	{
! 		fputs(_("creating configuration files ... "), stdout);
! 		fflush(stdout);
! 	}
  	/* postgresql.conf */
  
  	conflines = readfile(conf_file);
***************
*** 1350,1359 ****
  	char	  **bki_lines;
  	char		headerline[MAXPGPATH];
  
! 	printf(_("creating template1 database in %s/base/1 ... "), pg_data);
! 	fflush(stdout);
  
! 	if (debug)
  		talkargs = "-d 5";
  
  	bki_lines = readfile(bki_file);
--- 1364,1376 ----
  	char	  **bki_lines;
  	char		headerline[MAXPGPATH];
  
! 	if (!quiet)
! 	{
! 		printf(_("creating template1 database in %s/base/1 ... "), pg_data);
! 		fflush(stdout);
! 	}
  
! 		if (debug)
  		talkargs = "-d 5";
  
  	bki_lines = readfile(bki_file);
***************
*** 1444,1451 ****
  		NULL
  	};
  
! 	fputs(_("initializing pg_authid ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1461,1471 ----
  		NULL
  	};
  
! 	if (!quiet)
! 	{
! 		fputs(_("initializing pg_authid ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1572,1579 ****
  		NULL
  	};
  
! 	fputs(_("enabling unlimited row size for system tables ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1592,1602 ----
  		NULL
  	};
  
! 	if (!quiet)
! 	{
! 		fputs(_("enabling unlimited row size for system tables ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1652,1659 ****
  		NULL
  	};
  
! 	fputs(_("initializing dependencies ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1675,1685 ----
  		NULL
  	};
  
! 	if (!quiet)
! 	{
! 		fputs(_("initializing dependencies ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1680,1687 ****
  	char	  **line;
  	char	  **sysviews_setup;
  
! 	fputs(_("creating system views ... "), stdout);
! 	fflush(stdout);
  
  	sysviews_setup = readfile(system_views_file);
  
--- 1706,1716 ----
  	char	  **line;
  	char	  **sysviews_setup;
  
! 	if (!quiet)
! 	{
! 		fputs(_("creating system views ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	sysviews_setup = readfile(system_views_file);
  
***************
*** 1716,1723 ****
  {
  	PG_CMD_DECL;
  
! 	fputs(_("loading pg_description ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1745,1755 ----
  {
  	PG_CMD_DECL;
  
! 	if (!quiet)
! 	{
! 		fputs(_("loading pg_description ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1755,1762 ****
  	char	  **line;
  	char	  **conv_lines;
  
! 	fputs(_("creating conversions ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1787,1797 ----
  	char	  **line;
  	char	  **conv_lines;
  
! 	if (!quiet)
! 	{
! 		fputs(_("creating conversions ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1806,1813 ****
  		NULL
  	};
  
! 	fputs(_("setting privileges on built-in objects ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1841,1851 ----
  		NULL
  	};
  
! 	if (!quiet)
! 	{
! 		fputs(_("setting privileges on built-in objects ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1864,1871 ****
  	char	  **line;
  	char	  **lines;
  
! 	fputs(_("creating information schema ... "), stdout);
! 	fflush(stdout);
  
  	lines = readfile(info_schema_file);
  
--- 1902,1912 ----
  	char	  **line;
  	char	  **lines;
  
! 	if (!quiet)
! 	{
! 		fputs(_("creating information schema ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	lines = readfile(info_schema_file);
  
***************
*** 1920,1927 ****
  {
  	PG_CMD_DECL;
  
! 	fputs(_("vacuuming database template1 ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 1961,1971 ----
  {
  	PG_CMD_DECL;
  
! 	if (!quiet)
! 	{
! 		fputs(_("vacuuming database template1 ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 1974,1981 ****
  		NULL
  	};
  
! 	fputs(_("copying template1 to template0 ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 2018,2028 ----
  		NULL
  	};
  
! 	if (!quiet)
! 	{
! 		fputs(_("copying template1 to template0 ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 2004,2012 ****
  		"CREATE DATABASE postgres;\n",
  		NULL
  	};
! 
! 	fputs(_("copying template1 to postgres ... "), stdout);
! 	fflush(stdout);
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
--- 2051,2062 ----
  		"CREATE DATABASE postgres;\n",
  		NULL
  	};
! 	
! 	if (!quiet)
! 	{
! 		fputs(_("copying template1 to postgres ... "), stdout);
! 		fflush(stdout);
! 	}
  
  	snprintf(cmd, sizeof(cmd),
  			 "\"%s\" %s template1 >%s",
***************
*** 2076,2083 ****
  	else
  	{
  		/* all seems well */
! 		printf(_("ok\n"));
! 		fflush(stdout);
  	}
  }
  
--- 2126,2136 ----
  	else
  	{
  		/* all seems well */
! 		if (!quiet)
! 		{
! 			printf(_("ok\n"));
! 			fflush(stdout);
! 		}
  	}
  }
  
***************
*** 2266,2271 ****
--- 2319,2325 ----
  	printf(_("  -V, --version             output version information, then exit\n"));
  	printf(_("\nLess commonly used options:\n"));
  	printf(_("  -d, --debug               generate lots of debugging output\n"));
+ 	printf(_("  -q, --quiet               don't write any messages\n"));
  	printf(_("  -s, --show                show internal settings\n"));
  	printf(_("  -L DIRECTORY              where to find the input files\n"));
  	printf(_("  -n, --noclean             do not clean up after errors\n"));
***************
*** 2299,2304 ****
--- 2353,2359 ----
  		{"help", no_argument, NULL, '?'},
  		{"version", no_argument, NULL, 'V'},
  		{"debug", no_argument, NULL, 'd'},
+ 		{"quiet", no_argument, NULL, 'q'},
  		{"show", no_argument, NULL, 's'},
  		{"noclean", no_argument, NULL, 'n'},
  		{NULL, 0, NULL, 0}
***************
*** 2369,2374 ****
--- 2424,2433 ----
  				debug = true;
  				printf(_("Running in debug mode.\n"));
  				break;
+ 			case 'q':
+ 				quiet = true;
+ 				printf(_("Running in quiet mode. Messages will not be displayed.\n"));
+ 				break;
  			case 'n':
  				noclean = true;
  				printf(_("Running in noclean mode.  Mistakes will not be cleaned up.\n"));
***************
*** 2604,2613 ****
  
  	setlocales();
  
! 	printf(_("The files belonging to this database system will be owned "
! 			 "by user \"%s\".\n"
! 			 "This user must also own the server process.\n\n"),
! 		   effective_user);
  
  	if (strcmp(lc_ctype, lc_collate) == 0 &&
  		strcmp(lc_ctype, lc_time) == 0 &&
--- 2663,2675 ----
  
  	setlocales();
  
! 	if (!quiet)
! 	{
! 		printf(_("The files belonging to this database system will be owned "
! 				 "by user \"%s\".\n"
! 				 "This user must also own the server process.\n\n"),
! 		  	 effective_user);
! 	}
  
  	if (strcmp(lc_ctype, lc_collate) == 0 &&
  		strcmp(lc_ctype, lc_time) == 0 &&
***************
*** 2690,2699 ****
  	{
  		case 0:
  			/* PGDATA not there, must create it */
! 			printf(_("creating directory %s ... "),
! 				   pg_data);
! 			fflush(stdout);
! 
  			if (!mkdatadir(NULL))
  				exit_nicely();
  			else
--- 2752,2763 ----
  	{
  		case 0:
  			/* PGDATA not there, must create it */
! 			if (!quiet)
! 			{
! 				printf(_("creating directory %s ... "),
! 					   pg_data);
! 				fflush(stdout);
! 			}
  			if (!mkdatadir(NULL))
  				exit_nicely();
  			else
***************
*** 2704,2712 ****
  
  		case 1:
  			/* Present but empty, fix permissions and use it */
! 			printf(_("fixing permissions on existing directory %s ... "),
! 				   pg_data);
! 			fflush(stdout);
  
  			if (chmod(pg_data, 0700) != 0)
  			{
--- 2768,2779 ----
  
  		case 1:
  			/* Present but empty, fix permissions and use it */
! 			if (!quiet)
! 			{
! 				printf(_("fixing permissions on existing directory %s ... "),
! 					   pg_data);
! 				fflush(stdout);
! 			}
  
  			if (chmod(pg_data, 0700) != 0)
  			{
***************
*** 2741,2748 ****
  
  	for (i = 0; i < (sizeof(subdirs) / sizeof(char *)); i++)
  	{
! 		printf(_("creating directory %s/%s ... "), pg_data, subdirs[i]);
! 		fflush(stdout);
  
  		if (!mkdatadir(subdirs[i]))
  			exit_nicely();
--- 2808,2818 ----
  
  	for (i = 0; i < (sizeof(subdirs) / sizeof(char *)); i++)
  	{
! 		if (!quiet)
! 		{
! 			printf(_("creating directory %s/%s ... "), pg_data, subdirs[i]);
! 			fflush(stdout);
! 		}
  
  		if (!mkdatadir(subdirs[i]))
  			exit_nicely();
