summaryrefslogtreecommitdiff
path: root/src/port/getopt.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-02-15 14:31:30 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-02-15 14:31:30 -0500
commit60ff2fdd9970ba29f5267317a5e7354d2658c1e5 (patch)
tree1bf03f09220a25a87f2a3bbfda5391a722d83541 /src/port/getopt.c
parent32be1c8e900b89a89ec5e3a064c6b6010869d062 (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/port/getopt.c')
-rw-r--r--src/port/getopt.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/port/getopt.c b/src/port/getopt.c
index eb50cba1ca4..b81fba14b07 100644
--- a/src/port/getopt.c
+++ b/src/port/getopt.c
@@ -32,6 +32,8 @@
#include "c.h"
+#include "pg_getopt.h"
+
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
@@ -49,20 +51,13 @@ int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
-#else
-extern int opterr;
-extern int optind;
-extern int optopt;
-extern char *optarg;
#endif
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
-int getopt(int nargc, char *const * nargv, const char *ostr);
-
/*
* getopt
* Parse argc/argv argument vector.