aboutsummaryrefslogtreecommitdiff
path: root/src/util/gnunet-config.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-15 09:39:46 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-15 11:14:58 +0100
commit30eb0faa8d4894659cc90c76cc634148df86eab9 (patch)
treeb6cfb44c28bf018c575f11720e28cda06d346063 /src/util/gnunet-config.c
parentcd475225e4fd83fcc16b77ea1294c11428447209 (diff)
downloadgnunet-30eb0faa8d4894659cc90c76cc634148df86eab9.tar.gz
gnunet-30eb0faa8d4894659cc90c76cc634148df86eab9.zip
getopt major style fix, remove macro-mania with nicer typed functions
Diffstat (limited to 'src/util/gnunet-config.c')
-rw-r--r--src/util/gnunet-config.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c
index 7ec7162f1..2beb772a9 100644
--- a/src/util/gnunet-config.c
+++ b/src/util/gnunet-config.c
@@ -223,34 +223,48 @@ run (void *cls,
223int 223int
224main (int argc, char *const *argv) 224main (int argc, char *const *argv)
225{ 225{
226 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 226 struct GNUNET_GETOPT_CommandLineOption options[] = {
227 { 'f', "filename", NULL, 227 GNUNET_GETOPT_OPTION_SET_ONE ('f',
228 gettext_noop ("obtain option of value as a filename (with $-expansion)"), 228 "filename",
229 0, &GNUNET_GETOPT_set_one, &is_filename }, 229 gettext_noop ("obtain option of value as a filename (with $-expansion)"),
230 { 's', "section", "SECTION", 230 &is_filename),
231 gettext_noop ("name of the section to access"), 231 GNUNET_GETOPT_OPTION_STRING ('s',
232 1, &GNUNET_GETOPT_set_string, &section }, 232 "section",
233 { 'o', "option", "OPTION", 233 "SECTION",
234 gettext_noop ("name of the option to access"), 234 gettext_noop ("name of the section to access"),
235 1, &GNUNET_GETOPT_set_string, &option }, 235 &section),
236 { 'V', "value", "VALUE", 236 GNUNET_GETOPT_OPTION_STRING ('o',
237 gettext_noop ("value to set"), 237 "option",
238 1, &GNUNET_GETOPT_set_string, &value }, 238 "OPTION",
239 { 'S', "list-sections", NULL, 239 gettext_noop ("name of the option to access"),
240 gettext_noop ("print available configuration sections"), 240 &option),
241 0, &GNUNET_GETOPT_set_one, &list_sections }, 241 GNUNET_GETOPT_OPTION_STRING ('V',
242 { 'w', "rewrite", NULL, 242 "value",
243 gettext_noop ("write configuration file that only contains delta to defaults"), 243 "VALUE",
244 0, &GNUNET_GETOPT_set_one, &rewrite }, 244 gettext_noop ("value to set"),
245 &value),
246 GNUNET_GETOPT_OPTION_SET_ONE ('S',
247 "list-sections",
248 gettext_noop ("print available configuration sections"),
249 &list_sections),
250 GNUNET_GETOPT_OPTION_SET_ONE ('w',
251 "rewrite",
252 gettext_noop ("write configuration file that only contains delta to defaults"),
253 &rewrite),
245 GNUNET_GETOPT_OPTION_END 254 GNUNET_GETOPT_OPTION_END
246 }; 255 };
247 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 256 if (GNUNET_OK !=
257 GNUNET_STRINGS_get_utf8_args (argc, argv,
258 &argc, &argv))
248 return 2; 259 return 2;
249 260
250 ret = (GNUNET_OK == 261 ret = (GNUNET_OK ==
251 GNUNET_PROGRAM_run (argc, argv, "gnunet-config [OPTIONS]", 262 GNUNET_PROGRAM_run (argc,
263 argv,
264 "gnunet-config [OPTIONS]",
252 gettext_noop ("Manipulate GNUnet configuration files"), 265 gettext_noop ("Manipulate GNUnet configuration files"),
253 options, &run, NULL)) ? 0 : ret; 266 options,
267 &run, NULL)) ? 0 : ret;
254 GNUNET_free ((void*) argv); 268 GNUNET_free ((void*) argv);
255 return ret; 269 return ret;
256} 270}