diff options
| author | Thomas Adam <thomas@xteddy.org> | 2019-12-12 15:38:33 +0000 |
|---|---|---|
| committer | Thomas Adam <thomas@xteddy.org> | 2019-12-12 15:38:33 +0000 |
| commit | 58908b045b48b224063ce04d3db63741d32d0898 (patch) | |
| tree | 7f6a79252f87a0f01c6f57b6d7795e6f30025cfd /cmd-parse.y | |
| parent | 7922f4ee7bd4c18509c6774971fd007a4c5a10e3 (diff) | |
| parent | dcf41ec9275a2a1a87a5943d9ba189d83de67a89 (diff) | |
| download | rtmux-58908b045b48b224063ce04d3db63741d32d0898.tar.gz rtmux-58908b045b48b224063ce04d3db63741d32d0898.tar.bz2 rtmux-58908b045b48b224063ce04d3db63741d32d0898.zip | |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-parse.y')
| -rw-r--r-- | cmd-parse.y | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd-parse.y b/cmd-parse.y index 2c924010..97b50f57 100644 --- a/cmd-parse.y +++ b/cmd-parse.y @@ -746,6 +746,12 @@ cmd_parse_from_file(FILE *f, struct cmd_parse_input *pi) 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 @@ cmd_parse_from_string(const char *s, struct cmd_parse_input *pi) } 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; |