aboutsummaryrefslogtreecommitdiff
path: root/src/util/gnunet-scrypt.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-scrypt.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-scrypt.c')
-rw-r--r--src/util/gnunet-scrypt.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c
index ab0cf92e0..7c73cfe1e 100644
--- a/src/util/gnunet-scrypt.c
+++ b/src/util/gnunet-scrypt.c
@@ -307,21 +307,30 @@ run (void *cls,
307 * @return 0 ok, 1 on error 307 * @return 0 ok, 1 on error
308 */ 308 */
309int 309int
310main (int argc, char *const *argv) 310main (int argc,
311 char *const *argv)
311{ 312{
312 static const struct GNUNET_GETOPT_CommandLineOption options[] = { 313 struct GNUNET_GETOPT_CommandLineOption options[] = {
313 { 'b', "bits", "BITS", 314 GNUNET_GETOPT_OPTION_SET_ULONG ('b',
314 gettext_noop ("number of bits to require for the proof of work"), 315 "bits",
315 1, &GNUNET_GETOPT_set_ulong, &nse_work_required }, 316 "BITS",
316 { 'k', "keyfile", "FILE", 317 gettext_noop ("number of bits to require for the proof of work"),
317 gettext_noop ("file with private key, otherwise default is used"), 318 &nse_work_required),
318 1, &GNUNET_GETOPT_set_filename, &pkfn }, 319 GNUNET_GETOPT_OPTION_FILENAME ('k',
319 { 'o', "outfile", "FILE", 320 "keyfile",
320 gettext_noop ("file with proof of work, otherwise default is used"), 321 "FILE",
321 1, &GNUNET_GETOPT_set_filename, &pwfn }, 322 gettext_noop ("file with private key, otherwise default is used"),
322 { 't', "timeout", "TIME", 323 &pkfn),
323 gettext_noop ("time to wait between calculations"), 324 GNUNET_GETOPT_OPTION_FILENAME ('o',
324 1, &GNUNET_GETOPT_set_relative_time, &proof_find_delay }, 325 "outfile",
326 "FILE",
327 gettext_noop ("file with proof of work, otherwise default is used"),
328 &pwfn),
329 GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t',
330 "timeout",
331 "TIME",
332 gettext_noop ("time to wait between calculations"),
333 &proof_find_delay),
325 GNUNET_GETOPT_OPTION_END 334 GNUNET_GETOPT_OPTION_END
326 }; 335 };
327 int ret; 336 int ret;
@@ -334,7 +343,9 @@ main (int argc, char *const *argv)
334 GNUNET_PROGRAM_run (argc, argv, 343 GNUNET_PROGRAM_run (argc, argv,
335 "gnunet-scrypt [OPTIONS] prooffile", 344 "gnunet-scrypt [OPTIONS] prooffile",
336 gettext_noop ("Manipulate GNUnet proof of work files"), 345 gettext_noop ("Manipulate GNUnet proof of work files"),
337 options, &run, NULL)) ? 0 : 1; 346 options,
347 &run,
348 NULL)) ? 0 : 1;
338 GNUNET_free ((void*) argv); 349 GNUNET_free ((void*) argv);
339 GNUNET_free_non_null (pwfn); 350 GNUNET_free_non_null (pwfn);
340 return ret; 351 return ret;