=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-parse.y,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- src/usr.bin/tmux/cmd-parse.y 2019/10/14 08:38:07 1.20 +++ src/usr.bin/tmux/cmd-parse.y 2019/12/12 15:01:54 1.21 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-parse.y,v 1.20 2019/10/14 08:38:07 nicm Exp $ */ +/* $OpenBSD: cmd-parse.y,v 1.21 2019/12/12 15:01:54 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -746,6 +746,12 @@ struct cmd_parse_result * cmd_parse_from_string(const char *s, struct cmd_parse_input *pi) { + return (cmd_parse_from_buffer(s, strlen(s), pi)); +} + +struct cmd_parse_result * +cmd_parse_from_buffer(const void *buf, size_t len, struct cmd_parse_input *pi) +{ static struct cmd_parse_result pr; struct cmd_parse_input input; struct cmd_parse_commands *cmds; @@ -757,14 +763,14 @@ } memset(&pr, 0, sizeof pr); - if (*s == '\0') { + if (len == 0) { pr.status = CMD_PARSE_EMPTY; pr.cmdlist = NULL; pr.error = NULL; return (&pr); } - cmds = cmd_parse_do_buffer(s, strlen(s), pi, &cause); + cmds = cmd_parse_do_buffer(buf, len, pi, &cause); if (cmds == NULL) { pr.status = CMD_PARSE_ERROR; pr.error = cause;