From 7b9b7f595e3e707d7597e1c0da22b1f6cd95dc6c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 11 Jan 2024 22:58:58 +0100 Subject: Change delim for zflag --- grab.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/grab.c b/grab.c index 4b80aba..384e47d 100644 --- a/grab.c +++ b/grab.c @@ -64,9 +64,8 @@ static struct ops comppat(char *); static bool xisspace(char); static char *xstrchrnul(const char *, char); -static char delim = '\n'; static int rv = EXIT_SUCCESS; -static bool nflag; +static bool nflag, zflag; static const cmd_func op_table[UCHAR_MAX] = { ['g'] = cmdg, @@ -116,7 +115,7 @@ main(int argc, char **argv) nflag = true; break; case 'z': - delim = '\0'; + zflag = true; break; default: usage(argv[0]); @@ -320,7 +319,7 @@ void putsv(struct sv sv) { fwrite(sv.p, 1, sv.len, stdout); - putchar(delim); + putchar(zflag ? '\0' : '\n'); } regex_t -- cgit v1.2.3