From 879d526d7ee7ee7a876f284dac76075e7a7267ae Mon Sep 17 00:00:00 2001 From: katherine Date: Mon, 27 May 2019 18:45:21 -0700 Subject: move stores vals to named union for c99 compatibility --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 4dc9861..a00b364 100644 --- a/README.md +++ b/README.md @@ -83,32 +83,32 @@ int main(int argc, char **argv) if (options[i].arg_is_stored) { switch (options[i].type) { case SIMPLE_OPT_BOOL: - printf(", val: %s", options[i].val_bool ? "true" : "false"); + printf(", val: %s", options[i].val.v_bool ? "true" : "false"); break; case SIMPLE_OPT_INT: - printf(", val: %ld", options[i].val_int); + printf(", val: %ld", options[i].val.v_int); break; case SIMPLE_OPT_UNSIGNED: - printf(", val: %lu", options[i].val_unsigned); + printf(", val: %lu", options[i].val.v_unsigned); break; case SIMPLE_OPT_DOUBLE: - printf(", val: %lf", options[i].val_double); + printf(", val: %lf", options[i].val.v_double); break; case SIMPLE_OPT_CHAR: - printf(", val: %c", options[i].val_char); + printf(", val: %c", options[i].val.v_char); break; case SIMPLE_OPT_STRING: - printf(", val: %s", options[i].val_string); + printf(", val: %s", options[i].val.v_string); break; case SIMPLE_OPT_STRING_SET: printf(", val: %s", - options[i].string_set[options[i].val_string_set_idx]); + options[i].string_set[options[i].val.v_string_set_idx]); break; default: @@ -142,7 +142,7 @@ by `simple_opt_print_usage`. the end of the array must be indicated with an option of type `SIMPLE_OPT_END`. this array is passed to `simple_opt_parse` and, if the parsing is successful, -relevant values (`was_seen`, `arg_is_stored`, `val_`) are in-place stored +relevant values (`was_seen`, `arg_is_stored`, `val.v_`) are in-place stored in the options. otherwise, the returned `struct simple_opt_result` will have a type other than `SIMPLE_OPT_RESULT_SUCCESS`, in which case error reporting occurs. -- cgit v1.2.3