diff options
author | Fabian Groffen <grobian@gentoo.org> | 2018-03-23 21:16:58 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2018-03-23 21:16:58 +0100 |
commit | ca282deea01374d6f01746432ce3f450bcf6ac9f (patch) | |
tree | 4c5224b5d5159f3fdb118625de00ff060ba925b2 | |
parent | fix some more signedness problems (diff) | |
download | portage-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.h | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -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 |