diff options
author | nicm <nicm> | 2021-08-27 17:25:55 +0000 |
---|---|---|
committer | nicm <nicm> | 2021-08-27 17:25:55 +0000 |
commit | daec63e5e6eb3390d53f4bf7f8a327df77e46c95 (patch) | |
tree | cf78624cb0b4a80a6eeb8e29b368ea4f9beb5610 /client.c | |
parent | fd756a150b43d319d08ac4117f34edef9e0438c4 (diff) | |
download | rtmux-daec63e5e6eb3390d53f4bf7f8a327df77e46c95.tar.gz rtmux-daec63e5e6eb3390d53f4bf7f8a327df77e46c95.tar.bz2 rtmux-daec63e5e6eb3390d53f4bf7f8a327df77e46c95.zip |
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 'client.c')
-rw-r--r-- | client.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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). */ |