donau-config.c (2533B)
1 /* 2 This file is part of Taler. 3 Copyright (C) 2012-2024 Taler Systems SA 4 5 Taler 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 Taler 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/donau-config.c 23 * @brief tool to access and manipulate Taler configuration files 24 * @author Christian Grothoff 25 */ 26 #include "donau_config.h" 27 #include "donau_util.h" 28 #include <taler/taler_util.h> 29 30 31 /* LSB-style exit status codes */ 32 #ifndef EXIT_INVALIDARGUMENT 33 /** 34 * Command-line arguments are invalid. 35 * Restarting useless. 36 */ 37 #define EXIT_INVALIDARGUMENT 2 38 #endif 39 40 41 /** 42 * Program to manipulate configuration files. 43 * 44 * @param argc number of arguments from the command line 45 * @param argv command line arguments 46 * @return 0 ok, 1 on error 47 */ 48 int 49 main (int argc, 50 char *const *argv) 51 { 52 struct GNUNET_CONFIGURATION_ConfigSettings cs = { 53 .api_version = GNUNET_UTIL_VERSION, 54 .global_ret = EXIT_SUCCESS 55 }; 56 struct GNUNET_GETOPT_CommandLineOption options[] = { 57 GNUNET_GETOPT_option_help (DONAU_project_data (), 58 "donau-config [OPTIONS]"), 59 GNUNET_GETOPT_option_version (DONAU_project_data ()->version), 60 GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), 61 GNUNET_GETOPT_OPTION_END 62 }; 63 enum GNUNET_GenericReturnValue ret; 64 65 ret = GNUNET_PROGRAM_run (DONAU_project_data (), 66 argc, 67 argv, 68 "donau-config [OPTIONS]", 69 gettext_noop ( 70 "Manipulate Donau configuration files"), 71 options, 72 &GNUNET_CONFIGURATION_config_tool_run, 73 &cs); 74 GNUNET_CONFIGURATION_config_settings_free (&cs); 75 if (GNUNET_NO == ret) 76 return 0; 77 if (GNUNET_SYSERR == ret) 78 return EXIT_INVALIDARGUMENT; 79 return cs.global_ret; 80 } 81 82 83 /* end of donau-config.c */