aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-04-23 23:02:42 +0100
committerThomas Adam <thomas@xteddy.org>2019-04-23 23:02:42 +0100
commitc86936613366fe1a0d7a4a2d4ae628d04cd3b866 (patch)
tree88c945ce503cb9df4332904d5887d68b8b843fde /cmd.c
parentb0d7623b7eb4409eedde0583be6ed831b287d278 (diff)
parentb9022e33eac0152850ae59be99b54cccc10f4c63 (diff)
downloadrtmux-c86936613366fe1a0d7a4a2d4ae628d04cd3b866.tar.gz
rtmux-c86936613366fe1a0d7a4a2d4ae628d04cd3b866.tar.bz2
rtmux-c86936613366fe1a0d7a4a2d4ae628d04cd3b866.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/cmd.c b/cmd.c
index 877cd10c..82dcae3d 100644
--- a/cmd.c
+++ b/cmd.c
@@ -320,10 +320,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)
@@ -332,14 +333,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)