aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-01-11 22:58:58 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-01-11 22:58:58 +0100
commit7b9b7f595e3e707d7597e1c0da22b1f6cd95dc6c (patch)
treed6fcc838b9fc183e432c5a0263ae931494e6d2a5
parentf0b43c611e9d33f57fcc7abd8f49132fc3cd7d95 (diff)
Change delim for zflag
-rw-r--r--grab.c7
1 files 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