summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-08-27 17:25:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-08-27 17:25:56 +0000
commit916b1961091211ea4a58e0a54a72053e2fadc855 (patch)
tree790d0f70ac27e17d69a55b11050d43af98c0c534 /usr.bin/tmux/client.c
parentb9b52f488ddb6092e0930ae75f736ff92ab99f35 (diff)
Replace %% in command lists (by copying them) for template arguments ,
this means they can be used with {} as well. Also make argument processing from an existing vector preserve commands. GitHub issue 2858.
Diffstat (limited to 'usr.bin/tmux/client.c')
-rw-r--r--usr.bin/tmux/client.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c
index a1db86c7110..fb9562912c7 100644
--- a/usr.bin/tmux/client.c
+++ b/usr.bin/tmux/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.155 2021/02/17 07:18:36 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.156 2021/08/27 17:25:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -244,6 +244,7 @@ client_main(struct event_base *base, int argc, char **argv, uint64_t flags,
ssize_t linelen;
char *line = NULL, **caps = NULL, *cause;
u_int ncaps = 0;
+ struct args_value *values;
/* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */
signal(SIGCHLD, SIG_IGN);
@@ -259,17 +260,20 @@ client_main(struct event_base *base, int argc, char **argv, uint64_t flags,
msg = MSG_COMMAND;
/*
- * It sucks parsing the command string twice (in client and
- * later in server) but it is necessary to get the start server
- * flag.
+ * It's annoying parsing the command string twice (in client
+ * and later in server) but it is necessary to get the start
+ * server flag.
*/
- pr = cmd_parse_from_arguments(argc, argv, NULL);
+ values = args_from_vector(argc, argv);
+ pr = cmd_parse_from_arguments(values, argc, NULL);
if (pr->status == CMD_PARSE_SUCCESS) {
if (cmd_list_any_have(pr->cmdlist, CMD_STARTSERVER))
flags |= CLIENT_STARTSERVER;
cmd_list_free(pr->cmdlist);
} else
free(pr->error);
+ args_free_values(values, argc);
+ free(values);
}
/* Create client process structure (starts logging). */