summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/oid2name/oid2name.c8
-rw-r--r--contrib/pg_archivecleanup/pg_archivecleanup.c13
-rw-r--r--contrib/pg_standby/pg_standby.c13
-rw-r--r--contrib/pg_upgrade/option.c2
-rw-r--r--contrib/pgbench/pgbench.c8
-rw-r--r--contrib/vacuumlo/vacuumlo.c5
6 files changed, 5 insertions, 44 deletions
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 67d79346b2..d8565941f9 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -9,14 +9,8 @@
*/
#include "postgres_fe.h"
-#include <unistd.h>
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-extern char *optarg;
-
#include "libpq-fe.h"
+#include "pg_getopt.h"
/* an extensible array to keep track of elements to show */
typedef struct
diff --git a/contrib/pg_archivecleanup/pg_archivecleanup.c b/contrib/pg_archivecleanup/pg_archivecleanup.c
index f12331a62e..7b5484bb6a 100644
--- a/contrib/pg_archivecleanup/pg_archivecleanup.c
+++ b/contrib/pg_archivecleanup/pg_archivecleanup.c
@@ -17,20 +17,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
-
-#ifndef WIN32
#include <sys/time.h>
-#include <unistd.h>
-
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-#else /* WIN32 */
-extern int getopt(int argc, char *const argv[], const char *optstring);
-#endif /* ! WIN32 */
-extern char *optarg;
-extern int optind;
+#include "pg_getopt.h"
const char *progname;
diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c
index 059c820527..144edd8a07 100644
--- a/contrib/pg_standby/pg_standby.c
+++ b/contrib/pg_standby/pg_standby.c
@@ -28,20 +28,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
-
-#ifdef WIN32
-int getopt(int argc, char *const argv[], const char *optstring);
-#else
#include <sys/time.h>
-#include <unistd.h>
-
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-#endif /* ! WIN32 */
-extern char *optarg;
-extern int optind;
+#include "pg_getopt.h"
const char *progname;
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c
index 4c08e94ffd..cd9f66dd11 100644
--- a/contrib/pg_upgrade/option.c
+++ b/contrib/pg_upgrade/option.c
@@ -10,10 +10,10 @@
#include "postgres_fe.h"
#include "miscadmin.h"
+#include "getopt_long.h"
#include "pg_upgrade.h"
-#include <getopt_long.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 16b7ab5ddc..a836acfae9 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -40,12 +40,7 @@
#include <ctype.h>
#include <math.h>
#include <signal.h>
-
-#ifndef WIN32
#include <sys/time.h>
-#include <unistd.h>
-#endif /* ! WIN32 */
-
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
@@ -89,9 +84,6 @@ static int pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start
static int pthread_join(pthread_t th, void **thread_return);
#endif
-extern char *optarg;
-extern int optind;
-
/********************************************************************
* some configurable parameters */
diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c
index 3981dd6260..c2e5bad438 100644
--- a/contrib/vacuumlo/vacuumlo.c
+++ b/contrib/vacuumlo/vacuumlo.c
@@ -22,15 +22,12 @@
#endif
#include "libpq-fe.h"
+#include "pg_getopt.h"
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
#define BUFSIZE 1024
-extern char *optarg;
-extern int optind,
- opterr;
-
enum trivalue
{
TRI_DEFAULT,