[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Allow omitting some fields in ProjectData
From: |
Christian Grothoff |
Subject: |
Re: Allow omitting some fields in ProjectData |
Date: |
Sun, 11 Oct 2020 10:32:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
Hi Alessio,
Patch looks good, applied: 03199f7f2..77339944c
-Christian
On 10/10/20 6:11 PM, Alessio Vanni wrote:
> 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.
>