Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 866627f

Browse files
committed
Make adjustment for MS VC and BCC compile of psql, from Dave Page.
1 parent f6b896b commit 866627f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/bin/psql/win32.mak

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ CLEAN :
6060

6161
CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\
6262
"_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
63-
/I ..\..\include /I ..\..\interfaces\libpq /D "HAVE_STRDUP" /D "FRONTEND"
63+
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
64+
/D "HAVE_STRDUP" /D "FRONTEND"
6465

6566
CPP_OBJS=.\Release/
6667
CPP_SBRS=.
@@ -71,6 +72,8 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
7172
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
7273
/pdb:"$(OUTDIR)\psql.pdb" /machine:I386 /out:"$(OUTDIR)\psql.exe"
7374
LINK32_OBJS= \
75+
"$(INTDIR)\pgstrcasecmp.obj" \
76+
"$(INTDIR)\exec.obj" \
7477
"$(INTDIR)\command.obj" \
7578
"$(INTDIR)\common.obj" \
7679
"$(INTDIR)\help.obj" \
@@ -118,6 +121,16 @@ LINK32_OBJS= \
118121
$(CPP_PROJ) ..\..\port\path.c
119122
<<
120123

124+
"$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c
125+
$(CPP) @<<
126+
$(CPP_PROJ) ..\..\port\pgstrcasecmp.c
127+
<<
128+
129+
"$(INTDIR)\exec.obj" : ..\..\port\exec.c
130+
$(CPP) @<<
131+
$(CPP_PROJ) ..\..\port\exec.c
132+
<<
133+
121134
.c{$(CPP_OBJS)}.obj::
122135
$(CPP) @<<
123136
$(CPP_PROJ) $<

src/port/exec.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.25 2004/08/29 05:07:02 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.26 2004/09/27 22:06:41 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -22,7 +22,11 @@
2222
#include <pwd.h>
2323
#include <sys/stat.h>
2424
#include <sys/wait.h>
25+
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
2526
#include <unistd.h>
27+
#else
28+
#include "port/win32.h"
29+
#endif
2630

2731
#include "miscadmin.h"
2832

@@ -71,7 +75,7 @@ validate_exec(const char *path)
7175
int in_grp = 0;
7276

7377
#else
74-
char path_exe[MAXPGPATH + 2 + strlen(".exe")];
78+
char path_exe[MAXPGPATH + sizeof(".exe") - 1];
7579
#endif
7680
int is_r = 0;
7781
int is_x = 0;
@@ -176,7 +180,11 @@ find_my_exec(const char *argv0, char *retpath)
176180
test_path[MAXPGPATH];
177181
char *path;
178182

183+
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
179184
if (!getcwd(cwd, MAXPGPATH))
185+
#else
186+
if (!GetCurrentDirectory(MAXPGPATH, cwd))
187+
#endif
180188
cwd[0] = '\0';
181189

182190
/*
@@ -387,8 +395,8 @@ pipe_read_line(char *cmd, char *line, int maxsize)
387395
bytesread > 0)
388396
{
389397
/* So we read some data */
390-
retval = line;
391398
int len = strlen(line);
399+
retval = line;
392400

393401
/*
394402
* If EOL is \r\n, convert to just \n. Because stdout is a

0 commit comments

Comments
 (0)