diff options
Diffstat (limited to 'src/util/getopt_helpers.c')
-rw-r--r-- | src/util/getopt_helpers.c | 249 |
1 files changed, 80 insertions, 169 deletions
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index 592875531..917aa440b 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * @param value not used (NULL) | 38 | * @param value not used (NULL) |
39 | * @return #GNUNET_NO (do not continue, not an error) | 39 | * @return #GNUNET_NO (do not continue, not an error) |
40 | */ | 40 | */ |
41 | static int | 41 | static enum GNUNET_GenericReturnValue |
42 | print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 42 | print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
43 | void *scls, | 43 | void *scls, |
44 | const char *option, | 44 | const char *option, |
@@ -53,12 +53,6 @@ print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | /** | ||
57 | * Define the option to print the version of | ||
58 | * the application (-v option) | ||
59 | * | ||
60 | * @param version string with the version number | ||
61 | */ | ||
62 | struct GNUNET_GETOPT_CommandLineOption | 56 | struct GNUNET_GETOPT_CommandLineOption |
63 | GNUNET_GETOPT_option_version (const char *version) | 57 | GNUNET_GETOPT_option_version (const char *version) |
64 | { | 58 | { |
@@ -90,7 +84,7 @@ GNUNET_GETOPT_option_version (const char *version) | |||
90 | * @param value not used (NULL) | 84 | * @param value not used (NULL) |
91 | * @return #GNUNET_NO (do not continue, not an error) | 85 | * @return #GNUNET_NO (do not continue, not an error) |
92 | */ | 86 | */ |
93 | static int | 87 | static enum GNUNET_GenericReturnValue |
94 | format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 88 | format_help (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
95 | void *scls, | 89 | void *scls, |
96 | const char *option, | 90 | const char *option, |
@@ -192,12 +186,6 @@ OUTER: | |||
192 | } | 186 | } |
193 | 187 | ||
194 | 188 | ||
195 | /** | ||
196 | * Defining the option to print the command line | ||
197 | * help text (-h option). | ||
198 | * | ||
199 | * @param about string with brief description of the application | ||
200 | */ | ||
201 | struct GNUNET_GETOPT_CommandLineOption | 189 | struct GNUNET_GETOPT_CommandLineOption |
202 | GNUNET_GETOPT_option_help (const char *about) | 190 | GNUNET_GETOPT_option_help (const char *about) |
203 | { | 191 | { |
@@ -229,7 +217,7 @@ GNUNET_GETOPT_option_help (const char *about) | |||
229 | * @param value not used (NULL) | 217 | * @param value not used (NULL) |
230 | * @return #GNUNET_OK | 218 | * @return #GNUNET_OK |
231 | */ | 219 | */ |
232 | static int | 220 | static enum GNUNET_GenericReturnValue |
233 | increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 221 | increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
234 | void *scls, | 222 | void *scls, |
235 | const char *option, | 223 | const char *option, |
@@ -245,15 +233,6 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
245 | } | 233 | } |
246 | 234 | ||
247 | 235 | ||
248 | /** | ||
249 | * Increment @a val each time the option flag is given by one. | ||
250 | * | ||
251 | * @param shortName short name of the option | ||
252 | * @param name long name of the option | ||
253 | * @param argumentHelp help text for the option argument | ||
254 | * @param description long help text for the option | ||
255 | * @param[out] val increment by 1 each time the option is present | ||
256 | */ | ||
257 | struct GNUNET_GETOPT_CommandLineOption | 236 | struct GNUNET_GETOPT_CommandLineOption |
258 | GNUNET_GETOPT_option_increment_uint (char shortName, | 237 | GNUNET_GETOPT_option_increment_uint (char shortName, |
259 | const char *name, | 238 | const char *name, |
@@ -272,12 +251,6 @@ GNUNET_GETOPT_option_increment_uint (char shortName, | |||
272 | } | 251 | } |
273 | 252 | ||
274 | 253 | ||
275 | /** | ||
276 | * Define the '-V' verbosity option. Using the option more | ||
277 | * than once increments @a level each time. | ||
278 | * | ||
279 | * @param[out] level set to the verbosity level | ||
280 | */ | ||
281 | struct GNUNET_GETOPT_CommandLineOption | 254 | struct GNUNET_GETOPT_CommandLineOption |
282 | GNUNET_GETOPT_option_verbose (unsigned int *level) | 255 | GNUNET_GETOPT_option_verbose (unsigned int *level) |
283 | { | 256 | { |
@@ -308,7 +281,7 @@ GNUNET_GETOPT_option_verbose (unsigned int *level) | |||
308 | * @param value not used (NULL) | 281 | * @param value not used (NULL) |
309 | * @return #GNUNET_OK | 282 | * @return #GNUNET_OK |
310 | */ | 283 | */ |
311 | static int | 284 | static enum GNUNET_GenericReturnValue |
312 | set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 285 | set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
313 | void *scls, | 286 | void *scls, |
314 | const char *option, | 287 | const char *option, |
@@ -324,16 +297,6 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
324 | } | 297 | } |
325 | 298 | ||
326 | 299 | ||
327 | /** | ||
328 | * Allow user to specify a flag (which internally means setting | ||
329 | * an integer to 1/#GNUNET_YES/#GNUNET_OK. | ||
330 | * | ||
331 | * @param shortName short name of the option | ||
332 | * @param name long name of the option | ||
333 | * @param argumentHelp help text for the option argument | ||
334 | * @param description long help text for the option | ||
335 | * @param[out] val set to 1 if the option is present | ||
336 | */ | ||
337 | struct GNUNET_GETOPT_CommandLineOption | 300 | struct GNUNET_GETOPT_CommandLineOption |
338 | GNUNET_GETOPT_option_flag (char shortName, | 301 | GNUNET_GETOPT_option_flag (char shortName, |
339 | const char *name, | 302 | const char *name, |
@@ -366,7 +329,7 @@ GNUNET_GETOPT_option_flag (char shortName, | |||
366 | * @param value actual value of the option (a string) | 329 | * @param value actual value of the option (a string) |
367 | * @return #GNUNET_OK | 330 | * @return #GNUNET_OK |
368 | */ | 331 | */ |
369 | static int | 332 | static enum GNUNET_GenericReturnValue |
370 | set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 333 | set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
371 | void *scls, | 334 | void *scls, |
372 | const char *option, | 335 | const char *option, |
@@ -383,15 +346,6 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
383 | } | 346 | } |
384 | 347 | ||
385 | 348 | ||
386 | /** | ||
387 | * Allow user to specify a string. | ||
388 | * | ||
389 | * @param shortName short name of the option | ||
390 | * @param name long name of the option | ||
391 | * @param argumentHelp help text for the option argument | ||
392 | * @param description long help text for the option | ||
393 | * @param[out] str set to the string | ||
394 | */ | ||
395 | struct GNUNET_GETOPT_CommandLineOption | 349 | struct GNUNET_GETOPT_CommandLineOption |
396 | GNUNET_GETOPT_option_string (char shortName, | 350 | GNUNET_GETOPT_option_string (char shortName, |
397 | const char *name, | 351 | const char *name, |
@@ -413,12 +367,6 @@ GNUNET_GETOPT_option_string (char shortName, | |||
413 | } | 367 | } |
414 | 368 | ||
415 | 369 | ||
416 | /** | ||
417 | * Define the '-L' log level option. Note that we do not check | ||
418 | * that the log level is valid here. | ||
419 | * | ||
420 | * @param[out] level set to the log level | ||
421 | */ | ||
422 | struct GNUNET_GETOPT_CommandLineOption | 370 | struct GNUNET_GETOPT_CommandLineOption |
423 | GNUNET_GETOPT_option_loglevel (char **level) | 371 | GNUNET_GETOPT_option_loglevel (char **level) |
424 | { | 372 | { |
@@ -447,7 +395,7 @@ GNUNET_GETOPT_option_loglevel (char **level) | |||
447 | * @param value actual value of the option (a string) | 395 | * @param value actual value of the option (a string) |
448 | * @return #GNUNET_OK | 396 | * @return #GNUNET_OK |
449 | */ | 397 | */ |
450 | static int | 398 | static enum GNUNET_GenericReturnValue |
451 | set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 399 | set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
452 | void *scls, | 400 | void *scls, |
453 | const char *option, | 401 | const char *option, |
@@ -464,15 +412,6 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
464 | } | 412 | } |
465 | 413 | ||
466 | 414 | ||
467 | /** | ||
468 | * Allow user to specify a filename (automatically path expanded). | ||
469 | * | ||
470 | * @param shortName short name of the option | ||
471 | * @param name long name of the option | ||
472 | * @param argumentHelp help text for the option argument | ||
473 | * @param description long help text for the option | ||
474 | * @param[out] str set to the string | ||
475 | */ | ||
476 | struct GNUNET_GETOPT_CommandLineOption | 415 | struct GNUNET_GETOPT_CommandLineOption |
477 | GNUNET_GETOPT_option_filename (char shortName, | 416 | GNUNET_GETOPT_option_filename (char shortName, |
478 | const char *name, | 417 | const char *name, |
@@ -494,11 +433,6 @@ GNUNET_GETOPT_option_filename (char shortName, | |||
494 | } | 433 | } |
495 | 434 | ||
496 | 435 | ||
497 | /** | ||
498 | * Allow user to specify log file name (-l option) | ||
499 | * | ||
500 | * @param[out] logfn set to the name of the logfile | ||
501 | */ | ||
502 | struct GNUNET_GETOPT_CommandLineOption | 436 | struct GNUNET_GETOPT_CommandLineOption |
503 | GNUNET_GETOPT_option_logfile (char **logfn) | 437 | GNUNET_GETOPT_option_logfile (char **logfn) |
504 | { | 438 | { |
@@ -517,11 +451,6 @@ GNUNET_GETOPT_option_logfile (char **logfn) | |||
517 | } | 451 | } |
518 | 452 | ||
519 | 453 | ||
520 | /** | ||
521 | * Allow user to specify configuration file name (-c option) | ||
522 | * | ||
523 | * @param[out] fn set to the name of the configuration file | ||
524 | */ | ||
525 | struct GNUNET_GETOPT_CommandLineOption | 454 | struct GNUNET_GETOPT_CommandLineOption |
526 | GNUNET_GETOPT_option_cfgfile (char **fn) | 455 | GNUNET_GETOPT_option_cfgfile (char **fn) |
527 | { | 456 | { |
@@ -552,7 +481,7 @@ GNUNET_GETOPT_option_cfgfile (char **fn) | |||
552 | * @param value actual value of the option as a string. | 481 | * @param value actual value of the option as a string. |
553 | * @return #GNUNET_OK if parsing the value worked | 482 | * @return #GNUNET_OK if parsing the value worked |
554 | */ | 483 | */ |
555 | static int | 484 | static enum GNUNET_GenericReturnValue |
556 | set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 485 | set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
557 | void *scls, | 486 | void *scls, |
558 | const char *option, | 487 | const char *option, |
@@ -573,15 +502,6 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
573 | } | 502 | } |
574 | 503 | ||
575 | 504 | ||
576 | /** | ||
577 | * Allow user to specify an `unsigned long long` | ||
578 | * | ||
579 | * @param shortName short name of the option | ||
580 | * @param name long name of the option | ||
581 | * @param argumentHelp help text for the option argument | ||
582 | * @param description long help text for the option | ||
583 | * @param[out] val set to the value specified at the command line | ||
584 | */ | ||
585 | struct GNUNET_GETOPT_CommandLineOption | 505 | struct GNUNET_GETOPT_CommandLineOption |
586 | GNUNET_GETOPT_option_ulong (char shortName, | 506 | GNUNET_GETOPT_option_ulong (char shortName, |
587 | const char *name, | 507 | const char *name, |
@@ -616,7 +536,7 @@ GNUNET_GETOPT_option_ulong (char shortName, | |||
616 | * @param value actual value of the option as a string. | 536 | * @param value actual value of the option as a string. |
617 | * @return #GNUNET_OK if parsing the value worked | 537 | * @return #GNUNET_OK if parsing the value worked |
618 | */ | 538 | */ |
619 | static int | 539 | static enum GNUNET_GenericReturnValue |
620 | set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 540 | set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
621 | void *scls, | 541 | void *scls, |
622 | const char *option, | 542 | const char *option, |
@@ -664,15 +584,6 @@ set_timetravel_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
664 | } | 584 | } |
665 | 585 | ||
666 | 586 | ||
667 | /** | ||
668 | * Allow user to specify a `long long` with an offset to add to the current | ||
669 | * system time to construct the time seen by the application. Used for | ||
670 | * debugging / testing. | ||
671 | * | ||
672 | * @param shortName short name of the option | ||
673 | * @param name long name of the option | ||
674 | * @param[out] val set to the time specified at the command line | ||
675 | */ | ||
676 | struct GNUNET_GETOPT_CommandLineOption | 587 | struct GNUNET_GETOPT_CommandLineOption |
677 | GNUNET_GETOPT_option_timetravel (char shortName, | 588 | GNUNET_GETOPT_option_timetravel (char shortName, |
678 | const char *name) | 589 | const char *name) |
@@ -684,8 +595,7 @@ GNUNET_GETOPT_option_timetravel (char shortName, | |||
684 | .description = _ ( | 595 | .description = _ ( |
685 | "modify system time by given offset (for debugging/testing only)"), | 596 | "modify system time by given offset (for debugging/testing only)"), |
686 | .require_argument = 1, | 597 | .require_argument = 1, |
687 | .processor = | 598 | .processor = &set_timetravel_time |
688 | &set_timetravel_time | ||
689 | }; | 599 | }; |
690 | 600 | ||
691 | return clo; | 601 | return clo; |
@@ -705,7 +615,7 @@ GNUNET_GETOPT_option_timetravel (char shortName, | |||
705 | * @param value actual value of the option as a string. | 615 | * @param value actual value of the option as a string. |
706 | * @return #GNUNET_OK if parsing the value worked | 616 | * @return #GNUNET_OK if parsing the value worked |
707 | */ | 617 | */ |
708 | static int | 618 | static enum GNUNET_GenericReturnValue |
709 | set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 619 | set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
710 | void *scls, | 620 | void *scls, |
711 | const char *option, | 621 | const char *option, |
@@ -725,16 +635,6 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
725 | } | 635 | } |
726 | 636 | ||
727 | 637 | ||
728 | /** | ||
729 | * Allow user to specify a `struct GNUNET_TIME_Relative` | ||
730 | * (using human-readable "fancy" time). | ||
731 | * | ||
732 | * @param shortName short name of the option | ||
733 | * @param name long name of the option | ||
734 | * @param argumentHelp help text for the option argument | ||
735 | * @param description long help text for the option | ||
736 | * @param[out] val set to the time specified at the command line | ||
737 | */ | ||
738 | struct GNUNET_GETOPT_CommandLineOption | 638 | struct GNUNET_GETOPT_CommandLineOption |
739 | GNUNET_GETOPT_option_relative_time (char shortName, | 639 | GNUNET_GETOPT_option_relative_time (char shortName, |
740 | const char *name, | 640 | const char *name, |
@@ -748,8 +648,7 @@ GNUNET_GETOPT_option_relative_time (char shortName, | |||
748 | .argumentHelp = argumentHelp, | 648 | .argumentHelp = argumentHelp, |
749 | .description = description, | 649 | .description = description, |
750 | .require_argument = 1, | 650 | .require_argument = 1, |
751 | .processor = | 651 | .processor = &set_relative_time, |
752 | &set_relative_time, | ||
753 | .scls = (void *) val | 652 | .scls = (void *) val |
754 | }; | 653 | }; |
755 | 654 | ||
@@ -770,7 +669,7 @@ GNUNET_GETOPT_option_relative_time (char shortName, | |||
770 | * @param value actual value of the option as a string. | 669 | * @param value actual value of the option as a string. |
771 | * @return #GNUNET_OK if parsing the value worked | 670 | * @return #GNUNET_OK if parsing the value worked |
772 | */ | 671 | */ |
773 | static int | 672 | static enum GNUNET_GenericReturnValue |
774 | set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 673 | set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
775 | void *scls, | 674 | void *scls, |
776 | const char *option, | 675 | const char *option, |
@@ -790,16 +689,6 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
790 | } | 689 | } |
791 | 690 | ||
792 | 691 | ||
793 | /** | ||
794 | * Allow user to specify a `struct GNUNET_TIME_Absolute` | ||
795 | * (using human-readable "fancy" time). | ||
796 | * | ||
797 | * @param shortName short name of the option | ||
798 | * @param name long name of the option | ||
799 | * @param argumentHelp help text for the option argument | ||
800 | * @param description long help text for the option | ||
801 | * @param[out] val set to the time specified at the command line | ||
802 | */ | ||
803 | struct GNUNET_GETOPT_CommandLineOption | 692 | struct GNUNET_GETOPT_CommandLineOption |
804 | GNUNET_GETOPT_option_absolute_time (char shortName, | 693 | GNUNET_GETOPT_option_absolute_time (char shortName, |
805 | const char *name, | 694 | const char *name, |
@@ -813,8 +702,71 @@ GNUNET_GETOPT_option_absolute_time (char shortName, | |||
813 | .argumentHelp = argumentHelp, | 702 | .argumentHelp = argumentHelp, |
814 | .description = description, | 703 | .description = description, |
815 | .require_argument = 1, | 704 | .require_argument = 1, |
816 | .processor = | 705 | .processor = &set_absolute_time, |
817 | &set_absolute_time, | 706 | .scls = (void *) val |
707 | }; | ||
708 | |||
709 | return clo; | ||
710 | } | ||
711 | |||
712 | |||
713 | /** | ||
714 | * Set an option of type 'struct GNUNET_TIME_Timestamp' from the command line. | ||
715 | * A pointer to this function should be passed as part of the | ||
716 | * 'struct GNUNET_GETOPT_CommandLineOption' array to initialize options | ||
717 | * of this type. It should be followed by a pointer to a value of | ||
718 | * type 'struct GNUNET_TIME_Absolute'. | ||
719 | * | ||
720 | * @param ctx command line processing context | ||
721 | * @param scls additional closure (will point to the `struct GNUNET_TIME_Absolute`) | ||
722 | * @param option name of the option | ||
723 | * @param value actual value of the option as a string. | ||
724 | * @return #GNUNET_OK if parsing the value worked | ||
725 | */ | ||
726 | static enum GNUNET_GenericReturnValue | ||
727 | set_timestamp (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | ||
728 | void *scls, | ||
729 | const char *option, | ||
730 | const char *value) | ||
731 | { | ||
732 | struct GNUNET_TIME_Timestamp *t = scls; | ||
733 | struct GNUNET_TIME_Absolute abs; | ||
734 | |||
735 | (void) ctx; | ||
736 | if (GNUNET_OK != | ||
737 | GNUNET_STRINGS_fancy_time_to_absolute (value, | ||
738 | &abs)) | ||
739 | { | ||
740 | fprintf (stderr, | ||
741 | _ ("You must pass a timestamp to the `%s' option.\n"), | ||
742 | option); | ||
743 | return GNUNET_SYSERR; | ||
744 | } | ||
745 | if (0 != abs.abs_value_us % GNUNET_TIME_UNIT_SECONDS.rel_value_us) | ||
746 | { | ||
747 | fprintf (stderr, | ||
748 | _ ("The maximum precision allowed for timestamps is seconds.\n")); | ||
749 | return GNUNET_SYSERR; | ||
750 | } | ||
751 | t->abs_time = abs; | ||
752 | return GNUNET_OK; | ||
753 | } | ||
754 | |||
755 | |||
756 | struct GNUNET_GETOPT_CommandLineOption | ||
757 | GNUNET_GETOPT_option_timestamp (char shortName, | ||
758 | const char *name, | ||
759 | const char *argumentHelp, | ||
760 | const char *description, | ||
761 | struct GNUNET_TIME_Timestamp *val) | ||
762 | { | ||
763 | struct GNUNET_GETOPT_CommandLineOption clo = { | ||
764 | .shortName = shortName, | ||
765 | .name = name, | ||
766 | .argumentHelp = argumentHelp, | ||
767 | .description = description, | ||
768 | .require_argument = 1, | ||
769 | .processor = &set_timestamp, | ||
818 | .scls = (void *) val | 770 | .scls = (void *) val |
819 | }; | 771 | }; |
820 | 772 | ||
@@ -835,7 +787,7 @@ GNUNET_GETOPT_option_absolute_time (char shortName, | |||
835 | * @param value actual value of the option as a string. | 787 | * @param value actual value of the option as a string. |
836 | * @return #GNUNET_OK if parsing the value worked | 788 | * @return #GNUNET_OK if parsing the value worked |
837 | */ | 789 | */ |
838 | static int | 790 | static enum GNUNET_GenericReturnValue |
839 | set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 791 | set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
840 | void *scls, | 792 | void *scls, |
841 | const char *option, | 793 | const char *option, |
@@ -864,15 +816,6 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
864 | } | 816 | } |
865 | 817 | ||
866 | 818 | ||
867 | /** | ||
868 | * Allow user to specify an unsigned integer. | ||
869 | * | ||
870 | * @param shortName short name of the option | ||
871 | * @param name long name of the option | ||
872 | * @param argumentHelp help text for the option argument | ||
873 | * @param description long help text for the option | ||
874 | * @param[out] val set to the value specified at the command line | ||
875 | */ | ||
876 | struct GNUNET_GETOPT_CommandLineOption | 819 | struct GNUNET_GETOPT_CommandLineOption |
877 | GNUNET_GETOPT_option_uint (char shortName, | 820 | GNUNET_GETOPT_option_uint (char shortName, |
878 | const char *name, | 821 | const char *name, |
@@ -907,7 +850,7 @@ GNUNET_GETOPT_option_uint (char shortName, | |||
907 | * @param value actual value of the option as a string. | 850 | * @param value actual value of the option as a string. |
908 | * @return #GNUNET_OK if parsing the value worked | 851 | * @return #GNUNET_OK if parsing the value worked |
909 | */ | 852 | */ |
910 | static int | 853 | static enum GNUNET_GenericReturnValue |
911 | set_uint16 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 854 | set_uint16 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
912 | void *scls, | 855 | void *scls, |
913 | const char *option, | 856 | const char *option, |
@@ -938,15 +881,6 @@ set_uint16 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
938 | } | 881 | } |
939 | 882 | ||
940 | 883 | ||
941 | /** | ||
942 | * Allow user to specify an uint16_t. | ||
943 | * | ||
944 | * @param shortName short name of the option | ||
945 | * @param name long name of the option | ||
946 | * @param argumentHelp help text for the option argument | ||
947 | * @param description long help text for the option | ||
948 | * @param[out] val set to the value specified at the command line | ||
949 | */ | ||
950 | struct GNUNET_GETOPT_CommandLineOption | 884 | struct GNUNET_GETOPT_CommandLineOption |
951 | GNUNET_GETOPT_option_uint16 (char shortName, | 885 | GNUNET_GETOPT_option_uint16 (char shortName, |
952 | const char *name, | 886 | const char *name, |
@@ -998,7 +932,7 @@ struct Base32Context | |||
998 | * @param value actual value of the option as a string. | 932 | * @param value actual value of the option as a string. |
999 | * @return #GNUNET_OK if parsing the value worked | 933 | * @return #GNUNET_OK if parsing the value worked |
1000 | */ | 934 | */ |
1001 | static int | 935 | static enum GNUNET_GenericReturnValue |
1002 | set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 936 | set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
1003 | void *scls, | 937 | void *scls, |
1004 | const char *option, | 938 | const char *option, |
@@ -1036,17 +970,6 @@ free_bc (void *cls) | |||
1036 | } | 970 | } |
1037 | 971 | ||
1038 | 972 | ||
1039 | /** | ||
1040 | * Allow user to specify a binary value using Crockford | ||
1041 | * Base32 encoding. | ||
1042 | * | ||
1043 | * @param shortName short name of the option | ||
1044 | * @param name long name of the option | ||
1045 | * @param argumentHelp help text for the option argument | ||
1046 | * @param description long help text for the option | ||
1047 | * @param[out] val binary value decoded from Crockford Base32-encoded argument | ||
1048 | * @param val_size size of @a val in bytes | ||
1049 | */ | ||
1050 | struct GNUNET_GETOPT_CommandLineOption | 973 | struct GNUNET_GETOPT_CommandLineOption |
1051 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, | 974 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, |
1052 | const char *name, | 975 | const char *name, |
@@ -1073,12 +996,6 @@ GNUNET_GETOPT_option_base32_fixed_size (char shortName, | |||
1073 | } | 996 | } |
1074 | 997 | ||
1075 | 998 | ||
1076 | /** | ||
1077 | * Make the given option mandatory. | ||
1078 | * | ||
1079 | * @param opt option to modify | ||
1080 | * @return @a opt with the mandatory flag set. | ||
1081 | */ | ||
1082 | struct GNUNET_GETOPT_CommandLineOption | 999 | struct GNUNET_GETOPT_CommandLineOption |
1083 | GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) | 1000 | GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) |
1084 | { | 1001 | { |
@@ -1087,12 +1004,6 @@ GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) | |||
1087 | } | 1004 | } |
1088 | 1005 | ||
1089 | 1006 | ||
1090 | /** | ||
1091 | * Make the given option mutually exclusive with other options. | ||
1092 | * | ||
1093 | * @param opt option to modify | ||
1094 | * @return @a opt with the exclusive flag set. | ||
1095 | */ | ||
1096 | struct GNUNET_GETOPT_CommandLineOption | 1007 | struct GNUNET_GETOPT_CommandLineOption |
1097 | GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt) | 1008 | GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt) |
1098 | { | 1009 | { |