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.
17 * @author Christian Grothoff
20 * Functions related to starting programs
22 * @defgroup program Program library
23 * Start command-line programs.
27 #ifndef GNUNET_PROGRAM_LIB_H
28 #define GNUNET_PROGRAM_LIB_H
33 #if 0 /* keep Emacsens' auto-indent happy */
38 #include "gnunet_configuration_lib.h"
39 #include "gnunet_getopt_lib.h"
40 #include "gnunet_scheduler_lib.h"
43 * Main function that will be run.
46 * @param args remaining command-line arguments
47 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
48 * @param cfg configuration
51 (*GNUNET_PROGRAM_Main) (void *cls,
54 const struct GNUNET_CONFIGURATION_Handle *cfg);
58 * Run a standard GNUnet command startup sequence (initialize loggers
59 * and configuration, parse options).
61 * @param argc number of command line arguments in @a argv
62 * @param argv command line arguments
63 * @param binaryName our expected name
64 * @param binaryHelp help text for the program
65 * @param options command line options
66 * @param task main function to run
67 * @param task_cls closure for @a task
68 * @param run_without_scheduler #GNUNET_NO start the scheduler,
69 * #GNUNET_YES do not start the scheduler just run the main task
70 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
73 GNUNET_PROGRAM_run2 (int argc,
75 const char *binaryName,
76 const char *binaryHelp,
77 const struct GNUNET_GETOPT_CommandLineOption *options,
78 GNUNET_PROGRAM_Main task,
80 int run_without_scheduler);
84 * Run a standard GNUnet command startup sequence (initialize loggers
85 * and configuration, parse options).
87 * @param argc number of command line arguments
88 * @param argv command line arguments
89 * @param binaryName our expected name
90 * @param binaryHelp helptext for "-h" option (about the app)
91 * @param options command line options
92 * @param task main function to run
93 * @param task_cls closure for @a task
94 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
97 GNUNET_PROGRAM_run (int argc,
99 const char *binaryName,
100 const char *binaryHelp,
101 const struct GNUNET_GETOPT_CommandLineOption *options,
102 GNUNET_PROGRAM_Main task,
106 #if 0 /* keep Emacsens' auto-indent happy */
113 /* ifndef GNUNET_PROGRAM_LIB_H */
116 /** @} */ /* end of group program */
118 /* end of gnunet_program_lib.h */