Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Fri, 23 Mar 2018 20:17:46
Message-Id: 1521836218.ca282deea01374d6f01746432ce3f450bcf6ac9f.grobian@gentoo
1 commit: ca282deea01374d6f01746432ce3f450bcf6ac9f
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 23 20:16:58 2018 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 23 20:16:58 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ca282dee
7
8 getopt: add workaround for Solaris to silence compiler
9
10 porting.h | 19 ++++++++++++++++++-
11 1 file changed, 18 insertions(+), 1 deletion(-)
12
13 diff --git a/porting.h b/porting.h
14 index 206c6e3..b0225df 100644
15 --- a/porting.h
16 +++ b/porting.h
17 @@ -32,7 +32,6 @@
18 #include <errno.h>
19 #include <fcntl.h>
20 #include <fnmatch.h>
21 -#include <getopt.h>
22 #include <glob.h>
23 #include <inttypes.h>
24 #include <libgen.h>
25 @@ -52,6 +51,24 @@
26
27 #include <iniparser.h>
28
29 +#if defined(__sun) && defined(__SVR4)
30 +/* workaround non-const defined name in option struct, such that we
31 + * don't get a zillion of warnings */
32 +#define no_argument 0
33 +#define required_argument 1
34 +#define optional_argument 2
35 +struct option {
36 + const char *name;
37 + int has_arg;
38 + int *flag;
39 + int val;
40 +};
41 +extern int getopt_long(int, char * const *, const char *,
42 + const struct option *, int *);
43 +#else
44 +#include <getopt.h>
45 +#endif
46 +
47 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr)))
48
49 #ifndef BUFSIZE