1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

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
This commit is contained in:
Tom Lane
2014-02-15 14:31:30 -05:00
parent 32be1c8e90
commit 60ff2fdd99
19 changed files with 57 additions and 130 deletions

View File

@@ -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.