proj/portage-utils:master commit in: /

"Fabian Groffen" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1782055759.a3ba381a01ff4db8e06a195cabb421767695df03.grobian@gentoo>
commit:     a3ba381a01ff4db8e06a195cabb421767695df03
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 21 15:29:19 2026 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jun 21 15:29:19 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a3ba381a

main/applets: move all global/vars code from main into applets

Only applets should be able to directly access the variables from global
scope that refer to portage's environment.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 applets.h | 26 +++++++++++++++++++++++++-
 main.h    | 26 +-------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/applets.h b/applets.h
index 4793841a..a389db0b 100644
--- a/applets.h
+++ b/applets.h
@@ -28,8 +28,13 @@ extern int	getopt_long(int, char * const *, const char *,
 # include <getopt.h>
 #endif
 
+#define GETOPT_LONG(A, a, ex) \
+	getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL)
+
+#define a_argument required_argument
+#define opt_argument optional_argument
+
 #include <stdbool.h>
-#include <dirent.h>
 
 #include "array.h"
 #include "set.h"
@@ -165,6 +170,23 @@ static const struct applet_t {
 			  } break; \
 	default:  applet ## _usage(EXIT_FAILURE); break;
 
+typedef enum { _Q_BOOL, _Q_STR, _Q_ISTR, _Q_ISET } var_types;
+typedef struct {
+	const char     *name;
+	const size_t    name_len;
+	const var_types type;
+	union {
+		char      **s;
+		bool       *b;
+		set       **t;
+	}               value;
+	size_t          value_len;
+	const char     *default_value;
+	char           *src;
+	bool            fromenv;
+} env_vars;
+extern env_vars vars_to_read[];
+
 extern char *portarch;
 extern char *portroot;
 extern char *configroot;
@@ -181,6 +203,8 @@ extern char *pkgdir;
 extern char *port_tmpdir;
 extern set  *features;
 extern set  *ev_use;
+extern set  *accept_keywords;
+extern hash_t *package_masks;
 extern char *install_mask;
 extern char *binpkg_format;
 extern array *overlays;

diff --git a/main.h b/main.h
index 6e9a7ffd..4c015116 100644
--- a/main.h
+++ b/main.h
@@ -22,8 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "colors.h"
-#include "set.h"
+#include "colors.h"  /* because err/warn macros use it */
 
 extern const char *argv0;
 
@@ -115,12 +114,6 @@ extern const char *argv0;
 # define USE_CLEANUP 0
 #endif
 
-#define GETOPT_LONG(A, a, ex) \
-	getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL)
-
-#define a_argument required_argument
-#define opt_argument optional_argument
-
 /* we need the space before the last comma or we trigger a bug in gcc-2 :( */
 extern FILE *warnout;
 #if defined OPTIMIZE_FOR_SIZE && (OPTIMIZE_FOR_SIZE > 1)
@@ -148,22 +141,5 @@ extern FILE *warnout;
 #define errp(fmt, args...) _err(warnp, fmt , ## args)
 #define errfp(fmt, args...) _err(warnfp, fmt, ## args)
 
-typedef enum { _Q_BOOL, _Q_STR, _Q_ISTR, _Q_ISET } var_types;
-typedef struct {
-	const char     *name;
-	const size_t    name_len;
-	const var_types type;
-	union {
-		char      **s;
-		bool       *b;
-		set       **t;
-	}               value;
-	size_t          value_len;
-	const char     *default_value;
-	char           *src;
-	bool            fromenv;
-} env_vars;
-extern env_vars vars_to_read[];
-extern hash_t *package_masks;
 
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.