Add new macro as shorthand for MS VC and Borland C++:

+ #if   defined(_MSC_VER) || defined(__BORLANDC__)
+ #define       WIN32_CLIENT_ONLY
+ #endif
This commit is contained in:
Bruce Momjian 2004-09-27 23:24:45 +00:00
parent e017051006
commit e1c8b37afb
11 changed files with 31 additions and 28 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.28 2004/08/29 05:06:43 momjian Exp $
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.29 2004/09/27 23:24:30 momjian Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@ -20,8 +20,7 @@
/* This is intended to be used in both frontend and backend, so use c.h */
#include "c.h"
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
@ -34,8 +33,7 @@
#endif
#include <arpa/inet.h>
#include <sys/file.h>
#endif /* !defined(_MSC_VER) &&
* !defined(__BORLANDC__) */
#endif
#include "libpq/ip.h"

View File

@ -2,7 +2,7 @@
* Encoding names and routines for work with it. All
* in this file is shared bedween FE and BE.
*
* $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.19 2004/09/17 21:59:57 petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.20 2004/09/27 23:24:33 momjian Exp $
*/
#ifdef FRONTEND
#include "postgres_fe.h"
@ -13,7 +13,7 @@
#include "utils/builtins.h"
#endif
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
#endif

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.51 2004/08/29 05:06:54 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.52 2004/09/27 23:24:35 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@ -12,7 +12,7 @@
#include <math.h>
#include <signal.h>
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <unistd.h>
#endif

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/c.h,v 1.176 2004/09/27 22:11:22 momjian Exp $
* $PostgreSQL: pgsql/src/include/c.h,v 1.177 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -54,6 +54,10 @@
#include "pg_config_manual.h" /* must be after pg_config.h */
#if !defined(WIN32) && !defined(__CYGWIN__)
#include "pg_config_os.h" /* must be before any system header files */
#else
#if defined(_MSC_VER) || defined(__BORLANDC__)
#define WIN32_CLIENT_ONLY
#endif
#endif
#include "postgres_ext.h"
@ -76,7 +80,7 @@
#endif
#if defined(WIN32) || defined(__CYGWIN__)
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
/* We have to redefine some system functions after they are included above */
#include "pg_config_os.h"
#else

View File

@ -15,14 +15,14 @@
*
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.12 2003/11/29 22:40:53 pgsql Exp $
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.13 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef GETADDRINFO_H
#define GETADDRINFO_H
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <sys/socket.h>
#include <netdb.h>
#endif

View File

@ -6,16 +6,17 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.62 2004/09/27 20:37:20 momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.63 2004/09/27 23:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
/* for thread.c */
#include <pwd.h>
#include <netdb.h>
#endif
#include <ctype.h>
/* non-blocking */
@ -169,7 +170,7 @@ extern int pgunlink(const char *path);
extern int pgsymlink(const char *oldpath, const char *newpath);
/* Include this first so later includes don't see these defines */
#ifdef _MSC_VER
#ifdef WIN32_CLIENT_ONLY
#include <io.h>
#endif
@ -183,7 +184,7 @@ extern bool rmtree(char *path, bool rmtopdir);
#ifdef WIN32
/* open() replacement to allow delete of held files */
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
extern int win32_open(const char *, int,...);
#define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
@ -242,7 +243,7 @@ extern double rint(double x);
#endif
#ifndef HAVE_INET_ATON
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.33 2004/09/14 03:50:17 tgl Exp $ */
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.34 2004/09/27 23:24:40 momjian Exp $ */
/* undefine and redefine after #include */
#undef mkdir
@ -31,7 +31,7 @@
#define DLLIMPORT __declspec (dllimport)
#endif
#elif defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) /* not CYGWIN or MingW */
#elif defined(WIN32_CLIENT_ONLY)
#if defined(_DLL)
#define DLLIMPORT __declspec (dllexport)

View File

@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.110 2004/08/29 05:07:00 momjian Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.111 2004/09/27 23:24:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -34,7 +34,7 @@
#include <signal.h>
#include <time.h>
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <arpa/inet.h>
#endif

View File

@ -12,7 +12,7 @@
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.12 2003/11/29 19:52:13 pgsql Exp $
* $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.13 2004/09/27 23:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -20,7 +20,7 @@
/* This is intended to be used in both frontend and backend, so use c.h */
#include "c.h"
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.6 2003/11/29 22:41:31 pgsql Exp $
/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.7 2004/09/27 23:24:45 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
@ -44,7 +44,7 @@
#include "c.h"
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
#ifndef WIN32_CLIENT_ONLY
#include <netinet/in.h>
#include <ctype.h>
#endif

View File

@ -7,7 +7,7 @@
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/port/thread.c,v 1.25 2004/08/29 05:07:02 momjian Exp $
* $PostgreSQL: pgsql/src/port/thread.c,v 1.26 2004/09/27 23:24:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -16,7 +16,7 @@
#include <sys/types.h>
#include <errno.h>
#if defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__))
#ifdef WIN32_CLIENT_ONLY
#undef ERROR
#else
#include <pwd.h>