diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-04-12 17:39:51 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-04-12 18:37:01 +0200 |
| commit | 964189735954a9e89ad507c68c20423fe02eaccf (patch) | |
| tree | c5aacf02332a8e54c0de22eb8762e9eb33a8fa4c /sam.c | |
| parent | 08ca4d22e08491130bd6be4baad4503f972f7750 (diff) | |
| download | vis-964189735954a9e89ad507c68c20423fe02eaccf.tar.gz vis-964189735954a9e89ad507c68c20423fe02eaccf.tar.xz | |
sam: distinguish between empty // and no regex
Diffstat (limited to 'sam.c')
| -rw-r--r-- | sam.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -550,7 +550,7 @@ static char *parse_until(const char **s, const char *until, const char *escchars static char *parse_delimited(const char **s, int type) { char delim[2] = { **s, '\0' }; - if (!delim[0]) + if (!delim[0] || isspace((unsigned char)delim[0])) return NULL; (*s)++; char *chunk = parse_until(s, delim, NULL, type); @@ -624,7 +624,10 @@ static char *parse_cmdname(const char **s) { } static Regex *parse_regex(Vis *vis, const char **s) { + const char *before = *s; char *pattern = parse_delimited(s, CMD_REGEX); + if (!pattern && *s == before) + return NULL; Regex *regex = vis_regex(vis, pattern); free(pattern); return regex; |
