GNUnet  0.11.x
Functions | Variables
gnunet-template.c File Reference

template for writing a tool More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for gnunet-template.c:

Go to the source code of this file.


static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
 Main function that will be run by the scheduler. More...
int main (int argc, char *const *argv)
 The main function. More...


static int ret
 Final status code. More...

Detailed Description

template for writing a tool

Christian Grothoff

Definition in file gnunet-template.c.

Function Documentation

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle cfg 

Main function that will be run by the scheduler.

argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)

Definition at line 45 of file gnunet-template.c.

49 {
50  /* main code here */
51 }

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 

The main function.

argcnumber of arguments from the command line
argvcommand line arguments
0 ok, 1 on error

Definition at line 62 of file gnunet-template.c.

63 {
64  static const struct GNUNET_GETOPT_CommandLineOption options[] = {
65  /* FIMXE: add options here */
67  };
69  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
70  return 2;
72  ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc,
73  argv,
74  "gnunet-template",
75  gettext_noop ("help text"),
76  options,
77  &run,
78  NULL))
79  ? ret
80  : 1;
81  GNUNET_free_nz ((void *) argv);
82  return ret;
83 }
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:69
static int ret
Final status code.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run by the scheduler.
Definition: gnunet_common.h:95
#define GNUNET_free_nz(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:364
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1209
Definition of a command line option.

References gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), options, ret, and run().

Here is the call graph for this function:

Variable Documentation

◆ ret

int ret

Final status code.

Definition at line 33 of file gnunet-template.c.

Referenced by main().