From e44c93180172b892993fcb77370c5546606b34ab Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 19 Jul 1999 02:27:16 +0000 Subject: [PATCH] Re-add getopt.h check, remove NT-specific tests for it. --- src/backend/bootstrap/bootstrap.c | 9 +++--- src/backend/postmaster/postmaster.c | 44 +++++++++++++---------------- src/backend/tcop/postgres.c | 6 ++-- src/backend/utils/mb/common.c | 10 ++----- src/bin/pg_dump/pg_dump.c | 4 +-- src/bin/pg_id/pg_id.c | 10 ++++--- src/bin/psql/psql.c | 7 +++-- src/configure.in | 1 + src/include/config.h.in | 3 ++ src/include/port/win32.h | 1 - src/interfaces/ecpg/preproc/ecpg.c | 2 +- src/interfaces/libpq/fe-auth.c | 11 ++++---- src/interfaces/libpq/fe-connect.c | 15 +++++----- src/interfaces/libpq/fe-exec.c | 14 ++++----- src/interfaces/libpq/fe-lobj.c | 16 +++++------ src/interfaces/libpq/fe-misc.c | 21 ++++++-------- src/interfaces/libpq/fe-print.c | 22 +++++++-------- src/interfaces/libpq/win32.h | 3 -- 18 files changed, 92 insertions(+), 107 deletions(-) diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index fc357d87a7..8db37d0a08 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -7,7 +7,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.65 1999/07/17 20:16:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.66 1999/07/19 02:27:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -15,14 +15,13 @@ #include #include #include -#ifdef __CYGWIN32__ -#include -#endif #define BOOTSTRAP_INCLUDE /* mask out stuff in tcop/tcopprot.h */ #include "postgres.h" - +#ifdef HAVE_GETOPT_H +#include +#endif #include "access/genam.h" #include "access/heapam.h" diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 15a21773e9..c21611cc1a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.114 1999/07/17 20:17:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.115 1999/07/19 02:27:06 momjian Exp $ * * NOTES * @@ -32,46 +32,40 @@ * *------------------------------------------------------------------------- */ -#include "postgres.h" -#include - /* moved here to prevent double define */ -#ifdef HAVE_NETDB_H -#include -#endif - - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif - -#if !defined(NO_UNISTD_H) #include -#endif /* !NO_UNISTD_H */ - #include #include - - -#ifdef HAVE_LIMITS_H -#include -#else -#include -#endif #include #include #include #include #include #include - #include #include +#include + +#include "postgres.h" + /* moved here to prevent double define */ +#ifdef HAVE_NETDB_H +#include +#endif + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif + +#ifdef HAVE_LIMITS_H +#include +#else +#include +#endif #ifdef HAVE_SYS_SELECT_H #include #endif -#ifdef __CYGWIN32__ +#ifdef HAVE_GETOPT_H #include "getopt.h" #endif diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 6dfd32f6b1..ea357ba613 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.125 1999/07/17 20:17:51 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.126 1999/07/19 02:27:06 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -39,7 +39,7 @@ #include #include #include -#ifdef __CYGWIN32__ +#ifdef HAVE_GETOPT_H #include #endif @@ -1494,7 +1494,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.125 $ $Date: 1999/07/17 20:17:51 $\n"); + puts("$Revision: 1.126 $ $Date: 1999/07/19 02:27:06 $\n"); } /* ---------------- diff --git a/src/backend/utils/mb/common.c b/src/backend/utils/mb/common.c index cab36c7b4c..0464f5cb87 100644 --- a/src/backend/utils/mb/common.c +++ b/src/backend/utils/mb/common.c @@ -2,19 +2,15 @@ * This file contains some public functions * usable for both the backend and the frontend. * Tatsuo Ishii - * $Id: common.c,v 1.5 1999/05/25 16:12:41 momjian Exp $ */ + * $Id: common.c,v 1.6 1999/07/19 02:27:07 momjian Exp $ */ #include +#include +#include #ifdef WIN32 #include "win32.h" -#else -#if !defined(NO_UNISTD_H) -#include #endif -#endif - -#include #include "mb/pg_wchar.h" diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index c1597d7f26..cd48c73a80 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.117 1999/07/17 20:18:18 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.118 1999/07/19 02:27:08 momjian Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -75,7 +75,7 @@ #include #endif -#ifdef __CYGWIN32__ +#ifdef HAVE_GETOPT_H #include #endif diff --git a/src/bin/pg_id/pg_id.c b/src/bin/pg_id/pg_id.c index d14d653c60..70da5f5d5d 100644 --- a/src/bin/pg_id/pg_id.c +++ b/src/bin/pg_id/pg_id.c @@ -9,16 +9,18 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.8 1999/02/13 23:20:29 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_id/Attic/pg_id.c,v 1.9 1999/07/19 02:27:09 momjian Exp $ * *------------------------------------------------------------------------- */ -#include -#include #include #include #include -#ifdef __CYGWIN32__ +#include +#include + +#include "postgres.h" +#ifdef HAVE_GETOPT_H #include #endif diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c index 5b042bdab6..c7aaf83f98 100644 --- a/src/bin/psql/psql.c +++ b/src/bin/psql/psql.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.183 1999/07/17 20:18:23 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.184 1999/07/19 02:27:10 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -32,13 +32,16 @@ #include "pqsignal.h" #include "stringutils.h" #include "psqlHelp.h" + #ifndef HAVE_STRDUP #include "strdup.h" #endif + #ifdef HAVE_TERMIOS_H #include #endif -#ifdef __CYGWIN32__ + +#ifdef HAVE_GETOPT_H #include #endif diff --git a/src/configure.in b/src/configure.in index 05ad2c2ea6..311c36bb22 100644 --- a/src/configure.in +++ b/src/configure.in @@ -582,6 +582,7 @@ AC_CHECK_HEADERS(dld.h) AC_CHECK_HEADERS(endian.h) AC_CHECK_HEADERS(float.h) AC_CHECK_HEADERS(fp_class.h) +AC_CHECK_HEADERS(getopt.h) AC_CHECK_HEADERS(history.h) AC_CHECK_HEADERS(ieeefp.h) AC_CHECK_HEADERS(limits.h) diff --git a/src/include/config.h.in b/src/include/config.h.in index fb1d566a09..e7ae8b302b 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -235,6 +235,9 @@ /* Set to 1 if you have */ #undef HAVE_FP_CLASS_H +/* Set to 1 if you have */ +#undef HAVE_GETOPT_H + /* Set to 1 if you have */ #undef HAVE_HISTORY_H diff --git a/src/include/port/win32.h b/src/include/port/win32.h index d343f60692..7e21816b2b 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,6 +1,5 @@ #define JMP_BUF #define NEED_SIG_JMP -#define NO_UNISTD_H #define USES_WINSOCK #define NOFILE 100 #ifndef MAXPATHLEN diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 07fc820df8..192e47eaa4 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -5,7 +5,7 @@ #include #include "postgres.h" -#ifdef __CYGWIN32__ +#ifdef HAVE_GETOPT_H #include "getopt.h" #endif diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 62f5ad4f8e..f9732893b8 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.30 1999/07/17 20:18:43 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.31 1999/07/19 02:27:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,10 +25,12 @@ * */ +#include + +#include "postgres.h" #include "libpq-fe.h" #include "libpq-int.h" #include "fe-auth.h" -#include "postgres.h" #ifdef WIN32 #include "win32.h" @@ -37,11 +39,8 @@ #ifndef MAXHOSTNAMELEN #include /* for MAXHOSTNAMELEN on some */ #endif -#if !defined(NO_UNISTD_H) -#include -#endif #include -#endif /* WIN32 */ +#endif #ifdef HAVE_CRYPT_H #include diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 8f7540d57e..be88779e0c 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -7,28 +7,27 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.99 1999/07/17 20:18:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.100 1999/07/19 02:27:15 momjian Exp $ * *------------------------------------------------------------------------- */ +#include +#include +#include +#include + +#include "postgres.h" #include "libpq-fe.h" #include "libpq-int.h" #include "fe-auth.h" -#include "postgres.h" #ifdef WIN32 #include "win32.h" #else -#if !defined(NO_UNISTD_H) -#include -#endif #include #include #endif -#include -#include -#include /* for isspace() */ #ifndef HAVE_STRDUP #include "strdup.h" diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 1ca2440c63..2b6b1b9e26 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -7,23 +7,21 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.82 1999/07/17 20:18:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.83 1999/07/19 02:27:15 momjian Exp $ * *------------------------------------------------------------------------- */ +#include +#include +#include + +#include "postgres.h" #include "libpq-fe.h" #include "libpq-int.h" -#include "postgres.h" #ifdef WIN32 #include "win32.h" -#else -#if !defined(NO_UNISTD_H) -#include #endif -#endif -#include -#include /* keep this in same order as ExecStatusType in libpq-fe.h */ diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index b5757a0b9f..6dbc200e24 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -7,25 +7,23 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.21 1999/07/17 20:18:46 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.22 1999/07/19 02:27:15 momjian Exp $ * *------------------------------------------------------------------------- */ +#include +#include +#include +#include + +#include "postgres.h" #include "libpq-fe.h" #include "libpq-int.h" -#include "postgres.h" #ifdef WIN32 #include "win32.h" -#include -#else -#if !defined(NO_UNISTD_H) -#include #endif -#endif -#include -#include #include "libpq/libpq-fs.h" /* must come after sys/stat.h */ diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index d31ee45647..519bf1fbcf 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -24,28 +24,25 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.26 1999/07/17 20:18:46 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.27 1999/07/19 02:27:15 momjian Exp $ * *------------------------------------------------------------------------- */ -#include "libpq-fe.h" -#include "libpq-int.h" - -#include "postgres.h" -#include "pqsignal.h" - +#include +#include #include #include #include + +#include "postgres.h" +#include "libpq-fe.h" +#include "libpq-int.h" +#include "pqsignal.h" + #ifdef WIN32 #include "win32.h" -#else -#include -#if !defined(NO_UNISTD_H) -#include #endif -#endif /* WIN32 */ #ifdef HAVE_SYS_SELECT_H #include diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 1b8c73b07f..0d97a3a84d 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -9,29 +9,29 @@ * didn't really belong there. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.24 1999/07/17 20:18:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.25 1999/07/19 02:27:16 momjian Exp $ * *------------------------------------------------------------------------- */ +#include +#include + +#include "postgres.h" #include "libpq-fe.h" #include "libpq-int.h" -#include "postgres.h" #include "pqsignal.h" #ifdef WIN32 #include "win32.h" #else -#if !defined(NO_UNISTD_H) -#include -#endif #include -#ifndef HAVE_TERMIOS_H -#include -#else -#include #endif -#endif /* WIN32 */ -#include + +#ifdef HAVE_TERMIOS_H +#include +#else +#include +#endif #ifdef MULTIBYTE #include "mb/pg_wchar.h" diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h index d3e9b34815..303fbd91ca 100644 --- a/src/interfaces/libpq/win32.h +++ b/src/interfaces/libpq/win32.h @@ -5,9 +5,6 @@ */ #define strcasecmp(a,b) stricmp(a,b) - - -#define NO_UNISTD_H #define SOCKET_SIZE_TYPE int /*