From e6e482054de77f3fe5d65344da86065373cf5f23 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 25 Nov 2023 14:57:19 -0500 Subject: Deprecate '-p' flag and replace backslash interpolation with curly brace interpolation --- bp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'bp.c') diff --git a/bp.c b/bp.c index 6adad36..3b7a843 100644 --- a/bp.c +++ b/bp.c @@ -43,7 +43,6 @@ static const char *usage = ( " -i --ignore-case preform matching case-insensitively\n" " -I --inplace modify a file in-place\n" " -l --list-files list filenames only\n" - " -p --pattern provide a pattern (equivalent to bp '\\()')\n" " -w --word find words matching the given string pattern\n" " -r --replace replace the input pattern with the given replacement\n" " -s --skip skip over the given pattern when looking for matches\n" @@ -383,7 +382,7 @@ static int print_matches(FILE *out, file_t *f, pat_t *pattern, pat_t *defs) // Print trailing context if needed: if (matches > 0) { fprint_context(out, f, prev, NULL); - if (last_line_num < 0) { // Hacky fix to ensure line number gets printed for `bp -p '$$'` + if (last_line_num < 0) { // Hacky fix to ensure line number gets printed for `bp '{$$}'` fprint_linenum(out, f, f->nlines, print_opts.normal_color); fputc('\n', out); } @@ -599,9 +598,6 @@ int main(int argc, char *argv[]) if (f == NULL) errx(EXIT_FAILURE, "Couldn't find grammar: %s", flag); defs = load_grammar(defs, f); // Keep in memory for debug output - } else if (FLAG("-p") || FLAG("--pattern")) { - pat_t *p = assert_pat(flag, NULL, bp_pattern(flag, flag+strlen(flag))); - pattern = chain_together(pattern, p); } else if (FLAG("-w") || FLAG("--word")) { require(asprintf(&flag, "\\|%s\\|", flag), "Could not allocate memory"); file_t *arg_file = spoof_file(&loaded_files, "", flag, -1); -- cgit v1.2.3