gnunet-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Allow omitting some fields in ProjectData


From: Alessio Vanni
Subject: Allow omitting some fields in ProjectData
Date: Sat, 10 Oct 2020 18:11:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Hello,

as the subject line says, the attached patch allows applications to omit
(set to NULL) some fields in the ProjectData structure.  This change is
mostly meant for clients, as services don't really gain anything from
omitting fields.

Consider the following simple example use case:

I'm writing a wget-style tool which takes a peer P from the command line
and optionally a port Q, connects to to P through CADET (eventually
using port Q) and dumps the received data to stdout, closing the
connection afterwards.

Because I'm specifiying new options, I want to use gettext to localize
the new help strings, so I specify this ProjectData structure (with some
macros from autoconf):

static struct GNUNET_OS_ProjectData pd = {
     .project_dirname = PACKAGE,
     .binary_name = "cget",
     .bug_email = PACKAGE_BUGREPORT,
     .homepage = "myhomepage.tld/cget",
     .version = PACKAGE_VERSION,
     .is_gnu = 0,
     .gettext_domain = PACKAGE,
     .gettext_path = LOCALEDIR,
     .agpl_url = "myhomepage.tld/cget/source",
};

I don't provide a library, since it's just a self-contained client tool,
and the only configuration needed is GNUnet's and the values taken from
the command line, so I don't specify any environment variable or a
configuration file.  GNUnet's configuration can be obtained with
`GNUNET_CONFIGURATION_default'.

Despite compiling just fine, when ran the program fails immediately at
startup: not specifying a configuration file (either using NULL or an
empty string) terminates the program either aborting (NULL value) or
stating that the configuration file is missing or malformed (empty
string.)

With the attached patch, clients like this hypotetical "cget" tool can
be used even without installing an empty configuration file in
`GNUNET_OS_IPK_DATADIR'.

Thanks,
A.V.

Attachment: 0001-Allow-applications-to-change-ProjectData-with-only-s.patch
Description: Patch for GNUnet


reply via email to

[Prev in Thread] Current Thread [Next in Thread]