Apply Win32 patch from Horak Daniel.
authorBruce Momjian
Sun, 17 Jan 1999 06:20:06 +0000 (06:20 +0000)
committerBruce Momjian
Sun, 17 Jan 1999 06:20:06 +0000 (06:20 +0000)
58 files changed:
src/Makefile.shlib
src/backend/Makefile
src/backend/access/nbtree/nbtsort.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/Makefile
src/backend/commands/copy.c
src/backend/commands/dbcommands.c
src/backend/commands/vacuum.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c
src/backend/libpq/be-fsstubs.c
src/backend/libpq/crypt.c
src/backend/libpq/hba.c
src/backend/libpq/password.c
src/backend/libpq/pqcomm.c
src/backend/optimizer/geqo/geqo_params.c
src/backend/port/snprintf.c
src/backend/postmaster/postmaster.c
src/backend/storage/smgr/md.c
src/backend/tcop/postgres.c
src/backend/tcop/utility.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/cache/relcache.c
src/backend/utils/init/miscinit.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/database.c
src/backend/utils/misc/trace.c
src/backend/utils/sort/psort.c
src/bin/pg_dump/Makefile.in
src/bin/pg_dump/pg_dump.c
src/bin/pg_id/Makefile
src/bin/pg_id/pg_id.c
src/bin/pg_passwd/Makefile
src/bin/pg_passwd/pg_passwd.c
src/bin/pg_version/Makefile.in
src/bin/psql/Makefile.in
src/bin/psql/psql.c
src/configure
src/configure.in
src/include/c.h
src/interfaces/ecpg/lib/Makefile.in
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/libpq++/Makefile.in
src/interfaces/libpq/Makefile.in
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-lobj.c
src/interfaces/odbc/GNUmakefile.in
src/interfaces/odbc/gpps.c
src/interfaces/odbc/misc.c
src/lextest/Makefile
src/pl/plpgsql/src/Makefile.in
src/template/.similar
src/test/regress/GNUmakefile
src/test/regress/regress.sh
src/tools/entab/entab.c
src/utils/Makefile
src/utils/version.c

index eb4da6fcf67912be5dd414fc0807adbaef2b2db4..7f1d083b113af3a07cb15aad126bce94369e15ee 100644 (file)
@@ -6,7 +6,7 @@
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -156,6 +156,10 @@ ifeq ($(PORTNAME), unixware)
   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.
 
@@ -163,6 +167,7 @@ all: lib$(NAME).a $(shlib)
 
 # Rules to build regular and shared libraries
 
+ifneq ($(PORTNAME), win)
 lib$(NAME).a: $(OBJS)
 ifdef MK_NO_LORDER
    $(AR) $(AROPT) $@ $(OBJS) 
@@ -170,10 +175,21 @@ else
    $(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
@@ -185,6 +201,7 @@ install-lib: lib$(NAME).a
 
 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); \
@@ -195,3 +212,4 @@ install-shlib: $(shlib)
        rm -f lib$(NAME)$(DLSUFFIX); \
        $(LN_S) $(shlib) lib$(NAME)$(DLSUFFIX); \
    fi
+endif
index 9410ab8ce37f064474fe4ff8aeafdc54db3dd2e2..87e4b75c1d89be6c764f942ab747934348a2b3d8 100644 (file)
@@ -34,7 +34,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -58,12 +58,34 @@ CFLAGS+= $(KRBFLAGS)
 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
+   dlltool --dllname $@$(X) --output-exp [email protected] --def postgres.def
+   gcc -g -o $@$(X) -Wl,--base-file,[email protected] [email protected] $(DLLOBJS) $(DLLLIBS)
+   dlltool --dllname $@$(X) --base-file [email protected] --output-exp [email protected] --def postgres.def
+   gcc -g -o $@$(X) [email protected] $(DLLOBJS) $(DLLLIBS)
+endif
+
+#.PHONY: postgres
 
 $(OBJS): $(DIRS:%=%.dir)
 
@@ -71,7 +93,10 @@ $(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/$@
@@ -89,7 +114,6 @@ postgres.o: $(OBJS)
 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.
@@ -104,9 +128,14 @@ fmgr.h:
 
 #############################################################################
 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:
@@ -132,12 +161,18 @@ install: $(LIBDIR) $(BINDIR) $(HEADERDIR) postgres $(POSTGRES_IMP) fmgr.h\
          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
@@ -152,7 +187,13 @@ endif
    $(INSTALL) $(INSTLOPTS) optimizer/geqo/pg_geqo.sample \
      $(LIBDIR)/pg_geqo.sample
 
-$(BINDIR) $(LIBDIR) $(HEADERDIR): 
+#$(BINDIR) $(LIBDIR) $(HEADERDIR):
+#  mkdir $@
+$(BINDIR):
+   mkdir $@
+$(LIBDIR):
+   mkdir $@
+$(HEADERDIR):
    mkdir $@
 
 #############################################################################
index 30d74ced97053004a2fb1cd3fcb81f7c84e1db3e..10dc7701c02cbbd269dfb7b9862ce2ccae653b20 100644 (file)
@@ -5,7 +5,7 @@
  *
  *
  * 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
  *
@@ -420,7 +420,11 @@ _bt_tapecreate(char *fname)
 
    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 */
index 9eb4e740bcf5f8bce886caa1293e4fee08805655..ff1c5afc103c2d4bcfabd9c924a14b9eba8040c4 100644 (file)
@@ -7,7 +7,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,6 +17,9 @@
 #include 
 #include 
 #include 
+#ifdef __CYGWIN32__
+#include 
+#endif
 
 #define BOOTSTRAP_INCLUDE      /* mask out stuff in tcop/tcopprot.h */
 
index 6d5d26a143195a0a66fb76a85cd56cdc58e8bee3..93232ea66b014d5c5089ee5ffff6068bdc45278e 100644 (file)
@@ -4,7 +4,7 @@
 #    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 $
 #
 #-------------------------------------------------------------------------
 
@@ -39,17 +39,26 @@ LOCALBKI_SRCS= $(addprefix ../../include/catalog/, \
                 )
 
 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
index a9e22ec40be7d47caa8b68116eefc04233b37106..5a8b3fc96504c5de086f30a8ae8bd435cdf86aca 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -250,7 +250,11 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
            }
            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 "
@@ -277,7 +281,11 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
                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 "
index a774ca1deb148b42c591a90c15a12a912b08988b..a3cdd49f265f39dd87a04e503051129b566e409d 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -305,7 +305,11 @@ stop_vacuum(char *dbpath, char *dbname)
    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);
index 608dd729ffa6656debaf6183d1dc8ca15ce5e28a..6005c107cc17f847a6c83fe7498ff976ba54f4da 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -187,7 +187,11 @@ vc_init()
 {
    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\
index 5ec45c7c795726528798942afa2d7be2b7a64907..d0b3dc39167d919e15e1776b68f904f6147bd691 100644 (file)
@@ -6,7 +6,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -100,8 +100,13 @@ ExecHash(Hash *node)
        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);
index 4673d92ce31e1e5dc1708764370f99abbae3d8fc..1de20fb16523c2000312b9db39548e8991fb84b1 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -172,9 +172,15 @@ ExecHashJoin(HashJoin *node)
            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;
 
index b35eba81ca0ebefd6535226847261549051d719d..0e6bd7f5228bd7ed4885c926ad3fa9b63aea7de4 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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
@@ -267,7 +267,11 @@ lo_import(text *filename)
     * 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",
@@ -341,7 +345,11 @@ lo_export(Oid lobjId, text *filename)
     */
    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 */
index 92f70c5acb99386ef417064b6d65357f67b6d994..fb87280299f700f94a5000e136ca5e1e9b872213 100644 (file)
@@ -9,7 +9,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -76,7 +76,11 @@ crypt_openpwdfile()
    FILE       *pwdfile;
 
    filename = crypt_getpwdfilename();
+#ifndef __CYGWIN32__
    pwdfile = AllocateFile(filename, "r");
+#else
+   pwdfile = AllocateFile(filename, "rb");
+#endif
 
    return pwdfile;
 }
index daa4716e30b27395d8f479495892a03d3d280045..c5be35f82bf41c870130dece04edeaf4a828eb77 100644 (file)
@@ -5,7 +5,7 @@
  *   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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -390,7 +390,11 @@ find_hba_entry(SockAddr *raddr, const char *user, const char *database,
    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);
@@ -801,7 +805,11 @@ verify_against_usermap(const char *pguser,
        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.  */
@@ -973,7 +981,11 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
    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;
index e6c1d816a8baaa7128cfa1b1b15d39d2b9fc836d..968ba055e6786fbef23dbcbbb7eb96e517a8571f 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * 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 $ 
  *
  */
 
@@ -27,7 +27,11 @@ verify_password(char *auth_arg, char *user, char *password)
    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,
index c8de26e8d5b497ec5426bef774ce8a8d7fde69fc..8f9c14fee9fcca8d56f13912182289dd2e3ac842 100644 (file)
@@ -5,7 +5,7 @@
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -466,7 +466,11 @@ StreamServerPort(char *hostName, short portName, int *fdP)
         * 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;
            
@@ -519,7 +523,11 @@ StreamServerPort(char *hostName, short portName, int *fdP)
         * 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;
            
index 2257f2c293d233e8a07b9bb55988555f164d1cfd..e3779ead25f7097cee784d2f47a38852a904092f 100644 (file)
@@ -5,7 +5,7 @@
 *
 * 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 $
 *
 *-------------------------------------------------------------------------
 */
@@ -91,7 +91,11 @@ geqo_params(int string_length)
    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)
    {
 
index c49df449423eb76a772bee81c53e5bb2b2b07251..2d6215decd5b52850b92bd0cc19ffc66a35d08d2 100644 (file)
@@ -36,6 +36,7 @@
 #include "pathnames.h"
 #endif
 
+#include 
 #include "postgres.h"
 
 #include "regex/cdefs.h"
@@ -73,7 +74,7 @@ typedef unsigned long long ulong_long;
  * 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;
 
index 8c35f6eeb6c5a45a6d0be5f0d5c9cc66a0a8f41e..795b1959fde8461d9e1d43c7f7db32e4c1c93de3 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * 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"
@@ -170,7 +174,9 @@ static int  real_argc;
 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
@@ -268,7 +274,11 @@ checkDataDir(const char *DataDir, bool *DataDirOK)
 
        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.  "
@@ -522,6 +532,7 @@ PostmasterMain(int argc, char *argv[])
            exit(1);
        }
    }
+#ifndef __CYGWIN32__
    status = StreamServerPort(NULL, PostPortName, &ServerSock_UNIX);
    if (status != STATUS_OK)
    {
@@ -529,7 +540,7 @@ PostmasterMain(int argc, char *argv[])
                progname);
        exit(1);
    }
-
+#endif
    /* set up shared memory and semaphores */
    EnableMemoryContext(TRUE);
    reset_shared(PostPortName);
@@ -584,7 +595,11 @@ pmdaemonize(void)
        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);
@@ -688,12 +703,14 @@ ServerLoop(void)
 
        /* 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) &&
@@ -802,6 +819,7 @@ initMasks(fd_set *rmask, fd_set *wmask)
    FD_ZERO(rmask);
    FD_ZERO(wmask);
 
+#ifndef __CYGWIN32__
    if (ServerSock_UNIX != INVALID_SOCK)
    {
        FD_SET(ServerSock_UNIX, rmask);
@@ -809,6 +827,7 @@ initMasks(fd_set *rmask, fd_set *wmask)
        if (ServerSock_UNIX > nsocks)
            nsocks = ServerSock_UNIX;
    }
+#endif
 
    if (ServerSock_INET != INVALID_SOCK)
    {
@@ -1437,7 +1456,9 @@ DoBackend(Port *port)
    /* Close the postmater sockets */
    if (NetServer)
        StreamClose(ServerSock_INET);
+#ifndef __CYGWIN32__
    StreamClose(ServerSock_UNIX);
+#endif
 
    /* Save port for ps status */
    MyProcPort = port;
@@ -1546,8 +1567,10 @@ ExitPostmaster(int status)
     */
    if (ServerSock_INET != INVALID_SOCK)
        StreamClose(ServerSock_INET);
+#ifndef __CYGWIN32__
    if (ServerSock_UNIX != INVALID_SOCK)
        StreamClose(ServerSock_UNIX);
+#endif
    proc_exit(status);
 }
 
index 1c45872883748fab0dce06537f359cc0123fa98a..762b49836c72b94d99bafd1efb3f735860c7a30e 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -140,7 +140,11 @@ mdcreate(Relation reln)
    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
@@ -157,7 +161,11 @@ mdcreate(Relation reln)
    {
        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;
    }
@@ -290,11 +298,19 @@ mdopen(Relation reln)
 
    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)
@@ -622,7 +638,11 @@ mdblindwrt(char *dbstr,
    }
 #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 */
@@ -900,7 +920,11 @@ _mdfd_openseg(Relation reln, int segno, int oflags)
        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);
index 7e5f2d66d6be4e9bc7664b8042350c8f5b184ff2..eeec7b02259306c07a0c92d7b48f74fd9587bd6a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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
@@ -39,6 +39,9 @@
 #include 
 #include 
 #include 
+#ifdef __CYGWIN32__
+#include 
+#endif
 
 #include "postgres.h"
 #include "miscadmin.h"
@@ -1451,7 +1454,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
        {
            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;
@@ -1520,7 +1527,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
    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");
    }
 
    /* ----------------
index 598fe952c40cd65c9b1852c309ce56dedf881a41..7d9e11ba5bd5ba83ae4bd5bb21f60e32b293f750 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -620,7 +620,11 @@ ProcessUtility(Node *parsetree,
 
                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);
index 04a224feaebb529d9a189bf59da6e60e8675b230..7a4a14583b94ddeebbf89a3a3721df32b1255333 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -550,7 +550,11 @@ _ReadLOArray(char *str,
    {
        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,
index 99ee3d2fc54f7fa38af5eff937b0897d26855544..f86196d3bcff42aa698ae9877b8c58f92ae74f9b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -1861,7 +1861,11 @@ init_irels(void)
    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;
@@ -2022,7 +2026,11 @@ write_irels(void)
    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);
 
index 564be81ec436a57402d1ab96b61e1c1b5a4e3dfa..0f10549285bbfb2113bffc5c25588443a9bff363 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -338,7 +338,11 @@ SetCharSet()
        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;
index 12bbcf3034a0a9d6de8217fcbebc39b29cf8a94d..c23dd15bce109afa30e328114b4303cb22be727f 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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
@@ -176,7 +176,11 @@ VerifySystemDatabase()
 
    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.",
@@ -212,7 +216,11 @@ VerifyMyDatabase()
    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."
index 60f6499872e86efc2571af7a6cc3b3b1befd3871..dadf6a8173c121c2efe939ca04701244144b7d17 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -198,7 +198,11 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
    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);
index def34162f2493776228e849329acb95252e62444..1ac48bc82d7a381a189fb288ecf9f3a60cd69abd 100644 (file)
@@ -345,7 +345,11 @@ read_pg_options(SIGNAL_ARGS)
    }
 
    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)
index 76daa0351ee51e1901b86fa396789b64a6f3ebe5..09bbd877ef16873944a3fa297c106a30aa811440 100644 (file)
@@ -4,7 +4,7 @@
  *
  * 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.
@@ -1033,8 +1033,11 @@ gettape()
 
    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));
index ca15402600365ecee1afa2c04d07beab3eb03bd1..f387b729e0b7fb8d0b6a74de90d45697c992c595 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -39,7 +39,7 @@ submake:
    $(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
 
@@ -47,7 +47,7 @@ depend dep:
    $(CC) -MM $(CFLAGS) *.c >depend
 
 clean: 
-   rm -f pg_dump $(OBJS) 
+   rm -f pg_dump$(X) $(OBJS) 
 
 ifeq (depend,$(wildcard depend))
 include depend
index 0ffaaeb97db2a97adc4270a8c6875856f7f3753b..4686c7cbee703d8e25ea9826c2dc97e8f9aead90 100644 (file)
@@ -21,7 +21,7 @@
  *
  *
  * 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 $
  *
  * Modifications - 6/10/96 - [email protected] - version 1.13.dhb
  *
 #include 
 #endif
 
+#ifdef __CYGWIN32__
+#include 
+#endif
+
 #include "pg_dump.h"
 
 static void dumpSequence(FILE *fout, TableInfo tbinfo);
@@ -629,7 +633,11 @@ main(int argc, char **argv)
        g_fout = stdout;
    else
    {
+#ifndef __CYGWIN32__
        g_fout = fopen(filename, "w");
+#else
+       g_fout = fopen(filename, "wb");
+#endif
        if (g_fout == NULL)
        {
            fprintf(stderr,
index c98275678ce6cce59902e97c6eebb484141ca4f1..0919f2ffc42405e07b19da84c5b64610d06353a7 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -33,13 +33,13 @@ $(LIBPQDIR)/libpq.a:
    $(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
index 7388946051e0d4774c3432cfbf087130e353da42..ee2cb020a23f07663aa438f9ca8a2f53c2f51f9f 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,9 @@
 #include 
 #include 
 #include 
-
+#ifdef __CYGWIN32__
+#include 
+#endif
 
 int
 main(int argc, char **argv)
index 408640fea52ea62bac741b1212bfde396ce4ac9e..e4ceb5c7136b24f589da0f2af27ac36ddfad4684 100644 (file)
@@ -15,7 +15,7 @@ pg_passwd: $(OBJS)
    $(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:
@@ -25,7 +25,7 @@ depend dep:
    $(CC) -MM $(CFLAGS) *.c >depend
 
 clean:
-   rm -f pg_passwd $(OBJS)
+   rm -f pg_passwd$(X) $(OBJS)
 
 ifeq (depend,$(wildcard depend))
 include depend
index de9ffd65a7c9a505ff1ba7cb9983952ad18957b3..0718a3153bf2f14eceb5cc1014d7d956d3afc443 100644 (file)
@@ -63,7 +63,11 @@ read_pwd_file(char *filename)
    int         i;
 
 try_again:
+#ifndef __CYGWIN32__
    fp = fopen(filename, "r");
+#else
+   fp = fopen(filename, "rb");
+#endif
    if (fp == NULL)
    {
        if (errno == ENOENT)
@@ -75,7 +79,11 @@ try_again:
            {
                case 'y':
                case 'Y':
+#ifndef __CYGWIN32__
                    fp = fopen(filename, "w");
+#else
+                   fp = fopen(filename, "wb");
+#endif
                    if (fp == NULL)
                    {
                        perror(filename);
@@ -193,7 +201,11 @@ link_again:
    }
 
    /* open file */
+#ifndef __CYGWIN32__
    if ((fp = fopen(filename, "w")) == NULL)
+#else
+   if ((fp = fopen(filename, "wb")) == NULL)
+#endif
    {
        perror(filename);
        exit(1);
index ed0eff2405508b1335fd687534ad724d8bf5ac10..516a07f498a4b8ccb203052e8c4075c48bf802ee 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -28,13 +28,13 @@ submake:
    $(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
index 1af2e51ff879abaeb4c3a3ac8a8782b71b08ea10..4e19ed1984a701ba9c93a91f7e4ffc311d251d1a 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -43,13 +43,13 @@ submake:
    $(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
index ace31f577c3085c1ea33aef95ce4a326ded1a0e7..453d7ae7e11d22025ff2099b25a73dac241af372 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,6 +40,9 @@
 #ifdef HAVE_TERMIOS_H
 #include 
 #endif
+#ifdef __CYGWIN32__
+#include 
+#endif
 
 #ifdef HAVE_LIBREADLINE
 #ifdef HAVE_READLINE_H
@@ -1436,9 +1439,17 @@ do_copy(const char *args, PsqlSettings *pset)
            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).",
@@ -2139,7 +2150,11 @@ HandleSlashCmds(PsqlSettings *pset,
                }
                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;
@@ -2209,7 +2224,11 @@ HandleSlashCmds(PsqlSettings *pset,
                    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;
@@ -2305,7 +2324,11 @@ HandleSlashCmds(PsqlSettings *pset,
                    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;
@@ -3086,7 +3109,11 @@ setFout(PsqlSettings *pset, char *fname)
        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
index e4d2d008a8dd3a4dd5087177bb46ee990b223a43..c4ebfada06ee41e961b67566b14fd2871eb2a47b 100755 (executable)
@@ -668,8 +668,6 @@ PORTNAME=${os}
 
 
 
-
-
 echo "checking echo setting..."
 if echo '\c' | grep -s c >/dev/null 2>&1
 then
@@ -760,7 +758,7 @@ fi
 
 
 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
@@ -798,7 +796,7 @@ fi
 
 
 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
@@ -1549,11 +1547,11 @@ esac
 
 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
index 71c9c4749f0a514d7a6d2590e82da5c50fd3da12..a51defc872b374f6d0320ec77bc3da30c7a9dc10 100644 (file)
@@ -164,7 +164,7 @@ AC_ARG_WITH(includes,
     ])
 
 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
@@ -196,7 +196,7 @@ AC_ARG_WITH(libraries,
     ])
 
 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
index 0432d819406633d0c5562a36dc6ca52bd2076164..7c95bbd433c819b800b044b3967eb8582f2df361 100644 (file)
@@ -7,7 +7,7 @@
  *
  * 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
  * ----------------------------------------------------------------
index 88d39846debb801c9625eb08195aadbe3221cf8c..182fd6574325cc07889916f94641f037a54e43da 100644 (file)
@@ -6,7 +6,7 @@
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -43,6 +43,9 @@ typename.o : typename.c ../include/ecpgtype.h
 .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
index 0a5a591cc5da267d4c3742cdc9cdf5399a44c705..cd4b989f7ba532e14356a93c3a1ccea665c1535b 100644 (file)
@@ -15,10 +15,10 @@ OBJ=y.tab.o pgc.o type.o ecpg.o ecpg_keywords.o ../../../backend/parser/scansup.
 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
index 16cddc77b7679a46b4b52b2deca1da1e112bc12c..11ed36ef65c65d583cc3754ccd0c24f5d03b0419 100644 (file)
@@ -61,7 +61,11 @@ main(int argc, char *const argv[])
        switch (c)
        {
            case 'o':
+#ifndef __CYGWIN32__
                yyout = fopen(optarg, "w");
+#else
+               yyout = fopen(optarg, "wb");
+#endif
                if (yyout == NULL)
                    perror(optarg);
                else
@@ -126,7 +130,11 @@ main(int argc, char *const argv[])
                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);
@@ -136,7 +144,11 @@ main(int argc, char *const argv[])
                }
            }
 
+#ifndef __CYGWIN32__
            yyin = fopen(input_filename, "r");
+#else
+           yyin = fopen(input_filename, "rb");
+#endif
            if (yyin == NULL)
                perror(argv[fnr]);
            else
index 5a1fc34f85bd441f52142e64c15d8f3e2798bb36..8c3ba2f0048528c2590e491bdad3b9159d64b6a1 100644 (file)
@@ -6,7 +6,7 @@
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -44,7 +44,11 @@ endif
 
 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
@@ -87,6 +91,9 @@ beforeinstall-headers:
 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
index 6d60876dd640efc63e8cac879805ce58a022b05b..471fda1773df1258e5a8ebbc142bd5399e6a0754 100644 (file)
@@ -6,7 +6,7 @@
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -36,7 +36,11 @@ endif
 
 # 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
@@ -139,6 +143,9 @@ beforeinstall-headers:
 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
index cb515be8f3a4c911456da7fc6a5efdea3cb28b60..4c5f70035aeaacccc13dff84676eafad52ec3b0a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -567,7 +567,7 @@ connectDB(PGconn *conn)
        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
index 19c7770f3f194c3f5668094233dee7b4240a9118..7fd52737bf08745d29581927754d2c71da5fa060 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -392,7 +392,11 @@ lo_import(PGconn *conn, char *filename)
    /*
     * 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,
@@ -467,7 +471,11 @@ lo_export(PGconn *conn, Oid lobjId, char *filename)
    /*
     * 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,
index 64ffee8825f1b588d7e93b99e457b353d9b9d67f..0835bd53b5a720cfe3bbbee34726c3be4b76064c 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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@
@@ -73,7 +73,11 @@ clean:
 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
 
index 5cb4502c186278bab67c281e5e9250852f710fd3..38a2e49928b3397eb83c0be8acc2c3545af4b3f8 100644 (file)
@@ -97,10 +97,18 @@ GetPrivateProfileString(char *theSection,   // section name
      /* 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
    }
 
        
index 60baaa63f2d2b6e0101e04d4637cfba0d3097518..cc31c3bdf83aa223a6e4d25de2a9d27cedb8d88b 100644 (file)
@@ -71,7 +71,11 @@ char filebuf[80];
 
        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);
        }
@@ -102,7 +106,11 @@ FILE* LOGFP = globals.qlogFP;
 
        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);
        }
index d1cdc1a3bac9a51277a7742c04b3e6180b78f87e..b466704a07633c592deed34831337f8e8598a269 100644 (file)
@@ -19,6 +19,6 @@ lextest: lextest.c scan.l
    @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:
index 637ede61920e39e542ca816e894a4893f1d0879d..7b3379d5520ce146a9931d1f8895c7f246d40d1e 100644 (file)
@@ -4,7 +4,7 @@
 #    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 $
 #
 #-------------------------------------------------------------------------
 
@@ -24,7 +24,11 @@ LFLAGS+= -i -l
 
 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
@@ -74,3 +78,6 @@ pl.tab.h: pl_gram.c
 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
index 7702fc6291faff36a11a596e423040387e701bc9..f281e256a6efbac1dba8b026769b065d3723dd1e 100644 (file)
@@ -12,6 +12,7 @@ i386-pc-solaris=solaris_i386_gcc
 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
index e23eecdae79879118fbc2d3c81bd6a66ec5bbf96..7c23558139037d049ad97e89b2b64f986d246648 100644 (file)
@@ -7,7 +7,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -43,19 +43,37 @@ endif
 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
index 8e74b0402c9aec96c9780bb225737a49d26cb3fc..f64de5a858e5e990ff16fcd0c911a7c3b9a43ea5 100755 (executable)
@@ -1,6 +1,19 @@
 #!/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
+   echo "Syntaxe: $0 "
+   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"
@@ -18,7 +31,7 @@ PGTZ="PST8PDT"; export PGTZ
 PGDATESTYLE="Postgres,US"; export PGDATESTYLE
 
 #FRONTEND=monitor
-FRONTEND="psql -n -e -q"
+FRONTEND="psql $HOST -n -e -q"
 
 SYSTEM=`uname -s`
 
@@ -31,10 +44,10 @@ echo "See regress/README for more information."
 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
index 5aa94e6abf03118db42a35f648e517f02234cd79..b0019b30b2ae820b2ef9cd57ceb719adec9abb51 100644 (file)
@@ -94,7 +94,11 @@ char   **argv;
            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++;
        }
index cf38bc6eeb71f2d7c6bf64c6088ac68a76faaf07..46ab610f1189bc410116a252a701c6815f9ea680 100644 (file)
@@ -4,7 +4,7 @@
 #    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
@@ -27,6 +27,9 @@ depend dep:
 
 clean: 
    rm -f version.o
+ifeq ($(PORTNAME), win)
+   rm -f dllinit.o
+endif
 
 ifeq (depend,$(wildcard depend))
 include depend
index aef5de8b48a0ce4397f7c195b36f488eb4dc555c..7dafe60b313f119c4498245c7645c4051f807a0d 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * 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
@@ -68,7 +68,11 @@ ValidatePgVersion(const char *path, char **reason_p)
 
    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);
@@ -123,7 +127,11 @@ SetPgVersion(const char *path, char **reason_p)
 
    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));