diff options
author | katherine <shmibs@airen-no-jikken.icu> | 2019-05-27 18:45:21 -0700 |
---|---|---|
committer | katherine <shmibs@airen-no-jikken.icu> | 2019-05-27 18:45:21 -0700 |
commit | 879d526d7ee7ee7a876f284dac76075e7a7267ae (patch) | |
tree | a62bbaf2d70d4772faf34e6d4b7a37cf0f7d1711 /README.md | |
parent | 9e8912b6d5672333e254e7f3aacff3bf99816dff (diff) | |
download | simple-opt-879d526d7ee7ee7a876f284dac76075e7a7267ae.tar.gz |
move stores vals to named union
for c99 compatibility
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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_<type>`) are in-place stored +relevant values (`was_seen`, `arg_is_stored`, `val.v_<type>`) 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. |