aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2018-03-23 21:16:58 +0100
committerFabian Groffen <grobian@gentoo.org>2018-03-23 21:16:58 +0100
commitca282deea01374d6f01746432ce3f450bcf6ac9f (patch)
tree4c5224b5d5159f3fdb118625de00ff060ba925b2
parentfix some more signedness problems (diff)
downloadportage-utils-ca282deea01374d6f01746432ce3f450bcf6ac9f.tar.gz
portage-utils-ca282deea01374d6f01746432ce3f450bcf6ac9f.tar.bz2
portage-utils-ca282deea01374d6f01746432ce3f450bcf6ac9f.zip
getopt: add workaround for Solaris to silence compiler
-rw-r--r--porting.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/porting.h b/porting.h
index 206c6e31..b0225dfa 100644
--- a/porting.h
+++ b/porting.h
@@ -32,7 +32,6 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
-#include <getopt.h>
#include <glob.h>
#include <inttypes.h>
#include <libgen.h>
@@ -52,6 +51,24 @@
#include <iniparser.h>
+#if defined(__sun) && defined(__SVR4)
+/* workaround non-const defined name in option struct, such that we
+ * don't get a zillion of warnings */
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+extern int getopt_long(int, char * const *, const char *,
+ const struct option *, int *);
+#else
+#include <getopt.h>
+#endif
+
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr)))
#ifndef BUFSIZE