summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-04-23 20:36:55 +0000
committernicm <nicm@openbsd.org>2019-04-23 20:36:55 +0000
commit84306383f43633fe9eb5efa8d90d68abd1fd599c (patch)
tree5cdb6cb2f0890e99f4f12ca0a58bb943809f289f /usr.bin/tmux/cmd.c
parentadd ccp to acpi, and scale back the caps; (diff)
downloadwireguard-openbsd-84306383f43633fe9eb5efa8d90d68abd1fd599c.tar.xz
wireguard-openbsd-84306383f43633fe9eb5efa8d90d68abd1fd599c.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 'usr.bin/tmux/cmd.c')
-rw-r--r--usr.bin/tmux/cmd.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index 1abb8e1bc10..15ca4f0ca27 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.142 2019/03/18 11:58:40 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.143 2019/04/23 20:36:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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)