aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c8
-rw-r--r--src/bin/pg_dump/pg_dumpall.c8
-rw-r--r--src/bin/pg_dump/pg_restore.c9
-rw-r--r--src/bin/psql/startup.c9
-rw-r--r--src/bin/scripts/common.h9
-rw-r--r--src/include/getopt_long.h23
-rw-r--r--src/include/pg_config.h.in3
7 files changed, 35 insertions, 34 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index fb21d04cd69..a6ecda10d60 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.342 2003/08/04 02:40:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.343 2003/08/07 21:11:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,9 +29,6 @@
#ifdef ENABLE_NLS
#include <locale.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
@@ -40,8 +37,9 @@
#include "strdup.h"
#endif
-#ifndef HAVE_GETOPT_LONG
#include "getopt_long.h"
+
+#ifndef HAVE_OPTRESET
int optreset;
#endif
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 9be39ecb759..8c83254c817 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.26 2003/08/04 02:40:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.27 2003/08/07 21:11:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,16 +17,14 @@
#ifdef ENABLE_NLS
#include <locale.h>
#endif
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
#ifndef HAVE_STRDUP
#include "strdup.h"
#endif
#include <errno.h>
-#ifndef HAVE_GETOPT_LONG
#include "getopt_long.h"
+
+#ifndef HAVE_OPTRESET
int optreset;
#endif
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 0598c9c4510..f9217f2c099 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -34,7 +34,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.49 2003/08/04 00:43:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.50 2003/08/07 21:11:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,12 +55,9 @@
#include <unistd.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#ifndef HAVE_GETOPT_LONG
#include "getopt_long.h"
+
+#ifndef HAVE_OPTRESET
int optreset;
#endif
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 7dbe42d5a81..afee6d62a53 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.78 2003/08/04 23:59:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.79 2003/08/07 21:11:58 tgl Exp $
*/
#include "postgres_fe.h"
@@ -17,12 +17,9 @@
#include <win32.h>
#endif /* WIN32 */
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#ifndef HAVE_GETOPT_LONG
#include "getopt_long.h"
+
+#ifndef HAVE_OPTRESET
int optreset;
#endif
diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h
index 8a6431e7245..f8cba29eb33 100644
--- a/src/bin/scripts/common.h
+++ b/src/bin/scripts/common.h
@@ -1,15 +1,8 @@
#include "postgres_fe.h"
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-#ifndef HAVE_GETOPT_LONG
-#include "getopt_long.h"
-#endif
-
#include "libpq-fe.h"
#include "pqexpbuffer.h"
+#include "getopt_long.h"
#ifndef HAVE_OPTRESET
int optreset;
diff --git a/src/include/getopt_long.h b/src/include/getopt_long.h
index 3651cdeee92..9b155b25dad 100644
--- a/src/include/getopt_long.h
+++ b/src/include/getopt_long.h
@@ -2,11 +2,16 @@
* Portions Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
- * Portions Copyright (c) 2003
- * PostgreSQL Global Development Group
+ * Portions Copyright (c) 2003, PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/include/getopt_long.h,v 1.2 2003/08/04 00:43:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/include/getopt_long.h,v 1.3 2003/08/07 21:11:58 tgl Exp $
*/
+#ifndef GETOPT_LONG_H
+#define GETOPT_LONG_H
+
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
/* These are picked up from the system's getopt() facility. */
extern int opterr;
@@ -17,6 +22,8 @@ extern char *optarg;
/* Some systems have this, otherwise you need to define it somewhere. */
extern int optreset;
+#ifndef HAVE_STRUCT_OPTION
+
struct option
{
const char *name;
@@ -28,6 +35,14 @@ struct option
#define no_argument 0
#define required_argument 1
-int getopt_long(int argc, char *const argv[],
+#endif
+
+#ifndef HAVE_GETOPT_LONG
+
+extern int getopt_long(int argc, char *const argv[],
const char *optstring,
const struct option * longopts, int *longindex);
+
+#endif
+
+#endif /* GETOPT_LONG_H */
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index e89cdb8730a..379f0f4f991 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -417,6 +417,9 @@
/* Define to 1 if the system has the type `struct fcred'. */
#undef HAVE_STRUCT_FCRED
+/* Define to 1 if the system has the type `struct option'. */
+#undef HAVE_STRUCT_OPTION
+
/* Define to 1 if `sa_len' is member of `struct sockaddr'. */
#undef HAVE_STRUCT_SOCKADDR_SA_LEN