diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-06-23 13:09:39 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-06-23 13:09:39 -0400 |
| commit | faba716e87b6201784fa71542e76073ca25963e8 (patch) | |
| tree | d4708351258cf15fbbbbcb22c7b902f70518561e /bp.c | |
| parent | 22015bf6ac80585aec0679d443822213b1b4dd4c (diff) | |
Add special case support for parsing `bp "->foo"` as a pattern instead
of an invalid flag
Diffstat (limited to 'bp.c')
| -rw-r--r-- | bp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -647,9 +647,9 @@ int main(int argc, char *argv[]) options.print_filenames = 0; } else if (!streq(flag, "auto")) errx(EXIT_FAILURE, "Unknown --format option: %s", flag); - } else if (argv[0][0] == '-' && argv[0][1] && argv[0][1] != '-') { // single-char flags - errx(EXIT_FAILURE, "Unrecognized flag: -%c\n\n%s", argv[0][1], usage); - } else if (argv[0][0] != '-') { + } else if (argv[0][0] != '-' || strncmp(argv[0], "->", 2) == 0) { + // As a special case, support `bp '->foo'` as a way to search for + // pointer field accesses without needing to escape anything. if (pattern != NULL) break; bp_pat_t *p = assert_pat(argv[0], NULL, bp_stringpattern(argv[0], argv[0]+strlen(argv[0]))); if (!explicit_case_sensitivity) |
