2 This file is part of GNUnet.
3 (C) 2001-2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file include/gnunet_program_lib.h
23 * @brief functions related to starting programs
24 * @author Christian Grothoff
25 * @defgroup program functions for writing command-line programs
29 #ifndef GNUNET_PROGRAM_LIB_H
30 #define GNUNET_PROGRAM_LIB_H
35 #if 0 /* keep Emacsens' auto-indent happy */
40 #include "gnunet_configuration_lib.h"
41 #include "gnunet_getopt_lib.h"
42 #include "gnunet_scheduler_lib.h"
45 * Main function that will be run.
48 * @param args remaining command-line arguments
49 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
50 * @param cfg configuration
52 typedef void (*GNUNET_PROGRAM_Main) (void *cls, char *const *args,
54 const struct GNUNET_CONFIGURATION_Handle *
59 * Run a standard GNUnet command startup sequence (initialize loggers
60 * and configuration, parse options).
62 * @param argc number of command line arguments in @a argv
63 * @param argv command line arguments
64 * @param binaryName our expected name
65 * @param binaryHelp help text for the program
66 * @param options command line options
67 * @param task main function to run
68 * @param task_cls closure for @a task
69 * @param run_without_scheduler #GNUNET_NO start the scheduler,
70 * #GNUNET_YES do not start the scheduler just run the main task
71 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
74 GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName,
75 const char *binaryHelp,
76 const struct GNUNET_GETOPT_CommandLineOption *options,
77 GNUNET_PROGRAM_Main task, void *task_cls,
78 int run_without_scheduler);
81 * Run a standard GNUnet command startup sequence (initialize loggers
82 * and configuration, parse options).
84 * @param argc number of command line arguments
85 * @param argv command line arguments
86 * @param binaryName our expected name
87 * @param binaryHelp helptext for "-h" option (about the app)
88 * @param options command line options
89 * @param task main function to run
90 * @param task_cls closure for @a task
91 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
94 GNUNET_PROGRAM_run (int argc, char *const *argv, const char *binaryName,
95 const char *binaryHelp,
96 const struct GNUNET_GETOPT_CommandLineOption *options,
97 GNUNET_PROGRAM_Main task, void *task_cls);
101 #if 0 /* keep Emacsens' auto-indent happy */
108 /** @} */ /* end of group program */
110 /* ifndef GNUNET_PROGRAM_LIB_H */
112 /* end of gnunet_program_lib.h */