From 614c44ef97fe4f1d91e4161bd77e028a9ee2d214 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Wed, 19 Jun 2024 21:06:02 +0200 Subject: Minor tweaks --- bgrep.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bgrep.c b/bgrep.c index dde305a..81a73c8 100644 --- a/bgrep.c +++ b/bgrep.c @@ -1,14 +1,16 @@ #define PCRE2_CODE_UNIT_WIDTH 8 + #include #include + #include #include #include #include #include -static const char *marker = "\n"; +static const char *marker = ""; static const char *pattern = NULL; static bool overlap = false; static size_t group = 0; @@ -85,11 +87,11 @@ writef(const char *fmt, ...) va_start(cpy, fmt); vsnprintf(buf, bufsize, fmt, cpy); va_end(cpy); - + writeall(buf, size); } -void +static void parse(int argc, const char **argv) { const char **arg; @@ -148,7 +150,7 @@ main(int argc, const char **argv) filecap = BUFSIZ; filesize = 0; file = malloc(filecap); - if (!file) die("mallo:"); + if (!file) die("malloc:"); pos = 0; lastmatch = 0; @@ -183,9 +185,9 @@ main(int argc, const char **argv) lastmatch = ovector[1]; } - writef("0x%zx:", filesize + ovector[0]); + writef("%s:0x%zx:", marker, filesize + ovector[0]); writeall(match, match_size); - writef("%s", marker); + writef("\n"); } else { break; } -- cgit v1.2.3-71-gd317