GNUnet  0.11.x
Functions
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 37 of file configuration_helper.c.

41 {
42  const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
43 
44  char *value_fn;
45  char *fn;
46 
49  section,
50  option,
51  &value_fn));
53  if (NULL == fn)
54  fn = value_fn;
55  else
56  GNUNET_free (value_fn);
57  fprintf (stdout,
58  "%s = %s\n",
59  option,
60  fn);
61  GNUNET_free (fn);
62 }
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:36
@ GNUNET_OK
Definition: gnunet_common.h:95
static char * fn
Filename of the unique file.
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.
#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:482

References cfg, fn, 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 74 of file configuration_helper.c.

78 {
79  (void) cls;
80  (void) section;
81 
82  fprintf (stdout,
83  "%s = %s\n",
84  option,
85  value);
86 }
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 96 of file configuration_helper.c.

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

Referenced by GNUNET_CONFIGURATION_config_tool_run().

Here is the caller graph for this function: