GNUnet  0.20.0
configuration_helper.c File Reference

helper logic for gnunet-config More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for configuration_helper.c:

Go to the source code of this file.

Functions

static void print_filename_option (void *cls, const char *section, const char *option, const char *value)
 Print each option in a given section as a filename. More...
 
static void print_option (void *cls, const char *section, const char *option, const char *value)
 Print each option in a given section. More...
 
static void print_section_name (void *cls, const char *section)
 Print out given section name. More...
 
void GNUNET_CONFIGURATION_config_tool_run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main task to run to perform operations typical for gnunet-config as per the configuration settings given in cls. More...
 
void GNUNET_CONFIGURATION_config_settings_free (struct GNUNET_CONFIGURATION_ConfigSettings *cs)
 Free resources associated with cs. More...
 

Detailed Description

helper logic for gnunet-config

Author
Christian Grothoff

Definition in file configuration_helper.c.

Function Documentation

◆ print_filename_option()

static void print_filename_option ( void *  cls,
const char *  section,
const char *  option,
const char *  value 
)
static

Print each option in a given section as a filename.

Parameters
clsclosure
sectionname of the section
optionname of the option
valuevalue of the option

Definition at line 38 of file configuration_helper.c.

42 {
43  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
44 
45  char *value_fn;
46  char *fn;
47 
50  section,
51  option,
52  &value_fn));
53  fn = GNUNET_STRINGS_filename_expand (value_fn);
54  if (NULL == fn)
55  fn = value_fn;
56  else
57  GNUNET_free (value_fn);
58  fprintf (stdout,
59  "%s = %s\n",
60  option,
61  fn);
62  GNUNET_free (fn);
63 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
@ GNUNET_OK
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_free(ptr)
Wrapper around free.
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
Definition: strings.c:494

References cfg, GNUNET_assert, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_free, GNUNET_OK, and GNUNET_STRINGS_filename_expand().

Referenced by GNUNET_CONFIGURATION_config_tool_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_option()

static void print_option ( void *  cls,
const char *  section,
const char *  option,
const char *  value 
)
static

Print each option in a given section.

Parameters
clsclosure
sectionname of the section
optionname of the option
valuevalue of the option

Definition at line 75 of file configuration_helper.c.

79 {
80  (void) cls;
81  (void) section;
82 
83  fprintf (stdout,
84  "%s = %s\n",
85  option,
86  value);
87 }
static char * value
Value of the record to add/remove.

References value.

Referenced by GNUNET_CONFIGURATION_config_tool_run().

Here is the caller graph for this function:

◆ print_section_name()

static void print_section_name ( void *  cls,
const char *  section 
)
static

Print out given section name.

Parameters
clsunused
sectiona section in the configuration file

Definition at line 97 of file configuration_helper.c.

99 {
100  (void) cls;
101  fprintf (stdout,
102  "%s\n",
103  section);
104 }

Referenced by GNUNET_CONFIGURATION_config_tool_run().

Here is the caller graph for this function: