aboutsummaryrefslogtreecommitdiff
path: root/sam.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-04 12:50:27 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-04 12:50:27 +0200
commit371c50e7c4a760448545e30705df92be2a88103a (patch)
treeb79e24a9a2f2ac0b9ea7bf1df7c4afd495d843ff /sam.c
parentd462d1531eabe9339d0cc57276f1085bc43e8c31 (diff)
downloadvis-371c50e7c4a760448545e30705df92be2a88103a.tar.gz
vis-371c50e7c4a760448545e30705df92be2a88103a.tar.xz
sam: y and Y commands require a regexp pattern
Diffstat (limited to 'sam.c')
-rw-r--r--sam.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sam.c b/sam.c
index 924cef5..4077509 100644
--- a/sam.c
+++ b/sam.c
@@ -122,9 +122,9 @@ static const CommandDef cmds[] = {
{ { "s" }, CMD_SHELL, NULL, cmd_substitute },
{ { "v" }, CMD_CMD|CMD_REGEX, "p", cmd_guard },
{ { "x" }, CMD_CMD|CMD_REGEX|CMD_REGEX_DEFAULT, "p", cmd_extract },
- { { "y" }, CMD_CMD|CMD_REGEX|CMD_REGEX_DEFAULT, "p", cmd_extract },
+ { { "y" }, CMD_CMD|CMD_REGEX, "p", cmd_extract },
{ { "X" }, CMD_CMD|CMD_REGEX|CMD_REGEX_DEFAULT, NULL, cmd_files },
- { { "Y" }, CMD_CMD|CMD_REGEX|CMD_REGEX_DEFAULT, NULL, cmd_files },
+ { { "Y" }, CMD_CMD|CMD_REGEX, NULL, cmd_files },
{ { ">" }, CMD_SHELL|CMD_ADDRESS_LINE, NULL, cmd_pipeout },
{ { "<" }, CMD_SHELL|CMD_ADDRESS_LINE, NULL, cmd_pipein },
{ { "|" }, CMD_SHELL|CMD_ADDRESS_LINE, NULL, cmd_filter },
@@ -200,6 +200,8 @@ static char *parse_delimited_text(const char **s) {
bool escaped = false;
char delim = **s;
+ if (!delim)
+ return NULL;
buffer_init(&buf);
for ((*s)++; **s && (**s != delim || escaped); (*s)++) {