Christian Grothoff <[email protected]> writes:

> Sure, overall gnunet-ext could certainly be improved by illustrating
> more things. Patches welcome ;-)

I asked just in case there were some particular plans.
Is the attached patch acceptable?

Thanks,
A.V.

>From 850abc96de688c998cb30b67314f7469ddc57e58 Mon Sep 17 00:00:00 2001
From: Alessio Vanni <[email protected]>
Date: Sun, 8 Sep 2019 16:29:11 +0200
Subject: [PATCH] Add initialization to service

---
 src/ext/gnunet-service-ext.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/ext/gnunet-service-ext.c b/src/ext/gnunet-service-ext.c
index 4ebcdf2..83cbd52 100644
--- a/src/ext/gnunet-service-ext.c
+++ b/src/ext/gnunet-service-ext.c
@@ -68,6 +68,38 @@ struct ClientContext
  */
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
+/**
+ * This structure holds informations about the project.
+ */
+static const struct GNUNET_OS_ProjectData gnunetext_pd =
+{
+  .libname = "libgnunetext",
+  .project_dirname = "gnunet-ext",
+  .binary_name = "gnunet-service-ext",
+  .env_varname = "GNUNET_EXT_PREFIX",
+  .base_config_varname = "GNUNET_EXT_BASE_CONFIG",
+  .bug_email = "[email protected]",
+  .homepage = "http://www.gnu.org/s/gnunet/";,
+  .config_file = "gnunet-ext.conf",
+  .user_config_file = "~/.config/gnunet-ext.conf",
+  .version = "1.0",
+  .is_gnu = 1,
+  .gettext_domain = PACKAGE,
+  .gettext_path = NULL,
+};
+
+/**
+ * Initialize the project with the data set in the
+ * GNUNET_OS_ProjectData structure.  This is defined with
+ * __attribute__ ((constructor)) because it has to be called before
+ * the main function (implicitly defined by GNUNET_SERVICE_MAIN.)
+ * Other "pre-main" initialization can be performed here too.
+ */
+static void __attribute__ ((constructor))
+project_data_initialize (void)
+{
+  GNUNET_OS_init (&gnunetext_pd);
+}
 
 /**
  * Handle EXT-message.
-- 
2.21.0

_______________________________________________
GNUnet-developers mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnunet-developers

Reply via email to