On 8/4/19 4:17 PM, Alessio Vanni wrote:
> The first thing is a "user interface" issue: when I develop a client
> following the handbook, if I run it with the '--help' or '--version'
> flags I get messages that do not apply to my program.  The help message
> prints a series of messages related to the GNU project, of which my
> simple program is not part of.  Also, it says that the bug reporting
> address is GNUnet's one instead of my own.  The '--version' flag is
> similar, in which it prints '0.11.6' instead of e.g. '1.0' (the version
> of my program.)

Have a look at the attached os_installation.c from GNU Taler. It shows
you how to initialize libgnunetutil to customize the --help output (at
least some of it).  It also demonstrates how we could easily enable
further customizations in the future, if necessary.

For the version number, you need to call

GNUNET_GETOPT_option_version("1.0")

in your option list, to get --version to show '1.0'.

/*
     This file is part of GNU Taler.
     Copyright (C) 2016 Inria

     Taler is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published
     by the Free Software Foundation; either version 3, or (at your
     option) any later version.

     Taler is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with Taler; see the file COPYING.  If not, write to the
     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     Boston, MA 02110-1301, USA.
*/

/**
 * @file os_installation.c
 * @brief initialize libgnunet OS subsystem for Taler.
 * @author Christian Grothoff
 */
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>


/**
 * Default project data used for installation path detection
 * for GNU Taler.
 */
static const struct GNUNET_OS_ProjectData taler_pd = {
  .libname = "libtalerutil",
  .project_dirname = "taler",
  .binary_name = "taler-exchange-httpd",
  .env_varname = "TALER_PREFIX",
  .base_config_varname = "TALER_BASE_CONFIG",
  .bug_email = "[email protected]",
  .homepage = "http://www.gnu.org/s/taler/";,
  .config_file = "taler.conf",
  .user_config_file = "~/.config/taler.conf",
};


/**
 * Return default project data used by Taler.
 */
const struct GNUNET_OS_ProjectData *
TALER_project_data_default (void)
{
  return &taler_pd;
}


/**
 * Initialize libtalerutil.
 */
void __attribute__ ((constructor))
TALER_OS_init ()
{
  GNUNET_OS_init (&taler_pd);
}


/* end of os_installation.c */

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to