aboutsummaryrefslogtreecommitdiff
path: root/bp.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-11 16:46:07 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-11 16:46:07 -0500
commit5f49677d763607ae8624eb9fc6933ce7cf871811 (patch)
tree4dde9ea093ca375d0c65d20118f9aa88ab8b1b02 /bp.c
parent8041d3047c5a4707b19d8b4444fd1d5c3c4f6064 (diff)
Bugfix for string literals and add support for printing patterns with
--verbose
Diffstat (limited to 'bp.c')
-rw-r--r--bp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bp.c b/bp.c
index 68c07d0..3f17736 100644
--- a/bp.c
+++ b/bp.c
@@ -10,6 +10,7 @@
#include <fcntl.h>
#include <glob.h>
#include <limits.h>
+#include <printf.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
@@ -558,6 +559,9 @@ int main(int argc, char *argv[])
{
char *flag = NULL;
+ if (set_pattern_printf_specifier('P'))
+ errx(1, "Couldn't set printf specifier");
+
pat_t *defs = NULL;
file_t *loaded_files = NULL;
pat_t *pattern = NULL;
@@ -678,6 +682,9 @@ int main(int argc, char *argv[])
// Handle exit() calls gracefully:
require(atexit(&cleanup), "Failed to set cleanup handler at exit");
+ if (options.verbose)
+ printf("Matching pattern: %P\n", pattern);
+
int found = 0;
if (options.mode == MODE_JSON) printf("[");
if (options.git_mode) { // Get the list of files from `git --ls-files ...`