diff options
author | nicm <nicm> | 2019-04-23 20:36:55 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-04-23 20:36:55 +0000 |
commit | 772b3b7a06ceba64933cb3a9dfff61e56c229a74 (patch) | |
tree | b39ae35756cf031dd8e7390f7f0882eb96a78e5a /cmd.c | |
parent | 564e44adc6816282cd40d59d1bc642937e53dc54 (diff) | |
download | rtmux-772b3b7a06ceba64933cb3a9dfff61e56c229a74.tar.gz rtmux-772b3b7a06ceba64933cb3a9dfff61e56c229a74.tar.bz2 rtmux-772b3b7a06ceba64933cb3a9dfff61e56c229a74.zip |
Indicate an array option with a flag rather than a special type so that
in future will not have to be strings.
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -321,10 +321,11 @@ cmd_try_alias(int *argc, char ***argv) { struct options_entry *o; struct options_array_item *a; + union options_value *ov; int old_argc = *argc, new_argc, i; char **old_argv = *argv, **new_argv; size_t wanted; - const char *s, *cp = NULL; + const char *cp = NULL; o = options_get_only(global_options, "command-alias"); if (o == NULL) @@ -333,14 +334,16 @@ cmd_try_alias(int *argc, char ***argv) a = options_array_first(o); while (a != NULL) { - s = options_array_item_value(a); - if (s != NULL) { - cp = strchr(s, '='); - if (cp != NULL && - (size_t)(cp - s) == wanted && - strncmp(old_argv[0], s, wanted) == 0) - break; + ov = options_array_item_value(a); + if (ov == NULL) { + a = options_array_next(a); + continue; } + cp = strchr(ov->string, '='); + if (cp != NULL && + (size_t)(cp - ov->string) == wanted && + strncmp(old_argv[0], ov->string, wanted) == 0) + break; a = options_array_next(a); } if (a == NULL) |