diff options
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/psql/command.c | 5 | ||||
| -rw-r--r-- | src/bin/psql/common.c | 10 | ||||
| -rw-r--r-- | src/bin/psql/help.c | 4 | ||||
| -rw-r--r-- | src/bin/psql/print.c | 5 | ||||
| -rw-r--r-- | src/bin/psql/startup.c | 5 | ||||
| -rw-r--r-- | src/bin/psql/win32.mak | 28 |
6 files changed, 53 insertions, 4 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 6f1bc1b66d..4ed0280c89 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -28,6 +28,7 @@ #include "variables.h" #ifdef WIN32 +#include "../../interfaces/libpq/win32.h" #define popen(x,y) _popen(x,y) #define pclose(x) _pclose(x) #endif @@ -849,7 +850,11 @@ unescape(const char *source, int encoding) unsigned int len; char *copy; const char *value; +#ifndef WIN32 void *new; +#else + char *new; +#endif len = strcspn(p + 2, "}"); copy = xstrdup(p + 2); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 8133faa467..b1241bd53d 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -111,10 +111,12 @@ setQFout(const char *fname) } /* Direct signals */ +#ifndef WIN32 if (pset.queryFoutPipe) pqsignal(SIGPIPE, SIG_IGN); else pqsignal(SIGPIPE, SIG_DFL); +#endif return status; } @@ -252,11 +254,15 @@ PSQLexec(const char *query) return NULL; cancelConn = pset.db; +#ifndef WIN32 pqsignal(SIGINT, handle_sigint); /* control-C => cancel */ +#endif res = PQexec(pset.db, query); +#ifndef WIN32 pqsignal(SIGINT, SIG_DFL); /* now control-C is back to normal */ +#endif if (PQstatus(pset.db) == CONNECTION_BAD) { @@ -345,11 +351,15 @@ SendQuery(const char *query) } cancelConn = pset.db; +#ifndef WIN32 pqsignal(SIGINT, handle_sigint); +#endif results = PQexec(pset.db, query); +#ifndef WIN32 pqsignal(SIGINT, SIG_DFL); +#endif if (results == NULL) { diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 47fc0d8fc5..18f41e84fc 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -176,7 +176,9 @@ slashUsage(void) (fout = popen(pagerenv, "w"))) { usePipe = true; +#ifndef WIN32 pqsignal(SIGPIPE, SIG_IGN); +#endif } else fout = stdout; @@ -220,7 +222,9 @@ slashUsage(void) if (usePipe) { pclose(fout); +#ifndef WIN32 pqsignal(SIGPIPE, SIG_DFL); +#endif } } diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 156cdf6c65..4676d4b506 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -922,7 +922,9 @@ printTable(const char *title, if (pager) { output = pager; +#ifndef WIN32 pqsignal(SIGPIPE, SIG_IGN); +#endif } else output = fout; @@ -963,7 +965,10 @@ printTable(const char *title, if (pager) { pclose(pager); +#ifndef WIN32 pqsignal(SIGPIPE, SIG_DFL); +#endif + } } diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 2b2a1db3d4..c1e9fa0219 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -10,7 +10,7 @@ #ifdef WIN32 #include <io.h> -#include <window.h> +#include <windows.h> #else #include <unistd.h> #endif @@ -223,7 +223,8 @@ main(int argc, char **argv) #ifdef WIN32 /* getopt is not in the standard includes on Win32 */ int getopt(int, char *const[], const char *); - +/* And it requires progname to be set */ +char *__progname = "psql"; #endif static void diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak index 0b0228f3f6..0365a00311 100644 --- a/src/bin/psql/win32.mak +++ b/src/bin/psql/win32.mak @@ -17,8 +17,20 @@ OutDir=.\Release ALL : "$(OUTDIR)\psql.exe" CLEAN : - -@erase "$(INTDIR)\psql.obj" + -@erase "$(INTDIR)\command.obj" + -@erase "$(INTDIR)\common.obj" + -@erase "$(INTDIR)\help.obj" + -@erase "$(INTDIR)\input.obj" -@erase "$(INTDIR)\stringutils.obj" + -@erase "$(INTDIR)\mainloop.obj" + -@erase "$(INTDIR)\copy.obj" + -@erase "$(INTDIR)\startup.obj" + -@erase "$(INTDIR)\prompt.obj" + -@erase "$(INTDIR)\variables.obj" + -@erase "$(INTDIR)\large_obj.obj" + -@erase "$(INTDIR)\print.obj" + -@erase "$(INTDIR)\describe.obj" + -@erase "$(INTDIR)\tab-complete.obj" -@erase "$(INTDIR)\getopt.obj" -@erase "$(INTDIR)\vc50.idb" -@erase "$(OUTDIR)\psql.exe" @@ -46,8 +58,20 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\ /pdb:"$(OUTDIR)\psql.pdb" /machine:I386 /out:"$(OUTDIR)\psql.exe" LINK32_OBJS= \ - "$(INTDIR)\psql.obj" \ + "$(INTDIR)\command.obj" \ + "$(INTDIR)\common.obj" \ + "$(INTDIR)\help.obj" \ + "$(INTDIR)\input.obj" \ "$(INTDIR)\stringutils.obj" \ + "$(INTDIR)\mainloop.obj" \ + "$(INTDIR)\copy.obj" \ + "$(INTDIR)\startup.obj" \ + "$(INTDIR)\prompt.obj" \ + "$(INTDIR)\variables.obj" \ + "$(INTDIR)\large_obj.obj" \ + "$(INTDIR)\print.obj" \ + "$(INTDIR)\describe.obj" \ + "$(INTDIR)\tab-complete.obj" \ "$(INTDIR)\getopt.obj" \ "..\..\interfaces\libpq\Release\libpqdll.lib" |
