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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Christian Grothoff
25 * Functions related to starting programs
27 * @defgroup program Program library
28 * Start command-line programs.
32 #ifndef GNUNET_PROGRAM_LIB_H
33 #define GNUNET_PROGRAM_LIB_H
38 #if 0 /* keep Emacsens' auto-indent happy */
43 #include "gnunet_configuration_lib.h"
44 #include "gnunet_getopt_lib.h"
45 #include "gnunet_scheduler_lib.h"
48 * Main function that will be run.
51 * @param args remaining command-line arguments
52 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
53 * @param cfg configuration
56 (*GNUNET_PROGRAM_Main) (void *cls,
59 const struct GNUNET_CONFIGURATION_Handle *cfg);
63 * Run a standard GNUnet command startup sequence (initialize loggers
64 * and configuration, parse options).
66 * @param argc number of command line arguments in @a argv
67 * @param argv command line arguments
68 * @param binaryName our expected name
69 * @param binaryHelp help text for the program
70 * @param options command line options
71 * @param task main function to run
72 * @param task_cls closure for @a task
73 * @param run_without_scheduler #GNUNET_NO start the scheduler,
74 * #GNUNET_YES do not start the scheduler just run the main task
75 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
78 GNUNET_PROGRAM_run2 (int argc,
80 const char *binaryName,
81 const char *binaryHelp,
82 const struct GNUNET_GETOPT_CommandLineOption *options,
83 GNUNET_PROGRAM_Main task,
85 int run_without_scheduler);
89 * Run a standard GNUnet command startup sequence (initialize loggers
90 * and configuration, parse options).
92 * @param argc number of command line arguments
93 * @param argv command line arguments
94 * @param binaryName our expected name
95 * @param binaryHelp helptext for "-h" option (about the app)
96 * @param options command line options
97 * @param task main function to run
98 * @param task_cls closure for @a task
99 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
102 GNUNET_PROGRAM_run (int argc,
104 const char *binaryName,
105 const char *binaryHelp,
106 const struct GNUNET_GETOPT_CommandLineOption *options,
107 GNUNET_PROGRAM_Main task,
111 #if 0 /* keep Emacsens' auto-indent happy */
118 /* ifndef GNUNET_PROGRAM_LIB_H */
121 /** @} */ /* end of group program */
123 /* end of gnunet_program_lib.h */