Index: src/backend/libpq/ip.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/libpq/ip.c,v
retrieving revision 1.34
diff -c -r1.34 ip.c
*** src/backend/libpq/ip.c	5 Mar 2006 15:58:27 -0000	1.34
--- src/backend/libpq/ip.c	13 Apr 2006 16:04:14 -0000
***************
*** 20,26 ****
  /* This is intended to be used in both frontend and backend, so use c.h */
  #include "c.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <errno.h>
  #include <unistd.h>
  #include <sys/types.h>
--- 20,25 ----
***************
*** 33,39 ****
  #endif
  #include <arpa/inet.h>
  #include <sys/file.h>
- #endif
  
  #include "libpq/ip.h"
  
--- 32,37 ----
Index: src/backend/port/dynloader/win32.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/port/dynloader/win32.c,v
retrieving revision 1.7
diff -c -r1.7 win32.c
*** src/backend/port/dynloader/win32.c	15 Oct 2005 02:49:23 -0000	1.7
--- src/backend/port/dynloader/win32.c	13 Apr 2006 15:43:10 -0000
***************
*** 1,7 ****
  /* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.7 2005/10/15 02:49:23 momjian Exp $ */
  
! #include <windows.h>
! #include <stdio.h>
  
  char	   *dlerror(void);
  int			dlclose(void *handle);
--- 1,6 ----
  /* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.7 2005/10/15 02:49:23 momjian Exp $ */
  
! #include "postgres.h"
  
  char	   *dlerror(void);
  int			dlclose(void *handle);
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.483
diff -c -r1.483 postmaster.c
*** src/backend/postmaster/postmaster.c	18 Mar 2006 22:09:58 -0000	1.483
--- src/backend/postmaster/postmaster.c	9 Apr 2006 11:38:00 -0000
***************
*** 1121,1127 ****
  		ExitPostmaster(1);
  	}
  #endif
! 	i = open(NULL_DEV, O_RDWR);
  	dup2(i, 0);
  	dup2(i, 1);
  	dup2(i, 2);
--- 1121,1127 ----
  		ExitPostmaster(1);
  	}
  #endif
! 	i = open(NULL_DEV, O_RDWR, 0);
  	dup2(i, 0);
  	dup2(i, 1);
  	dup2(i, 2);
Index: src/backend/postmaster/syslogger.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/postmaster/syslogger.c,v
retrieving revision 1.23
diff -c -r1.23 syslogger.c
*** src/backend/postmaster/syslogger.c	5 Mar 2006 15:58:36 -0000	1.23
--- src/backend/postmaster/syslogger.c	9 Apr 2006 11:38:17 -0000
***************
*** 153,159 ****
  	 */
  	if (redirection_done)
  	{
! 		int			fd = open(NULL_DEV, O_WRONLY);
  
  		/*
  		 * The closes might look redundant, but they are not: we want to be
--- 153,159 ----
  	 */
  	if (redirection_done)
  	{
! 		int			fd = open(NULL_DEV, O_WRONLY, 0);
  
  		/*
  		 * The closes might look redundant, but they are not: we want to be
Index: src/backend/utils/adt/float.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/float.c,v
retrieving revision 1.123
diff -c -r1.123 float.c
*** src/backend/utils/adt/float.c	11 Mar 2006 01:19:22 -0000	1.123
--- src/backend/utils/adt/float.c	22 Apr 2006 21:03:48 -0000
***************
*** 157,164 ****
  	/* C99 standard way */
  	return (double) NAN;
  #else
! 	/* Assume we can get a NAN via zero divide */
! 	return (double) (0.0 / 0.0);
  #endif
  }
  
--- 157,166 ----
  	/* C99 standard way */
  	return (double) NAN;
  #else
! 	/* Assume we can get a NAN via zero divide. Use separate variable to trick compilers
!          * that detect divide-by-zero. */
! 	double zero = 0.0;
! 	return (double) (0.0 / zero);
  #endif
  }
  
***************
*** 169,176 ****
  	/* C99 standard way */
  	return (float) NAN;
  #else
! 	/* Assume we can get a NAN via zero divide */
! 	return (float) (0.0 / 0.0);
  #endif
  }
  
--- 171,180 ----
  	/* C99 standard way */
  	return (float) NAN;
  #else
! 	/* Assume we can get a NAN via zero divide. Use separate variable to trick compilers
!          * that detect divide-by-zero. */
! 	float zero = 0.0;
! 	return (float) (0.0 / zero);
  #endif
  }
  
Index: src/backend/utils/fmgr/dfmgr.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v
retrieving revision 1.82
diff -c -r1.82 dfmgr.c
*** src/backend/utils/fmgr/dfmgr.c	5 Mar 2006 15:58:46 -0000	1.82
--- src/backend/utils/fmgr/dfmgr.c	22 Apr 2006 10:08:08 -0000
***************
*** 17,23 ****
--- 17,27 ----
  #include <errno.h>
  #include <sys/stat.h>
  
+ #ifndef _MSC_VER
  #include "dynloader.h"
+ #else /* Visual C++ */
+ #include "port/dynloader/win32.h"
+ #endif
  #include "miscadmin.h"
  #include "utils/dynamic_loader.h"
  
Index: src/backend/utils/mb/encnames.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/mb/encnames.c,v
retrieving revision 1.29
diff -c -r1.29 encnames.c
*** src/backend/utils/mb/encnames.c	18 Feb 2006 16:15:22 -0000	1.29
--- src/backend/utils/mb/encnames.c	13 Apr 2006 16:04:32 -0000
***************
*** 13,21 ****
  #include "utils/builtins.h"
  #endif
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #include "mb/pg_wchar.h"
  #include <ctype.h>
--- 13,19 ----
Index: src/bin/initdb/initdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.114
diff -c -r1.114 initdb.c
*** src/bin/initdb/initdb.c	21 Mar 2006 17:54:28 -0000	1.114
--- src/bin/initdb/initdb.c	13 Apr 2006 15:16:30 -0000
***************
*** 2261,2268 ****
  }
  
  #ifdef WIN32
! /* MingW headers are incomplete */
! typedef WINAPI BOOL (*__CreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
  #define DISABLE_MAX_PRIVILEGE   0x1 
  
  /*
--- 2261,2267 ----
  }
  
  #ifdef WIN32
! typedef BOOL (WINAPI *__CreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
  #define DISABLE_MAX_PRIVILEGE   0x1 
  
  /*
Index: src/bin/pg_controldata/pg_controldata.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v
retrieving revision 1.28
diff -c -r1.28 pg_controldata.c
*** src/bin/pg_controldata/pg_controldata.c	3 Apr 2006 23:35:04 -0000	1.28
--- src/bin/pg_controldata/pg_controldata.c	9 Apr 2006 20:41:31 -0000
***************
*** 104,110 ****
  
  	snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
  
! 	if ((fd = open(ControlFilePath, O_RDONLY)) == -1)
  	{
  		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
  				progname, ControlFilePath, strerror(errno));
--- 104,110 ----
  
  	snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
  
! 	if ((fd = open(ControlFilePath, O_RDONLY, 0)) == -1)
  	{
  		fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
  				progname, ControlFilePath, strerror(errno));
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.67
diff -c -r1.67 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	5 Mar 2006 15:58:50 -0000	1.67
--- src/bin/pg_ctl/pg_ctl.c	9 Apr 2006 21:01:49 -0000
***************
*** 1159,1170 ****
   * also load the couple of functions that *do* exist in minwg headers but not
   * on NT4. That way, we don't break on NT4.
   */
! typedef WINAPI BOOL (*__CreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
! typedef WINAPI BOOL (*__IsProcessInJob)(HANDLE, HANDLE, PBOOL);
! typedef WINAPI HANDLE (*__CreateJobObject)(LPSECURITY_ATTRIBUTES, LPCTSTR);
! typedef WINAPI BOOL (*__SetInformationJobObject)(HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD);
! typedef WINAPI BOOL (*__AssignProcessToJobObject)(HANDLE, HANDLE);
! typedef WINAPI BOOL (*__QueryInformationJobObject)(HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD, LPDWORD);
  
  /* Windows API define missing from MingW headers */
  #define DISABLE_MAX_PRIVILEGE   0x1 
--- 1159,1170 ----
   * also load the couple of functions that *do* exist in minwg headers but not
   * on NT4. That way, we don't break on NT4.
   */
! typedef BOOL (WINAPI *__CreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
! typedef BOOL (WINAPI *__IsProcessInJob)(HANDLE, HANDLE, PBOOL);
! typedef HANDLE (WINAPI *__CreateJobObject)(LPSECURITY_ATTRIBUTES, LPCTSTR);
! typedef BOOL (WINAPI *__SetInformationJobObject)(HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD);
! typedef BOOL (WINAPI *__AssignProcessToJobObject)(HANDLE, HANDLE);
! typedef BOOL (WINAPI *__QueryInformationJobObject)(HANDLE, JOBOBJECTINFOCLASS, LPVOID, DWORD, LPDWORD);
  
  /* Windows API define missing from MingW headers */
  #define DISABLE_MAX_PRIVILEGE   0x1 
Index: src/bin/pg_dump/pg_backup_archiver.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.127
diff -c -r1.127 pg_backup_archiver.c
*** src/bin/pg_dump/pg_backup_archiver.c	19 Apr 2006 16:02:17 -0000	1.127
--- src/bin/pg_dump/pg_backup_archiver.c	23 Apr 2006 17:07:03 -0000
***************
*** 28,36 ****
  
  #include <ctype.h>
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #ifdef WIN32
  #include <io.h>
--- 28,34 ----
Index: src/bin/pg_dump/pg_backup_db.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v
retrieving revision 1.70
diff -c -r1.70 pg_backup_db.c
*** src/bin/pg_dump/pg_backup_db.c	3 Mar 2006 23:38:29 -0000	1.70
--- src/bin/pg_dump/pg_backup_db.c	13 Apr 2006 16:15:46 -0000
***************
*** 15,23 ****
  #include "pg_backup_db.h"
  #include "dumputils.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #include <ctype.h>
  
--- 15,21 ----
Index: src/bin/pg_dump/pg_backup_null.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_null.c,v
retrieving revision 1.17
diff -c -r1.17 pg_backup_null.c
*** src/bin/pg_dump/pg_backup_null.c	12 Feb 2006 06:11:50 -0000	1.17
--- src/bin/pg_dump/pg_backup_null.c	13 Apr 2006 16:15:37 -0000
***************
*** 25,33 ****
  #include "pg_backup.h"
  #include "pg_backup_archiver.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>				/* for dup */
- #endif
  
  #include "libpq/libpq-fs.h"
  
--- 25,31 ----
Index: src/bin/pg_dump/pg_backup_tar.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v
retrieving revision 1.50
diff -c -r1.50 pg_backup_tar.c
*** src/bin/pg_dump/pg_backup_tar.c	12 Feb 2006 06:11:50 -0000	1.50
--- src/bin/pg_dump/pg_backup_tar.c	13 Apr 2006 16:15:01 -0000
***************
*** 27,36 ****
  
  #include <ctype.h>
  #include <limits.h>
- 
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
  static void _StartData(ArchiveHandle *AH, TocEntry *te);
--- 27,33 ----
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.433
diff -c -r1.433 pg_dump.c
*** src/bin/pg_dump/pg_dump.c	5 Mar 2006 15:58:50 -0000	1.433
--- src/bin/pg_dump/pg_dump.c	13 Apr 2006 16:15:25 -0000
***************
*** 24,32 ****
   */
  #include "postgres.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #include <ctype.h>
  #ifdef ENABLE_NLS
--- 24,30 ----
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.74
diff -c -r1.74 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c	7 Apr 2006 21:26:29 -0000	1.74
--- src/bin/pg_dump/pg_dumpall.c	13 Apr 2006 16:14:51 -0000
***************
*** 14,23 ****
  #include "postgres_fe.h"
  
  #include <time.h>
- 
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #ifdef ENABLE_NLS
  #include <locale.h>
--- 14,20 ----
Index: src/bin/pg_dump/pg_restore.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.77
diff -c -r1.77 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	12 Apr 2006 22:18:48 -0000	1.77
--- src/bin/pg_dump/pg_restore.c	23 Apr 2006 17:07:03 -0000
***************
*** 53,61 ****
  #include <termios.h>
  #endif
  
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #include "getopt_long.h"
  
--- 53,59 ----
Index: src/bin/pg_resetxlog/pg_resetxlog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v
retrieving revision 1.43
diff -c -r1.43 pg_resetxlog.c
*** src/bin/pg_resetxlog/pg_resetxlog.c	5 Apr 2006 03:34:05 -0000	1.43
--- src/bin/pg_resetxlog/pg_resetxlog.c	13 Apr 2006 15:16:56 -0000
***************
*** 245,251 ****
  	 */
  	snprintf(path, MAXPGPATH, "%s/postmaster.pid", DataDir);
  
! 	if ((fd = open(path, O_RDONLY)) < 0)
  	{
  		if (errno != ENOENT)
  		{
--- 245,251 ----
  	 */
  	snprintf(path, MAXPGPATH, "%s/postmaster.pid", DataDir);
  
! 	if ((fd = open(path, O_RDONLY, 0)) < 0)
  	{
  		if (errno != ENOENT)
  		{
***************
*** 347,353 ****
  	char	   *buffer;
  	pg_crc32	crc;
  
! 	if ((fd = open(XLOG_CONTROL_FILE, O_RDONLY)) < 0)
  	{
  		/*
  		 * If pg_control is not there at all, or we can't read it, the odds
--- 347,353 ----
  	char	   *buffer;
  	pg_crc32	crc;
  
! 	if ((fd = open(XLOG_CONTROL_FILE, O_RDONLY, 0)) < 0)
  	{
  		/*
  		 * If pg_control is not there at all, or we can't read it, the odds
Index: src/bin/psql/bcc32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/bcc32.mak,v
retrieving revision 1.15
diff -c -r1.15 bcc32.mak
*** src/bin/psql/bcc32.mak	27 Sep 2005 17:39:33 -0000	1.15
--- src/bin/psql/bcc32.mak	13 Apr 2006 16:17:59 -0000
***************
*** 82,88 ****
  
  .path.obj = $(INTDIR)
  
! USERDEFINES = WIN32;_CONSOLE;_MBCS;HAVE_STRDUP
  
  ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"
  
--- 82,88 ----
  
  .path.obj = $(INTDIR)
  
! USERDEFINES = WIN32;_CONSOLE;_MBCS;HAVE_STRDUP;_MSC_VER
  
  ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"
  
Index: src/bin/psql/command.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.166
diff -c -r1.166 command.c
*** src/bin/psql/command.c	2 Apr 2006 20:08:22 -0000	1.166
--- src/bin/psql/command.c	13 Apr 2006 16:33:16 -0000
***************
*** 8,14 ****
  #include "postgres_fe.h"
  #include "command.h"
  
! #ifdef WIN32_CLIENT_ONLY		/* needed for BCC */
  #undef mkdir
  #endif
  
--- 8,14 ----
  #include "postgres_fe.h"
  #include "command.h"
  
! #ifdef __BORLANDC__		/* needed for BCC */
  #undef mkdir
  #endif
  
***************
*** 26,36 ****
  #include <io.h>
  #include <fcntl.h>
  #include <direct.h>
- #ifndef WIN32_CLIENT_ONLY
  #include <sys/types.h>			/* for umask() */
  #include <sys/stat.h>			/* for stat() */
  #endif
- #endif
  
  #include "libpq-fe.h"
  #include "pqexpbuffer.h"
--- 26,34 ----
***************
*** 1260,1269 ****
  	bool		error = false;
  	int			fd;
  
- #ifndef WIN32_CLIENT_ONLY
  	struct stat before,
  				after;
- #endif
  
  	if (filename_arg)
  		fname = filename_arg;
--- 1258,1265 ----
***************
*** 1338,1356 ****
  		}
  	}
  
- #ifndef WIN32_CLIENT_ONLY
  	if (!error && stat(fname, &before) != 0)
  	{
  		psql_error("%s: %s\n", fname, strerror(errno));
  		error = true;
  	}
- #endif
  
  	/* call editor */
  	if (!error)
  		error = !editFile(fname);
  
- #ifndef WIN32_CLIENT_ONLY
  	if (!error && stat(fname, &after) != 0)
  	{
  		psql_error("%s: %s\n", fname, strerror(errno));
--- 1334,1349 ----
***************
*** 1359,1368 ****
  
  	if (!error && before.st_mtime != after.st_mtime)
  	{
- #else
- 	if (!error)
- 	{
- #endif
  		stream = fopen(fname, PG_BINARY_R);
  		if (!stream)
  		{
--- 1352,1357 ----
Index: src/bin/psql/copy.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/copy.c,v
retrieving revision 1.60
diff -c -r1.60 copy.c
*** src/bin/psql/copy.c	5 Mar 2006 15:58:51 -0000	1.60
--- src/bin/psql/copy.c	9 Apr 2006 21:21:38 -0000
***************
*** 26,32 ****
  #include "prompt.h"
  #include "stringutils.h"
  
! #if defined(WIN32) && (!defined(__MINGW32__))
  #define __S_ISTYPE(mode, mask)	(((mode) & S_IFMT) == (mask))
  #define S_ISDIR(mode)	 __S_ISTYPE((mode), S_IFDIR)
  #endif
--- 26,32 ----
  #include "prompt.h"
  #include "stringutils.h"
  
! #if defined(WIN32) && (!defined(S_ISDIR))
  #define __S_ISTYPE(mode, mask)	(((mode) & S_IFMT) == (mask))
  #define S_ISDIR(mode)	 __S_ISTYPE((mode), S_IFDIR)
  #endif
Index: src/bin/psql/print.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/print.c,v
retrieving revision 1.85
diff -c -r1.85 print.c
*** src/bin/psql/print.c	5 Mar 2006 15:58:51 -0000	1.85
--- src/bin/psql/print.c	13 Apr 2006 17:32:04 -0000
***************
*** 11,20 ****
  
  #include <math.h>
  #include <signal.h>
- 
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #ifndef WIN32
  #include <sys/ioctl.h>			/* for ioctl() */
--- 11,17 ----
***************
*** 641,650 ****
  		for (ptr = footers; *ptr; ptr++)
  			fprintf(fout, "%s\n", *ptr);
  
! #ifndef __MINGW32__
  
  	/*
! 	 * for some reason MinGW outputs an extra newline, so this supresses it
  	 */
  	fputc('\n', fout);
  #endif
--- 638,647 ----
  		for (ptr = footers; *ptr; ptr++)
  			fprintf(fout, "%s\n", *ptr);
  
! #ifndef WIN32
  
  	/*
! 	 * for some reason MinGW (and vc++) outputs an extra newline, so this supresses it
  	 */
  	fputc('\n', fout);
  #endif
Index: src/bin/psql/win32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/win32.mak,v
retrieving revision 1.30
diff -c -r1.30 win32.mak
*** src/bin/psql/win32.mak	3 Mar 2006 23:11:48 -0000	1.30
--- src/bin/psql/win32.mak	23 Apr 2006 19:08:57 -0000
***************
*** 28,34 ****
  
  CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
   "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
!  /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
   /I ..\pg_dump /I ..\..\backend \
   /D "HAVE_STRDUP" /D "FRONTEND"
  
--- 28,34 ----
  
  CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
   "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
!  /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 /I ..\..\include\port\win32vc \
   /I ..\pg_dump /I ..\..\backend \
   /D "HAVE_STRDUP" /D "FRONTEND"
  
***************
*** 57,62 ****
--- 57,63 ----
  	-@erase "$(INTDIR)\exec.obj"
  	-@erase "$(INTDIR)\getopt.obj"
  	-@erase "$(INTDIR)\getopt_long.obj"
+ 	-@erase "$(INTDIR)\snprintf.obj"
  	-@erase "$(INTDIR)\path.obj"
  	-@erase "$(INTDIR)\pgstrcasecmp.obj"
  	-@erase "$(INTDIR)\sprompt.obj"
***************
*** 91,96 ****
--- 92,98 ----
  	"$(INTDIR)\exec.obj" \
  	"$(INTDIR)\getopt.obj" \
  	"$(INTDIR)\getopt_long.obj" \
+ 	"$(INTDIR)\snprintf.obj" \
  	"$(INTDIR)\path.obj" \
  	"$(INTDIR)\pgstrcasecmp.obj" \
  	"$(INTDIR)\sprompt.obj" \
***************
*** 139,144 ****
--- 141,151 ----
      $(CPP_PROJ) ..\..\port\getopt_long.c
  <<
  
+ "$(INTDIR)\snprintf.obj" : "$(INTDIR)" ..\..\port\snprintf.c
+     $(CPP) @<<
+     $(CPP_PROJ) ..\..\port\snprintf.c
+ <<
+ 
  "$(INTDIR)\path.obj" : "$(INTDIR)" ..\..\port\path.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\path.c
Index: src/include/c.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.199
diff -c -r1.199 c.h
*** src/include/c.h	5 Mar 2006 15:58:52 -0000	1.199
--- src/include/c.h	22 Apr 2006 17:54:40 -0000
***************
*** 52,65 ****
  
  #include "pg_config.h"
  #include "pg_config_manual.h"	/* must be after pg_config.h */
! #if !defined(WIN32) && !defined(__CYGWIN__)
  #include "pg_config_os.h"		/* must be before any system header files */
- #else
- #if defined(_MSC_VER) || defined(__BORLANDC__)
- #define WIN32_CLIENT_ONLY
- /* Some use MinGW-generated pg_config.h but MSVC for extensions. */
- #undef HAVE_STRINGS_H
- #endif
  #endif
  #include "postgres_ext.h"
  
--- 52,59 ----
  
  #include "pg_config.h"
  #include "pg_config_manual.h"	/* must be after pg_config.h */
! #if !defined(WIN32) && !defined(__CYGWIN__) /* win32 will include further down */
  #include "pg_config_os.h"		/* must be before any system header files */
  #endif
  #include "postgres_ext.h"
  
***************
*** 82,94 ****
  #endif
  
  #if defined(WIN32) || defined(__CYGWIN__)
! #ifndef WIN32_CLIENT_ONLY
! /* We have to redefine some system functions after they are included above */
! #include "pg_config_os.h"
! #else
! #include "port/win32.h"			/* We didn't run configure, but this is our
! 								 * port file */
! #endif
  #endif
  
  /* Must be before gettext() games below */
--- 76,86 ----
  #endif
  
  #if defined(WIN32) || defined(__CYGWIN__)
! /* We have to redefine some system functions after they are included above.
!  *
!  * use port/win32.h directly to work on both mingw and non-mingw.
!  */
! #include "port/win32.h"
  #endif
  
  /* Must be before gettext() games below */
Index: src/include/getaddrinfo.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/getaddrinfo.h,v
retrieving revision 1.19
diff -c -r1.19 getaddrinfo.h
*** src/include/getaddrinfo.h	5 Mar 2006 15:58:53 -0000	1.19
--- src/include/getaddrinfo.h	13 Apr 2006 20:56:50 -0000
***************
*** 22,31 ****
  #ifndef GETADDRINFO_H
  #define GETADDRINFO_H
  
- #ifndef WIN32_CLIENT_ONLY
  #include <sys/socket.h>
  #include <netdb.h>
- #endif
  
  
  /* Various macros that ought to be in <netdb.h>, but might not be */
--- 22,29 ----
***************
*** 42,48 ****
  #define EAI_MEMORY		(-10)
  #define EAI_SYSTEM		(-11)
  #else							/* WIN32 */
! #if defined(WIN32_CLIENT_ONLY)
  #define WSA_NOT_ENOUGH_MEMORY   (WSAENOBUFS)
  #define WSATYPE_NOT_FOUND       (WSABASEERR+109)
  #endif
--- 40,46 ----
  #define EAI_MEMORY		(-10)
  #define EAI_SYSTEM		(-11)
  #else							/* WIN32 */
! #ifdef _MSC_VER
  #define WSA_NOT_ENOUGH_MEMORY   (WSAENOBUFS)
  #define WSATYPE_NOT_FOUND       (WSABASEERR+109)
  #endif
Index: src/include/pg_config.h.win32
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/pg_config.h.win32,v
retrieving revision 1.28
diff -c -r1.28 pg_config.h.win32
*** src/include/pg_config.h.win32	11 Mar 2006 04:38:38 -0000	1.28
--- src/include/pg_config.h.win32	22 Apr 2006 18:59:16 -0000
***************
*** 1,69 ****
! /* $PostgreSQL: pgsql/src/include/pg_config.h.win32,v 1.28 2006/03/11 04:38:38 momjian Exp $ */
  
! #ifndef	pg_config_h_win32__
! #define	pg_config_h_win32__
! /*
!  * Parts of pg_config.h that you get with autoconf on other systems
   */
- #define PG_VERSION "8.2devel"
- #define PG_VERSION_STR "8.2devel (win32)"
  
  #define DEF_PGPORT 5432
  #define DEF_PGPORT_STR "5432"
  
! #define MAXIMUM_ALIGNOF 4
! #define ACCEPT_TYPE_ARG3 int
  
! #define MAXPGPATH 1024
! #define MEMSET_LOOP_LIMIT 1024
  
! #define INDEX_MAX_KEYS 32
  
! #define HAVE_ATEXIT
! #define HAVE_MEMMOVE
  
! #ifdef __BORLANDC__
! #define HAVE_RANDOM
  #endif
  
! #define INT64_FORMAT "%I64d"
! #define HAVE_DECL_VSNPRINTF 1
  
! /* use _snprintf and _vsnprintf */
  #define HAVE_DECL_SNPRINTF 1
! #define snprintf        _snprintf
  #define HAVE_DECL_VSNPRINTF 1
- #define vsnprintf       _vsnprintf
  
! /* defines for dynamic linking on Win32 platform */
! #ifdef __CYGWIN__
  
! #if __GNUC__ && ! defined (__declspec)
! #error You need egcs 1.1 or newer for compiling!
! #endif
  
! #ifdef BUILDING_DLL
! #define DLLIMPORT __declspec (dllexport)
! #else							/* not BUILDING_DLL */
! #define DLLIMPORT __declspec (dllimport)
! #endif
  
! #elif defined(WIN32) && defined(_MSC_VER)		/* not CYGWIN */
  
! #if defined(_DLL)
! #define DLLIMPORT __declspec (dllexport)
! #else							/* not _DLL */
! #define DLLIMPORT __declspec (dllimport)
! #endif
  
! #else							/* not CYGWIN, not MSVC */
  
! #define DLLIMPORT
  
! #endif
  
! #ifndef __CYGWIN__
! #include <windows.h>
! #endif
  
! #endif /* pg_config_h_win32__ */
--- 1,660 ----
! /* src/include/pg_config.h.  Generated by configure.  */
! /* src/include/pg_config.h.in.  Generated from configure.in by autoheader.  */
  
! /* This file is generated from MingW ./configure, and with the following
!  * changes to be valid for Visual C++ (and compatible):
!  *
!  * HAVE_CBRT, HAVE_FUNCNAME_FUNC, HAVE_FUNCNAME_FUNCTION, HAVE_GETOPT,
!  * HAVE_GETOPT_H, HAVE_GETOPT_LONG, HAVE_RINT, HAVE_STRINGS_H, 
!  * HAVE_STRTOLL, HAVE_STRTOULL, HAVE_STRUCT_OPTION
!  *
!  * For now, also HAVE_IPV6
   */
  
+ /* Define to the type of arg 1 of 'accept' */
+ #define ACCEPT_TYPE_ARG1 unsigned int
+ 
+ /* Define to the type of arg 2 of 'accept' */
+ #define ACCEPT_TYPE_ARG2 struct sockaddr *
+ 
+ /* Define to the type of arg 3 of 'accept' */
+ #define ACCEPT_TYPE_ARG3 int
+ 
+ /* Define to the return type of 'accept' */
+ #define ACCEPT_TYPE_RETURN unsigned int PASCAL
+ 
+ /* The alignment requirement of a `double'. */
+ #define ALIGNOF_DOUBLE 8
+ 
+ /* The alignment requirement of a `int'. */
+ #define ALIGNOF_INT 4
+ 
+ /* The alignment requirement of a `long'. */
+ #define ALIGNOF_LONG 4
+ 
+ /* The alignment requirement of a `long long int'. */
+ #define ALIGNOF_LONG_LONG_INT 8
+ 
+ /* The alignment requirement of a `short'. */
+ #define ALIGNOF_SHORT 2
+ 
+ /* Define to the default TCP port number on which the server listens and to
+    which clients will try to connect. This can be overridden at run-time, but
+    it's convenient if your clients have the right default compiled in.
+    (--with-pgport=PORTNUM) */
  #define DEF_PGPORT 5432
+ 
+ /* Define to the default TCP port number as a string constant. */
  #define DEF_PGPORT_STR "5432"
  
! /* Define to 1 if you want National Language Support. (--enable-nls) */
! /* #undef ENABLE_NLS */
  
! /* Define to 1 to build client libraries as thread-safe code.
!    (--enable-thread-safety) */
! /* #undef ENABLE_THREAD_SAFETY */
  
! /* Define to 1 if getpwuid_r() takes a 5th argument. */
! /* #undef GETPWUID_R_5ARG */
  
! /* Define to 1 if gettimeofday() takes only 1 argument. */
! /* #undef GETTIMEOFDAY_1ARG */
  
! #ifdef GETTIMEOFDAY_1ARG
! # define gettimeofday(a,b) gettimeofday(a)
  #endif
  
! /* Define to 1 if you have the `atexit' function. */
! #define HAVE_ATEXIT 1
! 
! /* Define to 1 if you have the `cbrt' function. */
! //#define HAVE_CBRT 1
! 
! /* Define to 1 if you have the `class' function. */
! /* #undef HAVE_CLASS */
! 
! /* Define to 1 if you have the `crypt' function. */
! /* #undef HAVE_CRYPT */
! 
! /* Define to 1 if you have the <crypt.h> header file. */
! /* #undef HAVE_CRYPT_H */
! 
! /* Define to 1 if you have the declaration of `fdatasync', and to 0 if you
!    don't. */
! #define HAVE_DECL_FDATASYNC 0
  
! /* Define to 1 if you have the declaration of `F_FULLFSYNC', and to 0 if you
!    don't. */
! #define HAVE_DECL_F_FULLFSYNC 0
! 
! /* Define to 1 if you have the declaration of `snprintf', and to 0 if you
!    don't. */
  #define HAVE_DECL_SNPRINTF 1
! 
! /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
!    don't. */
  #define HAVE_DECL_VSNPRINTF 1
  
! /* Define to 1 if you have the <dld.h> header file. */
! /* #undef HAVE_DLD_H */
  
! /* Define to 1 if you have the `dlopen' function. */
! /* #undef HAVE_DLOPEN */
  
! /* Define to 1 if you have the <editline/history.h> header file. */
! /* #undef HAVE_EDITLINE_HISTORY_H */
  
! /* Define to 1 if you have the <editline/readline.h> header file. */
! /* #undef HAVE_EDITLINE_READLINE_H */
  
! /* Define to 1 if you have the <endian.h> header file. */
! /* #undef HAVE_ENDIAN_H */
  
! /* Define to 1 if you have the `fcvt' function. */
! #define HAVE_FCVT 1
  
! /* Define to 1 if you have the `fdatasync' function. */
! /* #undef HAVE_FDATASYNC */
  
! /* Define to 1 if you have finite(). */
! #define HAVE_FINITE 1
  
! /* Define to 1 if you have the `fpclass' function. */
! /* #undef HAVE_FPCLASS */
! 
! /* Define to 1 if you have the `fp_class' function. */
! /* #undef HAVE_FP_CLASS */
! 
! /* Define to 1 if you have the `fp_class_d' function. */
! /* #undef HAVE_FP_CLASS_D */
! 
! /* Define to 1 if you have the <fp_class.h> header file. */
! /* #undef HAVE_FP_CLASS_H */
! 
! /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
! /* #undef HAVE_FSEEKO */
! 
! /* Define to 1 if your compiler understands __func__. */
! //#define HAVE_FUNCNAME__FUNC 1
! 
! /* Define to 1 if your compiler understands __FUNCTION__. */
! #undef HAVE_FUNCNAME__FUNCTION
! 
! /* Define to 1 if you have getaddrinfo(). */
! /* #undef HAVE_GETADDRINFO */
! 
! /* Define to 1 if you have the `gethostbyname_r' function. */
! /* #undef HAVE_GETHOSTBYNAME_R */
! 
! /* Define to 1 if you have the `getopt' function. */
! //#define HAVE_GETOPT 1
! 
! /* Define to 1 if you have the <getopt.h> header file. */
! //#define HAVE_GETOPT_H 1
! 
! /* Define to 1 if you have the `getopt_long' function. */
! //#define HAVE_GETOPT_LONG 1
! 
! /* Define to 1 if you have the `getpeereid' function. */
! /* #undef HAVE_GETPEEREID */
! 
! /* Define to 1 if you have the `getpwuid_r' function. */
! /* #undef HAVE_GETPWUID_R */
! 
! /* Define to 1 if you have the `getrusage' function. */
! /* #undef HAVE_GETRUSAGE */
! 
! /* Define to 1 if you have the <history.h> header file. */
! /* #undef HAVE_HISTORY_H */
! 
! /* Define to 1 if you have the <ieeefp.h> header file. */
! /* #undef HAVE_IEEEFP_H */
! 
! /* Define to 1 if you have the `inet_aton' function. */
! /* #undef HAVE_INET_ATON */
! 
! /* Define to 1 if the system has the type `int64'. */
! /* #undef HAVE_INT64 */
! 
! /* Define to 1 if the system has the type `int8'. */
! /* #undef HAVE_INT8 */
! 
! /* Define to 1 if you have the <inttypes.h> header file. */
! #define HAVE_INTTYPES_H 1
! 
! /* Define to 1 if you have the global variable 'int optreset'. */
! #define HAVE_INT_OPTRESET 1
! 
! /* Define to 1 if you have the global variable 'int timezone'. */
! #define HAVE_INT_TIMEZONE 
! 
! /* Define to 1 if you have support for IPv6. */
! //#define HAVE_IPV6 1
! 
! /* Define to 1 if you have isinf(). */
! #define HAVE_ISINF 1
! 
! /* Define to 1 if you have the <kernel/image.h> header file. */
! /* #undef HAVE_KERNEL_IMAGE_H */
! 
! /* Define to 1 if you have the <kernel/OS.h> header file. */
! /* #undef HAVE_KERNEL_OS_H */
! 
! /* Define to 1 if `e_data' is member of `krb5_error'. */
! /* #undef HAVE_KRB5_ERROR_E_DATA */
! 
! /* Define to 1 if `text.data' is member of `krb5_error'. */
! /* #undef HAVE_KRB5_ERROR_TEXT_DATA */
! 
! /* Define to 1 if `client' is member of `krb5_ticket'. */
! /* #undef HAVE_KRB5_TICKET_CLIENT */
! 
! /* Define to 1 if `enc_part2' is member of `krb5_ticket'. */
! /* #undef HAVE_KRB5_TICKET_ENC_PART2 */
! 
! /* Define to 1 if you have the <langinfo.h> header file. */
! /* #undef HAVE_LANGINFO_H */
! 
! /* Define to 1 if you have the <ldap.h> header file. */
! /* #undef HAVE_LDAP_H */
! 
! /* Define to 1 if you have the `crypto' library (-lcrypto). */
! /* #undef HAVE_LIBCRYPTO */
! 
! /* Define to 1 if you have the `eay32' library (-leay32). */
! /* #undef HAVE_LIBEAY32 */
! 
! /* Define to 1 if you have the `ldap' library (-lldap). */
! /* #undef HAVE_LIBLDAP */
! 
! /* Define to 1 if you have the `pam' library (-lpam). */
! /* #undef HAVE_LIBPAM */
! 
! /* Define if you have a function readline library */
! /* #undef HAVE_LIBREADLINE */
! 
! /* Define to 1 if you have the `ssl' library (-lssl). */
! /* #undef HAVE_LIBSSL */
! 
! /* Define to 1 if you have the `ssleay32' library (-lssleay32). */
! /* #undef HAVE_LIBSSLEAY32 */
! 
! /* Define to 1 if you have the `wldap32' library (-lwldap32). */
! /* #undef HAVE_LIBWLDAP32 */
! 
! /* Define to 1 if you have the `z' library (-lz). */
! /* #undef HAVE_LIBZ */
! 
! /* Define to 1 if constants of type 'long long int' should have the suffix LL.
!    */
! #define HAVE_LL_CONSTANTS 1
! 
! /* Define to 1 if `long int' works and is 64 bits. */
! /* #undef HAVE_LONG_INT_64 */
! 
! /* Define to 1 if `long long int' works and is 64 bits. */
! #define HAVE_LONG_LONG_INT_64 
! 
! /* Define to 1 if you have the `memmove' function. */
! #define HAVE_MEMMOVE 1
! 
! /* Define to 1 if you have the <memory.h> header file. */
! #define HAVE_MEMORY_H 1
! 
! /* Define to 1 if you have the <netinet/in.h> header file. */
! #define HAVE_NETINET_IN_H 1
! 
! /* Define to 1 if you have the <netinet/tcp.h> header file. */
! /* #undef HAVE_NETINET_TCP_H */
! 
! /* Define to 1 if you have the `on_exit' function. */
! /* #undef HAVE_ON_EXIT */
! 
! /* Define to 1 if you have the <pam/pam_appl.h> header file. */
! /* #undef HAVE_PAM_PAM_APPL_H */
! 
! /* Define to 1 if you have the `poll' function. */
! /* #undef HAVE_POLL */
! 
! /* Define to 1 if you have the <poll.h> header file. */
! /* #undef HAVE_POLL_H */
! 
! /* Define to 1 if you have the POSIX signal interface. */
! /* #undef HAVE_POSIX_SIGNALS */
! 
! /* Define to 1 if you have the `pstat' function. */
! /* #undef HAVE_PSTAT */
! 
! /* Define to 1 if the PS_STRINGS thing exists. */
! /* #undef HAVE_PS_STRINGS */
! 
! /* Define if you have POSIX threads libraries and header files. */
! /* #undef HAVE_PTHREAD */
! 
! /* Define to 1 if you have the <pwd.h> header file. */
! #define HAVE_PWD_H 1
! 
! /* Define to 1 if you have the `random' function. */
! /* #undef HAVE_RANDOM */
! 
! /* Define to 1 if you have the <readline.h> header file. */
! /* #undef HAVE_READLINE_H */
! 
! /* Define to 1 if you have the <readline/history.h> header file. */
! /* #undef HAVE_READLINE_HISTORY_H */
! 
! /* Define to 1 if you have the <readline/readline.h> header file. */
! /* #undef HAVE_READLINE_READLINE_H */
! 
! /* Define to 1 if you have the `readlink' function. */
! /* #undef HAVE_READLINK */
! 
! /* Define to 1 if you have the `replace_history_entry' function. */
! /* #undef HAVE_REPLACE_HISTORY_ENTRY */
! 
! /* Define to 1 if you have the `rint' function. */
! /*#define HAVE_RINT 1*/
! 
! /* Define to 1 if you have the global variable
!    'rl_completion_append_character'. */
! /* #undef HAVE_RL_COMPLETION_APPEND_CHARACTER */
! 
! /* Define to 1 if you have the `rl_completion_matches' function. */
! /* #undef HAVE_RL_COMPLETION_MATCHES */
! 
! /* Define to 1 if you have the `rl_filename_completion_function' function. */
! /* #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION */
! 
! /* Define to 1 if you have the <security/pam_appl.h> header file. */
! /* #undef HAVE_SECURITY_PAM_APPL_H */
! 
! /* Define to 1 if you have the `setproctitle' function. */
! /* #undef HAVE_SETPROCTITLE */
! 
! /* Define to 1 if you have the `setsid' function. */
! /* #undef HAVE_SETSID */
! 
! /* Define to 1 if you have the `sigprocmask' function. */
! /* #undef HAVE_SIGPROCMASK */
! 
! /* Define to 1 if you have sigsetjmp(). */
! /* #undef HAVE_SIGSETJMP */
! 
! /* Define to 1 if the system has the type `sig_atomic_t'. */
! #define HAVE_SIG_ATOMIC_T 1
! 
! /* Define to 1 if you have the `snprintf' function. */
! /* #undef HAVE_SNPRINTF */
! 
! /* Define to 1 if you have spinlocks. */
! #define HAVE_SPINLOCKS 1
! 
! /* Define to 1 if you have the `srandom' function. */
! /* #undef HAVE_SRANDOM */
! 
! /* Define to 1 if you have the <stdint.h> header file. */
! #define HAVE_STDINT_H 1
! 
! /* Define to 1 if you have the <stdlib.h> header file. */
! #define HAVE_STDLIB_H 1
! 
! /* Define to 1 if you have the `strdup' function. */
! #define HAVE_STRDUP 1
! 
! /* Define to 1 if you have the `strerror' function. */
! #define HAVE_STRERROR 1
! 
! /* Define to 1 if you have the `strerror_r' function. */
! /* #undef HAVE_STRERROR_R */
! 
! /* Define to 1 if cpp supports the ANSI # stringizing operator. */
! #define HAVE_STRINGIZE 1
! 
! /* Define to 1 if you have the <strings.h> header file. */
! /*#define HAVE_STRINGS_H 1 */
! 
! /* Define to 1 if you have the <string.h> header file. */
! #define HAVE_STRING_H 1
! 
! /* Define to 1 if you have the `strtol' function. */
! #define HAVE_STRTOL 1
! 
! /* Define to 1 if you have the `strtoll' function. */
! //#define HAVE_STRTOLL 1
! 
! /* Define to 1 if you have the `strtoq' function. */
! /* #undef HAVE_STRTOQ */
! 
! /* Define to 1 if you have the `strtoul' function. */
! #define HAVE_STRTOUL 1
! 
! /* Define to 1 if you have the `strtoull' function. */
! //#define HAVE_STRTOULL 1
! 
! /* Define to 1 if you have the `strtouq' function. */
! /* #undef HAVE_STRTOUQ */
! 
! /* Define to 1 if the system has the type `struct addrinfo'. */
! #define HAVE_STRUCT_ADDRINFO 1
! 
! /* Define to 1 if the system has the type `struct cmsgcred'. */
! /* #undef HAVE_STRUCT_CMSGCRED */
! 
! /* Define to 1 if the system has the type `struct fcred'. */
! /* #undef HAVE_STRUCT_FCRED */
! 
! /* Define to 1 if the system has the type `struct option'. */
! //#define HAVE_STRUCT_OPTION 1
! 
! /* Define to 1 if `sa_len' is member of `struct sockaddr'. */
! /* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
! 
! /* Define to 1 if the system has the type `struct sockaddr_storage'. */
! #define HAVE_STRUCT_SOCKADDR_STORAGE 1
! 
! /* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
! #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
! 
! /* Define to 1 if `ss_len' is member of `struct sockaddr_storage'. */
! /* #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */
! 
! /* Define to 1 if `__ss_family' is member of `struct sockaddr_storage'. */
! /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
! 
! /* Define to 1 if `__ss_len' is member of `struct sockaddr_storage'. */
! /* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN */
! 
! /* Define to 1 if the system has the type `struct sockaddr_un'. */
! /* #undef HAVE_STRUCT_SOCKADDR_UN */
! 
! /* Define to 1 if the system has the type `struct sockcred'. */
! /* #undef HAVE_STRUCT_SOCKCRED */
! 
! /* Define to 1 if `tm_zone' is member of `struct tm'. */
! /* #undef HAVE_STRUCT_TM_TM_ZONE */
! 
! /* Define to 1 if you have the <SupportDefs.h> header file. */
! /* #undef HAVE_SUPPORTDEFS_H */
! 
! /* Define to 1 if you have the `symlink' function. */
! #define HAVE_SYMLINK 1
! 
! /* Define to 1 if you have the `sysconf' function. */
! /* #undef HAVE_SYSCONF */
! 
! /* Define to 1 if you have the syslog interface. */
! /* #undef HAVE_SYSLOG */
! 
! /* Define to 1 if you have the <sys/ipc.h> header file. */
! /* #undef HAVE_SYS_IPC_H */
! 
! /* Define to 1 if you have the <sys/poll.h> header file. */
! /* #undef HAVE_SYS_POLL_H */
! 
! /* Define to 1 if you have the <sys/pstat.h> header file. */
! /* #undef HAVE_SYS_PSTAT_H */
! 
! /* Define to 1 if you have the <sys/select.h> header file. */
! /* #undef HAVE_SYS_SELECT_H */
! 
! /* Define to 1 if you have the <sys/sem.h> header file. */
! /* #undef HAVE_SYS_SEM_H */
! 
! /* Define to 1 if you have the <sys/shm.h> header file. */
! /* #undef HAVE_SYS_SHM_H */
! 
! /* Define to 1 if you have the <sys/socket.h> header file. */
! #define HAVE_SYS_SOCKET_H 1
! 
! /* Define to 1 if you have the <sys/stat.h> header file. */
! #define HAVE_SYS_STAT_H 1
! 
! /* Define to 1 if you have the <sys/time.h> header file. */
! #define HAVE_SYS_TIME_H 1
! 
! /* Define to 1 if you have the <sys/types.h> header file. */
! #define HAVE_SYS_TYPES_H 1
! 
! /* Define to 1 if you have the <sys/un.h> header file. */
! /* #undef HAVE_SYS_UN_H */
! 
! /* Define to 1 if you have the <termios.h> header file. */
! /* #undef HAVE_TERMIOS_H */
! 
! /* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
!    `HAVE_STRUCT_TM_TM_ZONE' instead. */
! /* #undef HAVE_TM_ZONE */
! 
! /* Define to 1 if you have the `towlower' function. */
! #define HAVE_TOWLOWER 1
! 
! /* Define to 1 if you have the external array `tzname'. */
! /* #undef HAVE_TZNAME */
! 
! /* Define to 1 if the system has the type `uint64'. */
! /* #undef HAVE_UINT64 */
! 
! /* Define to 1 if the system has the type `uint8'. */
! /* #undef HAVE_UINT8 */
! 
! /* Define to 1 if the system has the type `union semun'. */
! /* #undef HAVE_UNION_SEMUN */
! 
! /* Define to 1 if you have the <unistd.h> header file. */
! #define HAVE_UNISTD_H 1
! 
! /* Define to 1 if you have unix sockets. */
! /* #undef HAVE_UNIX_SOCKETS */
! 
! /* Define to 1 if you have the `unsetenv' function. */
! /* #undef HAVE_UNSETENV */
! 
! /* Define to 1 if you have the `utime' function. */
! #define HAVE_UTIME 1
! 
! /* Define to 1 if you have the `utimes' function. */
! /* #undef HAVE_UTIMES */
! 
! /* Define to 1 if you have the <utime.h> header file. */
! #define HAVE_UTIME_H 1
! 
! /* Define to 1 if you have the `vsnprintf' function. */
! /* #undef HAVE_VSNPRINTF */
! 
! /* Define to 1 if you have the `waitpid' function. */
! /* #undef HAVE_WAITPID */
! 
! /* Define to 1 if you have the <wchar.h> header file. */
! #define HAVE_WCHAR_H 1
! 
! /* Define to 1 if you have the `wcstombs' function. */
! #define HAVE_WCSTOMBS 1
! 
! /* Define to 1 if you have the <wctype.h> header file. */
! #define HAVE_WCTYPE_H 1
! 
! /* Define to 1 if you have the <winldap.h> header file. */
! /* #undef HAVE_WINLDAP_H */
! 
! /* Define to the appropriate snprintf format for 64-bit ints, if any. */
! #define INT64_FORMAT "%lld"
! 
! /* Define to build with Kerberos 5 support. (--with-krb5) */
! /* #undef KRB5 */
! 
! /* Define to the location of locale files. */
! /* #undef LOCALEDIR */
! 
! /* Define as the maximum alignment requirement of any C data type. */
! #define MAXIMUM_ALIGNOF 8
! 
! /* Define bytes to use libc memset(). */
! #define MEMSET_LOOP_LIMIT 1024
! 
! /* Define to the address where bug reports for this package should be sent. */
! #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org"
! 
! /* Define to the full name of this package. */
! #define PACKAGE_NAME "PostgreSQL"
! 
! /* Define to the full name and version of this package. */
! #define PACKAGE_STRING "PostgreSQL 8.2devel"
! 
! /* Define to the one symbol short name of this package. */
! #define PACKAGE_TARNAME "postgresql"
! 
! /* Define to the version of this package. */
! #define PACKAGE_VERSION "8.2devel"
! 
! /* Define to the name of the default PostgreSQL service principal in Kerberos.
!    (--with-krb-srvnam=NAME) */
! #define PG_KRB_SRVNAM "postgres"
! 
! /* PostgreSQL version as a string */
! #define PG_VERSION "8.2devel"
! 
! /* PostgreSQL version as a number */
! #define PG_VERSION_NUM 80200
! 
! /* A string containing the version number, platform, and C compiler */
! #define PG_VERSION_STR "Uninitialized version string (win32)"
! 
! /* Define to the necessary symbol if this constant uses a non-standard name on
!    your system. */
! /* #undef PTHREAD_CREATE_JOINABLE */
! 
! /* The size of a `size_t', as computed by sizeof. */
! #define SIZEOF_SIZE_T 4
! 
! /* The size of a `unsigned long', as computed by sizeof. */
! #define SIZEOF_UNSIGNED_LONG 4
! 
! /* Define to 1 if you have the ANSI C header files. */
! #define STDC_HEADERS 1
! 
! /* Define to 1 if strerror_r() returns a int. */
! /* #undef STRERROR_R_INT */
! 
! /* Define to 1 if your <sys/time.h> declares `struct tm'. */
! /* #undef TM_IN_SYS_TIME */
! 
! /* Define to the appropriate snprintf format for unsigned 64-bit ints, if any.
!    */
! #define UINT64_FORMAT "%llu"
! 
! /* Define to 1 to build with assertion checks. (--enable-cassert) */
! /* #undef USE_ASSERT_CHECKING */
! 
! /* Define to 1 to build with Bonjour support. (--with-bonjour) */
! /* #undef USE_BONJOUR */
! 
! /* Define to 1 if you want 64-bit integer timestamp and interval support.
!    (--enable-integer-datetimes) */
! /* #undef USE_INTEGER_DATETIMES */
! 
! /* Define to 1 to build with LDAP support. (--with-ldap) */
! /* #undef USE_LDAP */
! 
! /* Define to select named POSIX semaphores. */
! /* #undef USE_NAMED_POSIX_SEMAPHORES */
! 
! /* Define to 1 to build with PAM support. (--with-pam) */
! /* #undef USE_PAM */
! 
! /* Use replacement snprintf() functions. */
! #define USE_REPL_SNPRINTF 1
! 
! /* Define to build with (Open)SSL support. (--with-openssl) */
! /* #undef USE_SSL */
! 
! /* Define to select SysV-style semaphores. */
! #define USE_SYSV_SEMAPHORES 1
! 
! /* Define to select SysV-style shared memory. */
! #define USE_SYSV_SHARED_MEMORY 1
! 
! /* Define to select unnamed POSIX semaphores. */
! /* #undef USE_UNNAMED_POSIX_SEMAPHORES */
! 
! /* Number of bits in a file offset, on hosts where this is settable. */
! /* #undef _FILE_OFFSET_BITS */
! 
! /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
! /* #undef _LARGEFILE_SOURCE */
! 
! /* Define for large files, on AIX-style hosts. */
! /* #undef _LARGE_FILES */
! 
! /* Define to empty if `const' does not conform to ANSI C. */
! /* #undef const */
! 
! /* Define as `__inline' if that's what the C compiler calls it, or to nothing
!    if it is not supported. */
! /* #undef inline */
! 
! /* Define to empty if the C compiler does not understand signed types. */
! /* #undef signed */
  
! /* Define to empty if the keyword `volatile' does not work. Warning: valid
!    code using `volatile' can become incorrect without. Disable with care. */
! /* #undef volatile */
Index: src/include/port.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port.h,v
retrieving revision 1.90
diff -c -r1.90 port.h
*** src/include/port.h	5 Mar 2006 15:58:53 -0000	1.90
--- src/include/port.h	23 Apr 2006 19:52:59 -0000
***************
*** 11,21 ****
   *-------------------------------------------------------------------------
   */
  
- #ifndef WIN32_CLIENT_ONLY
- /* for thread.c */
  #include <pwd.h>
  #include <netdb.h>
- #endif
  
  #include <ctype.h>
  
--- 11,18 ----
***************
*** 221,227 ****
  extern int	pgunlink(const char *path);
  
  /* Include this first so later includes don't see these defines */
! #ifdef WIN32_CLIENT_ONLY
  #include <io.h>
  #endif
  
--- 218,224 ----
  extern int	pgunlink(const char *path);
  
  /* Include this first so later includes don't see these defines */
! #ifdef _MSC_VER
  #include <io.h>
  #endif
  
***************
*** 249,258 ****
  
  /* open() replacement to allow delete of held files and passing
   * of special options. */
- #ifndef WIN32_CLIENT_ONLY
  extern int	win32_open(const char *, int,...);
  
! #define		open(a,b,...)	win32_open(a,b,##__VA_ARGS__)
  #endif
  
  #ifndef __BORLANDC__
--- 246,255 ----
  
  /* open() replacement to allow delete of held files and passing
   * of special options. */
  extern int	win32_open(const char *, int,...);
  
! #ifndef FRONTEND
! #define		open(a,b,c)	win32_open(a,b,c)
  #endif
  
  #ifndef __BORLANDC__
***************
*** 306,315 ****
  #endif
  
  #ifndef HAVE_INET_ATON
- #ifndef WIN32_CLIENT_ONLY
  #include <netinet/in.h>
  #include <arpa/inet.h>
- #endif
  extern int	inet_aton(const char *cp, struct in_addr * addr);
  #endif
  
--- 303,310 ----
Index: src/include/libpq/pqcomm.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/libpq/pqcomm.h,v
retrieving revision 1.99
diff -c -r1.99 pqcomm.h
*** src/include/libpq/pqcomm.h	5 Mar 2006 15:58:56 -0000	1.99
--- src/include/libpq/pqcomm.h	13 Apr 2006 16:19:21 -0000
***************
*** 16,36 ****
  #ifndef PQCOMM_H
  #define PQCOMM_H
  
- #ifdef WIN32
- #include <winsock.h>
- /* workaround for clashing defines of "ERROR" */
- #ifdef ELOG_H
- #undef ERROR
- #define ERROR	PGERROR
- #endif
- #else							/* not WIN32 */
  #include <sys/socket.h>
  #include <netdb.h>
  #ifdef HAVE_SYS_UN_H
  #include <sys/un.h>
  #endif
  #include <netinet/in.h>
- #endif   /* not WIN32 */
  
  #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
  
--- 16,27 ----
Index: src/include/port/win32.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.51
diff -c -r1.51 win32.h
*** src/include/port/win32.h	3 Mar 2006 20:52:36 -0000	1.51
--- src/include/port/win32.h	22 Apr 2006 21:20:20 -0000
***************
*** 4,15 ****
  #undef mkdir
  
  #undef ERROR
  #include <windows.h>
! #include <winsock.h>
  #include <process.h>
  #include <signal.h>
  #include <errno.h>
! 
  #undef near
  
  /* Must be here to avoid conflicting with prototype in windows.h */
--- 4,19 ----
  #undef mkdir
  
  #undef ERROR
+ #define _WINSOCKAPI_
  #include <windows.h>
! #include <winsock2.h>
! #include <ws2tcpip.h>
! #undef small
  #include <process.h>
  #include <signal.h>
  #include <errno.h>
! #include <direct.h>
! #include <sys/utime.h> /* for non-unicode version */
  #undef near
  
  /* Must be here to avoid conflicting with prototype in windows.h */
***************
*** 28,34 ****
  #define USES_WINSOCK
  
  /* defines for dynamic linking on Win32 platform */
! #if defined(__MINGW32__) || defined(__CYGWIN__)
  
  #if __GNUC__ && ! defined (__declspec)
  #error You need egcs 1.1 or newer for compiling!
--- 32,38 ----
  #define USES_WINSOCK
  
  /* defines for dynamic linking on Win32 platform */
! #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(_MSC_VER)
  
  #if __GNUC__ && ! defined (__declspec)
  #error You need egcs 1.1 or newer for compiling!
***************
*** 40,53 ****
  #define DLLIMPORT __declspec (dllimport)
  #endif
  
- #elif defined(WIN32_CLIENT_ONLY)
- 
- #if defined(_DLL)
- #define DLLIMPORT __declspec (dllexport)
- #else							/* not _DLL */
- #define DLLIMPORT __declspec (dllimport)
- #endif
- 
  #else							/* not CYGWIN, not MSVC, not MingW */
  
  #define DLLIMPORT
--- 44,49 ----
***************
*** 175,181 ****
  #endif
  typedef long key_t;
  
! #ifdef WIN32_CLIENT_ONLY
  typedef int pid_t;
  #endif
  
--- 171,177 ----
  #endif
  typedef long key_t;
  
! #ifdef _MSC_VER
  typedef int pid_t;
  #endif
  
***************
*** 256,258 ****
--- 252,286 ----
  
  /* in backend/port/win32/error.c */
  extern void _dosmaperr(unsigned long);
+ 
+ 
+ /* Things that exist in MingW headers, but need to be added to Visual C++ */
+ #ifdef _MSC_VER
+ typedef long ssize_t;
+ typedef unsigned short mode_t;
+ 
+ #define inline __inline
+ #define __inline__ __inline
+ 
+ #define _S_IRWXU	(_S_IREAD | _S_IWRITE | _S_IEXEC)
+ #define _S_IXUSR	_S_IEXEC
+ #define _S_IWUSR	_S_IWRITE
+ #define _S_IRUSR	_S_IREAD
+ #define S_IRUSR		_S_IRUSR
+ #define S_IWUSR		_S_IWUSR
+ #define S_IXUSR		_S_IXUSR
+ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+ 
+ #define F_OK 0
+ #define W_OK 2
+ #define R_OK 4
+ 
+ #define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
+ #define isnan(x) _isnan(x)
+ #define finite(x) _finite(x)
+ 
+ 
+ /* Pulled from Makefile.port in mingw */
+ #define DLSUFFIX ".dll"
+ #endif
Index: src/include/storage/s_lock.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/storage/s_lock.h,v
retrieving revision 1.148
diff -c -r1.148 s_lock.h
*** src/include/storage/s_lock.h	5 Mar 2006 15:59:00 -0000	1.148
--- src/include/storage/s_lock.h	13 Apr 2006 21:00:07 -0000
***************
*** 782,790 ****
  typedef unsigned char slock_t;
  #endif
  
  
! #endif	/* !defined(HAS_TEST_AND_SET) */
  
  
  /* Blow up if we didn't have any way to do spinlocks */
  #ifndef HAS_TEST_AND_SET
--- 782,809 ----
  typedef unsigned char slock_t;
  #endif
  
+ #ifdef _MSC_VER
+ /* Visual C++ on win32. We use InterlockedCompareExchange(). This function is
+  * declared inline, so it should be fast enough...
+  */
+ typedef LONG slock_t;
  
! #define HAS_TEST_AND_SET
! #define TAS(lock) (InterlockedCompareExchange(lock, 1, 0))
! 
! #define SPIN_DELAY() spin_delay()
! 
! static __forceinline void
! spin_delay(void)
! {
! 	/* See comment for gcc code. Same code, MASM syntax */
! 	__asm rep nop;
! }
  
+ #endif
+ 
+ 
+ #endif	/* !defined(HAS_TEST_AND_SET) */
  
  /* Blow up if we didn't have any way to do spinlocks */
  #ifndef HAS_TEST_AND_SET
Index: src/interfaces/libpq/bcc32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/bcc32.mak,v
retrieving revision 1.20
diff -c -r1.20 bcc32.mak
*** src/interfaces/libpq/bcc32.mak	16 Sep 2005 19:00:05 -0000	1.20
--- src/interfaces/libpq/bcc32.mak	13 Apr 2006 16:17:40 -0000
***************
*** 59,65 ****
  
  OUTFILENAME=blibpq
  
! USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;
  
  CPP=bcc32.exe
  CPP_PROJ = -I$(BCB)\include;..\..\include -n"$(INTDIR)" -WD -c -D$(USERDEFINES) -tWM \
--- 59,65 ----
  
  OUTFILENAME=blibpq
  
! USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;_MSC_VER
  
  CPP=bcc32.exe
  CPP_PROJ = -I$(BCB)\include;..\..\include -n"$(INTDIR)" -WD -c -D$(USERDEFINES) -tWM \
Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.328
diff -c -r1.328 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	14 Mar 2006 22:48:23 -0000	1.328
--- src/interfaces/libpq/fe-connect.c	13 Apr 2006 16:12:13 -0000
***************
*** 20,28 ****
  #include <fcntl.h>
  #include <ctype.h>
  #include <time.h>
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #ifndef HAVE_STRDUP
  #include "strdup.h"
--- 20,26 ----
Index: src/interfaces/libpq/fe-misc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v
retrieving revision 1.125
diff -c -r1.125 fe-misc.c
*** src/interfaces/libpq/fe-misc.c	5 Mar 2006 15:59:09 -0000	1.125
--- src/interfaces/libpq/fe-misc.c	13 Apr 2006 16:11:59 -0000
***************
*** 34,43 ****
  #include <signal.h>
  #include <time.h>
  
- #ifndef WIN32_CLIENT_ONLY
  #include <netinet/in.h>
  #include <arpa/inet.h>
- #endif
  
  #ifdef WIN32
  #include "win32.h"
--- 34,41 ----
Index: src/interfaces/libpq/win32.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/win32.c,v
retrieving revision 1.16
diff -c -r1.16 win32.c
*** src/interfaces/libpq/win32.c	5 Mar 2006 15:59:10 -0000	1.16
--- src/interfaces/libpq/win32.c	13 Apr 2006 15:20:21 -0000
***************
*** 26,37 ****
  #define NOCRYPT
  
  #include <windows.h>
- #include <winsock.h>
  #include <stdio.h>
  #include "win32.h"
! #include "postgres_fe.h"
! #include "libpq-fe.h"
! #include "libpq-int.h"
  
  static struct WSErrorEntry
  {
--- 26,43 ----
  #define NOCRYPT
  
  #include <windows.h>
  #include <stdio.h>
  #include "win32.h"
! 
! /* Declared here to avoid pulling in all includes, which causes name collissions */ 
! #ifdef ENABLE_NLS
! extern char *
! libpq_gettext(const char *msgid)
! __attribute__((format_arg(1)));
! #else
! #define libpq_gettext(x) (x)
! #endif
! 
  
  static struct WSErrorEntry
  {
Index: src/interfaces/libpq/win32.mak
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/win32.mak,v
retrieving revision 1.36
diff -c -r1.36 win32.mak
*** src/interfaces/libpq/win32.mak	16 Sep 2005 18:58:48 -0000	1.36
--- src/interfaces/libpq/win32.mak	23 Apr 2006 19:04:58 -0000
***************
*** 68,73 ****
--- 68,74 ----
  	-@erase "$(INTDIR)\wchar.obj"
  	-@erase "$(INTDIR)\encnames.obj"
  	-@erase "$(INTDIR)\pthread-win32.obj"
+ 	-@erase "$(INTDIR)\snprintf.obj"
  	-@erase "$(OUTDIR)\$(OUTFILENAME).lib"
  	-@erase "$(OUTDIR)\$(OUTFILENAME)dll.lib"
  	-@erase "$(OUTDIR)\libpq.res"
***************
*** 103,108 ****
--- 104,110 ----
  	"$(INTDIR)\pqsignal.obj" \
  	"$(INTDIR)\wchar.obj" \
  	"$(INTDIR)\encnames.obj" \
+ 	"$(INTDIR)\snprintf.obj" \
  	"$(INTDIR)\pthread-win32.obj"
  
  
***************
*** 117,123 ****
  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
  
! CPP_PROJ=/nologo /W3 /GX $(OPT) /I "..\..\include" /I. /D "FRONTEND" $(DEBUGDEF) /D\
   "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
   /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c  /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP"
  
--- 119,125 ----
  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
  
! CPP_PROJ=/nologo /W3 /GX $(OPT) /I "..\..\include" /I "..\..\include\port\win32" /I "..\..\include\port\win32vc" /I. /D "FRONTEND" $(DEBUGDEF) /D\
   "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
   /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c  /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP"
  
***************
*** 212,217 ****
--- 214,224 ----
  	$(CPP_PROJ) /I"." ..\..\backend\utils\mb\encnames.c
  <<
  
+ "$(INTDIR)\snprintf.obj" : ..\..\port\snprintf.c
+ 	$(CPP) @<<
+ 	$(CPP_PROJ) /I"." ..\..\port\snprintf.c
+ <<
+ 
  .c{$(CPP_OBJS)}.obj:
  	$(CPP) $(CPP_PROJ) $<
  
Index: src/port/exec.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/exec.c,v
retrieving revision 1.41
diff -c -r1.41 exec.c
*** src/port/exec.c	5 Mar 2006 15:59:10 -0000	1.41
--- src/port/exec.c	13 Apr 2006 16:09:28 -0000
***************
*** 24,32 ****
  #include <pwd.h>
  #include <sys/stat.h>
  #include <sys/wait.h>
- #ifndef WIN32_CLIENT_ONLY
  #include <unistd.h>
- #endif
  
  #ifndef S_IRUSR					/* XXX [TRH] should be in a header */
  #define S_IRUSR		 S_IREAD
--- 24,30 ----
***************
*** 48,56 ****
  #define log_error(str, param)	(fprintf(stderr, str, param), fputc('\n', stderr))
  #endif
  
- #ifdef WIN32_CLIENT_ONLY
  #define getcwd(cwd,len)  GetCurrentDirectory(len, cwd)
- #endif
  
  static int	validate_exec(const char *path);
  static int	resolve_symlinks(char *path);
--- 46,52 ----
Index: src/port/getaddrinfo.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/getaddrinfo.c,v
retrieving revision 1.23
diff -c -r1.23 getaddrinfo.c
*** src/port/getaddrinfo.c	5 Mar 2006 15:59:10 -0000	1.23
--- src/port/getaddrinfo.c	13 Apr 2006 16:07:31 -0000
***************
*** 24,46 ****
  /* This is intended to be used in both frontend and backend, so use c.h */
  #include "c.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <sys/socket.h>
  #include <netdb.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
- #endif
  
  #include "getaddrinfo.h"
  
  
  #ifdef WIN32
- 
- #define WIN32_LEAN_AND_MEAN
- 
- #include <windows.h>
- 
- #if !defined(WIN32_CLIENT_ONLY)
  /*
   * The native routines may or may not exist on the Windows platform we are on,
   * so we dynamically look up the routines, and call them via function pointers.
--- 24,38 ----
***************
*** 130,136 ****
  	return (getaddrinfo_ptr != NULL);
  }
  #endif
- #endif
  
  
  /*
--- 122,127 ----
***************
*** 151,157 ****
  			   *psin;
  	struct addrinfo hints;
  
! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
  
  	/*
  	 * If Windows has native IPv6 support, use the native Windows routine.
--- 142,148 ----
  			   *psin;
  	struct addrinfo hints;
  
! #ifdef WIN32
  
  	/*
  	 * If Windows has native IPv6 support, use the native Windows routine.
***************
*** 274,280 ****
  {
  	if (res)
  	{
! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
  
  		/*
  		 * If Windows has native IPv6 support, use the native Windows routine.
--- 265,271 ----
  {
  	if (res)
  	{
! #ifdef WIN32
  
  		/*
  		 * If Windows has native IPv6 support, use the native Windows routine.
***************
*** 337,345 ****
--- 328,338 ----
  			return "Not enough memory";
  #endif
  #ifdef EAI_NODATA
+ #ifndef _MSC_VER	/* Visual C++ complains because another case has the same value */
  		case EAI_NODATA:
  			return "No host data of that type was found";
  #endif
+ #endif
  #ifdef EAI_SERVICE
  		case EAI_SERVICE:
  			return "Class type not found";
***************
*** 366,372 ****
  			char *node, int nodelen,
  			char *service, int servicelen, int flags)
  {
! #if defined(WIN32) && !defined(WIN32_CLIENT_ONLY)
  
  	/*
  	 * If Windows has native IPv6 support, use the native Windows routine.
--- 359,365 ----
  			char *node, int nodelen,
  			char *service, int servicelen, int flags)
  {
! #ifdef WIN32
  
  	/*
  	 * If Windows has native IPv6 support, use the native Windows routine.
Index: src/port/inet_aton.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/inet_aton.c,v
retrieving revision 1.8
diff -c -r1.8 inet_aton.c
*** src/port/inet_aton.c	15 Oct 2005 02:49:51 -0000	1.8
--- src/port/inet_aton.c	13 Apr 2006 16:05:13 -0000
***************
*** 44,53 ****
  
  #include "c.h"
  
- #ifndef WIN32_CLIENT_ONLY
  #include <netinet/in.h>
  #include <ctype.h>
- #endif
  
  /*
   * Check whether "cp" is a valid ascii representation
--- 44,51 ----
Index: src/port/thread.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/thread.c,v
retrieving revision 1.32
diff -c -r1.32 thread.c
*** src/port/thread.c	5 Mar 2006 15:59:10 -0000	1.32
--- src/port/thread.c	13 Apr 2006 16:05:00 -0000
***************
*** 14,24 ****
  
  #include "c.h"
  
- #ifdef WIN32_CLIENT_ONLY
- #undef ERROR
- #else
  #include <pwd.h>
- #endif
  #if defined(ENABLE_THREAD_SAFETY)
  #include <pthread.h>
  #endif
--- 14,20 ----
Index: src/timezone/localtime.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/timezone/localtime.c,v
retrieving revision 1.13
diff -c -r1.13 localtime.c
*** src/timezone/localtime.c	9 Apr 2006 19:21:34 -0000	1.13
--- src/timezone/localtime.c	13 Apr 2006 16:20:17 -0000
***************
*** 157,163 ****
  		}
  		if (doaccess && access(name, R_OK) != 0)
  			return -1;
! 		if ((fid = open(name, O_RDONLY | PG_BINARY)) == -1)
  			return -1;
  	}
  	{
--- 157,163 ----
  		}
  		if (doaccess && access(name, R_OK) != 0)
  			return -1;
! 		if ((fid = open(name, O_RDONLY | PG_BINARY, 0)) == -1)
  			return -1;
  	}
  	{
