1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-18 12:22:09 +03:00

Apply Win32 patch from Horak Daniel.

This commit is contained in:
Bruce Momjian
1999-01-17 06:20:06 +00:00
parent 298682d9e0
commit 7a6b562fdf
58 changed files with 484 additions and 86 deletions

View 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

View 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

View 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

View 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

View 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

View 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

View 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,

View 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

View 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
}

View 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);
}