diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-07-03 04:24:16 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-07-03 04:24:16 +0000 |
commit | c765b4b052262416a2212ba206d9669f88ca68b9 (patch) | |
tree | 63ef0bf26933568d64dc6fe5c957d09c7dd2b0d8 /src/interfaces/libpq/fe-print.c | |
parent | d5283ccd3efce2abb66ad26d7f2ab2a5f81d5608 (diff) |
Hello!
Through some minor changes, I have been able to compile the libpq
client libraries on the Win32 platform. Since the libpq communications
part has been rewritten, this has become much easier. Enclosed is
a patch that will allow at least Microsoft Visual C++ to compile
libpq into both a static and a dynamic library. I will take a look
at porting the psql frontend as well, but I figured it was a good
idea to send in these patches first - so no major changes are done
to the files before it gets applied (if it does).
Regards,
Magnus Hagander
Diffstat (limited to 'src/interfaces/libpq/fe-print.c')
-rw-r--r-- | src/interfaces/libpq/fe-print.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index ae820561c06..586ec370aa4 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -9,24 +9,31 @@ * didn't really belong there. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.5 1998/06/16 07:29:49 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.6 1998/07/03 04:24:15 momjian Exp $ * *------------------------------------------------------------------------- */ +#ifdef WIN32 +#include "win32.h" +#endif #include <postgres.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <string.h> +#ifndef WIN32 #include <unistd.h> #include <sys/ioctl.h> +#endif #include "libpq/pqsignal.h" #include "libpq-fe.h" +#ifndef WIN32 #ifndef HAVE_TERMIOS_H #include <sys/termios.h> #else #include <termios.h> #endif +#endif /* WIN32 */ #ifdef MB #include "regex/pg_wchar.h" @@ -143,9 +150,13 @@ PQprint(FILE *fout, if (fout == NULL) fout = stdout; - if (po->pager && fout == stdout && + if (po->pager && fout == stdout +#ifndef WIN32 + && isatty(fileno(stdin)) && - isatty(fileno(stdout))) + isatty(fileno(stdout)) +#endif + ) { /* try to pipe to the pager program if possible */ #ifdef TIOCGWINSZ @@ -174,11 +185,17 @@ PQprint(FILE *fout, - (po->header != 0) * 2 /* row count and newline */ ))) { +#ifdef WIN32 + fout = _popen(pagerenv, "w"); +#else fout = popen(pagerenv, "w"); +#endif if (fout) { usePipe = 1; +#ifndef WIN32 pqsignal(SIGPIPE, SIG_IGN); +#endif } else fout = stdout; @@ -289,8 +306,12 @@ PQprint(FILE *fout, free(fieldNames); if (usePipe) { +#ifdef WIN32 + _pclose(fout); +#else pclose(fout); pqsignal(SIGPIPE, SIG_DFL); +#endif } if (po->html3 && !po->expanded) fputs("</table>\n", fout); |