# Copyright (c) 1998, Regents of the University of California
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.5 1998/11/30 00:30:03 tgl Exp $
+# $Header: /cvsroot/pgsql/src/Makefile.shlib,v 1.6 1999/01/17 06:18:08 momjian Exp $
#
#-------------------------------------------------------------------------
endif
endif
+ifeq ($(PORTNAME), win)
+ install-shlib-dep := install-shlib
+ shlib := $(NAME)$(DLSUFFIX)
+endif
# Default target definition. Note shlib is empty if not building a shlib.
# Rules to build regular and shared libraries
+ifneq ($(PORTNAME), win)
lib$(NAME).a: $(OBJS)
ifdef MK_NO_LORDER
$(AR) $(AROPT) $@ $(OBJS)
$(AR) $(AROPT) $@ `lorder $(OBJS) | tsort`
endif
$(RANLIB) $@
+endif
ifneq ($(shlib),)
+ifneq ($(PORTNAME), win)
$(shlib): $(OBJS)
$(LD) $(LDFLAGS_SL) -o $@ $(OBJS) $(SHLIB_LINK)
+else
+$(shlib) lib$(NAME).a: $(OBJS) $(SRCDIR)/utils/dllinit.o
+ $(DLLTOOL) --export-all --output-def $(NAME).def $(OBJS)
+ $(DLLWRAP) -o $(shlib) --dllname $(shlib) --def $(NAME).def $(OBJS) $(SRCDIR)/utils/dllinit.o $(DLLINIT) $(SHLIB_LINK)
+ $(DLLTOOL) --dllname $(shlib) --def $(NAME).def --output-lib lib$(NAME).a
+
+$(SRCDIR)/utils/dllinit.o: $(SRCDIR)/utils/dllinit.c
+ $(MAKE) -C $(SRCDIR)/utils dllinit.o
+endif
endif
# Rules to install regular and shared libraries
install-shlib: $(shlib)
$(INSTALL) $(INSTL_SHLIB_OPTS) $(shlib) $(LIBDIR)/$(shlib)
+ifneq ($(PORTNAME), win)
if [ "$(shlib)" != "lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)" ]; then \
cd $(LIBDIR); \
rm -f lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION); \
rm -f lib$(NAME)$(DLSUFFIX); \
$(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX); \
fi
+endif
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.34 1998/11/27 19:51:27 vadim Exp $
+# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.35 1999/01/17 06:18:11 momjian Exp $
#
#-------------------------------------------------------------------------
LDFLAGS+= $(KRBLIBS)
endif
+ifeq ($(MAKE_DLL), true)
+DLLOBJS=$(OBJS)
+DLLOBJS+= ../utils/version.o
+DLLLIBS= -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
+
+postgres.def: $(DLLOBJS)
+ $(DLLTOOL) --export-all --output-def $@ $(DLLOBJS)
+
+libpostgres.a: $(DLLOBJS) ../utils/dllinit.o postgres.def
+ $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
+endif
all: postgres $(POSTGRES_IMP) global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
+ifneq ($(PORTNAME), win)
postgres: fmgr.h $(OBJS) ../utils/version.o
$(CC) -o postgres $(OBJS) ../utils/version.o $(LDFLAGS)
+else
+postgres: $(DLLOBJS) ../utils/dllinit.o postgres.def libpostgres.a
+endif
+
+#.PHONY: postgres
$(OBJS): $(DIRS:%=%.dir)
$(MAKE) -C $(subst .dir,,$@) all
../utils/version.o:
- $(MAKE) -C ../utils version.o
+ $(MAKE) -C ../utils version.o
+
+../utils/dllinit.c:
+ $(MAKE) -C ../utils dllinit.o
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description: catalog/$@
fast:
$(CC) -r -o postgres.o $(OBJS) $(LDFLAGS)
-
############################################################################
# The following targets are specified in make commands that appear in the
# make files in our subdirectories.
#############################################################################
clean:
- rm -f postgres $(POSTGRES_IMP) fmgr.h parse.h \
+ rm -f postgres$(X) $(POSTGRES_IMP) fmgr.h parse.h \
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description
+ifeq ($(PORTNAME), win)
+ifeq ($(MAKE_DLL), true)
+ rm -f postgres.dll postgres.def libpostgres.a
+endif
+endif
for i in $(DIRS); do $(MAKE) -C $$i clean; done
.DEFAULT:
global1.bki.source local1_template1.bki.source \
global1.description local1_template1.description \
libpq/pg_hba.conf.sample optimizer/geqo/pg_geqo.sample
- $(INSTALL) $(INSTL_EXE_OPTS) postgres $(BINDIR)/postgres
+ $(INSTALL) $(INSTL_EXE_OPTS) postgres$(X) $(BINDIR)/postgres$(X)
ifeq ($(MAKE_EXPORTS), true)
$(INSTALL) $(INSTLOPTS) $(POSTGRES_IMP) $(LIBDIR)/$(POSTGRES_IMP)
endif
@rm -f $(BINDIR)/postmaster
- ln -s postgres $(BINDIR)/postmaster
+ ln -s postgres$(X) $(BINDIR)/postmaster
+ifeq ($(PORTNAME), win)
+ifeq ($(MAKE_DLL), true)
+# $(INSTALL) $(INSTLOPTS) postgres.dll $(BINDIR)/postgres.dll
+ $(INSTALL) $(INSTLOPTS) libpostgres.a $(LIBDIR)/libpostgres.a
+endif
+endif
$(INSTALL) $(INSTLOPTS) fmgr.h $(HEADERDIR)/fmgr.h
$(INSTALL) $(INSTLOPTS) global1.bki.source \
$(LIBDIR)/global1.bki.source
$(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \
$(LIBDIR)/pg_geqo.sample
-$(BINDIR) $(LIBDIR) $(HEADERDIR):
+#$(BINDIR) $(LIBDIR) $(HEADERDIR):
+# mkdir $@
+$(BINDIR):
+ mkdir $@
+$(LIBDIR):
+ mkdir $@
+$(HEADERDIR):
mkdir $@
#############################################################################
*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.33 1998/09/01 04:27:07 momjian Exp $
+ * $Id: nbtsort.c,v 1.34 1999/01/17 06:18:12 momjian Exp $
*
* NOTES
*
tape->bttb_magic = BTTAPEMAGIC;
+#ifndef __CYGWIN32__
tape->bttb_fd = FileNameOpenFile(fname, O_RDWR | O_CREAT | O_TRUNC, 0600);
+#else
+ tape->bttb_fd = FileNameOpenFile(fname, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600);
+#endif
Assert(tape->bttb_fd >= 0);
/* initialize the buffer */
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.52 1998/11/27 19:51:45 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.53 1999/01/17 06:18:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include
#include
#include
+#ifdef __CYGWIN32__
+#include
+#endif
#define BOOTSTRAP_INCLUDE /* mask out stuff in tcop/tcopprot.h */
# Makefile for catalog
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.14 1998/10/08 18:29:19 momjian Exp $
+# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.15 1999/01/17 06:18:14 momjian Exp $
#
#-------------------------------------------------------------------------
)
global1.bki.source: $(GENBKI) $(GLOBALBKI_SRCS)
+ifneq ($(PORTNAME), win)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@ 2>global1.description
+else
+ $(GENBKI) $(BKIOPTS) $(GLOBALBKI_SRCS) > $@ 2>global1.description
+endif
local1_template1.bki.source: $(GENBKI) $(LOCALBKI_SRCS)
+ifneq ($(PORTNAME), win)
sh $(SHOPTS) $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@ 2>local1_template1.description
+else
+ $(GENBKI) $(BKIOPTS) $(LOCALBKI_SRCS) > $@ 2>local1_template1.description
+endif
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
rm -f SUBSYS.o $(OBJS) global1.bki.source local1_template1.bki.source \
- global1.description local1_template1.description
+ global1.description local1_template1.description \
+ $(GENBKI)
ifeq (depend,$(wildcard depend))
include depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.66 1999/01/11 03:56:05 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.67 1999/01/17 06:18:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
else
{
+#ifndef __CYGWIN32__
fp = AllocateFile(filename, "r");
+#else
+ fp = AllocateFile(filename, "rb");
+#endif
if (fp == NULL)
elog(ERROR, "COPY command, running in backend with "
"effective uid %d, could not open file '%s' for "
mode_t oumask; /* Pre-existing umask value */
oumask = umask((mode_t) 0);
+#ifndef __CYGWIN32__
fp = AllocateFile(filename, "w");
+#else
+ fp = AllocateFile(filename, "wb");
+#endif
umask(oumask);
if (fp == NULL)
elog(ERROR, "COPY command, running in backend with "
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.28 1998/12/15 12:45:55 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.29 1999/01/17 06:18:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
else
snprintf(filename, 256, "%s%c%s.vacuum", dbpath, SEP_CHAR, dbname);
+#ifndef __CYGWIN32__
if ((fp = AllocateFile(filename, "r")) != NULL)
+#else
+ if ((fp = AllocateFile(filename, "rb")) != NULL)
+#endif
{
fscanf(fp, "%d", &pid);
FreeFile(fp);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.92 1998/12/15 12:46:01 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.93 1999/01/17 06:18:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
int fd;
+#ifndef __CYGWIN32__
if ((fd = open("pg_vlock", O_CREAT | O_EXCL, 0600)) < 0)
+#else
+ if ((fd = open("pg_vlock", O_CREAT | O_EXCL | O_BINARY, 0600)) < 0)
+#endif
{
elog(ERROR, "Can't create lock file. Is another vacuum cleaner running?\n\
\tIf not, you may remove the pg_vlock file in the %s\n\
* Copyright (c) 1994, Regents of the University of California
*
*
- * $Id: nodeHash.c,v 1.28 1998/12/15 12:46:06 vadim Exp $
+ * $Id: nodeHash.c,v 1.29 1999/01/17 06:18:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
batches = (File *) palloc(nbatch * sizeof(File));
for (i = 0; i < nbatch; i++)
{
+#ifndef __CYGWIN32__
batches[i] = FileNameOpenFile(ABSADDR(innerbatchNames[i]),
O_CREAT | O_RDWR, 0600);
+#else
+ batches[i] = FileNameOpenFile(ABSADDR(innerbatchNames[i]),
+ O_CREAT | O_RDWR | O_BINARY, 0600);
+#endif
}
hashstate->hashBatches = batches;
batchPos = (RelativeAddr *) ABSADDR(hashtable->innerbatchPos);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.14 1998/11/27 19:52:02 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.15 1999/01/17 06:18:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
palloc(nbatch * sizeof(File));
for (i = 0; i < nbatch; i++)
{
+#ifndef __CYGWIN32__
outerbatches[i] = FileNameOpenFile(
- ABSADDR(outerbatchNames[i]),
- O_CREAT | O_RDWR, 0600);
+ ABSADDR(outerbatchNames[i]),
+ O_CREAT | O_RDWR, 0600);
+#else
+ outerbatches[i] = FileNameOpenFile(
+ ABSADDR(outerbatchNames[i]),
+ O_CREAT | O_RDWR | O_BINARY, 0600);
+#endif
}
hjstate->hj_OuterBatches = outerbatches;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.26 1998/09/01 04:28:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.27 1999/01/17 06:18:24 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
* open the file to be read in
*/
StrNCpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ + 1);
+#ifndef __CYGWIN32__
fd = open(fnamebuf, O_RDONLY, 0666);
+#else
+ fd = open(fnamebuf, O_RDONLY | O_BINARY, 0666);
+#endif
if (fd < 0)
{ /* error */
elog(ERROR, "be_lo_import: can't open unix file\"%s\"\n",
*/
oumask = umask((mode_t) 0);
StrNCpy(fnamebuf, VARDATA(filename), VARSIZE(filename) - VARHDRSZ + 1);
+#ifndef __CYGWIN32__
fd = open(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+#else
+ fd = open(fnamebuf, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
+#endif
umask(oumask);
if (fd < 0)
{ /* error */
* Dec 17, 1997 - Todd A. Brandys
* Orignal Version Completed.
*
- * $Id: crypt.c,v 1.13 1998/12/14 06:50:24 scrappy Exp $
+ * $Id: crypt.c,v 1.14 1999/01/17 06:18:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
FILE *pwdfile;
filename = crypt_getpwdfilename();
+#ifndef __CYGWIN32__
pwdfile = AllocateFile(filename, "r");
+#else
+ pwdfile = AllocateFile(filename, "rb");
+#endif
return pwdfile;
}
* wherein you authenticate a user by seeing what IP address the system
* says he comes from and possibly using ident).
*
- * $Id: hba.c,v 1.37 1998/12/14 06:50:25 scrappy Exp $
+ * $Id: hba.c,v 1.38 1999/01/17 06:18:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
old_conf_file = (char *) palloc(bufsize);
snprintf(old_conf_file, bufsize, "%s/%s", DataDir, OLD_CONF_FILE);
+#ifndef __CYGWIN32__
if ((fd = open(old_conf_file, O_RDONLY, 0)) != -1)
+#else
+ if ((fd = open(old_conf_file, O_RDONLY | O_BINARY, 0)) != -1)
+#endif
{
/* Old config file exists. Tell this guy he needs to upgrade. */
close(fd);
map_file = (char *) palloc(bufsize);
snprintf(map_file, bufsize, "%s/%s", DataDir, MAP_FILE);
+#ifndef __CYGWIN32__
file = AllocateFile(map_file, "r");
+#else
+ file = AllocateFile(map_file, "rb");
+#endif
if (file == NULL)
{
/* The open of the map file failed. */
bufsize = (strlen(DataDir) + strlen(CHARSET_FILE) + 2) * sizeof(char);
map_file = (char *) palloc(bufsize);
snprintf(map_file, bufsize, "%s/%s", DataDir, CHARSET_FILE);
+#ifndef __CYGWIN32__
file = fopen(map_file, "r");
+#else
+ file = fopen(map_file, "rb");
+#endif
if (file == NULL)
{
return;
/*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: password.c,v 1.19 1998/12/14 06:50:26 scrappy Exp $
+ * $Id: password.c,v 1.20 1999/01/17 06:18:26 momjian Exp $
*
*/
strcat(pw_file_fullname, "/");
strcat(pw_file_fullname, auth_arg);
+#ifndef __CYGWIN32__
pw_file = AllocateFile(pw_file_fullname, "r");
+#else
+ pw_file = AllocateFile(pw_file_fullname, "rb");
+#endif
if (!pw_file)
{
snprintf(PQerrormsg, ERROR_MSG_LENGTH,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.c,v 1.62 1999/01/17 03:10:23 tgl Exp $
+ * $Id: pqcomm.c,v 1.63 1999/01/17 06:18:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* can safely delete the file.
*/
#ifdef HAVE_FCNTL_SETLK
+#ifndef __CYGWIN32__
if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
+#else
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | O_BINARY, 0666)) >= 0)
+#endif
{
struct flock lck;
* lock_fd is left open to keep the lock.
*/
#ifdef HAVE_FCNTL_SETLK
+#ifndef __CYGWIN32__
if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
+#else
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK | O_BINARY, 0666)) >= 0)
+#endif
{
struct flock lck;
*
* Copyright (c) 1994, Regents of the University of California
*
-* $Id: geqo_params.c,v 1.10 1998/09/01 03:23:11 momjian Exp $
+* $Id: geqo_params.c,v 1.11 1999/01/17 06:18:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
sprintf(conf_file, "%s/%s", DataDir, GEQO_FILE);
/* open the config file */
+#ifndef __CYGWIN32__
file = AllocateFile(conf_file, "r");
+#else
+ file = AllocateFile(conf_file, "rb");
+#endif
if (file)
{
#include "pathnames.h"
#endif
+#include
#include "postgres.h"
#include "regex/cdefs.h"
* causing nast effects.
**************************************************************/
-/*static char _id[] = "$Id: snprintf.c,v 1.16 1999/01/17 03:22:49 tgl Exp $";*/
+/*static char _id[] = "$Id: snprintf.c,v 1.17 1999/01/17 06:18:33 momjian Exp $";*/
static char *end;
static int SnprfOverflow;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.98 1998/11/29 01:51:56 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.99 1999/01/17 06:18:34 momjian Exp $
*
* NOTES
*
#include
#endif
+#ifdef __CYGWIN32__
+#include
+#endif
+
#include "storage/ipc.h"
#include "libpq/libpq.h"
#include "libpq/auth.h"
static char Execfile[MAXPATHLEN] = "";
static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
+#ifndef __CYGWIN32__
static int ServerSock_UNIX = INVALID_SOCK; /* stream socket server */
+#endif
/*
* Set by the -o option
sprintf(path, "%s%cbase%ctemplate1%cpg_class",
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
+#ifndef __CYGWIN32__
fp = AllocateFile(path, "r");
+#else
+ fp = AllocateFile(path, "rb");
+#endif
if (fp == NULL)
{
fprintf(stderr, "%s does not find the database system. "
exit(1);
}
}
+#ifndef __CYGWIN32__
status = StreamServerPort(NULL, PostPortName, &ServerSock_UNIX);
if (status != STATUS_OK)
{
progname);
exit(1);
}
-
+#endif
/* set up shared memory and semaphores */
EnableMemoryContext(TRUE);
reset_shared(PostPortName);
exit(1);
}
#endif
+#ifndef __CYGWIN32__
i = open(NULL_DEV, O_RDWR);
+#else
+ i = open(NULL_DEV, O_RDWR | O_BINARY);
+#endif
dup2(i, 0);
dup2(i, 1);
dup2(i, 2);
/* new connection pending on our well-known port's socket */
+#ifndef __CYGWIN32__
if (ServerSock_UNIX != INVALID_SOCK &&
FD_ISSET(ServerSock_UNIX, &rmask) &&
(port = ConnCreate(ServerSock_UNIX)) != NULL)
PacketReceiveSetup(&port->pktInfo,
readStartupPacket,
(void *) port);
+#endif
if (ServerSock_INET != INVALID_SOCK &&
FD_ISSET(ServerSock_INET, &rmask) &&
FD_ZERO(rmask);
FD_ZERO(wmask);
+#ifndef __CYGWIN32__
if (ServerSock_UNIX != INVALID_SOCK)
{
FD_SET(ServerSock_UNIX, rmask);
if (ServerSock_UNIX > nsocks)
nsocks = ServerSock_UNIX;
}
+#endif
if (ServerSock_INET != INVALID_SOCK)
{
/* Close the postmater sockets */
if (NetServer)
StreamClose(ServerSock_INET);
+#ifndef __CYGWIN32__
StreamClose(ServerSock_UNIX);
+#endif
/* Save port for ps status */
MyProcPort = port;
*/
if (ServerSock_INET != INVALID_SOCK)
StreamClose(ServerSock_INET);
+#ifndef __CYGWIN32__
if (ServerSock_UNIX != INVALID_SOCK)
StreamClose(ServerSock_UNIX);
+#endif
proc_exit(status);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.39 1998/09/01 04:32:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.40 1999/01/17 06:18:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *path;
path = relpath(reln->rd_rel->relname.data);
+#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
+#else
+ fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
+#endif
/*
* If the file already exists and is empty, we pretend that the create
{
if (!IsBootstrapProcessingMode())
return -1;
+#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600); /* Bootstrap */
+#else
+ fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600); /* Bootstrap */
+#endif
if (fd < 0)
return -1;
}
path = relpath(reln->rd_rel->relname.data);
+#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600);
+#else
+ fd = FileNameOpenFile(path, O_RDWR | O_BINARY, 0600);
+#endif
/* this should only happen during bootstrap processing */
if (fd < 0)
+#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
+#else
+ fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
+#endif
vfd = _fdvec_alloc();
if (vfd < 0)
}
#endif
+#ifndef __CYGWIN32__
if ((fd = open(path, O_RDWR, 0600)) < 0)
+#else
+ if ((fd = open(path, O_RDWR | O_BINARY, 0600)) < 0)
+#endif
return SM_FAIL;
/* seek to the right spot */
fullpath = path;
/* open the file */
+#ifndef __CYGWIN32__
fd = PathNameOpenFile(fullpath, O_RDWR | oflags, 0600);
+#else
+ fd = PathNameOpenFile(fullpath, O_RDWR | O_BINARY | oflags, 0600);
+#endif
if (dofree)
pfree(fullpath);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.95 1998/12/16 11:53:52 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.96 1999/01/17 06:18:42 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
#include
#include
+#ifdef __CYGWIN32__
+#include
+#endif
#include "postgres.h"
#include "miscadmin.h"
{
fprintf(stderr,
"Postmaster flag set: no port number specified, use /dev/null\n");
+#ifndef __CYGWIN32__
Portfd = open(NULL_DEV, O_RDWR, 0666);
+#else
+ Portfd = open(NULL_DEV, O_RDWR | O_BINARY, 0666);
+#endif
}
pq_init(Portfd);
whereToSendOutput = Remote;
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.95 $ $Date: 1998/12/16 11:53:52 $\n");
+ puts("$Revision: 1.96 $ $Date: 1999/01/17 06:18:42 $\n");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.51 1998/12/18 09:10:36 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.52 1999/01/17 06:18:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
filename = stmt->filename;
closeAllVfds();
+#ifndef __CYGWIN32__
if ((fp = AllocateFile(filename, "r")) == NULL)
+#else
+ if ((fp = AllocateFile(filename, "rb")) == NULL)
+#endif
elog(ERROR, "LOAD: could not open file '%s'", filename);
FreeFile(fp);
load_file(filename);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.34 1998/09/01 04:32:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.35 1999/01/17 06:18:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
FILE *afd;
+#ifndef __CYGWIN32__
if ((afd = AllocateFile(accessfile, "r")) == NULL)
+#else
+ if ((afd = AllocateFile(accessfile, "r")) == NULL)
+#endif
elog(ERROR, "unable to open access pattern file");
*chunkFlag = true;
retStr = _ChunkArray(*fd, afd, ndim, dim, baseSize, nbytes,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.52 1998/12/15 12:46:37 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.53 1999/01/17 06:18:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int i;
int relno;
+#ifndef __CYGWIN32__
if ((fd = FileNameOpenFile(INIT_FILENAME, O_RDONLY, 0600)) < 0)
+#else
+ if ((fd = FileNameOpenFile(INIT_FILENAME, O_RDONLY | O_BINARY, 0600)) < 0)
+#endif
{
write_irels();
return;
int relno;
RelationBuildDescInfo bi;
+#ifndef __CYGWIN32__
fd = FileNameOpenFile(INIT_FILENAME, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+#else
+ fd = FileNameOpenFile(INIT_FILENAME, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0600);
+#endif
if (fd < 0)
elog(FATAL, "cannot create init file %s", INIT_FILENAME);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.24 1998/10/08 18:30:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.25 1999/01/17 06:18:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
map_file = (char *) malloc((strlen(DataDir) +
strlen(p) + 2) * sizeof(char));
sprintf(map_file, "%s/%s", DataDir, p);
+#ifndef __CYGWIN32__
file = fopen(map_file, "r");
+#else
+ file = fopen(map_file, "rb");
+#endif
if (file == NULL)
return;
eof = false;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.35 1998/09/01 04:33:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.36 1999/01/17 06:18:55 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
errormsg[0] = '\0';
+#ifndef __CYGWIN32__
if ((fd = open(DataDir, O_RDONLY, 0)) == -1)
+#else
+ if ((fd = open(DataDir, O_RDONLY | O_DIROPEN, 0)) == -1)
+#endif
sprintf(errormsg, "Database system does not exist. "
"PGDATA directory '%s' not found.\n\tNormally, you "
"create a database system by running initdb.",
name = DatabaseName;
myPath = DatabasePath;
+#ifndef __CYGWIN32__
if ((fd = open(myPath, O_RDONLY, 0)) == -1)
+#else
+ if ((fd = open(myPath, O_RDONLY | O_DIROPEN, 0)) == -1)
+#endif
sprintf(errormsg,
"Database '%s' does not exist."
"\n\tWe know this because the directory '%s' does not exist."
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.21 1998/11/27 19:52:29 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.22 1999/01/17 06:18:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
sprintf(dbfname, "%s%cpg_database", DataDir, SEP_CHAR);
fileflags = O_RDONLY;
+#ifndef __CYGWIN32__
if ((dbfd = open(dbfname, O_RDONLY, 0)) < 0)
+#else
+ if ((dbfd = open(dbfname, O_RDONLY | O_BINARY, 0)) < 0)
+#endif
elog(FATAL, "Cannot open %s", dbfname);
pfree(dbfname);
}
snprintf(buffer, BUF_SIZE - 1, "%s/%s", DataDir, "pg_options");
+#ifndef __CYGWIN32__
if ((fd = open(buffer, O_RDONLY)) < 0)
+#else
+ if ((fd = open(buffer, O_RDONLY | O_BINARY)) < 0)
+#endif
return;
if ((n = read(fd, buffer, BUF_SIZE - 1)) > 0)
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: psort.c,v 1.46 1999/01/01 04:48:49 momjian Exp $
+ * $Id: psort.c,v 1.47 1999/01/17 06:19:02 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
StrNCpy(tp->tl_name, uniqueName, MAXPGPATH);
-
+#ifndef __CYGWIN32__
file = AllocateFile(tp->tl_name, "w+");
+#else
+ file = AllocateFile(tp->tl_name, "w+b");
+#endif
if (file == NULL)
elog(ERROR, "Open: %s in %s line %d, %s", tp->tl_name,
__FILE__, __LINE__, strerror(errno));
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/Makefile.in,v 1.10 1998/08/30 05:06:53 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/Makefile.in,v 1.11 1999/01/17 06:19:05 momjian Exp $
#
#-------------------------------------------------------------------------
$(MAKE) -C $(LIBPQDIR) libpq.a
install: pg_dump
- $(INSTALL) $(INSTL_EXE_OPTS) pg_dump $(BINDIR)/pg_dump
+ $(INSTALL) $(INSTL_EXE_OPTS) pg_dump$(X) $(BINDIR)/pg_dump$(X)
$(INSTALL) $(INSTL_EXE_OPTS) pg_dumpall $(BINDIR)/pg_dumpall
$(INSTALL) $(INSTL_EXE_OPTS) pg_upgrade $(BINDIR)/pg_upgrade
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f pg_dump $(OBJS)
+ rm -f pg_dump$(X) $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.97 1998/12/13 23:41:32 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.98 1999/01/17 06:19:05 momjian Exp $
*
*
#include
#endif
+#ifdef __CYGWIN32__
+#include
+#endif
+
#include "pg_dump.h"
static void dumpSequence(FILE *fout, TableInfo tbinfo);
g_fout = stdout;
else
{
+#ifndef __CYGWIN32__
g_fout = fopen(filename, "w");
+#else
+ g_fout = fopen(filename, "wb");
+#endif
if (g_fout == NULL)
{
fprintf(stderr,
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.11 1998/04/06 16:51:04 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/Makefile,v 1.12 1999/01/17 06:19:10 momjian Exp $
#
#-------------------------------------------------------------------------
$(MAKE) -C $(LIBPQDIR) libpq.a
install: pg_id
- $(INSTALL) $(INSTL_EXE_OPTS) pg_id $(BINDIR)/pg_id
+ $(INSTALL) $(INSTL_EXE_OPTS) pg_id$(X) $(BINDIR)/pg_id$(X)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f pg_id $(OBJS)
+ rm -f pg_id$(X) $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.6 1998/06/15 19:30:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.7 1999/01/17 06:19:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include
#include
#include
-
+#ifdef __CYGWIN32__
+#include
+#endif
int
main(int argc, char **argv)
$(CC) -o pg_passwd $(OBJS) $(LDFLAGS)
install: pg_passwd
- $(INSTALL) $(INSTL_EXE_OPTS) pg_passwd $(BINDIR)/pg_passwd
+ $(INSTALL) $(INSTL_EXE_OPTS) pg_passwd$(X) $(BINDIR)/pg_passwd$(X)
.PHONY: submake
submake:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f pg_passwd $(OBJS)
+ rm -f pg_passwd$(X) $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
int i;
try_again:
+#ifndef __CYGWIN32__
fp = fopen(filename, "r");
+#else
+ fp = fopen(filename, "rb");
+#endif
if (fp == NULL)
{
if (errno == ENOENT)
{
case 'y':
case 'Y':
+#ifndef __CYGWIN32__
fp = fopen(filename, "w");
+#else
+ fp = fopen(filename, "wb");
+#endif
if (fp == NULL)
{
perror(filename);
}
/* open file */
+#ifndef __CYGWIN32__
if ((fp = fopen(filename, "w")) == NULL)
+#else
+ if ((fp = fopen(filename, "wb")) == NULL)
+#endif
{
perror(filename);
exit(1);
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile.in,v 1.5 1998/04/06 16:51:27 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile.in,v 1.6 1999/01/17 06:19:14 momjian Exp $
#
#-------------------------------------------------------------------------
$(MAKE) -C ../../utils version.o
install: pg_version
- $(INSTALL) $(INSTL_EXE_OPTS) pg_version $(BINDIR)/pg_version
+ $(INSTALL) $(INSTL_EXE_OPTS) pg_version$(X) $(BINDIR)/pg_version$(X)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f pg_version pg_version.o
+ rm -f pg_version$(X) pg_version.o
ifeq (depend,$(wildcard depend))
include depend
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/psql/Attic/Makefile.in,v 1.14 1998/11/30 00:30:05 tgl Exp $
+# $Header: /cvsroot/pgsql/src/bin/psql/Attic/Makefile.in,v 1.15 1999/01/17 06:19:19 momjian Exp $
#
#-------------------------------------------------------------------------
$(MAKE) -C $(LIBPQDIR) libpq.a
install: psql
- $(INSTALL) $(INSTL_EXE_OPTS) psql $(BINDIR)/psql
+ $(INSTALL) $(INSTL_EXE_OPTS) psql$(X) $(BINDIR)/psql$(X)
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
clean:
- rm -f psql $(OBJS)
+ rm -f psql$(X) $(OBJS)
ifeq (depend,$(wildcard depend))
include depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.165 1998/12/14 04:59:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.166 1999/01/17 06:19:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef HAVE_TERMIOS_H
#include
#endif
+#ifdef __CYGWIN32__
+#include
+#endif
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_READLINE_H
strcat(query, " TO stdout");
if (from)
+#ifndef __CYGWIN32__
copystream = fopen(file, "r");
+#else
+ copystream = fopen(file, "rb");
+#endif
else
+#ifndef __CYGWIN32__
copystream = fopen(file, "w");
+#else
+ copystream = fopen(file, "wb");
+#endif
if (copystream == NULL)
fprintf(stderr,
"Unable to open file %s which to copy, errno = %s (%d).",
}
stat(lastfile, &st);
editFile(lastfile);
+#ifndef __CYGWIN32__
if ((stat(lastfile, &st2) == -1) || ((fd = fopen(lastfile, "r")) == NULL))
+#else
+ if ((stat(lastfile, &st2) == -1) || ((fd = fopen(lastfile, "rb")) == NULL))
+#endif
{
perror(lastfile);
break;
fprintf(stderr, "\\i must be followed by a file name\n");
break;
}
+#ifndef __CYGWIN32__
if ((fd = fopen(optarg, "r")) == NULL)
+#else
+ if ((fd = fopen(optarg, "rb")) == NULL)
+#endif
{
fprintf(stderr, "file named %s could not be opened\n", optarg);
break;
fprintf(stderr, "\\w must be followed by a file name\n");
break;
}
+#ifndef __CYGWIN32__
+ if ((fd = fopen(optarg, "w")) == NULL)
+#else
if ((fd = fopen(optarg, "w")) == NULL)
+#endif
{
fprintf(stderr, "file named %s could not be opened\n", optarg);
break;
if (*fname == '|')
{
pqsignal(SIGPIPE, SIG_IGN);
+#ifndef __CYGWIN32__
pset->queryFout = popen(fname + 1, "w");
+#else
+ pset->queryFout = popen(fname + 1, "wb");
+#endif
pset->pipe = 1;
}
else
-
-
echo "checking echo setting..."
if echo '\c' | grep -s c >/dev/null 2>&1
then
if test "$INCLUDE_DIRS"; then
- for dir in $INCLUDE_DIRS; do
+ for dir in $INCLUDE_DIRS $SRCH_INC; do
if test -d "$dir"; then
PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$dir"
else
if test "$LIBRARY_DIRS"; then
- for dir in $LIBRARY_DIRS; do
+ for dir in $LIBRARY_DIRS $SRCH_LIB; do
if test -d "$dir"; then
PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
else
ECHO_N_OUT=`echo -n "" | wc -c`
ECHO_C_OUT=`echo "\c" | wc -c`
-if test "$ECHO_N_OUT" -eq 0; then
+if test $ECHO_N_OUT -eq 0; then
DASH_N='-n'
BACKSLASH_C=
else
- if test "ECHO_C_OUT" -eq 0; then
+ if test $ECHO_C_OUT -eq 0; then
DASH_N=
BACKSLASH_C='\\\\c'
else
])
if test "$INCLUDE_DIRS"; then
- for dir in $INCLUDE_DIRS; do
+ for dir in $INCLUDE_DIRS $SRCH_INC; do
if test -d "$dir"; then
PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$dir"
else
])
if test "$LIBRARY_DIRS"; then
- for dir in $LIBRARY_DIRS; do
+ for dir in $LIBRARY_DIRS $SRCH_LIB; do
if test -d "$dir"; then
PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
else
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: c.h,v 1.48 1999/01/17 03:22:51 tgl Exp $
+ * $Id: c.h,v 1.49 1999/01/17 06:19:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include
#endif
+#ifdef __CYGWIN32__
+#include
+#endif
+
/* ----------------------------------------------------------------
* Section 1: bool, true, false, TRUE, FALSE
* ----------------------------------------------------------------
# Copyright (c) 1994, Regents of the University of California
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.38 1998/10/19 00:00:40 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.39 1999/01/17 06:19:24 momjian Exp $
#
#-------------------------------------------------------------------------
.PHONY: clean
clean:
rm -f lib$(NAME).a $(shlib) $(OBJS)
+ifeq ($(PORTNAME), win)
+ rm -f $(NAME).def
+endif
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
all:: ecpg
clean:
- rm -f *.o core a.out ecpg y.tab.h y.tab.c pgc.c *~
+ rm -f *.o core a.out ecpg$(X) y.tab.h y.tab.c pgc.c *~
install: all
- $(INSTALL) $(INSTL_EXE_OPTS) ecpg $(DESTDIR)$(BINDIR)
+ $(INSTALL) $(INSTL_EXE_OPTS) ecpg$(X) $(DESTDIR)$(BINDIR)
uninstall:
rm -f $(DESTDIR)$(BINDIR)/ecpg
switch (c)
{
case 'o':
+#ifndef __CYGWIN32__
yyout = fopen(optarg, "w");
+#else
+ yyout = fopen(optarg, "wb");
+#endif
if (yyout == NULL)
perror(optarg);
else
ptr2ext[1] = 'c';
ptr2ext[2] = '\0';
+#ifndef __CYGWIN32__
yyout = fopen(output_filename, "w");
+#else
+ yyout = fopen(output_filename, "wb");
+#endif
if (yyout == NULL)
{
perror(output_filename);
}
}
+#ifndef __CYGWIN32__
yyin = fopen(input_filename, "r");
+#else
+ yyin = fopen(input_filename, "rb");
+#endif
if (yyin == NULL)
perror(argv[fnr]);
else
# Copyright (c) 1994, Regents of the University of California
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.10 1998/10/19 00:00:46 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile.in,v 1.11 1999/01/17 06:19:39 momjian Exp $
#
#-------------------------------------------------------------------------
OBJS = pgenv.o pgconnection.o pgtransdb.o pgcursordb.o pglobject.o
+ifeq ($(PORTNAME), win)
+SHLIB_LINK+= -L../libpq -lpq -lstdc++
+else
SHLIB_LINK= -L../libpq -lpq
+endif
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
clean:
rm -f libpq++.a $(shlib) $(OBJS)
$(MAKE) -C examples clean
+ifeq ($(PORTNAME), win)
+ rm -f pq++.def
+endif
dep depend:
$(CXX) -MM $(CXXFLAGS) *.cc >depend
# Copyright (c) 1994, Regents of the University of California
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.41 1998/11/12 05:27:01 tgl Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.42 1999/01/17 06:19:34 momjian Exp $
#
#-------------------------------------------------------------------------
# If crypt is a separate library, rather than part of libc,
# make sure it gets included in shared libpq.
+ifeq ($(PORTNAME), win)
+SHLIB_LINK+= $(findstring -lcrypt,$(LIBS))
+else
SHLIB_LINK= $(findstring -lcrypt,$(LIBS))
+endif
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
clean:
rm -f libpq.a $(shlib) $(OBJS)
rm -f dllist.c common.c wchar.c conv.c
+ifeq ($(PORTNAME), win)
+ rm -f pq.def
+endif
depend dep:
$(CC) -MM $(CFLAGS) *.c >depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.87 1999/01/17 03:37:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.88 1999/01/17 06:19:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
conn->raddr.in.sin_port = htons((unsigned short) (portno));
conn->raddr_len = sizeof(struct sockaddr_in);
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__CYGWIN32__)
else
conn->raddr_len = UNIXSOCK_PATH(conn->raddr.un, portno);
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.17 1998/10/01 01:40:22 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.18 1999/01/17 06:19:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* open the file to be read in
*/
+#ifndef __CYGWIN32__
fd = open(filename, O_RDONLY, 0666);
+#else
+ fd = open(filename, O_RDONLY | O_BINARY, 0666);
+#endif
if (fd < 0)
{ /* error */
sprintf(conn->errorMessage,
/*
* open the file to be written to
*/
+#ifndef __CYGWIN32__
fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC, 0666);
+#else
+ fd = open(filename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
+#endif
if (fd < 0)
{ /* error */
sprintf(conn->errorMessage,
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.9 1998/10/28 06:49:10 thomas Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.10 1999/01/17 06:19:43 momjian Exp $
#
#-------------------------------------------------------------------------
@SET_MAKE@
distclean: clean
-rm -f config.h GNUmakefile Makefile.global
-rm -f config.cache config.log config.status
+ifeq ($(PORTNAME), win)
+ @if [ $SRCDIR != $ODBCSRCDIR ]; then rm -f template makefiles port; fi
+else
@if [ $SRCDIR ne $ODBCSRCDIR ]; then rm -f template makefiles port
+endif
.PHONY: standalone
/* This code makes it so that a file in the users home dir
* overrides a the "default" file as passed in
*/
+#ifndef __CYGWIN32__
aFile = (FILE*)(buf ? fopen(buf, "r") : NULL);
+#else
+ aFile = (FILE*)(buf ? fopen(buf, "rb") : NULL);
+#endif
if(!aFile) {
sprintf(buf,"%s",theIniFileName);
+#ifndef __CYGWIN32__
aFile = (FILE*)(buf ? fopen(buf, "r") : NULL);
+#else
+ aFile = (FILE*)(buf ? fopen(buf, "rb") : NULL);
+#endif
}
if (! LOGFP) {
generate_filename(MYLOGDIR,MYLOGFILE,filebuf);
+#ifndef __CYGWIN32__
LOGFP = fopen(filebuf, "w");
+#else
+ LOGFP = fopen(filebuf, "wb");
+#endif
globals.mylogFP = LOGFP;
setbuf(LOGFP, NULL);
}
if (! LOGFP) {
generate_filename(QLOGDIR,QLOGFILE,filebuf);
+#ifndef __CYGWIN32__
LOGFP = fopen(filebuf, "w");
+#else
+ LOGFP = fopen(filebuf, "wb");
+#endif
globals.qlogFP = LOGFP;
setbuf(LOGFP, NULL);
}
@echo "If this fails, flex is broken" | ./lextest || rm -f lextest
clean:
- rm -f lextest lex.yy.c lex.yy.o lextest.o
+ rm -f lextest$(X) lex.yy.c lex.yy.o lextest.o
dep:
# Makefile for the plpgsql shared object
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/Makefile.in,v 1.12 1998/10/30 15:05:23 tgl Exp $
+# $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/Makefile.in,v 1.13 1999/01/17 06:19:53 momjian Exp $
#
#-------------------------------------------------------------------------
OBJS= pl_parse.o pl_handler.o pl_comp.o pl_exec.o pl_funcs.o
+ifeq ($(PORTNAME), win)
+SHLIB_LINK+= -L$(LIBPQDIR) -lpq
+else
SHLIB_LINK= -L$(LIBPQDIR) -lpq
+endif
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
clean:
rm -f lib$(NAME).a $(shlib)
rm -f *.o pl.tab.h pl_gram.c pl_scan.c
+ifeq ($(PORTNAME), win)
+ rm -f $(NAME).def
+endif
i386-pc-sunos5=solaris_i386_gcc
i386-unknown-freebsd=freebsd
i386-unknown-netbsd=netbsd
+i386-pc-cygwin32=cygwin32
i486-pc-linux-gnu=linux_i386
i586-pc-linux-gnu=linux_i386
i586-pc-sco3.2v=sco
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.16 1998/07/26 04:31:41 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/GNUmakefile,v 1.17 1999/01/17 06:19:57 momjian Exp $
#
#-------------------------------------------------------------------------
all: $(INFILES)
cd input; $(MAKE) all; cd ..
cd output; $(MAKE) all; cd ..
+#ifneq ($(PORTNAME), win)
$(MAKE) -C ../../../contrib/spi REFINT_VERBOSE=1 refint$(DLSUFFIX) \
autoinc$(DLSUFFIX)
+#else
+# cat /dev/null > ../../../contrib/spi/refint$(DLSUFFIX)
+# cat /dev/null > ../../../contrib/spi/autoinc$(DLSUFFIX)
+#endif
+
+#ifeq ($(PORTNAME), win)
+#regress.dll: regress.c
+# cat /dev/null > $@
+#endif
#
# run the test
#
runtest: $(INFILES)
+ifneq ($(PORTNAME), win)
+ MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
+ $(SHELL) ./regress.sh $(PORTNAME) 2>&1 | tee regress.out
+else
MULTIBYTE=$(MULTIBYTE);export MULTIBYTE; \
- $(SHELL) ./regress.sh 2>&1 | tee regress.out
+ ./regress.sh $(PORTNAME) 2>&1 | tee regress.out
+endif
@echo "ACTUAL RESULTS OF REGRESSION TEST ARE NOW IN FILE regress.out"
clean:
- rm -f $(INFILES) regress.out
+ rm -f $(INFILES) regress.out regress.o regression.diffs
+ifeq ($(PORTNAME), win)
+ rm -f regress.def
+endif
$(MAKE) -C sql clean
$(MAKE) -C expected clean
$(MAKE) -C results clean
#!/bin/sh
-# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.21 1998/08/28 14:17:57 momjian Exp $
+# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.22 1999/01/17 06:19:58 momjian Exp $
#
+if [ $# -eq 0 ];
+then
+ exit 1
+fi
+
+if [ $1 == "win" ];
+then
+ HOST="-h localhost"
+else
+ HOST=""
+fi
+
if echo '\c' | grep -s c >/dev/null 2>&1
then
ECHO_N="echo -n"
PGDATESTYLE="Postgres,US"; export PGDATESTYLE
#FRONTEND=monitor
-FRONTEND="psql -n -e -q"
+FRONTEND="psql $HOST -n -e -q"
SYSTEM=`uname -s`
echo ""
echo "=============== destroying old regression database... ================="
-destroydb regression
+destroydb $HOST regression
echo "=============== creating new regression database... ================="
-createdb regression
+createdb $HOST regression
if [ $? -ne 0 ]; then
echo createdb failed
exit 1
in_file = stdin;
else
{
+#ifndef __CYGWIN32__
if ((in_file = fopen(*argv, "r")) == NULL)
+#else
+ if ((in_file = fopen(*argv, "rb")) == NULL)
+#endif
halt("PERROR: Can not open file %s\n", argv[0]);
argv++;
}
# Makefile for utils
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.5 1998/04/06 00:32:26 momjian Exp $
+# $Header: /cvsroot/pgsql/src/utils/Attic/Makefile,v 1.6 1999/01/17 06:20:03 momjian Exp $
#
# About strdup: Some systems have strdup in their standard library, others
# don't. Ones that don't will use this make file to compile the strdup.c
clean:
rm -f version.o
+ifeq ($(PORTNAME), win)
+ rm -f dllinit.o
+endif
ifeq (depend,$(wildcard depend))
include depend
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.9 1998/04/29 12:41:29 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.10 1999/01/17 06:20:06 momjian Exp $
*
* NOTES
* XXX eventually, should be able to handle version identifiers
PathSetVersionFilePath(path, full_path);
+#ifndef __CYGWIN32__
if ((fd = open(full_path, O_RDONLY, 0)) == -1)
+#else
+ if ((fd = open(full_path, O_RDONLY | O_BINARY, 0)) == -1)
+#endif
{
*reason_p = malloc(200);
sprintf(*reason_p, "File '%s' does not exist or no read permission.", full_path);
PathSetVersionFilePath(path, full_path);
+#ifndef __CYGWIN32__
fd = open(full_path, O_WRONLY | O_CREAT | O_EXCL, 0666);
+#else
+ fd = open(full_path, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0666);
+#endif
if (fd < 0)
{
*reason_p = malloc(100 + strlen(full_path));