aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-12-09 22:43:27 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-12-09 22:43:27 +0100
commitfeb158c34f8eb5dddf83c9f99ced73c92c70f8d1 (patch)
tree9b63df50405fd5503e3b1fb87c691e4c9af447ae
parentf9fb0bcb723765d859bc97b41407f72ca584aa40 (diff)
Replace ‘-d’ with ‘-z’
-rw-r--r--grab.12
-rw-r--r--grab.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/grab.1 b/grab.1
index 8349fc4..b86f5d2 100644
--- a/grab.1
+++ b/grab.1
@@ -6,7 +6,7 @@
.Nd search for patterns in files
.Sh SYNOPSIS
.Nm
-.Op Fl d Ar string
+.Op Fl z
.Ar pattern
.Op Ar
.Sh DESCRIPTION
diff --git a/grab.c b/grab.c
index 74f7e44..117f466 100644
--- a/grab.c
+++ b/grab.c
@@ -54,8 +54,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 const char *delim = "\n";
static const cmd_func op_table[UCHAR_MAX] = {
['g'] = cmdg,
['v'] = cmdg,
@@ -81,10 +81,10 @@ main(int argc, char **argv)
setlocale(LC_ALL, "");
- while ((opt = getopt(argc, argv, "d:")) != -1) {
+ while ((opt = getopt(argc, argv, "z")) != -1) {
switch (opt) {
- case 'd':
- delim = optarg;
+ case 'z':
+ delim = '\0';
break;
default:
usage(argv[0]);
@@ -239,7 +239,7 @@ void
putsv(struct sv sv)
{
fwrite(sv.p, 1, sv.len, stdout);
- fputs(delim, stdout);
+ putchar(delim);
}
regex_t