summaryrefslogtreecommitdiff
path: root/lib/win32/getopt_long.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2013-09-30 08:28:58 +0000
committerChris Wilson <chris+github@qwirx.com>2013-09-30 08:28:58 +0000
commitdae6303135c66acdd0e4f3985c6e5c95334aea7f (patch)
tree173acec5f3e34ef870f4e283c7403e10b097cd0e /lib/win32/getopt_long.cpp
parentcaa198fee3d6a9df3d2fbed4923b4b8ad554c706 (diff)
Fix getopt header confusion.
Our copy of getopt.h in lib/win32 was beating the system getopt.h in the search path, and providing different definitions, which clang picked up. Renamed our getopt.h to bsd_getopt.h, and added a box_getopt.h to decide whether to include this one instead of the system getopt.h.
Diffstat (limited to 'lib/win32/getopt_long.cpp')
-rwxr-xr-xlib/win32/getopt_long.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/win32/getopt_long.cpp b/lib/win32/getopt_long.cpp
index 31695aa0..941f23c1 100755
--- a/lib/win32/getopt_long.cpp
+++ b/lib/win32/getopt_long.cpp
@@ -68,16 +68,13 @@
#include "getopt.h"
-#if defined _MSC_VER || defined __MINGW32__
-#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
+#ifdef REPLACE_GETOPT // until end of file
-#ifdef REPLACE_GETOPT
int opterr = 1; /* if error message should be printed */
int optind = 1; /* index into parent argv vector */
int optopt = '?'; /* character checked for validity */
int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
-#endif
#define PRINT_ERROR ((opterr) && (*options != ':'))
@@ -499,7 +496,6 @@ start:
return (optchar);
}
-#ifdef REPLACE_GETOPT
/*
* getopt --
* Parse argc/argv argument vector.
@@ -520,7 +516,6 @@ getopt(int nargc, char * const *nargv, const char *options)
*/
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
}
-#endif /* REPLACE_GETOPT */
/*
* getopt_long --
@@ -548,4 +543,4 @@ getopt_long_only(int nargc, char * const *nargv, const char *options,
FLAG_PERMUTE|FLAG_LONGONLY));
}
-#endif // defined _MSC_VER || defined __MINGW32__
+#endif // REPLACE_GETOPT