From: Bruce Momjian Date: Mon, 27 Sep 2004 22:06:41 +0000 (+0000) Subject: Make adjustment for MS VC and BCC compile of psql, from Dave Page. X-Git-Tag: REL8_0_0BETA4~267 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=866627f84dfd01372748ef851e4be89429d7b346;p=postgresql Make adjustment for MS VC and BCC compile of psql, from Dave Page. --- diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak index 966a2993e9..bc6d3446f5 100644 --- a/src/bin/psql/win32.mak +++ b/src/bin/psql/win32.mak @@ -60,7 +60,8 @@ CLEAN : CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\ "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \ - /I ..\..\include /I ..\..\interfaces\libpq /D "HAVE_STRDUP" /D "FRONTEND" + /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \ + /D "HAVE_STRDUP" /D "FRONTEND" CPP_OBJS=.\Release/ CPP_SBRS=. @@ -71,6 +72,8 @@ 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)\pgstrcasecmp.obj" \ + "$(INTDIR)\exec.obj" \ "$(INTDIR)\command.obj" \ "$(INTDIR)\common.obj" \ "$(INTDIR)\help.obj" \ @@ -118,6 +121,16 @@ LINK32_OBJS= \ $(CPP_PROJ) ..\..\port\path.c << +"$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c + $(CPP) @<< + $(CPP_PROJ) ..\..\port\pgstrcasecmp.c +<< + +"$(INTDIR)\exec.obj" : ..\..\port\exec.c + $(CPP) @<< + $(CPP_PROJ) ..\..\port\exec.c +<< + .c{$(CPP_OBJS)}.obj:: $(CPP) @<< $(CPP_PROJ) $< diff --git a/src/port/exec.c b/src/port/exec.c index 5e62475975..cd583d5234 100644 --- a/src/port/exec.c +++ b/src/port/exec.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/exec.c,v 1.25 2004/08/29 05:07:02 momjian Exp $ + * $PostgreSQL: pgsql/src/port/exec.c,v 1.26 2004/09/27 22:06:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,11 @@ #include #include #include +#if !defined(_MSC_VER) && !defined(__BORLANDC__) #include +#else +#include "port/win32.h" +#endif #include "miscadmin.h" @@ -71,7 +75,7 @@ validate_exec(const char *path) int in_grp = 0; #else - char path_exe[MAXPGPATH + 2 + strlen(".exe")]; + char path_exe[MAXPGPATH + sizeof(".exe") - 1]; #endif int is_r = 0; int is_x = 0; @@ -176,7 +180,11 @@ find_my_exec(const char *argv0, char *retpath) test_path[MAXPGPATH]; char *path; +#if !defined(_MSC_VER) && !defined(__BORLANDC__) if (!getcwd(cwd, MAXPGPATH)) +#else + if (!GetCurrentDirectory(MAXPGPATH, cwd)) +#endif cwd[0] = '\0'; /* @@ -387,8 +395,8 @@ pipe_read_line(char *cmd, char *line, int maxsize) bytesread > 0) { /* So we read some data */ - retval = line; int len = strlen(line); + retval = line; /* * If EOL is \r\n, convert to just \n. Because stdout is a