diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-15 11:14:36 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-15 11:14:59 +0100 |
commit | f09c53eb6f8c540cc3bc3730f9e34be596ed3716 (patch) | |
tree | 524957bd395bfca32e006163d44601936bf2afda /src/util/getopt_helpers.c | |
parent | dc0d60c9c8a635221c0d656611f8f93e0256ed84 (diff) | |
download | gnunet-f09c53eb6f8c540cc3bc3730f9e34be596ed3716.tar.gz gnunet-f09c53eb6f8c540cc3bc3730f9e34be596ed3716.zip |
add way to mark options as mandatory, get tests to pass again
Diffstat (limited to 'src/util/getopt_helpers.c')
-rw-r--r-- | src/util/getopt_helpers.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index a94847a47..76342a6c9 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -357,7 +357,7 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
357 | { | 357 | { |
358 | char **val = scls; | 358 | char **val = scls; |
359 | 359 | ||
360 | GNUNET_assert (value != NULL); | 360 | GNUNET_assert (NULL != value); |
361 | GNUNET_free_non_null (*val); | 361 | GNUNET_free_non_null (*val); |
362 | *val = GNUNET_strdup (value); | 362 | *val = GNUNET_strdup (value); |
363 | return GNUNET_OK; | 363 | return GNUNET_OK; |
@@ -878,4 +878,18 @@ GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | |||
878 | } | 878 | } |
879 | 879 | ||
880 | 880 | ||
881 | /** | ||
882 | * Make the given option mandatory. | ||
883 | * | ||
884 | * @param opt option to modify | ||
885 | * @return @a opt with the mandatory flag set. | ||
886 | */ | ||
887 | struct GNUNET_GETOPT_CommandLineOption | ||
888 | GNUNET_GETOPT_OPTION_MANDATORY (struct GNUNET_GETOPT_CommandLineOption opt) | ||
889 | { | ||
890 | opt.option_mandatory = 1; | ||
891 | return opt; | ||
892 | } | ||
893 | |||
894 | |||
881 | /* end of getopt_helpers.c */ | 895 | /* end of getopt_helpers.c */ |