aboutsummaryrefslogtreecommitdiff
path: root/src/util/anastasis-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/anastasis-config.c')
-rw-r--r--src/util/anastasis-config.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/util/anastasis-config.c b/src/util/anastasis-config.c
new file mode 100644
index 0000000..0c2cb29
--- /dev/null
+++ b/src/util/anastasis-config.c
@@ -0,0 +1,73 @@
1/*
2 This file is part of Anastasis.
3 Copyright (C) 2012-2021 Anastasis Systems SA
4
5 Anastasis 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.
9
10 Anastasis 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.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file util/anastasis-config.c
23 * @brief tool to access and manipulate Anastasis configuration files
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "anastasis_util_lib.h"
28
29
30/**
31 * Program to manipulate configuration files.
32 *
33 * @param argc number of arguments from the command line
34 * @param argv command line arguments
35 * @return 0 ok, 1 on error
36 */
37int
38main (int argc,
39 char *const *argv)
40{
41 struct GNUNET_CONFIGURATION_ConfigSettings cs = {
42 .api_version = GNUNET_UTIL_VERSION,
43 .global_ret = EXIT_SUCCESS
44 };
45 struct GNUNET_GETOPT_CommandLineOption options[] = {
46 GNUNET_GETOPT_OPTION_END
47 };
48 enum GNUNET_GenericReturnValue ret;
49
50 if (GNUNET_OK !=
51 GNUNET_STRINGS_get_utf8_args (argc, argv,
52 &argc, &argv))
53 return EXIT_FAILURE;
54 ANASTASIS_OS_init ();
55 ret = GNUNET_PROGRAM_run (argc,
56 argv,
57 "anastasis-config [OPTIONS]",
58 gettext_noop (
59 "Manipulate Anastasis configuration files"),
60 options,
61 &GNUNET_CONFIGURATION_config_tool_run,
62 &cs);
63 GNUNET_free_nz ((void *) argv);
64 GNUNET_CONFIGURATION_config_settings_free (&cs);
65 if (GNUNET_NO == ret)
66 return 0;
67 if (GNUNET_SYSERR == ret)
68 return EXIT_INVALIDARGUMENT;
69 return cs.global_ret;
70}
71
72
73/* end of anastasis-config.c */