src/interfaces/ecpg/test/pg_regress_ecpg.c
static void
ecpg_filter_stderr(const char *resultfile, const char *tmpfile)
{
	FILE	   *s,
			   *t;
	StringInfoData linebuf;

	s = fopen(resultfile, "r");
	if (!s)
	{
		fprintf(stderr, "Could not open file %s for reading\n", resultfile);
		exit(2);
	}
	t = fopen(tmpfile, "w");
	if (!t)
	{
		fprintf(stderr, "Could not open file %s for writing\n", tmpfile);
		exit(2);
	}

	initStringInfo(&linebuf);

	while (pg_get_line_buf(s, &linebuf))
	{
		char	   *p1 = strstr(linebuf.data, "connection to server ");

		if (p1)
		{
			char	   *p2 = strstr(p1, "failed: ");

			if (p2)
			{
				memmove(p1 + 21, p2, strlen(p2) + 1);
				/* we don't bother to fix up linebuf.len */
			}
		}
		fputs(linebuf.data, t);
	}

	pfree(linebuf.data);
	fclose(s);
	fclose(t);
	if (rename(tmpfile, resultfile) != 0)
	{
		fprintf(stderr, "Could not overwrite file %s with %s\n",
				resultfile, tmpfile);
		exit(2);
	}
}
/*
 * Remove the details of connection failure error messages
 * in a test result file, since the target host/pathname and/or port
 * can vary.  Rewrite the result file in-place.
 *
 * At some point it might be interesting to unify this with
 * ecpg_filter_source, but building a general pattern matcher
 * is no fun, nor does it seem desirable to introduce a
 * dependency on an external one.
 */
Remove the details of connection failure error messages
in a test result file, since the target host/pathname and/or port
can vary.  Rewrite the result file in-place.

At some point it might be interesting to unify this with
ecpg_filter_source, but building a general pattern matcher
is no fun, nor does it seem desirable to introduce a
dependency on an external one.
Remove the details of connection failure error messages in a test result file since the target host / pathname and / or port can vary . Rewrite the result file in - place . At some point it might be interesting to unify this with ecpg_filter_source but building a general pattern matcher is no fun nor does it seem desirable to introduce a dependency on an external one .
static void
ecpg_filter_stderr(const char *resultfile, const char *tmpfile)
{
	FILE	   *s,
			   *t;
	StringInfoData linebuf;
	s = fopen(resultfile, "r");
	if (!s)
	{
		fprintf(stderr, "Could not open file %s for reading\n", resultfile);
		exit(2);
	}
	t = fopen(tmpfile, "w");
	if (!t)
	{
		fprintf(stderr, "Could not open file %s for writing\n", tmpfile);
		exit(2);
	}
	initStringInfo(&linebuf);
	while (pg_get_line_buf(s, &linebuf))
	{
		char	   *p1 = strstr(linebuf.data, "connection to server ");
		if (p1)
		{
			char	   *p2 = strstr(p1, "failed: ");
			if (p2)
			{
				memmove(p1 + 21, p2, strlen(p2) + 1);
			}
		}
		fputs(linebuf.data, t);
	}
	pfree(linebuf.data);
	fclose(s);
	fclose(t);
	if (rename(tmpfile, resultfile) != 0)
	{
		fprintf(stderr, "Could not overwrite file %s with %s\n",
				resultfile, tmpfile);
		exit(2);
	}
}
static void ecpg_filter_stderr ( const char * resultfile , const char * tmpfile ) { FILE * s , * t ; StringInfoData linebuf ; s = fopen ( resultfile , " " ) ; if ( ! s ) { fprintf ( stderr , " \n " , resultfile ) ; exit ( 2 ) ; } t = fopen ( tmpfile , " " ) ; if ( ! t ) { fprintf ( stderr , " \n " , tmpfile ) ; exit ( 2 ) ; } initStringInfo ( & linebuf ) ; while ( pg_get_line_buf ( s , & linebuf ) ) { char * p1 = strstr ( linebuf . data , " " ) ; if ( p1 ) { char * p2 = strstr ( p1 , " " ) ; if ( p2 ) { memmove ( p1 + 21 , p2 , strlen ( p2 ) + 1 ) ; } } fputs ( linebuf . data , t ) ; } pfree ( linebuf . data ) ; fclose ( s ) ; fclose ( t ) ; if ( rename ( tmpfile , resultfile ) != 0 ) { fprintf ( stderr , " \n " , resultfile , tmpfile ) ; exit ( 2 ) ; } }
Remove the details of connection failure error messages
 in a test result file, since the target host/pathname and/or port
 can vary.
Remove the details of connection failure error messages in a test result file since the target host / pathname and / or port can vary .
/* we don't bother to fix up linebuf.len */