diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/Makefile.in | 6 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_dump.c | 10 | ||||
| -rw-r--r-- | src/bin/pg_id/Makefile | 6 | ||||
| -rw-r--r-- | src/bin/pg_id/pg_id.c | 6 | ||||
| -rw-r--r-- | src/bin/pg_passwd/Makefile | 4 | ||||
| -rw-r--r-- | src/bin/pg_passwd/pg_passwd.c | 12 | ||||
| -rw-r--r-- | src/bin/pg_version/Makefile.in | 6 | ||||
| -rw-r--r-- | src/bin/psql/Makefile.in | 6 | ||||
| -rw-r--r-- | src/bin/psql/psql.c | 29 |
9 files changed, 67 insertions, 18 deletions
diff --git a/src/bin/pg_dump/Makefile.in b/src/bin/pg_dump/Makefile.in index ca15402600..f387b729e0 100644 --- a/src/bin/pg_dump/Makefile.in +++ b/src/bin/pg_dump/Makefile.in @@ -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 diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 0ffaaeb97d..4686c7cbee 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -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 - dave@bensoft.com - version 1.13.dhb * @@ -76,6 +76,10 @@ #include <termios.h> #endif +#ifdef __CYGWIN32__ +#include <getopt.h> +#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, diff --git a/src/bin/pg_id/Makefile b/src/bin/pg_id/Makefile index c98275678c..0919f2ffc4 100644 --- a/src/bin/pg_id/Makefile +++ b/src/bin/pg_id/Makefile @@ -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 diff --git a/src/bin/pg_id/pg_id.c b/src/bin/pg_id/pg_id.c index 7388946051..ee2cb020a2 100644 --- a/src/bin/pg_id/pg_id.c +++ b/src/bin/pg_id/pg_id.c @@ -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 <stdio.h> #include <stdlib.h> #include <unistd.h> - +#ifdef __CYGWIN32__ +#include <getopt.h> +#endif int main(int argc, char **argv) diff --git a/src/bin/pg_passwd/Makefile b/src/bin/pg_passwd/Makefile index 408640fea5..e4ceb5c713 100644 --- a/src/bin/pg_passwd/Makefile +++ b/src/bin/pg_passwd/Makefile @@ -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 diff --git a/src/bin/pg_passwd/pg_passwd.c b/src/bin/pg_passwd/pg_passwd.c index de9ffd65a7..0718a3153b 100644 --- a/src/bin/pg_passwd/pg_passwd.c +++ b/src/bin/pg_passwd/pg_passwd.c @@ -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); diff --git a/src/bin/pg_version/Makefile.in b/src/bin/pg_version/Makefile.in index ed0eff2405..516a07f498 100644 --- a/src/bin/pg_version/Makefile.in +++ b/src/bin/pg_version/Makefile.in @@ -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 diff --git a/src/bin/psql/Makefile.in b/src/bin/psql/Makefile.in index 1af2e51ff8..4e19ed1984 100644 --- a/src/bin/psql/Makefile.in +++ b/src/bin/psql/Makefile.in @@ -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 diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c index ace31f577c..453d7ae7e1 100644 --- a/src/bin/psql/psql.c +++ b/src/bin/psql/psql.c @@ -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 <termios.h> #endif +#ifdef __CYGWIN32__ +#include <getopt.h> +#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 |
