mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 10:41:18 +02:00
311da16439
07c8651dd9
currently causes compilation errors on mscv (and
probably some other) compilers because our getopt_long()
implementation doesn't have support for optional_argument.
Thus implement optional_argument in our fallback implemenation. It's
quite possibly also useful in other cases.
Arguably this needs a configure check for optional_argument, but it
has existed pretty much since getopt_long() was introduced and thus
doesn't seem worth the configure runtime.
Normally I'd would not push a patch this fast, but this allows msvc to
build again and has low risk as only optional_argument behaviour has
changed.
Author: Michael Paquier and Andres Freund
Discussion: CAB7nPqS5VeedSCxrK=QouokbawgGKLpyc1Q++RRFCa_sjcSVrg@mail.gmail.com
37 lines
688 B
C
37 lines
688 B
C
/*
|
|
* Portions Copyright (c) 1987, 1993, 1994
|
|
* The Regents of the University of California. All rights reserved.
|
|
*
|
|
* Portions Copyright (c) 2003-2014, PostgreSQL Global Development Group
|
|
*
|
|
* src/include/getopt_long.h
|
|
*/
|
|
#ifndef GETOPT_LONG_H
|
|
#define GETOPT_LONG_H
|
|
|
|
#include "pg_getopt.h"
|
|
|
|
#ifndef HAVE_STRUCT_OPTION
|
|
|
|
struct option
|
|
{
|
|
const char *name;
|
|
int has_arg;
|
|
int *flag;
|
|
int val;
|
|
};
|
|
|
|
#define no_argument 0
|
|
#define required_argument 1
|
|
#define optional_argument 2
|
|
#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 */
|