aboutsummaryrefslogtreecommitdiff
path: root/bp.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-17 09:11:11 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-17 09:11:11 -0800
commit05b9b0ff9775bf5e63c1cc018f57f6a9ff910a58 (patch)
treedbe250e9eff874282865182814f836feec25bdca /bp.c
parenta7e3e421dbc78ac988862a459c4077877a4ecba7 (diff)
Better errors for bad patterns.
Diffstat (limited to 'bp.c')
-rw-r--r--bp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bp.c b/bp.c
index 3f04217..15cc4bb 100644
--- a/bp.c
+++ b/bp.c
@@ -429,12 +429,17 @@ int main(int argc, char *argv[])
str = d->pat->end;
} else {
pat_t *p = bp_pattern(arg_file, str);
- check(p, "Pattern failed to compile: %s", flag);
+ if (!p) {
+ fprint_line(stdout, arg_file, str, arg_file->end,
+ "Failed to compile this part of the argument");
+ return 1;
+ }
check(npatterns == 0, "Cannot define multiple patterns");
defs = with_def(defs, arg_file, strlen("pattern"), "pattern", p);
++npatterns;
str = p->end;
}
+ str = after_spaces(str);
str = strchr(str, ';') ? strchr(str, ';') + 1 : str;
}
} else if (FLAG("--pattern-string") || FLAG("-P")) {