2 This file is part of GNUnet.
3 Copyright (C) 2001-2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @author Christian Grothoff
23 * Functions related to starting programs
25 * @defgroup program Program library
26 * Start command-line programs.
30 #ifndef GNUNET_PROGRAM_LIB_H
31 #define GNUNET_PROGRAM_LIB_H
36 #if 0 /* keep Emacsens' auto-indent happy */
41 #include "gnunet_configuration_lib.h"
42 #include "gnunet_getopt_lib.h"
43 #include "gnunet_scheduler_lib.h"
46 * Main function that will be run.
49 * @param args remaining command-line arguments
50 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
51 * @param cfg configuration
54 (*GNUNET_PROGRAM_Main) (void *cls,
57 const struct GNUNET_CONFIGURATION_Handle *cfg);
61 * Run a standard GNUnet command startup sequence (initialize loggers
62 * and configuration, parse options).
64 * @param argc number of command line arguments in @a argv
65 * @param argv command line arguments
66 * @param binaryName our expected name
67 * @param binaryHelp help text for the program
68 * @param options command line options
69 * @param task main function to run
70 * @param task_cls closure for @a task
71 * @param run_without_scheduler #GNUNET_NO start the scheduler,
72 * #GNUNET_YES do not start the scheduler just run the main task
73 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
76 GNUNET_PROGRAM_run2 (int argc,
78 const char *binaryName,
79 const char *binaryHelp,
80 const struct GNUNET_GETOPT_CommandLineOption *options,
81 GNUNET_PROGRAM_Main task,
83 int run_without_scheduler);
87 * Run a standard GNUnet command startup sequence (initialize loggers
88 * and configuration, parse options).
90 * @param argc number of command line arguments
91 * @param argv command line arguments
92 * @param binaryName our expected name
93 * @param binaryHelp helptext for "-h" option (about the app)
94 * @param options command line options
95 * @param task main function to run
96 * @param task_cls closure for @a task
97 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
100 GNUNET_PROGRAM_run (int argc,
102 const char *binaryName,
103 const char *binaryHelp,
104 const struct GNUNET_GETOPT_CommandLineOption *options,
105 GNUNET_PROGRAM_Main task,
109 #if 0 /* keep Emacsens' auto-indent happy */
116 /* ifndef GNUNET_PROGRAM_LIB_H */
119 /** @} */ /* end of group program */
121 /* end of gnunet_program_lib.h */