diff options
| author | Tom Lane | 2014-02-15 19:31:30 +0000 |
|---|---|---|
| committer | Tom Lane | 2014-02-15 19:31:30 +0000 |
| commit | 60ff2fdd9970ba29f5267317a5e7354d2658c1e5 (patch) | |
| tree | 1bf03f09220a25a87f2a3bbfda5391a722d83541 /src/backend | |
| parent | 32be1c8e900b89a89ec5e3a064c6b6010869d062 (diff) | |
Centralize getopt-related declarations in a new header file pg_getopt.h.
We used to have externs for getopt() and its API variables scattered
all over the place. Now that we find we're going to need to tweak the
variable declarations for Cygwin, it seems like a good idea to have
just one place to tweak.
In this commit, the variables are declared "#ifndef HAVE_GETOPT_H".
That may or may not work everywhere, but we'll soon find out.
Andres Freund
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/bootstrap/bootstrap.c | 7 | ||||
| -rw-r--r-- | src/backend/postmaster/postmaster.c | 13 | ||||
| -rw-r--r-- | src/backend/tcop/postgres.c | 12 |
3 files changed, 3 insertions, 29 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index ef6311b075b..c36e71d8066 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -17,9 +17,6 @@ #include <time.h> #include <unistd.h> #include <signal.h> -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif #include "access/htup_details.h" #include "bootstrap/bootstrap.h" @@ -29,6 +26,7 @@ #include "libpq/pqsignal.h" #include "miscadmin.h" #include "nodes/makefuncs.h" +#include "pg_getopt.h" #include "postmaster/bgwriter.h" #include "postmaster/startup.h" #include "postmaster/walwriter.h" @@ -46,9 +44,6 @@ #include "utils/relmapper.h" #include "utils/tqual.h" -extern int optind; -extern char *optarg; - uint32 bootstrap_data_checksum_version = 0; /* No checksum */ diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 7adc410b43a..6bb2a474857 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -83,10 +83,6 @@ #include <sys/select.h> #endif -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif - #ifdef USE_BONJOUR #include <dns_sd.h> #endif @@ -101,6 +97,7 @@ #include "libpq/libpq.h" #include "libpq/pqsignal.h" #include "miscadmin.h" +#include "pg_getopt.h" #include "pgstat.h" #include "postmaster/autovacuum.h" #include "postmaster/bgworker_internals.h" @@ -352,14 +349,6 @@ static volatile bool HaveCrashedWorker = false; static unsigned int random_seed = 0; static struct timeval random_start_time; -extern char *optarg; -extern int optind, - opterr; - -#ifdef HAVE_INT_OPTRESET -extern int optreset; /* might not be declared by system headers */ -#endif - #ifdef USE_BONJOUR static DNSServiceRef bonjour_sdref = NULL; #endif diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b7612b9b5f7..a230d7eda69 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -32,9 +32,6 @@ #include <sys/time.h> #include <sys/resource.h> #endif -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif #ifndef HAVE_GETRUSAGE #include "rusagestub.h" @@ -55,6 +52,7 @@ #include "pg_trace.h" #include "parser/analyze.h" #include "parser/parser.h" +#include "pg_getopt.h" #include "postmaster/autovacuum.h" #include "postmaster/postmaster.h" #include "replication/walsender.h" @@ -77,14 +75,6 @@ #include "mb/pg_wchar.h" -extern char *optarg; -extern int optind; - -#ifdef HAVE_INT_OPTRESET -extern int optreset; /* might not be declared by system headers */ -#endif - - /* ---------------- * global variables * ---------------- |
