mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Don't assume that struct option is available just because we can find a
getopt_long(). This is more or less the same problem as we saw earlier with getaddrinfo() and struct addrinfo, and for the same reason: random user-added libraries might contain the subroutine, but there's no guarantee we will find the matching header files.
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user