Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c15a52

Browse files
committed
Allow for platforms that have optreset but not <getopt.h>.
Reportedly, some versions of mingw are like that, and it seems plausible in general that older platforms might be that way. However, we'd determined experimentally that just doing "extern int" conflicts with the way Cygwin declares these variables, so explicitly exclude Cygwin. Michael Paquier, tweaked by me to hopefully not break Cygwin
1 parent 4f7bb4b commit 0c15a52

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/include/pg_getopt.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ extern int optind;
2929
extern int opterr;
3030
extern int optopt;
3131

32-
#ifdef HAVE_INT_OPTRESET
32+
#endif /* HAVE_GETOPT_H */
33+
34+
/*
35+
* Some platforms have optreset but not <getopt.h>. Cygwin, however,
36+
* doesn't like this either.
37+
*/
38+
#if defined(HAVE_INT_OPTRESET) && !defined(__CYGWIN__)
3339
extern int optreset;
3440
#endif
3541

36-
#endif /* HAVE_GETOPT_H */
37-
3842
#ifndef HAVE_GETOPT
3943
extern int getopt(int nargc, char *const * nargv, const char *ostr);
4044
#endif

0 commit comments

Comments
 (0)