aboutsummaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/initdb.c5
-rw-r--r--src/bin/pg_controldata/pg_controldata.c4
-rw-r--r--src/bin/pg_ctl/pg_ctl.c14
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c4
-rw-r--r--src/bin/pg_dump/pg_backup_db.c4
-rw-r--r--src/bin/pg_dump/pg_backup_null.c4
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c5
-rw-r--r--src/bin/pg_dump/pg_dump.c4
-rw-r--r--src/bin/pg_dump/pg_dumpall.c5
-rw-r--r--src/bin/pg_dump/pg_restore.c4
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c6
-rw-r--r--src/bin/psql/command.c15
-rw-r--r--src/bin/psql/copy.c4
-rw-r--r--src/bin/psql/print.c9
-rw-r--r--src/bin/psql/win32.mak9
15 files changed, 36 insertions, 60 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 82743bdb0a2..343f428ddd9 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.116 2006/05/27 18:07:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.117 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2269,8 +2269,7 @@ setlocales(void)
}
#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);
+typedef BOOL (WINAPI *__CreateRestrictedToken)(HANDLE, DWORD, DWORD, PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES, PHANDLE);
#define DISABLE_MAX_PRIVILEGE 0x1
/*
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index b2d0e01e026..dd56ea787e6 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -6,7 +6,7 @@
* copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
* licence: BSD
*
- * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.28 2006/04/03 23:35:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.29 2006/06/07 22:24:44 momjian Exp $
*/
#include "postgres.h"
@@ -104,7 +104,7 @@ main(int argc, char *argv[])
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
- if ((fd = open(ControlFilePath, O_RDONLY)) == -1)
+ if ((fd = open(ControlFilePath, O_RDONLY, 0)) == -1)
{
fprintf(stderr, _("%s: could not open file \"%s\" for reading: %s\n"),
progname, ControlFilePath, strerror(errno));
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 57d7337e6b2..c000a46f06b 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.67 2006/03/05 15:58:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.68 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1159,12 +1159,12 @@ pgwin32_doRunAsService(void)
* 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);
+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
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 904de34a7c7..61e87ac28cf 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.131 2006/05/28 21:13:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.132 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,9 +28,7 @@
#include <ctype.h>
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#ifdef WIN32
#include <io.h>
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index 77c4086d3d2..19d0d5bb053 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.70 2006/03/03 23:38:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.71 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,9 +15,7 @@
#include "pg_backup_db.h"
#include "dumputils.h"
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#include <ctype.h>
diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_null.c
index 9dd373f252e..deecf192b38 100644
--- a/src/bin/pg_dump/pg_backup_null.c
+++ b/src/bin/pg_dump/pg_backup_null.c
@@ -17,7 +17,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.17 2006/02/12 06:11:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.18 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,9 +25,7 @@
#include "pg_backup.h"
#include "pg_backup_archiver.h"
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h> /* for dup */
-#endif
#include "libpq/libpq-fs.h"
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index bb490e2aefb..5fa080b06ac 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.51 2006/05/22 11:21:54 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.52 2006/06/07 22:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,10 +27,7 @@
#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);
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index daf7829b511..2f30b17428f 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.436 2006/05/28 21:13:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.437 2006/06/07 22:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,9 +24,7 @@
*/
#include "postgres.h"
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#include <ctype.h>
#ifdef ENABLE_NLS
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index e57f9c5050d..ecbd15f28c4 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.78 2006/05/31 11:02:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.79 2006/06/07 22:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,10 +14,7 @@
#include "postgres_fe.h"
#include <time.h>
-
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#ifdef ENABLE_NLS
#include <locale.h>
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index f9799be68b3..e34a475051e 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -34,7 +34,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.77 2006/04/12 22:18:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.78 2006/06/07 22:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,9 +53,7 @@
#include <termios.h>
#endif
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#include "getopt_long.h"
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c
index 22232eddf55..7d2f295a01d 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.47 2006/06/03 02:19:24 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.48 2006/06/07 22:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -245,7 +245,7 @@ main(int argc, char *argv[])
*/
snprintf(path, MAXPGPATH, "%s/postmaster.pid", DataDir);
- if ((fd = open(path, O_RDONLY)) < 0)
+ if ((fd = open(path, O_RDONLY, 0)) < 0)
{
if (errno != ENOENT)
{
@@ -347,7 +347,7 @@ ReadControlFile(void)
char *buffer;
pg_crc32 crc;
- if ((fd = open(XLOG_CONTROL_FILE, O_RDONLY)) < 0)
+ 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
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 63161edd457..3c5bd6740f1 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,12 +3,12 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.168 2006/06/01 00:15:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.169 2006/06/07 22:24:45 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
-#ifdef WIN32_CLIENT_ONLY /* needed for BCC */
+#ifdef __BORLANDC__ /* needed for BCC */
#undef mkdir
#endif
@@ -26,11 +26,9 @@
#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"
@@ -1261,10 +1259,8 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
bool error = false;
int fd;
-#ifndef WIN32_CLIENT_ONLY
struct stat before,
after;
-#endif
if (filename_arg)
fname = filename_arg;
@@ -1339,19 +1335,16 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
}
}
-#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));
@@ -1360,10 +1353,6 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
if (!error && before.st_mtime != after.st_mtime)
{
-#else
- if (!error)
- {
-#endif
stream = fopen(fname, PG_BINARY_R);
if (!stream)
{
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index ba89eb5b389..abf4b603422 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.64 2006/06/01 01:28:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.65 2006/06/07 22:24:45 momjian Exp $
*/
#include "postgres_fe.h"
#include "copy.h"
@@ -26,7 +26,7 @@
#include "prompt.h"
#include "stringutils.h"
-#if defined(WIN32) && (!defined(__MINGW32__))
+#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
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index d3b70896bfe..1ad04783d0c 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.85 2006/03/05 15:58:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.86 2006/06/07 22:24:45 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -11,10 +11,7 @@
#include <math.h>
#include <signal.h>
-
-#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
-#endif
#ifndef WIN32
#include <sys/ioctl.h> /* for ioctl() */
@@ -641,10 +638,10 @@ print_aligned_text(const char *title, const char *const * headers,
for (ptr = footers; *ptr; ptr++)
fprintf(fout, "%s\n", *ptr);
-#ifndef __MINGW32__
+#ifndef WIN32
/*
- * for some reason MinGW outputs an extra newline, so this supresses it
+ * for some reason MinGW (and MSVC) outputs an extra newline, so this supresses it
*/
fputc('\n', fout);
#endif
diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak
index e63004d95f0..67b1b8e5b58 100644
--- a/src/bin/psql/win32.mak
+++ b/src/bin/psql/win32.mak
@@ -28,7 +28,7 @@ REFDOCDIR= ../../../doc/src/sgml/ref
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 /I ..\..\interfaces\libpq /I ..\..\include\port\win32 /I ..\..\include\port\win32_msvc \
/I ..\pg_dump /I ..\..\backend \
/D "HAVE_STRDUP" /D "FRONTEND"
@@ -57,6 +57,7 @@ CLEAN :
-@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,6 +92,7 @@ LINK32_OBJS= \
"$(INTDIR)\exec.obj" \
"$(INTDIR)\getopt.obj" \
"$(INTDIR)\getopt_long.obj" \
+ "$(INTDIR)\snprintf.obj" \
"$(INTDIR)\path.obj" \
"$(INTDIR)\pgstrcasecmp.obj" \
"$(INTDIR)\sprompt.obj" \
@@ -139,6 +141,11 @@ LINK32_OBJS = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\libpqdll.lib"
$(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